From 7226c232d73356a37ec8cfef0ed55147e68dd2fd Mon Sep 17 00:00:00 2001 From: Brian Salomon Date: Mon, 30 Jul 2018 13:13:17 -0400 Subject: Make GrTextureProxy store a GrTextureType. Removes flag indicating rectangle or external as its now redundant. Bug: skia: Change-Id: Ia475b557390e7a6b0f19f6e189cf8c27090e397c Reviewed-on: https://skia-review.googlesource.com/144346 Reviewed-by: Greg Daniel Commit-Queue: Brian Salomon --- src/image/SkImage_Gpu.cpp | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) (limited to 'src/image') diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp index 1dea80659a..58aa1bc86a 100644 --- a/src/image/SkImage_Gpu.cpp +++ b/src/image/SkImage_Gpu.cpp @@ -9,10 +9,9 @@ #include #include -#include "SkAutoPixmapStorage.h" +#include "GrAHardwareBufferImageGenerator.h" #include "GrBackendSurface.h" #include "GrBackendTextureImageGenerator.h" -#include "GrAHardwareBufferImageGenerator.h" #include "GrBitmapTextureMaker.h" #include "GrCaps.h" #include "GrColorSpaceXform.h" @@ -25,23 +24,24 @@ #include "GrResourceProvider.h" #include "GrSemaphore.h" #include "GrSurfacePriv.h" -#include "GrTextureAdjuster.h" #include "GrTexture.h" +#include "GrTextureAdjuster.h" #include "GrTexturePriv.h" #include "GrTextureProxy.h" #include "GrTextureProxyPriv.h" -#include "gl/GrGLDefines.h" -#include "effects/GrYUVtoRGBEffect.h" -#include "SkCanvas.h" +#include "SkAutoPixmapStorage.h" #include "SkBitmapCache.h" +#include "SkCanvas.h" #include "SkGr.h" -#include "SkImage_Gpu.h" #include "SkImageCacherator.h" #include "SkImageInfoPriv.h" +#include "SkImage_Gpu.h" #include "SkMipMap.h" #include "SkPixelRef.h" #include "SkReadPixelsRec.h" #include "SkTraceEvent.h" +#include "effects/GrYUVtoRGBEffect.h" +#include "gl/GrGLTexture.h" SkImage_Gpu::SkImage_Gpu(sk_sp context, uint32_t uniqueID, SkAlphaType at, sk_sp proxy, sk_sp colorSpace, @@ -651,14 +651,11 @@ private: sk_sp fDoneHelper; }; -static GrInternalSurfaceFlags get_flags_from_format(const GrBackendFormat& backendFormat) { +static GrTextureType TextureTypeFromBackendFormat(const GrBackendFormat& backendFormat) { if (const GrGLenum* target = backendFormat.getGLTarget()) { - if (GR_GL_TEXTURE_RECTANGLE == *target || GR_GL_TEXTURE_EXTERNAL == *target) { - return GrInternalSurfaceFlags::kIsGLTextureRectangleOrExternal; - } + return GrGLTexture::TextureTypeFromTarget(*target); } - - return GrInternalSurfaceFlags::kNone; + return GrTextureType::k2D; } sk_sp SkImage_Gpu::MakePromiseTexture(GrContext* context, @@ -696,10 +693,9 @@ sk_sp SkImage_Gpu::MakePromiseTexture(GrContext* context, return nullptr; } - GrInternalSurfaceFlags formatFlags = get_flags_from_format(backendFormat); + GrTextureType textureType = TextureTypeFromBackendFormat(backendFormat); - if (mipMapped == GrMipMapped::kYes && - SkToBool(formatFlags & GrInternalSurfaceFlags::kIsGLTextureRectangleOrExternal)) { + if (mipMapped == GrMipMapped::kYes && GrTextureTypeHasRestrictedSampling(textureType)) { // It is invalid to have a GL_TEXTURE_EXTERNAL or GL_TEXTURE_RECTANGLE and have mips as // well. return nullptr; @@ -716,15 +712,17 @@ sk_sp SkImage_Gpu::MakePromiseTexture(GrContext* context, textureContext); sk_sp proxy = proxyProvider->createLazyProxy( - [promiseHelper, config] (GrResourceProvider* resourceProvider) mutable { + [promiseHelper, config](GrResourceProvider* resourceProvider) mutable { if (!resourceProvider) { promiseHelper.reset(); return sk_sp(); } return promiseHelper.getTexture(resourceProvider, config); - }, desc, origin, mipMapped, formatFlags, SkBackingFit::kExact, - SkBudgeted::kNo, GrSurfaceProxy::LazyInstantiationType::kUninstantiate); + }, + desc, origin, mipMapped, textureType, GrInternalSurfaceFlags::kNone, + SkBackingFit::kExact, SkBudgeted::kNo, + GrSurfaceProxy::LazyInstantiationType::kUninstantiate); if (!proxy) { return nullptr; -- cgit v1.2.3