Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(64)

Side by Side Diff: include/core/SkImageGenerator.h

Issue 1775493002: Revert of Update Skia's YUV API (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « include/codec/SkCodec.h ('k') | include/core/SkPixelRef.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2013 Google Inc. 2 * Copyright 2013 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef SkImageGenerator_DEFINED 8 #ifndef SkImageGenerator_DEFINED
9 #define SkImageGenerator_DEFINED 9 #define SkImageGenerator_DEFINED
10 10
11 #include "SkBitmap.h" 11 #include "SkBitmap.h"
12 #include "SkColor.h" 12 #include "SkColor.h"
13 #include "SkImageInfo.h" 13 #include "SkImageInfo.h"
14 #include "SkYUVSizeInfo.h"
15 14
16 class GrContext; 15 class GrContext;
17 class GrTexture; 16 class GrTexture;
18 class GrTextureParams; 17 class GrTextureParams;
19 class SkBitmap; 18 class SkBitmap;
20 class SkData; 19 class SkData;
21 class SkImageGenerator; 20 class SkImageGenerator;
22 class SkMatrix; 21 class SkMatrix;
23 class SkPaint; 22 class SkPaint;
24 class SkPicture; 23 class SkPicture;
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 bool getPixels(const SkImageInfo& info, void* pixels, size_t rowBytes, 122 bool getPixels(const SkImageInfo& info, void* pixels, size_t rowBytes,
124 SkPMColor ctable[], int* ctableCount); 123 SkPMColor ctable[], int* ctableCount);
125 124
126 /** 125 /**
127 * Simplified version of getPixels() that asserts that info is NOT kIndex8_ SkColorType and 126 * Simplified version of getPixels() that asserts that info is NOT kIndex8_ SkColorType and
128 * uses the default Options. 127 * uses the default Options.
129 */ 128 */
130 bool getPixels(const SkImageInfo& info, void* pixels, size_t rowBytes); 129 bool getPixels(const SkImageInfo& info, void* pixels, size_t rowBytes);
131 130
132 /** 131 /**
133 * If decoding to YUV is supported, this returns true. Otherwise, this 132 * If planes or rowBytes is NULL or if any entry in planes is NULL or if an y entry in rowBytes
134 * returns false and does not modify any of the parameters. 133 * is 0, this imagegenerator should output the sizes and return true if it can efficiently
134 * return YUV planar data. If it cannot, it should return false. Note that either planes and
135 * rowBytes are both fully defined and non NULL/non 0 or they are both NULL or have NULL or 0
136 * entries only. Having only partial planes/rowBytes information is not sup ported.
135 * 137 *
136 * @param sizeInfo Output parameter indicating the sizes and required 138 * If all planes and rowBytes entries are non NULL or non 0, then it should copy the
137 * allocation widths of the Y, U, and V planes. 139 * associated YUV data into those planes of memory supplied by the caller. It should validate
138 * @param colorSpace Output parameter. 140 * that the sizes match what it expected. If the sizes do not match, it sho uld return false.
139 */ 141 */
140 bool queryYUV8(SkYUVSizeInfo* sizeInfo, SkYUVColorSpace* colorSpace) const; 142 bool getYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBytes[3],
141 143 SkYUVColorSpace* colorSpace);
142 /**
143 * Returns true on success and false on failure.
144 * This always attempts to perform a full decode. If the client only
145 * wants size, it should call queryYUV8().
146 *
147 * @param sizeInfo Needs to exactly match the values returned by the
148 * query, except the WidthBytes may be larger than the
149 * recommendation (but not smaller).
150 * @param planes Memory for each of the Y, U, and V planes.
151 */
152 bool getYUV8Planes(const SkYUVSizeInfo& sizeInfo, void* planes[3]);
153 144
154 /** 145 /**
155 * If the generator can natively/efficiently return its pixels as a GPU ima ge (backed by a 146 * If the generator can natively/efficiently return its pixels as a GPU ima ge (backed by a
156 * texture) this will return that image. If not, this will return NULL. 147 * texture) this will return that image. If not, this will return NULL.
157 * 148 *
158 * Regarding the GrContext parameter: 149 * Regarding the GrContext parameter:
159 * 150 *
160 * The caller may pass NULL for the context. In that case the generator may assume that its 151 * The caller may pass NULL for the context. In that case the generator may assume that its
161 * internal context is current. If it has no internal context, then it shou ld just return 152 * internal context is current. If it has no internal context, then it shou ld just return
162 * null. 153 * null.
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 } 241 }
251 } 242 }
252 243
253 protected: 244 protected:
254 SkImageGenerator(const SkImageInfo& info); 245 SkImageGenerator(const SkImageInfo& info);
255 246
256 virtual SkData* onRefEncodedData(SK_REFENCODEDDATA_CTXPARAM); 247 virtual SkData* onRefEncodedData(SK_REFENCODEDDATA_CTXPARAM);
257 248
258 virtual bool onGetPixels(const SkImageInfo& info, void* pixels, size_t rowBy tes, 249 virtual bool onGetPixels(const SkImageInfo& info, void* pixels, size_t rowBy tes,
259 SkPMColor ctable[], int* ctableCount); 250 SkPMColor ctable[], int* ctableCount);
260 251 virtual bool onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBy tes[3]);
261 virtual bool onQueryYUV8(SkYUVSizeInfo*, SkYUVColorSpace*) const { 252 virtual bool onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBy tes[3],
262 return false; 253 SkYUVColorSpace* colorSpace);
263 }
264 virtual bool onGetYUV8Planes(const SkYUVSizeInfo&, void*[3] /*planes*/) {
265 return false;
266 }
267 254
268 virtual GrTexture* onGenerateTexture(GrContext*, const SkIRect*) { 255 virtual GrTexture* onGenerateTexture(GrContext*, const SkIRect*) {
269 return nullptr; 256 return nullptr;
270 } 257 }
271 258
272 virtual bool onComputeScaledDimensions(SkScalar, SupportedSizes*) { 259 virtual bool onComputeScaledDimensions(SkScalar, SupportedSizes*) {
273 return false; 260 return false;
274 } 261 }
275 virtual bool onGenerateScaledPixels(const SkISize&, const SkIPoint&, const S kPixmap&) { 262 virtual bool onGenerateScaledPixels(const SkISize&, const SkIPoint&, const S kPixmap&) {
276 return false; 263 return false;
277 } 264 }
278 265
279 bool tryGenerateBitmap(SkBitmap* bm, const SkImageInfo* optionalInfo, SkBitm ap::Allocator*); 266 bool tryGenerateBitmap(SkBitmap* bm, const SkImageInfo* optionalInfo, SkBitm ap::Allocator*);
280 267
281 private: 268 private:
282 const SkImageInfo fInfo; 269 const SkImageInfo fInfo;
283 const uint32_t fUniqueID; 270 const uint32_t fUniqueID;
284 271
285 // This is our default impl, which may be different on different platforms. 272 // This is our default impl, which may be different on different platforms.
286 // It is called from NewFromEncoded() after it has checked for any runtime f actory. 273 // It is called from NewFromEncoded() after it has checked for any runtime f actory.
287 // The SkData will never be NULL, as that will have been checked by NewFromE ncoded. 274 // The SkData will never be NULL, as that will have been checked by NewFromE ncoded.
288 static SkImageGenerator* NewFromEncodedImpl(SkData*); 275 static SkImageGenerator* NewFromEncodedImpl(SkData*);
289 }; 276 };
290 277
291 #endif // SkImageGenerator_DEFINED 278 #endif // SkImageGenerator_DEFINED
OLDNEW
« no previous file with comments | « include/codec/SkCodec.h ('k') | include/core/SkPixelRef.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698