diff options
Diffstat (limited to 'src/image/SkImage_Gpu.cpp')
-rw-r--r-- | src/image/SkImage_Gpu.cpp | 36 |
1 files changed, 17 insertions, 19 deletions
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 <cstring> #include <type_traits> -#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<GrContext> context, uint32_t uniqueID, SkAlphaType at, sk_sp<GrTextureProxy> proxy, sk_sp<SkColorSpace> colorSpace, @@ -651,14 +651,11 @@ private: sk_sp<GrReleaseProcHelper> 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> SkImage_Gpu::MakePromiseTexture(GrContext* context, @@ -696,10 +693,9 @@ sk_sp<SkImage> 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> SkImage_Gpu::MakePromiseTexture(GrContext* context, textureContext); sk_sp<GrTextureProxy> proxy = proxyProvider->createLazyProxy( - [promiseHelper, config] (GrResourceProvider* resourceProvider) mutable { + [promiseHelper, config](GrResourceProvider* resourceProvider) mutable { if (!resourceProvider) { promiseHelper.reset(); return sk_sp<GrTexture>(); } 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; |