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

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

Issue 199733016: implement readPixels and writePixels natively, w/o using the (deprecated) (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: rebase Created 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | include/core/SkColorPriv.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 2006 The Android Open Source Project 2 * Copyright 2006 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 SkCanvas_DEFINED 8 #ifndef SkCanvas_DEFINED
9 #define SkCanvas_DEFINED 9 #define SkCanvas_DEFINED
10 10
11 #include "SkTypes.h" 11 #include "SkTypes.h"
12 #include "SkBitmap.h" 12 #include "SkBitmap.h"
13 #include "SkDeque.h" 13 #include "SkDeque.h"
14 #include "SkClipStack.h" 14 #include "SkClipStack.h"
15 #include "SkPaint.h" 15 #include "SkPaint.h"
16 #include "SkRefCnt.h" 16 #include "SkRefCnt.h"
17 #include "SkPath.h" 17 #include "SkPath.h"
18 #include "SkRegion.h" 18 #include "SkRegion.h"
19 #include "SkXfermode.h" 19 #include "SkXfermode.h"
20 20
21 //#define SK_SUPPORT_LEGACY_READPIXELSCONFIG 21 //#define SK_SUPPORT_LEGACY_READPIXELSCONFIG
22 22
23 #ifdef SK_SUPPORT_LEGACY_READPIXELSCONFIG
24 #ifndef SK_SUPPORT_LEGACY_CONFIG8888
25 #define SK_SUPPORT_LEGACY_CONFIG8888
26 #endif
27 #endif
28
23 // if not defined, we always assume ClipToLayer for saveLayer() 29 // if not defined, we always assume ClipToLayer for saveLayer()
24 //#define SK_SUPPORT_LEGACY_CLIPTOLAYERFLAG 30 //#define SK_SUPPORT_LEGACY_CLIPTOLAYERFLAG
25 31
26 32
27 //#define SK_SUPPORT_LEGACY_GETCLIPTYPE 33 //#define SK_SUPPORT_LEGACY_GETCLIPTYPE
28 //#define SK_SUPPORT_LEGACY_GETTOTALCLIP 34 //#define SK_SUPPORT_LEGACY_GETTOTALCLIP
29 //#define SK_SUPPORT_LEGACY_GETTOPDEVICE 35 //#define SK_SUPPORT_LEGACY_GETTOPDEVICE
30 36
31 class SkBounder; 37 class SkBounder;
32 class SkBaseDevice; 38 class SkBaseDevice;
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 * return the ImageInfo and rowBytes. The returned address is only valid 230 * return the ImageInfo and rowBytes. The returned address is only valid
225 * while the canvas object is in scope and unchanged. Any API calls made on 231 * while the canvas object is in scope and unchanged. Any API calls made on
226 * canvas (or its parent surface if any) will invalidate the 232 * canvas (or its parent surface if any) will invalidate the
227 * returned address (and associated information). 233 * returned address (and associated information).
228 * 234 *
229 * On failure, returns NULL and the info and rowBytes parameters are 235 * On failure, returns NULL and the info and rowBytes parameters are
230 * ignored. 236 * ignored.
231 */ 237 */
232 const void* peekPixels(SkImageInfo* info, size_t* rowBytes); 238 const void* peekPixels(SkImageInfo* info, size_t* rowBytes);
233 239
240 #ifdef SK_SUPPORT_LEGACY_CONFIG8888
234 /** 241 /**
235 * This enum can be used with read/writePixels to perform a pixel ops to or 242 * This enum can be used with read/writePixels to perform a pixel ops to or
236 * from an 8888 config other than Skia's native config (SkPMColor). There 243 * from an 8888 config other than Skia's native config (SkPMColor). There
237 * are three byte orders supported: native, BGRA, and RGBA. Each has a 244 * are three byte orders supported: native, BGRA, and RGBA. Each has a
238 * premultiplied and unpremultiplied variant. 245 * premultiplied and unpremultiplied variant.
239 * 246 *
240 * Components of a 8888 pixel can be packed/unpacked from a 32bit word using 247 * Components of a 8888 pixel can be packed/unpacked from a 32bit word using
241 * either byte offsets or shift values. Byte offsets are endian-invariant 248 * either byte offsets or shift values. Byte offsets are endian-invariant
242 * while shifts are not. BGRA and RGBA configs are defined by byte 249 * while shifts are not. BGRA and RGBA configs are defined by byte
243 * orderings. The native config is defined by shift values (SK_A32_SHIFT, 250 * orderings. The native config is defined by shift values (SK_A32_SHIFT,
(...skipping 14 matching lines...) Expand all
258 * low byte to high byte: B, G, R, A. 265 * low byte to high byte: B, G, R, A.
259 */ 266 */
260 kBGRA_Premul_Config8888, 267 kBGRA_Premul_Config8888,
261 kBGRA_Unpremul_Config8888, 268 kBGRA_Unpremul_Config8888,
262 /** 269 /**
263 * low byte to high byte: R, G, B, A. 270 * low byte to high byte: R, G, B, A.
264 */ 271 */
265 kRGBA_Premul_Config8888, 272 kRGBA_Premul_Config8888,
266 kRGBA_Unpremul_Config8888 273 kRGBA_Unpremul_Config8888
267 }; 274 };
275 #endif
268 276
269 #ifdef SK_SUPPORT_LEGACY_READPIXELSCONFIG 277 #ifdef SK_SUPPORT_LEGACY_READPIXELSCONFIG
270 /** 278 /**
271 * On success (returns true), copy the canvas pixels into the bitmap. 279 * On success (returns true), copy the canvas pixels into the bitmap.
272 * On failure, the bitmap parameter is left unchanged and false is 280 * On failure, the bitmap parameter is left unchanged and false is
273 * returned. 281 * returned.
274 * 282 *
275 * The canvas' pixels are converted to the bitmap's config. The only 283 * The canvas' pixels are converted to the bitmap's config. The only
276 * supported config is kARGB_8888_Config, though this is likely to be 284 * supported config is kARGB_8888_Config, though this is likely to be
277 * relaxed in the future. The meaning of config kARGB_8888_Config is 285 * relaxed in the future. The meaning of config kARGB_8888_Config is
(...skipping 1216 matching lines...) Expand 10 before | Expand all | Expand 10 after
1494 bool asROBitmap(SkBitmap*) const; 1502 bool asROBitmap(SkBitmap*) const;
1495 1503
1496 private: 1504 private:
1497 SkBitmap fBitmap; // used if peekPixels() fails 1505 SkBitmap fBitmap; // used if peekPixels() fails
1498 const void* fAddr; // NULL on failure 1506 const void* fAddr; // NULL on failure
1499 SkImageInfo fInfo; 1507 SkImageInfo fInfo;
1500 size_t fRowBytes; 1508 size_t fRowBytes;
1501 }; 1509 };
1502 1510
1503 #endif 1511 #endif
OLDNEW
« no previous file with comments | « no previous file | include/core/SkColorPriv.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698