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 // if not defined, we always assume ClipToLayer for saveLayer() |
| 22 //#define SK_SUPPORT_LEGACY_CLIPTOLAYERFLAG |
| 23 |
| 24 |
21 //#define SK_SUPPORT_LEGACY_WRITEPIXELSCONFIG | 25 //#define SK_SUPPORT_LEGACY_WRITEPIXELSCONFIG |
22 //#define SK_SUPPORT_LEGACY_GETCLIPTYPE | 26 //#define SK_SUPPORT_LEGACY_GETCLIPTYPE |
23 //#define SK_SUPPORT_LEGACY_GETTOTALCLIP | 27 //#define SK_SUPPORT_LEGACY_GETTOTALCLIP |
24 | 28 |
25 class SkBounder; | 29 class SkBounder; |
26 class SkBaseDevice; | 30 class SkBaseDevice; |
27 class SkDraw; | 31 class SkDraw; |
28 class SkDrawFilter; | 32 class SkDrawFilter; |
29 class SkMetaData; | 33 class SkMetaData; |
30 class SkPicture; | 34 class SkPicture; |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 | 322 |
319 enum SaveFlags { | 323 enum SaveFlags { |
320 /** save the matrix state, restoring it on restore() */ | 324 /** save the matrix state, restoring it on restore() */ |
321 kMatrix_SaveFlag = 0x01, | 325 kMatrix_SaveFlag = 0x01, |
322 /** save the clip state, restoring it on restore() */ | 326 /** save the clip state, restoring it on restore() */ |
323 kClip_SaveFlag = 0x02, | 327 kClip_SaveFlag = 0x02, |
324 /** the layer needs to support per-pixel alpha */ | 328 /** the layer needs to support per-pixel alpha */ |
325 kHasAlphaLayer_SaveFlag = 0x04, | 329 kHasAlphaLayer_SaveFlag = 0x04, |
326 /** the layer needs to support 8-bits per color component */ | 330 /** the layer needs to support 8-bits per color component */ |
327 kFullColorLayer_SaveFlag = 0x08, | 331 kFullColorLayer_SaveFlag = 0x08, |
328 /** the layer should clip against the bounds argument */ | 332 /** |
| 333 * the layer should clip against the bounds argument |
| 334 * |
| 335 * if SK_SUPPORT_LEGACY_CLIPTOLAYERFLAG is undefined, this is treated a
s always on. |
| 336 */ |
329 kClipToLayer_SaveFlag = 0x10, | 337 kClipToLayer_SaveFlag = 0x10, |
330 | 338 |
331 // helper masks for common choices | 339 // helper masks for common choices |
332 kMatrixClip_SaveFlag = 0x03, | 340 kMatrixClip_SaveFlag = 0x03, |
| 341 #ifdef SK_SUPPORT_LEGACY_CLIPTOLAYERFLAG |
333 kARGB_NoClipLayer_SaveFlag = 0x0F, | 342 kARGB_NoClipLayer_SaveFlag = 0x0F, |
| 343 #endif |
334 kARGB_ClipLayer_SaveFlag = 0x1F | 344 kARGB_ClipLayer_SaveFlag = 0x1F |
335 }; | 345 }; |
336 | 346 |
337 /** This call saves the current matrix, clip, and drawFilter, and pushes a | 347 /** This call saves the current matrix, clip, and drawFilter, and pushes a |
338 copy onto a private stack. Subsequent calls to translate, scale, | 348 copy onto a private stack. Subsequent calls to translate, scale, |
339 rotate, skew, concat or clipRect, clipPath, and setDrawFilter all | 349 rotate, skew, concat or clipRect, clipPath, and setDrawFilter all |
340 operate on this copy. | 350 operate on this copy. |
341 When the balancing call to restore() is made, the previous matrix, clip, | 351 When the balancing call to restore() is made, the previous matrix, clip, |
342 and drawFilter are restored. | 352 and drawFilter are restored. |
343 @param flags The flags govern what portion of the Matrix/Clip/drawFilter | 353 @param flags The flags govern what portion of the Matrix/Clip/drawFilter |
(...skipping 1069 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1413 bool asROBitmap(SkBitmap*) const; | 1423 bool asROBitmap(SkBitmap*) const; |
1414 | 1424 |
1415 private: | 1425 private: |
1416 SkBitmap fBitmap; // used if peekPixels() fails | 1426 SkBitmap fBitmap; // used if peekPixels() fails |
1417 const void* fAddr; // NULL on failure | 1427 const void* fAddr; // NULL on failure |
1418 SkImageInfo fInfo; | 1428 SkImageInfo fInfo; |
1419 size_t fRowBytes; | 1429 size_t fRowBytes; |
1420 }; | 1430 }; |
1421 | 1431 |
1422 #endif | 1432 #endif |
OLD | NEW |