OLD | NEW |
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 | |
29 // if not defined, we always assume ClipToLayer for saveLayer() | 23 // if not defined, we always assume ClipToLayer for saveLayer() |
30 //#define SK_SUPPORT_LEGACY_CLIPTOLAYERFLAG | 24 //#define SK_SUPPORT_LEGACY_CLIPTOLAYERFLAG |
31 | 25 |
32 | 26 |
33 //#define SK_SUPPORT_LEGACY_GETCLIPTYPE | 27 //#define SK_SUPPORT_LEGACY_GETCLIPTYPE |
34 //#define SK_SUPPORT_LEGACY_GETTOTALCLIP | 28 //#define SK_SUPPORT_LEGACY_GETTOTALCLIP |
35 //#define SK_SUPPORT_LEGACY_GETTOPDEVICE | 29 //#define SK_SUPPORT_LEGACY_GETTOPDEVICE |
36 | 30 |
37 class SkBounder; | 31 class SkBounder; |
38 class SkBaseDevice; | 32 class SkBaseDevice; |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 * return the ImageInfo and rowBytes. The returned address is only valid | 224 * return the ImageInfo and rowBytes. The returned address is only valid |
231 * while the canvas object is in scope and unchanged. Any API calls made on | 225 * while the canvas object is in scope and unchanged. Any API calls made on |
232 * canvas (or its parent surface if any) will invalidate the | 226 * canvas (or its parent surface if any) will invalidate the |
233 * returned address (and associated information). | 227 * returned address (and associated information). |
234 * | 228 * |
235 * On failure, returns NULL and the info and rowBytes parameters are | 229 * On failure, returns NULL and the info and rowBytes parameters are |
236 * ignored. | 230 * ignored. |
237 */ | 231 */ |
238 const void* peekPixels(SkImageInfo* info, size_t* rowBytes); | 232 const void* peekPixels(SkImageInfo* info, size_t* rowBytes); |
239 | 233 |
240 #ifdef SK_SUPPORT_LEGACY_CONFIG8888 | |
241 /** | 234 /** |
242 * This enum can be used with read/writePixels to perform a pixel ops to or | 235 * This enum can be used with read/writePixels to perform a pixel ops to or |
243 * from an 8888 config other than Skia's native config (SkPMColor). There | 236 * from an 8888 config other than Skia's native config (SkPMColor). There |
244 * are three byte orders supported: native, BGRA, and RGBA. Each has a | 237 * are three byte orders supported: native, BGRA, and RGBA. Each has a |
245 * premultiplied and unpremultiplied variant. | 238 * premultiplied and unpremultiplied variant. |
246 * | 239 * |
247 * Components of a 8888 pixel can be packed/unpacked from a 32bit word using | 240 * Components of a 8888 pixel can be packed/unpacked from a 32bit word using |
248 * either byte offsets or shift values. Byte offsets are endian-invariant | 241 * either byte offsets or shift values. Byte offsets are endian-invariant |
249 * while shifts are not. BGRA and RGBA configs are defined by byte | 242 * while shifts are not. BGRA and RGBA configs are defined by byte |
250 * orderings. The native config is defined by shift values (SK_A32_SHIFT, | 243 * orderings. The native config is defined by shift values (SK_A32_SHIFT, |
(...skipping 14 matching lines...) Expand all Loading... |
265 * low byte to high byte: B, G, R, A. | 258 * low byte to high byte: B, G, R, A. |
266 */ | 259 */ |
267 kBGRA_Premul_Config8888, | 260 kBGRA_Premul_Config8888, |
268 kBGRA_Unpremul_Config8888, | 261 kBGRA_Unpremul_Config8888, |
269 /** | 262 /** |
270 * low byte to high byte: R, G, B, A. | 263 * low byte to high byte: R, G, B, A. |
271 */ | 264 */ |
272 kRGBA_Premul_Config8888, | 265 kRGBA_Premul_Config8888, |
273 kRGBA_Unpremul_Config8888 | 266 kRGBA_Unpremul_Config8888 |
274 }; | 267 }; |
275 #endif | |
276 | 268 |
277 #ifdef SK_SUPPORT_LEGACY_READPIXELSCONFIG | 269 #ifdef SK_SUPPORT_LEGACY_READPIXELSCONFIG |
278 /** | 270 /** |
279 * On success (returns true), copy the canvas pixels into the bitmap. | 271 * On success (returns true), copy the canvas pixels into the bitmap. |
280 * On failure, the bitmap parameter is left unchanged and false is | 272 * On failure, the bitmap parameter is left unchanged and false is |
281 * returned. | 273 * returned. |
282 * | 274 * |
283 * The canvas' pixels are converted to the bitmap's config. The only | 275 * The canvas' pixels are converted to the bitmap's config. The only |
284 * supported config is kARGB_8888_Config, though this is likely to be | 276 * supported config is kARGB_8888_Config, though this is likely to be |
285 * relaxed in the future. The meaning of config kARGB_8888_Config is | 277 * relaxed in the future. The meaning of config kARGB_8888_Config is |
(...skipping 1216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1502 bool asROBitmap(SkBitmap*) const; | 1494 bool asROBitmap(SkBitmap*) const; |
1503 | 1495 |
1504 private: | 1496 private: |
1505 SkBitmap fBitmap; // used if peekPixels() fails | 1497 SkBitmap fBitmap; // used if peekPixels() fails |
1506 const void* fAddr; // NULL on failure | 1498 const void* fAddr; // NULL on failure |
1507 SkImageInfo fInfo; | 1499 SkImageInfo fInfo; |
1508 size_t fRowBytes; | 1500 size_t fRowBytes; |
1509 }; | 1501 }; |
1510 | 1502 |
1511 #endif | 1503 #endif |
OLD | NEW |