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 <reed@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
This commit is contained in:
Brian Osman 2017-01-13 14:58:32 -05:00 committed by Skia Commit-Bot
parent 69f98c738c
commit d9b6abb1a1
2 changed files with 0 additions and 81 deletions

View File

@ -18,7 +18,6 @@
#include "SkRefCnt.h"
#include "SkSize.h"
#include "SkString.h"
#include "SkYUVSizeInfo.h"
class SkColorTable;
struct SkIRect;
@ -193,31 +192,6 @@ public:
bool requestLock(const LockRequest&, LockResult*);
/**
* If this can efficiently return YUV data, this should return true.
* Otherwise this returns false and does not modify any of the parameters.
*
* @param sizeInfo Output parameter indicating the sizes and required
* allocation widths of the Y, U, and V planes.
* @param colorSpace Output parameter.
*/
bool queryYUV8(SkYUVSizeInfo* sizeInfo, SkYUVColorSpace* colorSpace) const {
return this->onQueryYUV8(sizeInfo, colorSpace);
}
/**
* Returns true on success and false on failure.
* Copies YUV data into the provided YUV planes.
*
* @param sizeInfo Needs to exactly match the values returned by the
* query, except the WidthBytes may be larger than the
* recommendation (but not smaller).
* @param planes Memory for each of the Y, U, and V planes.
*/
bool getYUV8Planes(const SkYUVSizeInfo& sizeInfo, void* planes[3]) {
return this->onGetYUV8Planes(sizeInfo, planes);
}
/** Populates dst with the pixels of this pixelRef, converting them to colorType. */
bool readPixels(SkBitmap* dst, SkColorType colorType, const SkIRect* subset = NULL);
@ -284,13 +258,6 @@ protected:
// default impl does nothing.
virtual void onNotifyPixelsChanged();
virtual bool onQueryYUV8(SkYUVSizeInfo*, SkYUVColorSpace*) const {
return false;
}
virtual bool onGetYUV8Planes(const SkYUVSizeInfo&, void*[3] /*planes*/) {
return false;
}
/**
* Returns the size (in bytes) of the internally allocated memory.
* This should be implemented in all serializable SkPixelRef derived classes.

View File

@ -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<GrTexture> 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<GrTexture> 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<GrTexture> 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