本文整理汇总了C++中sk_sp::release方法的典型用法代码示例。如果您正苦于以下问题:C++ sk_sp::release方法的具体用法?C++ sk_sp::release怎么用?C++ sk_sp::release使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sk_sp
的用法示例。
在下文中一共展示了sk_sp::release方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SkASSERT
GrResourceIOProcessor::ImageStorageAccess::ImageStorageAccess(sk_sp<GrTexture> texture,
GrIOType ioType,
GrSLMemoryModel memoryModel,
GrSLRestrict restrict,
GrShaderFlags visibility) {
SkASSERT(texture);
fTexture.set(texture.release(), ioType);
fMemoryModel = memoryModel;
fRestrict = restrict;
fVisibility = visibility;
// We currently infer this from the config. However, we could allow the client to specify
// a format that is different but compatible with the config.
switch (fTexture.get()->config()) {
case kRGBA_8888_GrPixelConfig:
fFormat = GrImageStorageFormat::kRGBA8;
break;
case kRGBA_8888_sint_GrPixelConfig:
fFormat = GrImageStorageFormat::kRGBA8i;
break;
case kRGBA_half_GrPixelConfig:
fFormat = GrImageStorageFormat::kRGBA16f;
break;
case kRGBA_float_GrPixelConfig:
fFormat = GrImageStorageFormat::kRGBA32f;
break;
default:
SkFAIL("Config is not (yet) supported as image storage.");
break;
}
}
示例2: deleteOps
void SkInternalAtlasTextTarget::deleteOps() {
for (int i = 0; i < fOps.count(); ++i) {
if (fOps[i]) {
fOpMemoryPool->release(std::move(fOps[i]));
}
}
fOps.reset();
}
示例3: attachStencilAttachment
bool GrRenderTargetPriv::attachStencilAttachment(sk_sp<GrStencilAttachment> stencil) {
if (!stencil && !fRenderTarget->fStencilAttachment) {
// No need to do any work since we currently don't have a stencil attachment and
// we're not actually adding one.
return true;
}
fRenderTarget->fStencilAttachment = stencil.release();
if (!fRenderTarget->completeStencilAttachment()) {
SkSafeSetNull(fRenderTarget->fStencilAttachment);
return false;
}
return true;
}
示例4: SkASSERT
sk_sp<SkPixelRef> SkMallocPixelRef::MakeWithData(const SkImageInfo& info,
size_t rowBytes,
sk_sp<SkColorTable> ctable,
sk_sp<SkData> data) {
SkASSERT(data != nullptr);
if (!is_valid(info, ctable.get())) {
return nullptr;
}
if ((rowBytes < info.minRowBytes()) || (data->size() < info.getSafeSize(rowBytes))) {
return nullptr;
}
// must get this address before we call release
void* pixels = const_cast<void*>(data->data());
SkPixelRef* pr = new SkMallocPixelRef(info, pixels, rowBytes, std::move(ctable),
sk_data_releaseproc, data.release());
pr->setImmutable(); // since we were created with (immutable) data
return sk_sp<SkPixelRef>(pr);
}
示例5: addDrawOp
void SkInternalAtlasTextTarget::addDrawOp(const GrClip& clip, std::unique_ptr<GrAtlasTextOp> op) {
SkASSERT(clip.quickContains(SkRect::MakeIWH(fWidth, fHeight)));
// The SkAtlasTextRenderer currently only handles grayscale SDF glyphs.
if (op->maskType() != GrAtlasTextOp::kGrayscaleDistanceField_MaskType) {
return;
}
const GrCaps& caps = *this->context()->internal().grContext()->contextPriv().caps();
op->finalizeForTextTarget(fColor, caps);
int n = SkTMin(kMaxBatchLookBack, fOps.count());
for (int i = 0; i < n; ++i) {
GrAtlasTextOp* other = fOps.fromBack(i).get();
if (other->combineIfPossible(op.get(), caps) == GrOp::CombineResult::kMerged) {
fOpMemoryPool->release(std::move(op));
return;
}
if (GrRectsOverlap(op->bounds(), other->bounds())) {
break;
}
}
op->visitProxies([](GrSurfaceProxy*) {});
fOps.emplace_back(std::move(op));
}
示例6: SkCreateDataProviderFromData
CGDataProviderRef SkCreateDataProviderFromData(sk_sp<SkData> data) {
const void* addr = data->data();
size_t size = data->size();
return CGDataProviderCreateWithData(data.release(), addr, size, unref_proc);
}
示例7: SetGlobal
void SkFontConfigInterface::SetGlobal(sk_sp<SkFontConfigInterface> fc) {
SkAutoMutexAcquire ac(gFontConfigInterfaceMutex);
SkSafeUnref(gFontConfigInterface);
gFontConfigInterface = fc.release();
}