本文整理汇总了C++中GrBackendTexture::config方法的典型用法代码示例。如果您正苦于以下问题:C++ GrBackendTexture::config方法的具体用法?C++ GrBackendTexture::config怎么用?C++ GrBackendTexture::config使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GrBackendTexture
的用法示例。
在下文中一共展示了GrBackendTexture::config方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SkTMax
sk_sp<SkSurface> SkSurface::MakeFromBackendTextureAsRenderTarget(GrContext* context,
const GrBackendTexture& tex,
GrSurfaceOrigin origin,
int sampleCnt,
sk_sp<SkColorSpace> colorSpace,
const SkSurfaceProps* props) {
if (!context) {
return nullptr;
}
if (!SkSurface_Gpu::Valid(context, tex.config(), colorSpace.get())) {
return nullptr;
}
sampleCnt = SkTMax(1, sampleCnt);
sk_sp<GrRenderTargetContext> rtc(
context->contextPriv().makeBackendTextureAsRenderTargetRenderTargetContext(
tex,
origin,
sampleCnt,
std::move(colorSpace),
props));
if (!rtc) {
return nullptr;
}
sk_sp<SkGpuDevice> device(SkGpuDevice::Make(context, std::move(rtc), tex.width(), tex.height(),
SkGpuDevice::kUninit_InitContents));
if (!device) {
return nullptr;
}
return sk_make_sp<SkSurface_Gpu>(std::move(device));
}
示例2:
sk_sp<GrRenderTarget> GrGpu::wrapBackendTextureAsRenderTarget(const GrBackendTexture& tex,
int sampleCnt) {
if (0 == this->caps()->getRenderTargetSampleCount(sampleCnt, tex.config())) {
return nullptr;
}
int maxSize = this->caps()->maxTextureSize();
if (tex.width() > maxSize || tex.height() > maxSize) {
return nullptr;
}
this->handleDirtyContext();
return this->onWrapBackendTextureAsRenderTarget(tex, sampleCnt);
}
示例3: SkASSERT
sk_sp<GrTexture> GrGpu::wrapRenderableBackendTexture(const GrBackendTexture& backendTex,
int sampleCnt, GrWrapOwnership ownership) {
this->handleDirtyContext();
if (sampleCnt < 1) {
return nullptr;
}
if (!this->caps()->isConfigTexturable(backendTex.config()) ||
!this->caps()->getRenderTargetSampleCount(sampleCnt, backendTex.config())) {
return nullptr;
}
if (backendTex.width() > this->caps()->maxRenderTargetSize() ||
backendTex.height() > this->caps()->maxRenderTargetSize()) {
return nullptr;
}
sk_sp<GrTexture> tex = this->onWrapRenderableBackendTexture(backendTex, sampleCnt, ownership);
if (tex && !backendTex.hasMipMaps()) {
// Ganesh will not ever allocate mipmaps for a wrapped resource. By setting this flag here,
// it will be propagated to any proxy that wraps this texture.
tex->texturePriv().setDoesNotSupportMipMaps();
}
SkASSERT(!tex || tex->asRenderTarget());
return tex;
}