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 |
(...skipping 921 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
932 virtual void beginCommentGroup(const char* description) { | 932 virtual void beginCommentGroup(const char* description) { |
933 // do nothing. Subclasses may do something | 933 // do nothing. Subclasses may do something |
934 } | 934 } |
935 virtual void addComment(const char* kywd, const char* value) { | 935 virtual void addComment(const char* kywd, const char* value) { |
936 // do nothing. Subclasses may do something | 936 // do nothing. Subclasses may do something |
937 } | 937 } |
938 virtual void endCommentGroup() { | 938 virtual void endCommentGroup() { |
939 // do nothing. Subclasses may do something | 939 // do nothing. Subclasses may do something |
940 } | 940 } |
941 | 941 |
| 942 /** |
| 943 * With this call the client asserts that subsequent draw operations (up to
the |
| 944 * matching popCull()) are fully contained within the given bounding box. T
he assertion |
| 945 * is not enforced, but the information might be used to quick-reject comma
nd blocks, |
| 946 * so an incorrect bounding box may result in incomplete rendering. |
| 947 */ |
| 948 void pushCull(const SkRect& cullRect) { |
| 949 ++fCullCount; |
| 950 this->onPushCull(cullRect); |
| 951 } |
942 | 952 |
| 953 /** |
| 954 * Terminates the current culling block, and restores the previous one (if
any). |
| 955 */ |
| 956 void popCull() { |
| 957 if (fCullCount > 0) { |
| 958 --fCullCount; |
| 959 this->onPopCull(); |
| 960 } |
| 961 } |
943 ////////////////////////////////////////////////////////////////////////// | 962 ////////////////////////////////////////////////////////////////////////// |
944 | 963 |
945 /** Get the current bounder object. | 964 /** Get the current bounder object. |
946 The bounder's reference count is unchaged. | 965 The bounder's reference count is unchaged. |
947 @return the canva's bounder (or NULL). | 966 @return the canva's bounder (or NULL). |
948 */ | 967 */ |
949 SkBounder* getBounder() const { return fBounder; } | 968 SkBounder* getBounder() const { return fBounder; } |
950 | 969 |
951 /** Set a new bounder (or NULL). | 970 /** Set a new bounder (or NULL). |
952 Pass NULL to clear any previous bounder. | 971 Pass NULL to clear any previous bounder. |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1098 | 1117 |
1099 // Called by child classes that override clipPath and clipRRect to only | 1118 // Called by child classes that override clipPath and clipRRect to only |
1100 // track fast conservative clip bounds, rather than exact clips. | 1119 // track fast conservative clip bounds, rather than exact clips. |
1101 bool updateClipConservativelyUsingBounds(const SkRect&, SkRegion::Op, | 1120 bool updateClipConservativelyUsingBounds(const SkRect&, SkRegion::Op, |
1102 bool inverseFilled); | 1121 bool inverseFilled); |
1103 | 1122 |
1104 // notify our surface (if we have one) that we are about to draw, so it | 1123 // notify our surface (if we have one) that we are about to draw, so it |
1105 // can perform copy-on-write or invalidate any cached images | 1124 // can perform copy-on-write or invalidate any cached images |
1106 void predrawNotify(); | 1125 void predrawNotify(); |
1107 | 1126 |
| 1127 virtual void onPushCull(const SkRect& cullRect); |
| 1128 virtual void onPopCull(); |
| 1129 |
1108 private: | 1130 private: |
1109 class MCRec; | 1131 class MCRec; |
1110 | 1132 |
1111 SkClipStack fClipStack; | 1133 SkClipStack fClipStack; |
1112 SkDeque fMCStack; | 1134 SkDeque fMCStack; |
1113 // points to top of stack | 1135 // points to top of stack |
1114 MCRec* fMCRec; | 1136 MCRec* fMCRec; |
1115 // the first N recs that can fit here mean we won't call malloc | 1137 // the first N recs that can fit here mean we won't call malloc |
1116 uint32_t fMCRecStorage[32]; | 1138 uint32_t fMCRecStorage[32]; |
1117 | 1139 |
1118 SkBounder* fBounder; | 1140 SkBounder* fBounder; |
1119 int fSaveLayerCount; // number of successful saveLayer calls | 1141 int fSaveLayerCount; // number of successful saveLayer calls |
| 1142 int fCullCount; // number of active culls |
1120 | 1143 |
1121 SkMetaData* fMetaData; | 1144 SkMetaData* fMetaData; |
1122 | 1145 |
1123 SkSurface_Base* fSurfaceBase; | 1146 SkSurface_Base* fSurfaceBase; |
1124 SkSurface_Base* getSurfaceBase() const { return fSurfaceBase; } | 1147 SkSurface_Base* getSurfaceBase() const { return fSurfaceBase; } |
1125 void setSurfaceBase(SkSurface_Base* sb) { | 1148 void setSurfaceBase(SkSurface_Base* sb) { |
1126 fSurfaceBase = sb; | 1149 fSurfaceBase = sb; |
1127 } | 1150 } |
1128 friend class SkSurface_Base; | 1151 friend class SkSurface_Base; |
1129 friend class SkSurface_Gpu; | 1152 friend class SkSurface_Gpu; |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1311 bool asROBitmap(SkBitmap*) const; | 1334 bool asROBitmap(SkBitmap*) const; |
1312 | 1335 |
1313 private: | 1336 private: |
1314 SkBitmap fBitmap; // used if peekPixels() fails | 1337 SkBitmap fBitmap; // used if peekPixels() fails |
1315 const void* fAddr; // NULL on failure | 1338 const void* fAddr; // NULL on failure |
1316 SkImageInfo fInfo; | 1339 SkImageInfo fInfo; |
1317 size_t fRowBytes; | 1340 size_t fRowBytes; |
1318 }; | 1341 }; |
1319 | 1342 |
1320 #endif | 1343 #endif |
OLD | NEW |