From d9b6abb1a16493d85d4372bbf57b254023816feb Mon Sep 17 00:00:00 2001 From: Brian Osman Date: Fri, 13 Jan 2017 14:58:32 -0500 Subject: Remove (unused) YUV API from SkPixelRef YUV conversion happens via SkImage now. BUG=skia: Change-Id: I6e1fa18effb72cbb00a173a346769b873e372c40 Reviewed-on: https://skia-review.googlesource.com/7034 Reviewed-by: Mike Reed Commit-Queue: Brian Osman --- src/gpu/SkGr.cpp | 48 ------------------------------------------------ 1 file changed, 48 deletions(-) (limited to 'src/gpu') diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp index f3b900814a..3cca52f2b0 100644 --- a/src/gpu/SkGr.cpp +++ b/src/gpu/SkGr.cpp @@ -16,7 +16,6 @@ #include "GrTexturePriv.h" #include "GrTypes.h" #include "GrXferProcessor.h" -#include "GrYUVProvider.h" #include "SkAutoMalloc.h" #include "SkBlendModePriv.h" @@ -31,13 +30,11 @@ #include "SkPixelRef.h" #include "SkResourceCache.h" #include "SkTemplates.h" -#include "SkYUVPlanesCache.h" #include "effects/GrBicubicEffect.h" #include "effects/GrConstColorProcessor.h" #include "effects/GrDitherEffect.h" #include "effects/GrPorterDuffXferProcessor.h" #include "effects/GrXfermodeFragmentProcessor.h" -#include "effects/GrYUVEffect.h" #ifndef SK_IGNORE_ETC1_SUPPORT # include "ktx.h" @@ -111,48 +108,7 @@ GrPixelConfig GrIsCompressedTextureDataSupported(GrContext* ctx, SkData* data, ////////////////////////////////////////////////////////////////////////////// -/** - * Once we have made SkImages handle all lazy/deferred/generated content, the YUV apis will - * be gone from SkPixelRef, and we can remove this subclass entirely. - */ -class PixelRef_GrYUVProvider : public GrYUVProvider { - SkPixelRef* fPR; - -public: - PixelRef_GrYUVProvider(SkPixelRef* pr) : fPR(pr) {} - - uint32_t onGetID() override { return fPR->getGenerationID(); } - bool onQueryYUV8(SkYUVSizeInfo* sizeInfo, SkYUVColorSpace* colorSpace) const override { - return fPR->queryYUV8(sizeInfo, colorSpace); - } - bool onGetYUV8Planes(const SkYUVSizeInfo& sizeInfo, void* planes[3]) override { - return fPR->getYUV8Planes(sizeInfo, planes); - } -}; - -static sk_sp create_texture_from_yuv(GrContext* ctx, const SkBitmap& bm, - const GrSurfaceDesc& desc) { - // Subsets are not supported, the whole pixelRef is loaded when using YUV decoding - SkPixelRef* pixelRef = bm.pixelRef(); - if ((nullptr == pixelRef) || - (pixelRef->info().width() != bm.info().width()) || - (pixelRef->info().height() != bm.info().height())) { - return nullptr; - } - - PixelRef_GrYUVProvider provider(pixelRef); - - return provider.refAsTexture(ctx, desc, !bm.isVolatile()); -} - GrTexture* GrUploadBitmapToTexture(GrContext* ctx, const SkBitmap& bitmap) { - GrSurfaceDesc desc = GrImageInfoToSurfaceDesc(bitmap.info(), *ctx->caps()); - - sk_sp texture(create_texture_from_yuv(ctx, bitmap, desc)); - if (texture) { - return texture.release(); - } - SkAutoLockPixels alp(bitmap); if (!bitmap.readyToDraw()) { return nullptr; @@ -244,10 +200,6 @@ GrTexture* GrGenerateMipMapsAndUploadToTexture(GrContext* ctx, const SkBitmap& b : SkDestinationSurfaceColorMode::kLegacy; GrSurfaceDesc desc = GrImageInfoToSurfaceDesc(bitmap.info(), *ctx->caps()); - sk_sp texture(create_texture_from_yuv(ctx, bitmap, desc)); - if (texture) { - return texture.release(); - } // We don't support Gray8 directly in the GL backend, so fail-over to GrUploadBitmapToTexture. // That will transform the Gray8 to 8888, then use the driver/GPU to build mipmaps. If we build -- cgit v1.2.3