aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/core
diff options
context:
space:
mode:
authorGravatar msarett <msarett@google.com>2016-03-07 09:16:52 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2016-03-07 09:16:52 -0800
commit1590f3b32890f6455b30494308633177b54db347 (patch)
tree5fabc87ced4a0c49bc304d87306068647e8123c2 /include/core
parent54887a6a2e12b0f2c93e039b00678732b6518826 (diff)
Revert of Update Skia's YUV API (patchset #5 id:160001 of https://codereview.chromium.org/1716523002/ )
Reason for revert: Blimp failures with manual roll in Chrome. Original issue's description: > Update Skia's YUV API > > We should match the recently designed API in SkCodec. > https://codereview.chromium.org/1549473003/ > > This requires changes in Chromium as well. > > BUG=skia: > GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1716523002 > > Committed: https://skia.googlesource.com/skia/+/095d31c8a0eeb5d491febf064bc3c8a44e22b94f TBR=scroggo@google.com,reed@google.com,bsalomon@google.com # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia: Review URL: https://codereview.chromium.org/1775493002
Diffstat (limited to 'include/core')
-rw-r--r--include/core/SkImageGenerator.h39
-rw-r--r--include/core/SkPixelRef.h39
-rw-r--r--include/core/SkYUVSizeInfo.h34
3 files changed, 26 insertions, 86 deletions
diff --git a/include/core/SkImageGenerator.h b/include/core/SkImageGenerator.h
index 1a46f6b9cd..86e3053a06 100644
--- a/include/core/SkImageGenerator.h
+++ b/include/core/SkImageGenerator.h
@@ -11,7 +11,6 @@
#include "SkBitmap.h"
#include "SkColor.h"
#include "SkImageInfo.h"
-#include "SkYUVSizeInfo.h"
class GrContext;
class GrTexture;
@@ -130,26 +129,18 @@ public:
bool getPixels(const SkImageInfo& info, void* pixels, size_t rowBytes);
/**
- * If decoding to YUV is supported, this returns true. Otherwise, this
- * returns false and does not modify any of the parameters.
+ * If planes or rowBytes is NULL or if any entry in planes is NULL or if any entry in rowBytes
+ * is 0, this imagegenerator should output the sizes and return true if it can efficiently
+ * return YUV planar data. If it cannot, it should return false. Note that either planes and
+ * rowBytes are both fully defined and non NULL/non 0 or they are both NULL or have NULL or 0
+ * entries only. Having only partial planes/rowBytes information is not supported.
*
- * @param sizeInfo Output parameter indicating the sizes and required
- * allocation widths of the Y, U, and V planes.
- * @param colorSpace Output parameter.
+ * If all planes and rowBytes entries are non NULL or non 0, then it should copy the
+ * associated YUV data into those planes of memory supplied by the caller. It should validate
+ * that the sizes match what it expected. If the sizes do not match, it should return false.
*/
- bool queryYUV8(SkYUVSizeInfo* sizeInfo, SkYUVColorSpace* colorSpace) const;
-
- /**
- * Returns true on success and false on failure.
- * This always attempts to perform a full decode. If the client only
- * wants size, it should call queryYUV8().
- *
- * @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]);
+ bool getYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBytes[3],
+ SkYUVColorSpace* colorSpace);
/**
* If the generator can natively/efficiently return its pixels as a GPU image (backed by a
@@ -257,13 +248,9 @@ protected:
virtual bool onGetPixels(const SkImageInfo& info, void* pixels, size_t rowBytes,
SkPMColor ctable[], int* ctableCount);
-
- virtual bool onQueryYUV8(SkYUVSizeInfo*, SkYUVColorSpace*) const {
- return false;
- }
- virtual bool onGetYUV8Planes(const SkYUVSizeInfo&, void*[3] /*planes*/) {
- return false;
- }
+ virtual bool onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBytes[3]);
+ virtual bool onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBytes[3],
+ SkYUVColorSpace* colorSpace);
virtual GrTexture* onGenerateTexture(GrContext*, const SkIRect*) {
return nullptr;
diff --git a/include/core/SkPixelRef.h b/include/core/SkPixelRef.h
index 651176ebbb..e1ce6d4c7f 100644
--- a/include/core/SkPixelRef.h
+++ b/include/core/SkPixelRef.h
@@ -18,7 +18,6 @@
#include "SkRefCnt.h"
#include "SkSize.h"
#include "SkString.h"
-#include "SkYUVSizeInfo.h"
class SkColorTable;
class SkData;
@@ -211,28 +210,19 @@ public:
virtual GrTexture* getTexture() { return NULL; }
/**
- * If this can efficiently return YUV data, this should return true.
- * Otherwise this returns false and does not modify any of the parameters.
+ * If any planes or rowBytes is NULL, this should output the sizes and return true
+ * if it can efficiently return YUV planar data. If it cannot, it should return false.
*
- * @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.
+ * If all planes and rowBytes are not NULL, then it should copy the associated Y,U,V data
+ * into those planes of memory supplied by the caller. It should validate that the sizes
+ * match what it expected. If the sizes do not match, it should return false.
*
- * @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.
+ * If colorSpace is not NULL, the YUV color space of the data should be stored in the address
+ * it points at.
*/
- bool getYUV8Planes(const SkYUVSizeInfo& sizeInfo, void* planes[3]) {
- return this->onGetYUV8Planes(sizeInfo, planes);
+ bool getYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBytes[3],
+ SkYUVColorSpace* colorSpace) {
+ return this->onGetYUV8Planes(sizes, planes, rowBytes, colorSpace);
}
/** Populates dst with the pixels of this pixelRef, converting them to colorType. */
@@ -318,12 +308,9 @@ 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;
- }
+ // default impl returns false.
+ virtual bool onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBytes[3],
+ SkYUVColorSpace* colorSpace);
/**
* Returns the size (in bytes) of the internally allocated memory.
diff --git a/include/core/SkYUVSizeInfo.h b/include/core/SkYUVSizeInfo.h
deleted file mode 100644
index 2c5a51d794..0000000000
--- a/include/core/SkYUVSizeInfo.h
+++ /dev/null
@@ -1,34 +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 SkYUVSizeInfo_DEFINED
-#define SkYUVSizeInfo_DEFINED
-
-struct SkYUVSizeInfo {
- enum {
- kY = 0,
- kU = 1,
- kV = 2,
- };
- SkISize fSizes[3];
-
- /**
- * While the widths of the Y, U, and V planes are not restricted, the
- * implementation often requires that the width of the memory allocated
- * for each plane be a multiple of 8.
- *
- * This struct allows us to inform the client how many "widthBytes"
- * that we need. Note that we use the new idea of "widthBytes"
- * because this idea is distinct from "rowBytes" (used elsewhere in
- * Skia). "rowBytes" allow the last row of the allocation to not
- * include any extra padding, while, in this case, every single row of
- * the allocation must be at least "widthBytes".
- */
- size_t fWidthBytes[3];
-};
-
-#endif // SkYUVSizeInfo_DEFINED