本文整理汇总了C++中GrRenderTarget::resourcePriv方法的典型用法代码示例。如果您正苦于以下问题:C++ GrRenderTarget::resourcePriv方法的具体用法?C++ GrRenderTarget::resourcePriv怎么用?C++ GrRenderTarget::resourcePriv使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GrRenderTarget
的用法示例。
在下文中一共展示了GrRenderTarget::resourcePriv方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SkASSERT
sk_sp<SkImage> SkSurface_Gpu::onNewImageSnapshot(SkBudgeted budgeted, ForceCopyMode forceCopyMode) {
GrRenderTarget* rt = fDevice->accessDrawContext()->accessRenderTarget();
SkASSERT(rt);
GrTexture* tex = rt->asTexture();
SkAutoTUnref<GrTexture> copy;
// If the original render target is a buffer originally created by the client, then we don't
// want to ever retarget the SkSurface at another buffer we create. Force a copy now to avoid
// copy-on-write.
if (kYes_ForceCopyMode == forceCopyMode || !tex || rt->resourcePriv().refsWrappedObjects()) {
GrSurfaceDesc desc = fDevice->accessDrawContext()->desc();
GrContext* ctx = fDevice->context();
desc.fFlags = desc.fFlags & ~kRenderTarget_GrSurfaceFlag;
copy.reset(ctx->textureProvider()->createTexture(desc, budgeted));
if (!copy) {
return nullptr;
}
if (!ctx->copySurface(copy, rt)) {
return nullptr;
}
tex = copy;
}
const SkImageInfo info = fDevice->imageInfo();
sk_sp<SkImage> image;
if (tex) {
image = sk_make_sp<SkImage_Gpu>(info.width(), info.height(), kNeedNewImageUniqueID,
info.alphaType(), tex, sk_ref_sp(info.colorSpace()),
budgeted);
}
return image;
}