aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Mike Reed <reed@google.com>2017-04-28 13:53:21 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-04-28 18:25:17 +0000
commit736a9cc88d623f1c309b70554f02f0f111a30766 (patch)
tree44179aecaea55e9a3c6b9d59ca7358de84adcea7
parent185ba21bffc2df9ddfc1e351505a7a622821df1f (diff)
remove unused yuv methods
Bug: skia: Change-Id: Ie1e6c905d8989b49c2cf5c9e5fd1f383268f6480 Reviewed-on: https://skia-review.googlesource.com/14645 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Mike Reed <reed@google.com>
-rw-r--r--gm/imagetoyuvplanes.cpp111
-rw-r--r--gn/gm.gni1
-rw-r--r--gn/gpu.gni2
-rw-r--r--gn/utils.gni2
-rw-r--r--include/core/SkImage.h7
-rw-r--r--src/gpu/GrTextureToYUVPlanes.cpp249
-rw-r--r--src/gpu/GrTextureToYUVPlanes.h21
-rw-r--r--src/image/SkImage.cpp13
-rw-r--r--src/image/SkImage_Base.h3
-rw-r--r--src/image/SkImage_Gpu.cpp10
-rw-r--r--src/image/SkImage_Gpu.h3
-rw-r--r--src/utils/SkRGBAToYUV.cpp58
-rw-r--r--src/utils/SkRGBAToYUV.h21
13 files changed, 0 insertions, 501 deletions
diff --git a/gm/imagetoyuvplanes.cpp b/gm/imagetoyuvplanes.cpp
deleted file mode 100644
index 2ba26967b1..0000000000
--- a/gm/imagetoyuvplanes.cpp
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Copyright 2016 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-
-#include <SkSurface.h>
-#include "gm.h"
-#include "SkBitmap.h"
-#include "SkGradientShader.h"
-#include "SkImage.h"
-
-static sk_sp<SkImage> create_image(GrContext* context, int width, int height) {
- sk_sp<SkSurface> surface;
- SkImageInfo info = SkImageInfo::MakeN32Premul(width, height);
- if (context) {
- surface = SkSurface::MakeRenderTarget(context, SkBudgeted::kYes, info);
- } else {
- surface = SkSurface::MakeRaster(info);
- }
- if (!surface) {
- return nullptr;
- }
- // Create an RGB image from which we will extract planes
- SkPaint paint;
- constexpr SkColor kColors[] =
- { SK_ColorBLUE, SK_ColorYELLOW, SK_ColorGREEN, SK_ColorWHITE };
- SkScalar r = (width + height) / 4.f;
- paint.setShader(SkGradientShader::MakeRadial(SkPoint::Make(0,0), r, kColors,
- nullptr, SK_ARRAY_COUNT(kColors),
- SkShader::kMirror_TileMode));
-
- surface->getCanvas()->drawPaint(paint);
- return surface->makeImageSnapshot();
-}
-
-DEF_SIMPLE_GM(image_to_yuv_planes, canvas, 120, 525) {
- constexpr SkScalar kPad = 5.f;
- constexpr int kImageSize = 32;
-
- GrContext *context = canvas->getGrContext();
- sk_sp<SkImage> rgbImage(create_image(context, kImageSize, kImageSize));
- if (!rgbImage) {
- return;
- }
-
- canvas->drawImage(rgbImage.get(), kPad, kPad);
- // Test cases where all three planes are the same size, where just u and v are the same size,
- // and where all differ.
- constexpr SkISize kSizes[][3] = {
- {{kImageSize, kImageSize}, {kImageSize , kImageSize }, {kImageSize, kImageSize }},
- {{kImageSize, kImageSize}, {kImageSize/2, kImageSize/2}, {kImageSize/2, kImageSize/2}},
- {{kImageSize, kImageSize}, {kImageSize/2, kImageSize/2}, {kImageSize/3, kImageSize/3}}
- };
-
- // A mix of rowbytes triples to go with the above sizes.
- constexpr size_t kRowBytes[][3] {
- {0, 0, 0},
- {kImageSize, kImageSize/2 + 1, kImageSize},
- {kImageSize + 13, kImageSize, kImageSize/3 + 8}
- };
-
-
- SkScalar x = kPad;
- for (size_t s = 0; s < SK_ARRAY_COUNT(kSizes); ++s) {
- SkScalar y = rgbImage->height() + 2 * kPad;
-
- const SkISize *sizes = kSizes[s];
- size_t realRowBytes[3];
- for (int i = 0; i < 3; ++i) {
- realRowBytes[i] = kRowBytes[s][i] ? kRowBytes[s][i] : kSizes[s][i].fWidth;
- }
- std::unique_ptr<uint8_t[]> yPlane(new uint8_t[realRowBytes[0] * sizes[0].fHeight]);
- std::unique_ptr<uint8_t[]> uPlane(new uint8_t[realRowBytes[1] * sizes[1].fHeight]);
- std::unique_ptr<uint8_t[]> vPlane(new uint8_t[realRowBytes[2] * sizes[2].fHeight]);
-
- void *planes[3] = {yPlane.get(), uPlane.get(), vPlane.get()};
-
- // Convert the RGB image to YUV planes using each YUV color space and draw the YUV planes
- // to the canvas.
- SkBitmap yuvBmps[3];
- yuvBmps[0].setInfo(SkImageInfo::MakeA8(sizes[0].fWidth, sizes[0].fHeight), kRowBytes[s][0]);
- yuvBmps[1].setInfo(SkImageInfo::MakeA8(sizes[1].fWidth, sizes[1].fHeight), kRowBytes[s][1]);
- yuvBmps[2].setInfo(SkImageInfo::MakeA8(sizes[2].fWidth, sizes[2].fHeight), kRowBytes[s][2]);
- yuvBmps[0].setPixels(yPlane.get());
- yuvBmps[1].setPixels(uPlane.get());
- yuvBmps[2].setPixels(vPlane.get());
-
- for (int space = kJPEG_SkYUVColorSpace; space <= kLastEnum_SkYUVColorSpace; ++space) {
- // Clear the planes so we don't accidentally see the old values if there is a bug in
- // readYUV8Planes().
- memset(yPlane.get(), 0, realRowBytes[0] * sizes[0].fHeight);
- memset(uPlane.get(), 0, realRowBytes[1] * sizes[1].fHeight);
- memset(vPlane.get(), 0, realRowBytes[2] * sizes[2].fHeight);
- if (rgbImage->readYUV8Planes(sizes, planes, kRowBytes[s],
- static_cast<SkYUVColorSpace>(space))) {
- yuvBmps[0].notifyPixelsChanged();
- yuvBmps[1].notifyPixelsChanged();
- yuvBmps[2].notifyPixelsChanged();
- for (int i = 0; i < 3; ++i) {
- canvas->drawBitmap(yuvBmps[i], x, y);
- y += kPad + yuvBmps[i].height();
- }
- }
- }
-
- x += rgbImage->width() + kPad;
- }
-}
diff --git a/gn/gm.gni b/gn/gm.gni
index e85ef7eed3..413e5695f5 100644
--- a/gn/gm.gni
+++ b/gn/gm.gni
@@ -173,7 +173,6 @@ gm_sources = [
"$_gm/imagescalealigned.cpp",
"$_gm/imagesource.cpp",
"$_gm/imagesource2.cpp",
- "$_gm/imagetoyuvplanes.cpp",
"$_gm/internal_links.cpp",
"$_gm/inversepaths.cpp",
"$_gm/largeglyphblur.cpp",
diff --git a/gn/gpu.gni b/gn/gpu.gni
index b3e78fd479..2c26062987 100644
--- a/gn/gpu.gni
+++ b/gn/gpu.gni
@@ -212,8 +212,6 @@ skia_gpu_sources = [
"$_src/gpu/GrTextureRenderTargetProxy.cpp",
"$_src/gpu/GrTextureRenderTargetProxy.h",
"$_src/gpu/GrTextureStripAtlas.h",
- "$_src/gpu/GrTextureToYUVPlanes.cpp",
- "$_src/gpu/GrTextureToYUVPlanes.h",
"$_src/gpu/GrTRecorder.h",
"$_src/gpu/GrUserStencilSettings.h",
"$_src/gpu/GrWindowRectangles.h",
diff --git a/gn/utils.gni b/gn/utils.gni
index 2aeb539656..3bf947b124 100644
--- a/gn/utils.gni
+++ b/gn/utils.gni
@@ -58,8 +58,6 @@ skia_utils_sources = [
"$_src/utils/SkParsePath.cpp",
"$_src/utils/SkPatchUtils.cpp",
"$_src/utils/SkPatchUtils.h",
- "$_src/utils/SkRGBAToYUV.cpp",
- "$_src/utils/SkRGBAToYUV.h",
"$_src/utils/SkShadowPaintFilterCanvas.cpp",
"$_src/utils/SkShadowPaintFilterCanvas.h",
"$_src/utils/SkShadowTessellator.cpp",
diff --git a/include/core/SkImage.h b/include/core/SkImage.h
index 1e5df0b116..c58a6243bd 100644
--- a/include/core/SkImage.h
+++ b/include/core/SkImage.h
@@ -243,13 +243,6 @@ public:
bool isAlphaOnly() const;
bool isOpaque() const { return SkAlphaTypeIsOpaque(this->alphaType()); }
- /**
- * Extracts YUV planes from the SkImage and stores them in client-provided memory. The sizes
- * planes and rowBytes arrays are ordered [y, u, v].
- */
- bool readYUV8Planes(const SkISize[3], void* const planes[3], const size_t rowBytes[3],
- SkYUVColorSpace) const;
-
sk_sp<SkShader> makeShader(SkShader::TileMode, SkShader::TileMode,
const SkMatrix* localMatrix = nullptr) const;
/**
diff --git a/src/gpu/GrTextureToYUVPlanes.cpp b/src/gpu/GrTextureToYUVPlanes.cpp
deleted file mode 100644
index c6f9794192..0000000000
--- a/src/gpu/GrTextureToYUVPlanes.cpp
+++ /dev/null
@@ -1,249 +0,0 @@
-/*
- * Copyright 2016 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "GrTextureToYUVPlanes.h"
-#include "effects/GrSimpleTextureEffect.h"
-#include "effects/GrYUVEffect.h"
-#include "GrClip.h"
-#include "GrContext.h"
-#include "GrPaint.h"
-#include "GrRenderTargetContext.h"
-#include "GrResourceProvider.h"
-
-namespace {
- using MakeFPProc = sk_sp<GrFragmentProcessor> (*)(sk_sp<GrFragmentProcessor>,
- SkYUVColorSpace colorSpace);
-};
-
-static bool convert_proxy(sk_sp<GrTextureProxy> src,
- GrRenderTargetContext* dst, int dstW, int dstH,
- SkYUVColorSpace colorSpace, MakeFPProc proc) {
-
- SkScalar xScale = SkIntToScalar(src->width()) / dstW;
- SkScalar yScale = SkIntToScalar(src->height()) / dstH;
- GrSamplerParams::FilterMode filter;
- if (dstW == src->width() && dstW == src->height()) {
- filter = GrSamplerParams::kNone_FilterMode;
- } else {
- filter = GrSamplerParams::kBilerp_FilterMode;
- }
-
- GrResourceProvider* resourceProvider = dst->resourceProvider();
-
- sk_sp<GrFragmentProcessor> fp(GrSimpleTextureEffect::Make(resourceProvider, std::move(src),
- nullptr,
- SkMatrix::MakeScale(xScale, yScale),
- filter));
- if (!fp) {
- return false;
- }
- fp = proc(std::move(fp), colorSpace);
- if (!fp) {
- return false;
- }
- GrPaint paint;
- paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
- paint.addColorFragmentProcessor(std::move(fp));
- dst->drawRect(GrNoClip(), std::move(paint), GrAA::kNo, SkMatrix::I(),
- SkRect::MakeIWH(dstW, dstH));
- return true;
-}
-
-bool GrTextureToYUVPlanes(GrContext* context, sk_sp<GrTextureProxy> proxy,
- const SkISize sizes[3], void* const planes[3],
- const size_t rowBytes[3], SkYUVColorSpace colorSpace) {
- if (!context) {
- return false;
- }
-
- {
- // Depending on the relative sizes of the y, u, and v planes we may do 1 to 3 draws/
- // readbacks.
- sk_sp<GrRenderTargetContext> yuvRenderTargetContext;
- sk_sp<GrRenderTargetContext> yRenderTargetContext;
- sk_sp<GrRenderTargetContext> uvRenderTargetContext;
- sk_sp<GrRenderTargetContext> uRenderTargetContext;
- sk_sp<GrRenderTargetContext> vRenderTargetContext;
-
- // We issue draw(s) to convert from RGBA to Y, U, and V. All three planes may have different
- // sizes however we optimize for two other cases - all planes are the same (1 draw to YUV),
- // and U and V are the same but Y differs (2 draws, one for Y, one for UV).
- if (sizes[0] == sizes[1] && sizes[1] == sizes[2]) {
- yuvRenderTargetContext = context->makeDeferredRenderTargetContextWithFallback(
- SkBackingFit::kApprox,
- sizes[0].fWidth,
- sizes[0].fHeight,
- kRGBA_8888_GrPixelConfig,
- nullptr);
- if (!yuvRenderTargetContext) {
- return false;
- }
- } else {
- yRenderTargetContext = context->makeDeferredRenderTargetContextWithFallback(
- SkBackingFit::kApprox,
- sizes[0].fWidth,
- sizes[0].fHeight,
- kAlpha_8_GrPixelConfig,
- nullptr);
- if (!yRenderTargetContext) {
- return false;
- }
- if (sizes[1] == sizes[2]) {
- // TODO: Add support for GL_RG when available.
- uvRenderTargetContext = context->makeDeferredRenderTargetContextWithFallback(
- SkBackingFit::kApprox,
- sizes[1].fWidth,
- sizes[1].fHeight,
- kRGBA_8888_GrPixelConfig,
- nullptr);
- if (!uvRenderTargetContext) {
- return false;
- }
- } else {
- uRenderTargetContext = context->makeDeferredRenderTargetContextWithFallback(
- SkBackingFit::kApprox,
- sizes[1].fWidth,
- sizes[1].fHeight,
- kAlpha_8_GrPixelConfig,
- nullptr);
- vRenderTargetContext = context->makeDeferredRenderTargetContextWithFallback(
- SkBackingFit::kApprox,
- sizes[2].fWidth,
- sizes[2].fHeight,
- kAlpha_8_GrPixelConfig,
- nullptr);
- if (!uRenderTargetContext || !vRenderTargetContext) {
- return false;
- }
- }
- }
-
- // Do all the draws before any readback.
- if (yuvRenderTargetContext) {
- if (!convert_proxy(std::move(proxy), yuvRenderTargetContext.get(),
- sizes[0].fWidth, sizes[0].fHeight,
- colorSpace, GrYUVEffect::MakeRGBToYUV)) {
- return false;
- }
- } else {
- SkASSERT(yRenderTargetContext);
- if (!convert_proxy(proxy, yRenderTargetContext.get(),
- sizes[0].fWidth, sizes[0].fHeight,
- colorSpace, GrYUVEffect::MakeRGBToY)) {
- return false;
- }
- if (uvRenderTargetContext) {
- if (!convert_proxy(std::move(proxy), uvRenderTargetContext.get(),
- sizes[1].fWidth, sizes[1].fHeight,
- colorSpace, GrYUVEffect::MakeRGBToUV)) {
- return false;
- }
- } else {
- SkASSERT(uRenderTargetContext && vRenderTargetContext);
- if (!convert_proxy(proxy, uRenderTargetContext.get(),
- sizes[1].fWidth, sizes[1].fHeight,
- colorSpace, GrYUVEffect::MakeRGBToU)) {
- return false;
- }
- if (!convert_proxy(std::move(proxy), vRenderTargetContext.get(),
- sizes[2].fWidth, sizes[2].fHeight,
- colorSpace, GrYUVEffect::MakeRGBToV)) {
- return false;
- }
- }
- }
-
- if (yuvRenderTargetContext) {
- SkASSERT(sizes[0] == sizes[1] && sizes[1] == sizes[2]);
- SkISize yuvSize = sizes[0];
- // We have no kRGB_888 pixel format, so readback rgba and then copy three channels.
- SkAutoSTMalloc<128 * 128, uint32_t> tempYUV(yuvSize.fWidth * yuvSize.fHeight);
-
- const SkImageInfo ii = SkImageInfo::Make(yuvSize.fWidth, yuvSize.fHeight,
- kRGBA_8888_SkColorType, kOpaque_SkAlphaType);
- if (!yuvRenderTargetContext->readPixels(ii, tempYUV.get(), 0, 0, 0)) {
- return false;
- }
- size_t yRowBytes = rowBytes[0] ? rowBytes[0] : yuvSize.fWidth;
- size_t uRowBytes = rowBytes[1] ? rowBytes[1] : yuvSize.fWidth;
- size_t vRowBytes = rowBytes[2] ? rowBytes[2] : yuvSize.fWidth;
- if (yRowBytes < (size_t)yuvSize.fWidth || uRowBytes < (size_t)yuvSize.fWidth ||
- vRowBytes < (size_t)yuvSize.fWidth) {
- return false;
- }
- for (int j = 0; j < yuvSize.fHeight; ++j) {
- for (int i = 0; i < yuvSize.fWidth; ++i) {
- // These writes could surely be made more efficient.
- uint32_t y = GrColorUnpackR(tempYUV.get()[j * yuvSize.fWidth + i]);
- uint32_t u = GrColorUnpackG(tempYUV.get()[j * yuvSize.fWidth + i]);
- uint32_t v = GrColorUnpackB(tempYUV.get()[j * yuvSize.fWidth + i]);
- uint8_t* yLoc = ((uint8_t*)planes[0]) + j * yRowBytes + i;
- uint8_t* uLoc = ((uint8_t*)planes[1]) + j * uRowBytes + i;
- uint8_t* vLoc = ((uint8_t*)planes[2]) + j * vRowBytes + i;
- *yLoc = y;
- *uLoc = u;
- *vLoc = v;
- }
- }
- return true;
- } else {
- SkASSERT(yRenderTargetContext);
-
- SkImageInfo ii = SkImageInfo::MakeA8(sizes[0].fWidth, sizes[0].fHeight);
- if (!yRenderTargetContext->readPixels(ii, planes[0], rowBytes[0], 0, 0)) {
- return false;
- }
-
- if (uvRenderTargetContext) {
- SkASSERT(sizes[1].fWidth == sizes[2].fWidth);
- SkISize uvSize = sizes[1];
- // We have no kRG_88 pixel format, so readback rgba and then copy two channels.
- SkAutoSTMalloc<128 * 128, uint32_t> tempUV(uvSize.fWidth * uvSize.fHeight);
-
- ii = SkImageInfo::Make(uvSize.fWidth, uvSize.fHeight,
- kRGBA_8888_SkColorType, kOpaque_SkAlphaType);
-
- if (!uvRenderTargetContext->readPixels(ii, tempUV.get(), 0, 0, 0)) {
- return false;
- }
-
- size_t uRowBytes = rowBytes[1] ? rowBytes[1] : uvSize.fWidth;
- size_t vRowBytes = rowBytes[2] ? rowBytes[2] : uvSize.fWidth;
- if (uRowBytes < (size_t)uvSize.fWidth || vRowBytes < (size_t)uvSize.fWidth) {
- return false;
- }
- for (int j = 0; j < uvSize.fHeight; ++j) {
- for (int i = 0; i < uvSize.fWidth; ++i) {
- // These writes could surely be made more efficient.
- uint32_t u = GrColorUnpackR(tempUV.get()[j * uvSize.fWidth + i]);
- uint32_t v = GrColorUnpackG(tempUV.get()[j * uvSize.fWidth + i]);
- uint8_t* uLoc = ((uint8_t*)planes[1]) + j * uRowBytes + i;
- uint8_t* vLoc = ((uint8_t*)planes[2]) + j * vRowBytes + i;
- *uLoc = u;
- *vLoc = v;
- }
- }
- return true;
- } else {
- SkASSERT(uRenderTargetContext && vRenderTargetContext);
-
- ii = SkImageInfo::MakeA8(sizes[1].fWidth, sizes[1].fHeight);
- if (!uRenderTargetContext->readPixels(ii, planes[1], rowBytes[1], 0, 0)) {
- return false;
- }
-
- ii = SkImageInfo::MakeA8(sizes[2].fWidth, sizes[2].fHeight);
- if (!vRenderTargetContext->readPixels(ii, planes[2], rowBytes[2], 0, 0)) {
- return false;
- }
-
- return true;
- }
- }
- }
- return false;
-}
diff --git a/src/gpu/GrTextureToYUVPlanes.h b/src/gpu/GrTextureToYUVPlanes.h
deleted file mode 100644
index 1dcbea3e9b..0000000000
--- a/src/gpu/GrTextureToYUVPlanes.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright 2016 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef GrTextureToYUVPlanes_DEFINED
-#define GrTextureToYUVPlanes_DEFINED
-
-#include "SkImageInfo.h"
-#include "SkSize.h"
-
-class GrContext;
-class GrTextureProxy;
-
-bool GrTextureToYUVPlanes(GrContext*, sk_sp<GrTextureProxy>,
- const SkISize[3], void* const planes[3],
- const size_t rowBytes[3], SkYUVColorSpace);
-
-#endif
diff --git a/src/image/SkImage.cpp b/src/image/SkImage.cpp
index 6e4d32e8df..5debe48b00 100644
--- a/src/image/SkImage.cpp
+++ b/src/image/SkImage.cpp
@@ -22,7 +22,6 @@
#include "SkPicture.h"
#include "SkPixelRef.h"
#include "SkPixelSerializer.h"
-#include "SkRGBAToYUV.h"
#include "SkReadPixelsRec.h"
#include "SkSpecialImage.h"
#include "SkStream.h"
@@ -199,22 +198,10 @@ SkImage_Base::~SkImage_Base() {
}
}
-bool SkImage_Base::onReadYUV8Planes(const SkISize sizes[3], void* const planes[3],
- const size_t rowBytes[3], SkYUVColorSpace colorSpace) const {
- return SkRGBAToYUV(this, sizes, planes, rowBytes, colorSpace);
-}
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
bool SkImage::readPixels(const SkPixmap& pmap, int srcX, int srcY, CachingHint chint) const {
return this->readPixels(pmap.info(), pmap.writable_addr(), pmap.rowBytes(), srcX, srcY, chint);
}
-bool SkImage::readYUV8Planes(const SkISize sizes[3], void* const planes[3],
- const size_t rowBytes[3], SkYUVColorSpace colorSpace) const {
- return as_IB(this)->onReadYUV8Planes(sizes, planes, rowBytes, colorSpace);
-}
-
///////////////////////////////////////////////////////////////////////////////////////////////////
sk_sp<SkImage> SkImage::MakeFromBitmap(const SkBitmap& bm) {
diff --git a/src/image/SkImage_Base.h b/src/image/SkImage_Base.h
index 96fd6e6dca..ce9c5cde52 100644
--- a/src/image/SkImage_Base.h
+++ b/src/image/SkImage_Base.h
@@ -41,9 +41,6 @@ public:
virtual const SkBitmap* onPeekBitmap() const { return nullptr; }
- virtual bool onReadYUV8Planes(const SkISize sizes[3], void* const planes[3],
- const size_t rowBytes[3], SkYUVColorSpace colorSpace) const;
-
virtual bool onReadPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBytes,
int srcX, int srcY, CachingHint) const = 0;
diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp
index d3b8a85f9b..68127f2297 100644
--- a/src/image/SkImage_Gpu.cpp
+++ b/src/image/SkImage_Gpu.cpp
@@ -23,7 +23,6 @@
#include "GrTextureAdjuster.h"
#include "GrTexturePriv.h"
#include "GrTextureProxy.h"
-#include "GrTextureToYUVPlanes.h"
#include "effects/GrNonlinearColorSpaceXformEffect.h"
#include "effects/GrYUVEffect.h"
#include "SkCanvas.h"
@@ -175,15 +174,6 @@ GrTexture* SkImage_Gpu::onGetTexture() const {
return proxy->instantiate(fContext->resourceProvider());
}
-bool SkImage_Gpu::onReadYUV8Planes(const SkISize sizes[3], void* const planes[3],
- const size_t rowBytes[3], SkYUVColorSpace colorSpace) const {
- if (GrTextureToYUVPlanes(fContext, fProxy, sizes, planes, rowBytes, colorSpace)) {
- return true;
- }
-
- return INHERITED::onReadYUV8Planes(sizes, planes, rowBytes, colorSpace);
-}
-
bool SkImage_Gpu::onReadPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRB,
int srcX, int srcY, CachingHint) const {
if (!SkImageInfoValidConversion(dstInfo, this->onImageInfo())) {
diff --git a/src/image/SkImage_Gpu.h b/src/image/SkImage_Gpu.h
index 8c3df394f3..b477acc7b5 100644
--- a/src/image/SkImage_Gpu.h
+++ b/src/image/SkImage_Gpu.h
@@ -53,9 +53,6 @@ public:
GrSurfaceOrigin* origin) const override;
GrTexture* onGetTexture() const override;
- bool onReadYUV8Planes(const SkISize sizes[3], void* const planes[3],
- const size_t rowBytes[3], SkYUVColorSpace colorSpace) const override;
-
bool onReadPixels(const SkImageInfo&, void* dstPixels, size_t dstRowBytes,
int srcX, int srcY, CachingHint) const override;
diff --git a/src/utils/SkRGBAToYUV.cpp b/src/utils/SkRGBAToYUV.cpp
deleted file mode 100644
index 0528b144f0..0000000000
--- a/src/utils/SkRGBAToYUV.cpp
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright 2016 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "SkRGBAToYUV.h"
-#include "SkCanvas.h"
-#include "SkColorMatrixFilterRowMajor255.h"
-#include "SkImage.h"
-#include "SkPaint.h"
-#include "SkSurface.h"
-
-bool SkRGBAToYUV(const SkImage* image, const SkISize sizes[3], void* const planes[3],
- const size_t rowBytes[3], SkYUVColorSpace colorSpace) {
- // Matrices that go from RGBA to YUV.
- static const SkScalar kYUVColorSpaceInvMatrices[][15] = {
- // kJPEG_SkYUVColorSpace
- { 0.299001f, 0.586998f, 0.114001f, 0.f, 0.0000821798f * 255.f,
- -0.168736f, -0.331263f, 0.499999f, 0.f, 0.499954f * 255.f,
- 0.499999f, -0.418686f, -0.0813131f, 0.f, 0.499941f * 255.f},
-
- // kRec601_SkYUVColorSpace
- { 0.256951f, 0.504421f, 0.0977346f, 0.f, 0.0625f * 255.f,
- -0.148212f, -0.290954f, 0.439166f, 0.f, 0.5f * 255.f,
- 0.439166f, -0.367886f, -0.0712802f, 0.f, 0.5f * 255.f},
-
- // kRec709_SkYUVColorSpace
- { 0.182663f, 0.614473f, 0.061971f, 0.f, 0.0625f * 255.f,
- -0.100672f, -0.338658f, 0.43933f, 0.f, 0.5f * 255.f,
- 0.439142f, -0.39891f, -0.040231f, 0.f, 0.5f * 255.f},
- };
- static_assert(kLastEnum_SkYUVColorSpace == 2, "yuv color matrix array problem");
- static_assert(kJPEG_SkYUVColorSpace == 0, "yuv color matrix array problem");
- static_assert(kRec601_SkYUVColorSpace == 1, "yuv color matrix array problem");
- static_assert(kRec709_SkYUVColorSpace == 2, "yuv color matrix array problem");
-
- for (int i = 0; i < 3; ++i) {
- size_t rb = rowBytes[i] ? rowBytes[i] : sizes[i].fWidth;
- auto surface(SkSurface::MakeRasterDirect(
- SkImageInfo::MakeA8(sizes[i].fWidth, sizes[i].fHeight), planes[i], rb));
- if (!surface) {
- return false;
- }
- SkPaint paint;
- paint.setFilterQuality(kLow_SkFilterQuality);
- paint.setBlendMode(SkBlendMode::kSrc);
- int rowStartIdx = 5 * i;
- const SkScalar* row = kYUVColorSpaceInvMatrices[colorSpace] + rowStartIdx;
- paint.setColorFilter(
- SkColorMatrixFilterRowMajor255::MakeSingleChannelOutput(row));
- surface->getCanvas()->drawImageRect(image, SkIRect::MakeWH(image->width(), image->height()),
- SkRect::MakeIWH(surface->width(), surface->height()),
- &paint);
- }
- return true;
-}
diff --git a/src/utils/SkRGBAToYUV.h b/src/utils/SkRGBAToYUV.h
deleted file mode 100644
index 5c3c1b1465..0000000000
--- a/src/utils/SkRGBAToYUV.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright 2016 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef SkRGBAToYUV_DEFINED
-#define SkRGBAToYUV_DEFINED
-
-#include "SkPixmap.h"
-#include "SkSize.h"
-
-class SkImage;
-// Works with any image type at the moment, but in the future it may only work with raster-backed
-// images. This really should take a SkPixmap for the input, however the implementation for the
-// time being requires an image.
-bool SkRGBAToYUV(const SkImage*, const SkISize [3], void* const planes[3],
- const size_t rowBytes[3], SkYUVColorSpace);
-
-#endif