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

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

Issue 374743003: Skia side RGB to YUV gpu conversion (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fixed comments and added SkImageGenerator unit tests Created 6 years, 5 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') | src/core/SkImageGenerator.cpp » ('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 "SkBitmap.h" 11 #include "SkBitmap.h"
12 #include "SkDynamicAnnotations.h" 12 #include "SkDynamicAnnotations.h"
13 #include "SkRefCnt.h" 13 #include "SkRefCnt.h"
14 #include "SkString.h" 14 #include "SkString.h"
15 #include "SkFlattenable.h" 15 #include "SkFlattenable.h"
16 #include "SkImageInfo.h" 16 #include "SkImageInfo.h"
17 #include "SkSize.h"
17 #include "SkTDArray.h" 18 #include "SkTDArray.h"
18 19
19 //#define xed 20 //#define xed
20 21
21 #ifdef SK_DEBUG 22 #ifdef SK_DEBUG
22 /** 23 /**
23 * Defining SK_IGNORE_PIXELREF_SETPRELOCKED will force all pixelref 24 * Defining SK_IGNORE_PIXELREF_SETPRELOCKED will force all pixelref
24 * subclasses to correctly handle lock/unlock pixels. For performance 25 * subclasses to correctly handle lock/unlock pixels. For performance
25 * reasons, simple malloc-based subclasses call setPreLocked() to skip 26 * reasons, simple malloc-based subclasses call setPreLocked() to skip
26 * the overhead of implementing these calls. 27 * the overhead of implementing these calls.
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 */ 221 */
221 bool decodeInto(int pow2, SkBitmap* bitmap) { 222 bool decodeInto(int pow2, SkBitmap* bitmap) {
222 SkASSERT(pow2 >= 0); 223 SkASSERT(pow2 >= 0);
223 return this->onDecodeInto(pow2, bitmap); 224 return this->onDecodeInto(pow2, bitmap);
224 } 225 }
225 226
226 /** Are we really wrapping a texture instead of a bitmap? 227 /** Are we really wrapping a texture instead of a bitmap?
227 */ 228 */
228 virtual GrTexture* getTexture() { return NULL; } 229 virtual GrTexture* getTexture() { return NULL; }
229 230
231 /**
232 * If any planes or rowBytes is NULL, this should output the sizes and retu rn true
233 * if it can efficiently return YUV planar data. If it cannot, it should re turn false.
234 *
235 * If all planes and rowBytes are not NULL, then it should copy the associa ted Y,U,V data
236 * into those planes of memory supplied by the caller. It should validate t hat the sizes
237 * match what it expected. If the sizes do not match, it should return fals e.
238 */
239 virtual bool getYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowByte s[3]) {
scroggo 2014/07/21 14:53:00 Why not follow the convention used in SkImageGener
sugoi1 2014/07/21 15:08:14 Done.
240 return false;
241 }
242
230 bool readPixels(SkBitmap* dst, const SkIRect* subset = NULL); 243 bool readPixels(SkBitmap* dst, const SkIRect* subset = NULL);
231 244
232 /** 245 /**
233 * Makes a deep copy of this PixelRef, respecting the requested config. 246 * Makes a deep copy of this PixelRef, respecting the requested config.
234 * @param colorType Desired colortype. 247 * @param colorType Desired colortype.
235 * @param subset Subset of this PixelRef to copy. Must be fully contained w ithin the bounds of 248 * @param subset Subset of this PixelRef to copy. Must be fully contained w ithin the bounds of
236 * of this PixelRef. 249 * of this PixelRef.
237 * @return A new SkPixelRef, or NULL if either there is an error (e.g. the destination could 250 * @return A new SkPixelRef, or NULL if either there is an error (e.g. the destination could
238 * not be created with the given config), or this PixelRef does not support deep 251 * not be created with the given config), or this PixelRef does not support deep
239 * copies. 252 * copies.
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 /** 397 /**
385 * Allocate a new pixelref matching the specified ImageInfo, allocating 398 * Allocate a new pixelref matching the specified ImageInfo, allocating
386 * the memory for the pixels. If the ImageInfo requires a ColorTable, 399 * the memory for the pixels. If the ImageInfo requires a ColorTable,
387 * the pixelref will ref() the colortable. 400 * the pixelref will ref() the colortable.
388 * On failure return NULL. 401 * On failure return NULL.
389 */ 402 */
390 virtual SkPixelRef* create(const SkImageInfo&, size_t rowBytes, SkColorTable *) = 0; 403 virtual SkPixelRef* create(const SkImageInfo&, size_t rowBytes, SkColorTable *) = 0;
391 }; 404 };
392 405
393 #endif 406 #endif
OLDNEW
« no previous file with comments | « include/core/SkImageGenerator.h ('k') | src/core/SkImageGenerator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698