| 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 | |
| 25 //#define SK_SUPPORT_LEGACY_GETCLIPTYPE | |
| 26 //#define SK_SUPPORT_LEGACY_GETTOTALCLIP | |
| 27 //#define SK_SUPPORT_LEGACY_GETTOPDEVICE | |
| 28 | |
| 29 //#define SK_SUPPORT_LEGACY_DRAWTEXT_VIRTUAL | |
| 30 #ifdef SK_SUPPORT_LEGACY_DRAWTEXT_VIRTUAL | 21 #ifdef SK_SUPPORT_LEGACY_DRAWTEXT_VIRTUAL |
| 31 #define SK_LEGACY_DRAWTEXT_VIRTUAL virtual | 22 #define SK_LEGACY_DRAWTEXT_VIRTUAL virtual |
| 32 #else | 23 #else |
| 33 #define SK_LEGACY_DRAWTEXT_VIRTUAL | 24 #define SK_LEGACY_DRAWTEXT_VIRTUAL |
| 34 #endif | 25 #endif |
| 35 | 26 |
| 36 class SkBounder; | |
| 37 class SkBaseDevice; | 27 class SkBaseDevice; |
| 38 class SkDraw; | 28 class SkDraw; |
| 39 class SkDrawFilter; | 29 class SkDrawFilter; |
| 40 class SkMetaData; | 30 class SkMetaData; |
| 41 class SkPicture; | 31 class SkPicture; |
| 42 class SkRRect; | 32 class SkRRect; |
| 43 class SkSurface; | 33 class SkSurface; |
| 44 class SkSurface_Base; | 34 class SkSurface_Base; |
| 45 class GrContext; | 35 class GrContext; |
| 46 class GrRenderTarget; | 36 class GrRenderTarget; |
| (...skipping 1015 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1062 */ | 1052 */ |
| 1063 void pushCull(const SkRect& cullRect); | 1053 void pushCull(const SkRect& cullRect); |
| 1064 | 1054 |
| 1065 /** | 1055 /** |
| 1066 * Terminates the current culling block, and restores the previous one (if
any). | 1056 * Terminates the current culling block, and restores the previous one (if
any). |
| 1067 */ | 1057 */ |
| 1068 void popCull(); | 1058 void popCull(); |
| 1069 | 1059 |
| 1070 ////////////////////////////////////////////////////////////////////////// | 1060 ////////////////////////////////////////////////////////////////////////// |
| 1071 | 1061 |
| 1072 /** Get the current bounder object. | |
| 1073 The bounder's reference count is unchaged. | |
| 1074 @return the canva's bounder (or NULL). | |
| 1075 */ | |
| 1076 SkBounder* getBounder() const { return fBounder; } | |
| 1077 | |
| 1078 /** Set a new bounder (or NULL). | |
| 1079 Pass NULL to clear any previous bounder. | |
| 1080 As a convenience, the parameter passed is also returned. | |
| 1081 If a previous bounder exists, its reference count is decremented. | |
| 1082 If bounder is not NULL, its reference count is incremented. | |
| 1083 @param bounder the new bounder (or NULL) to be installed in the canvas | |
| 1084 @return the set bounder object | |
| 1085 */ | |
| 1086 virtual SkBounder* setBounder(SkBounder* bounder); | |
| 1087 | |
| 1088 /** Get the current filter object. The filter's reference count is not | 1062 /** Get the current filter object. The filter's reference count is not |
| 1089 affected. The filter is saved/restored, just like the matrix and clip. | 1063 affected. The filter is saved/restored, just like the matrix and clip. |
| 1090 @return the canvas' filter (or NULL). | 1064 @return the canvas' filter (or NULL). |
| 1091 */ | 1065 */ |
| 1092 SkDrawFilter* getDrawFilter() const; | 1066 SkDrawFilter* getDrawFilter() const; |
| 1093 | 1067 |
| 1094 /** Set the new filter (or NULL). Pass NULL to clear any existing filter. | 1068 /** Set the new filter (or NULL). Pass NULL to clear any existing filter. |
| 1095 As a convenience, the parameter is returned. If an existing filter | 1069 As a convenience, the parameter is returned. If an existing filter |
| 1096 exists, its refcnt is decrement. If the new filter is not null, its | 1070 exists, its refcnt is decrement. If the new filter is not null, its |
| 1097 refcnt is incremented. The filter is saved/restored, just like the | 1071 refcnt is incremented. The filter is saved/restored, just like the |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1297 private: | 1271 private: |
| 1298 class MCRec; | 1272 class MCRec; |
| 1299 | 1273 |
| 1300 SkClipStack fClipStack; | 1274 SkClipStack fClipStack; |
| 1301 SkDeque fMCStack; | 1275 SkDeque fMCStack; |
| 1302 // points to top of stack | 1276 // points to top of stack |
| 1303 MCRec* fMCRec; | 1277 MCRec* fMCRec; |
| 1304 // the first N recs that can fit here mean we won't call malloc | 1278 // the first N recs that can fit here mean we won't call malloc |
| 1305 uint32_t fMCRecStorage[32]; | 1279 uint32_t fMCRecStorage[32]; |
| 1306 | 1280 |
| 1307 SkBounder* fBounder; | |
| 1308 int fSaveLayerCount; // number of successful saveLayer calls | 1281 int fSaveLayerCount; // number of successful saveLayer calls |
| 1309 int fCullCount; // number of active culls | 1282 int fCullCount; // number of active culls |
| 1310 | 1283 |
| 1311 SkMetaData* fMetaData; | 1284 SkMetaData* fMetaData; |
| 1312 | 1285 |
| 1313 SkSurface_Base* fSurfaceBase; | 1286 SkSurface_Base* fSurfaceBase; |
| 1314 SkSurface_Base* getSurfaceBase() const { return fSurfaceBase; } | 1287 SkSurface_Base* getSurfaceBase() const { return fSurfaceBase; } |
| 1315 void setSurfaceBase(SkSurface_Base* sb) { | 1288 void setSurfaceBase(SkSurface_Base* sb) { |
| 1316 fSurfaceBase = sb; | 1289 fSurfaceBase = sb; |
| 1317 } | 1290 } |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1518 } | 1491 } |
| 1519 | 1492 |
| 1520 static inline SkCanvas::SaveFlags& operator|=(SkCanvas::SaveFlags& lhs, | 1493 static inline SkCanvas::SaveFlags& operator|=(SkCanvas::SaveFlags& lhs, |
| 1521 const SkCanvas::SaveFlags rhs) { | 1494 const SkCanvas::SaveFlags rhs) { |
| 1522 lhs = lhs | rhs; | 1495 lhs = lhs | rhs; |
| 1523 return lhs; | 1496 return lhs; |
| 1524 } | 1497 } |
| 1525 | 1498 |
| 1526 | 1499 |
| 1527 #endif | 1500 #endif |
| OLD | NEW |