diff options
author | Greg Daniel <egdaniel@google.com> | 2018-05-02 15:06:47 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-05-02 21:34:58 +0000 |
commit | b73a9f8b9609c09c25405c16d277c977fdea8c07 (patch) | |
tree | 2a5b464adf4ed0e1a2d870b1a22f85ab1cba73be /src/image/SkImage_Gpu.cpp | |
parent | 90864a21c4ab6c7da3c6d671cf85a97373578243 (diff) |
Add internal grsurface flag to track if using gl rectangle or external texture.
Bug: skia:
Change-Id: I84963833bbc3ae957c919a19f6e78fce2c9de7ef
Reviewed-on: https://skia-review.googlesource.com/125294
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
Diffstat (limited to 'src/image/SkImage_Gpu.cpp')
-rw-r--r-- | src/image/SkImage_Gpu.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp index bd75c276a2..4786407104 100644 --- a/src/image/SkImage_Gpu.cpp +++ b/src/image/SkImage_Gpu.cpp @@ -661,7 +661,7 @@ static GrInternalSurfaceFlags get_flags_from_format(const GrBackendFormat& backe if (const GrGLenum* target = backendFormat.getGLTarget()) { if (GR_GL_TEXTURE_RECTANGLE == *target || GR_GL_TEXTURE_EXTERNAL == *target) { return GrInternalSurfaceFlags::kDoesNotSupportMipMaps | - GrInternalSurfaceFlags::kIsClampOnly; + GrInternalSurfaceFlags::kIsGLTextureRectangleOrExternal; } } @@ -714,6 +714,14 @@ sk_sp<SkImage> SkImage_Gpu::MakePromiseTexture(GrContext* context, GrInternalSurfaceFlags formatFlags = get_flags_from_format(backendFormat); + // Promise images always wrap resources. So if the promise image doesn't have mip maps, we + // cannot allocate mips for them and thus will need a copy to use a mipped image. We can't pass + // the fact that this creates a wrapped texture into createLazyProxy so we need to manually set + // in in the passed in flags. + if (GrMipMapped::kNo == mipMapped) { + formatFlags |= GrInternalSurfaceFlags::kDoesNotSupportMipMaps; + } + sk_sp<GrTextureProxy> proxy = proxyProvider->createLazyProxy( [promiseHelper, config] (GrResourceProvider* resourceProvider) mutable { if (!resourceProvider) { @@ -729,14 +737,6 @@ sk_sp<SkImage> SkImage_Gpu::MakePromiseTexture(GrContext* context, return nullptr; } - // Promise images always wrap resources. So if the promise image doesn't have mip maps, we - // cannot allocate mips for them and thus will need a copy to use a mipped image. We can't pass - // the fact that this creates a wrapped texture into createLazyProxy so we need to manually call - // setDoesNotSupportMipMaps. - if (GrMipMapped::kNo == mipMapped) { - proxy->texPriv().setDoesNotSupportMipMaps(); - } - return sk_make_sp<SkImage_Gpu>(context, kNeedNewImageUniqueID, alphaType, std::move(proxy), std::move(colorSpace), SkBudgeted::kNo); } |