Chromium Code Reviews| 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 917 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 928 virtual void beginCommentGroup(const char* description) { | 928 virtual void beginCommentGroup(const char* description) { |
| 929 // do nothing. Subclasses may do something | 929 // do nothing. Subclasses may do something |
| 930 } | 930 } |
| 931 virtual void addComment(const char* kywd, const char* value) { | 931 virtual void addComment(const char* kywd, const char* value) { |
| 932 // do nothing. Subclasses may do something | 932 // do nothing. Subclasses may do something |
| 933 } | 933 } |
| 934 virtual void endCommentGroup() { | 934 virtual void endCommentGroup() { |
| 935 // do nothing. Subclasses may do something | 935 // do nothing. Subclasses may do something |
| 936 } | 936 } |
| 937 | 937 |
| 938 /** | |
| 939 * This call asserts that subsequent draw operations (up to the matching po pCull() call) | |
| 940 * are fully contained within the given bounding box. The assertion is not enforced, | |
| 941 * but the information might be used to quick-reject command blocks, so an incorrect | |
| 942 * bounding box may result in incomplete rendering. | |
| 943 */ | |
|
iancottrell
2014/02/26 10:36:07
Forgive me if I am misunderstanding something, I a
robertphillips
2014/02/26 13:52:02
This is more of a contract on the caller's side. W
f(malita)
2014/02/26 14:23:54
We are currently quick-rejecting individual draw o
| |
| 944 void pushCull(const SkRect& cullRect) { | |
| 945 ++fCullCount; | |
| 946 this->onPushCull(cullRect); | |
| 947 } | |
| 938 | 948 |
| 949 /** | |
| 950 * Terminates the current culling block, and restores the previous one (if any). | |
| 951 */ | |
| 952 void popCull() { | |
| 953 if (fCullCount > 0) { | |
| 954 --fCullCount; | |
| 955 this->onPopCull(); | |
| 956 } | |
| 957 } | |
| 939 ////////////////////////////////////////////////////////////////////////// | 958 ////////////////////////////////////////////////////////////////////////// |
| 940 | 959 |
| 941 /** Get the current bounder object. | 960 /** Get the current bounder object. |
| 942 The bounder's reference count is unchaged. | 961 The bounder's reference count is unchaged. |
| 943 @return the canva's bounder (or NULL). | 962 @return the canva's bounder (or NULL). |
| 944 */ | 963 */ |
| 945 SkBounder* getBounder() const { return fBounder; } | 964 SkBounder* getBounder() const { return fBounder; } |
| 946 | 965 |
| 947 /** Set a new bounder (or NULL). | 966 /** Set a new bounder (or NULL). |
| 948 Pass NULL to clear any previous bounder. | 967 Pass NULL to clear any previous bounder. |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1094 | 1113 |
| 1095 // Called by child classes that override clipPath and clipRRect to only | 1114 // Called by child classes that override clipPath and clipRRect to only |
| 1096 // track fast conservative clip bounds, rather than exact clips. | 1115 // track fast conservative clip bounds, rather than exact clips. |
| 1097 bool updateClipConservativelyUsingBounds(const SkRect&, SkRegion::Op, | 1116 bool updateClipConservativelyUsingBounds(const SkRect&, SkRegion::Op, |
| 1098 bool inverseFilled); | 1117 bool inverseFilled); |
| 1099 | 1118 |
| 1100 // notify our surface (if we have one) that we are about to draw, so it | 1119 // notify our surface (if we have one) that we are about to draw, so it |
| 1101 // can perform copy-on-write or invalidate any cached images | 1120 // can perform copy-on-write or invalidate any cached images |
| 1102 void predrawNotify(); | 1121 void predrawNotify(); |
| 1103 | 1122 |
| 1123 virtual void onPushCull(const SkRect& cullRect); | |
| 1124 virtual void onPopCull(); | |
| 1125 | |
| 1104 private: | 1126 private: |
| 1105 class MCRec; | 1127 class MCRec; |
| 1106 | 1128 |
| 1107 SkClipStack fClipStack; | 1129 SkClipStack fClipStack; |
| 1108 SkDeque fMCStack; | 1130 SkDeque fMCStack; |
| 1109 // points to top of stack | 1131 // points to top of stack |
| 1110 MCRec* fMCRec; | 1132 MCRec* fMCRec; |
| 1111 // the first N recs that can fit here mean we won't call malloc | 1133 // the first N recs that can fit here mean we won't call malloc |
| 1112 uint32_t fMCRecStorage[32]; | 1134 uint32_t fMCRecStorage[32]; |
| 1113 | 1135 |
| 1114 SkBounder* fBounder; | 1136 SkBounder* fBounder; |
| 1115 int fSaveLayerCount; // number of successful saveLayer calls | 1137 int fSaveLayerCount; // number of successful saveLayer calls |
| 1138 int fCullCount; // number of active culls | |
| 1116 | 1139 |
| 1117 SkMetaData* fMetaData; | 1140 SkMetaData* fMetaData; |
| 1118 | 1141 |
| 1119 SkSurface_Base* fSurfaceBase; | 1142 SkSurface_Base* fSurfaceBase; |
| 1120 SkSurface_Base* getSurfaceBase() const { return fSurfaceBase; } | 1143 SkSurface_Base* getSurfaceBase() const { return fSurfaceBase; } |
| 1121 void setSurfaceBase(SkSurface_Base* sb) { | 1144 void setSurfaceBase(SkSurface_Base* sb) { |
| 1122 fSurfaceBase = sb; | 1145 fSurfaceBase = sb; |
| 1123 } | 1146 } |
| 1124 friend class SkSurface_Base; | 1147 friend class SkSurface_Base; |
| 1125 friend class SkSurface_Gpu; | 1148 friend class SkSurface_Gpu; |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1300 bool asROBitmap(SkBitmap*) const; | 1323 bool asROBitmap(SkBitmap*) const; |
| 1301 | 1324 |
| 1302 private: | 1325 private: |
| 1303 SkBitmap fBitmap; // used if peekPixels() fails | 1326 SkBitmap fBitmap; // used if peekPixels() fails |
| 1304 const void* fAddr; // NULL on failure | 1327 const void* fAddr; // NULL on failure |
| 1305 SkImageInfo fInfo; | 1328 SkImageInfo fInfo; |
| 1306 size_t fRowBytes; | 1329 size_t fRowBytes; |
| 1307 }; | 1330 }; |
| 1308 | 1331 |
| 1309 #endif | 1332 #endif |
| OLD | NEW |