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

Side by Side Diff: include/core/SkPixelRef.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/core/SkImageGenerator.h ('k') | include/core/SkYUVSizeInfo.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 2008 The Android Open Source Project 2 * Copyright 2008 The Android Open Source Project
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 SkPixelRef_DEFINED 8 #ifndef SkPixelRef_DEFINED
9 #define SkPixelRef_DEFINED 9 #define SkPixelRef_DEFINED
10 10
11 #include "../private/SkAtomics.h" 11 #include "../private/SkAtomics.h"
12 #include "../private/SkMutex.h" 12 #include "../private/SkMutex.h"
13 #include "../private/SkTDArray.h" 13 #include "../private/SkTDArray.h"
14 #include "SkBitmap.h" 14 #include "SkBitmap.h"
15 #include "SkFilterQuality.h" 15 #include "SkFilterQuality.h"
16 #include "SkImageInfo.h" 16 #include "SkImageInfo.h"
17 #include "SkPixmap.h" 17 #include "SkPixmap.h"
18 #include "SkRefCnt.h" 18 #include "SkRefCnt.h"
19 #include "SkSize.h" 19 #include "SkSize.h"
20 #include "SkString.h" 20 #include "SkString.h"
21 #include "SkYUVSizeInfo.h"
22 21
23 class SkColorTable; 22 class SkColorTable;
24 class SkData; 23 class SkData;
25 struct SkIRect; 24 struct SkIRect;
26 25
27 class GrTexture; 26 class GrTexture;
28 class SkDiscardableMemory; 27 class SkDiscardableMemory;
29 28
30 /** \class SkPixelRef 29 /** \class SkPixelRef
31 30
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 } 203 }
205 }; 204 };
206 205
207 bool requestLock(const LockRequest&, LockResult*); 206 bool requestLock(const LockRequest&, LockResult*);
208 207
209 /** Are we really wrapping a texture instead of a bitmap? 208 /** Are we really wrapping a texture instead of a bitmap?
210 */ 209 */
211 virtual GrTexture* getTexture() { return NULL; } 210 virtual GrTexture* getTexture() { return NULL; }
212 211
213 /** 212 /**
214 * If this can efficiently return YUV data, this should return true. 213 * If any planes or rowBytes is NULL, this should output the sizes and retu rn true
215 * Otherwise this returns false and does not modify any of the parameters. 214 * if it can efficiently return YUV planar data. If it cannot, it should re turn false.
216 * 215 *
217 * @param sizeInfo Output parameter indicating the sizes and required 216 * If all planes and rowBytes are not NULL, then it should copy the associa ted Y,U,V data
218 * allocation widths of the Y, U, and V planes. 217 * into those planes of memory supplied by the caller. It should validate t hat the sizes
219 * @param colorSpace Output parameter. 218 * match what it expected. If the sizes do not match, it should return fals e.
219 *
220 * If colorSpace is not NULL, the YUV color space of the data should be sto red in the address
221 * it points at.
220 */ 222 */
221 bool queryYUV8(SkYUVSizeInfo* sizeInfo, SkYUVColorSpace* colorSpace) const { 223 bool getYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBytes[3],
222 return this->onQueryYUV8(sizeInfo, colorSpace); 224 SkYUVColorSpace* colorSpace) {
223 } 225 return this->onGetYUV8Planes(sizes, planes, rowBytes, colorSpace);
224
225 /**
226 * Returns true on success and false on failure.
227 * Copies YUV data into the provided YUV planes.
228 *
229 * @param sizeInfo Needs to exactly match the values returned by the
230 * query, except the WidthBytes may be larger than the
231 * recommendation (but not smaller).
232 * @param planes Memory for each of the Y, U, and V planes.
233 */
234 bool getYUV8Planes(const SkYUVSizeInfo& sizeInfo, void* planes[3]) {
235 return this->onGetYUV8Planes(sizeInfo, planes);
236 } 226 }
237 227
238 /** Populates dst with the pixels of this pixelRef, converting them to color Type. */ 228 /** Populates dst with the pixels of this pixelRef, converting them to color Type. */
239 bool readPixels(SkBitmap* dst, SkColorType colorType, const SkIRect* subset = NULL); 229 bool readPixels(SkBitmap* dst, SkColorType colorType, const SkIRect* subset = NULL);
240 230
241 /** 231 /**
242 * Makes a deep copy of this PixelRef, respecting the requested config. 232 * Makes a deep copy of this PixelRef, respecting the requested config.
243 * @param colorType Desired colortype. 233 * @param colorType Desired colortype.
244 * @param profileType Desired colorprofiletype. 234 * @param profileType Desired colorprofiletype.
245 * @param subset Subset of this PixelRef to copy. Must be fully contained w ithin the bounds of 235 * @param subset Subset of this PixelRef to copy. Must be fully contained w ithin the bounds of
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 * The base class implementation returns false; 301 * The base class implementation returns false;
312 */ 302 */
313 virtual bool onReadPixels(SkBitmap* dst, SkColorType colorType, const SkIRec t* subsetOrNull); 303 virtual bool onReadPixels(SkBitmap* dst, SkColorType colorType, const SkIRec t* subsetOrNull);
314 304
315 // default impl returns NULL. 305 // default impl returns NULL.
316 virtual SkData* onRefEncodedData(); 306 virtual SkData* onRefEncodedData();
317 307
318 // default impl does nothing. 308 // default impl does nothing.
319 virtual void onNotifyPixelsChanged(); 309 virtual void onNotifyPixelsChanged();
320 310
321 virtual bool onQueryYUV8(SkYUVSizeInfo*, SkYUVColorSpace*) const { 311 // default impl returns false.
322 return false; 312 virtual bool onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBy tes[3],
323 } 313 SkYUVColorSpace* colorSpace);
324 virtual bool onGetYUV8Planes(const SkYUVSizeInfo&, void*[3] /*planes*/) {
325 return false;
326 }
327 314
328 /** 315 /**
329 * Returns the size (in bytes) of the internally allocated memory. 316 * Returns the size (in bytes) of the internally allocated memory.
330 * This should be implemented in all serializable SkPixelRef derived classe s. 317 * This should be implemented in all serializable SkPixelRef derived classe s.
331 * SkBitmap::fPixelRefOffset + SkBitmap::getSafeSize() should never overflo w this value, 318 * SkBitmap::fPixelRefOffset + SkBitmap::getSafeSize() should never overflo w this value,
332 * otherwise the rendering code may attempt to read memory out of bounds. 319 * otherwise the rendering code may attempt to read memory out of bounds.
333 * 320 *
334 * @return default impl returns 0. 321 * @return default impl returns 0.
335 */ 322 */
336 virtual size_t getAllocatedSizeInBytes() const; 323 virtual size_t getAllocatedSizeInBytes() const;
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 /** 400 /**
414 * Allocate a new pixelref matching the specified ImageInfo, allocating 401 * Allocate a new pixelref matching the specified ImageInfo, allocating
415 * the memory for the pixels. If the ImageInfo requires a ColorTable, 402 * the memory for the pixels. If the ImageInfo requires a ColorTable,
416 * the pixelref will ref() the colortable. 403 * the pixelref will ref() the colortable.
417 * On failure return NULL. 404 * On failure return NULL.
418 */ 405 */
419 virtual SkPixelRef* create(const SkImageInfo&, size_t rowBytes, SkColorTable *) = 0; 406 virtual SkPixelRef* create(const SkImageInfo&, size_t rowBytes, SkColorTable *) = 0;
420 }; 407 };
421 408
422 #endif 409 #endif
OLDNEW
« no previous file with comments | « include/core/SkImageGenerator.h ('k') | include/core/SkYUVSizeInfo.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698