aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Greg Daniel <egdaniel@google.com>2017-10-24 11:57:01 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-10-24 16:57:21 +0000
commitf47069cdbbc8026295e4e23db001401861e3e63e (patch)
tree131ada0fadeb68fa32e3ea19655423a609d82029
parent287282568ba53dd3db21a0c8428505706159f5fd (diff)
Create mipped texture proxys for PictureImageGenerator
Bug: skia: Change-Id: If86b01e5c008537de8c9af99000559bf524c836f Reviewed-on: https://skia-review.googlesource.com/63260 Commit-Queue: Greg Daniel <egdaniel@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
-rw-r--r--src/core/SkPictureImageGenerator.cpp7
-rw-r--r--src/image/SkSurface_Gpu.cpp7
2 files changed, 12 insertions, 2 deletions
diff --git a/src/core/SkPictureImageGenerator.cpp b/src/core/SkPictureImageGenerator.cpp
index f6c36ca93c..1f0439eb88 100644
--- a/src/core/SkPictureImageGenerator.cpp
+++ b/src/core/SkPictureImageGenerator.cpp
@@ -111,7 +111,8 @@ sk_sp<GrTextureProxy> SkPictureImageGenerator::onGenerateTexture(
//
SkImageInfo surfaceInfo = useXformCanvas ? info.makeColorSpace(nullptr) : info;
sk_sp<SkSurface> surface(SkSurface::MakeRenderTarget(ctx, SkBudgeted::kYes, surfaceInfo,
- 0, kTopLeft_GrSurfaceOrigin, nullptr));
+ 0, kTopLeft_GrSurfaceOrigin, nullptr,
+ willNeedMipMaps));
if (!surface) {
return nullptr;
}
@@ -131,6 +132,8 @@ sk_sp<GrTextureProxy> SkPictureImageGenerator::onGenerateTexture(
if (!image) {
return nullptr;
}
- return as_IB(image)->asTextureProxyRef();
+ sk_sp<GrTextureProxy> proxy = as_IB(image)->asTextureProxyRef();
+ SkASSERT(!willNeedMipMaps || GrMipMapped::kYes == proxy->mipMapped());
+ return proxy;
}
#endif
diff --git a/src/image/SkSurface_Gpu.cpp b/src/image/SkSurface_Gpu.cpp
index 0f90232fa6..667bd36b5d 100644
--- a/src/image/SkSurface_Gpu.cpp
+++ b/src/image/SkSurface_Gpu.cpp
@@ -225,12 +225,19 @@ sk_sp<SkSurface> SkSurface::MakeRenderTarget(GrContext* ctx, SkBudgeted budgeted
const SkImageInfo& info, int sampleCount,
GrSurfaceOrigin origin, const SkSurfaceProps* props,
bool shouldCreateWithMips) {
+ if (!ctx) {
+ return nullptr;
+ }
if (!SkSurface_Gpu::Valid(info)) {
return nullptr;
}
GrMipMapped mipMapped = shouldCreateWithMips ? GrMipMapped::kYes : GrMipMapped::kNo;
+ if (!ctx->caps()->mipMapSupport()) {
+ mipMapped = GrMipMapped::kNo;
+ }
+
sk_sp<SkGpuDevice> device(SkGpuDevice::Make(
ctx, budgeted, info, sampleCount, origin, props, mipMapped,
SkGpuDevice::kClear_InitContents));