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 1053 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1064 virtual void endCommentGroup() { | 1064 virtual void endCommentGroup() { |
1065 // do nothing. Subclasses may do something | 1065 // do nothing. Subclasses may do something |
1066 } | 1066 } |
1067 | 1067 |
1068 /** | 1068 /** |
1069 * With this call the client asserts that subsequent draw operations (up to the | 1069 * With this call the client asserts that subsequent draw operations (up to the |
1070 * matching popCull()) are fully contained within the given bounding box. T he assertion | 1070 * matching popCull()) are fully contained within the given bounding box. T he assertion |
1071 * is not enforced, but the information might be used to quick-reject comma nd blocks, | 1071 * is not enforced, but the information might be used to quick-reject comma nd blocks, |
1072 * so an incorrect bounding box may result in incomplete rendering. | 1072 * so an incorrect bounding box may result in incomplete rendering. |
1073 */ | 1073 */ |
1074 void pushCull(const SkRect& cullRect) { | 1074 void pushCull(const SkRect& cullRect); |
1075 ++fCullCount; | |
1076 this->onPushCull(cullRect); | |
1077 } | |
1078 | 1075 |
1079 /** | 1076 /** |
1080 * Terminates the current culling block, and restores the previous one (if any). | 1077 * Terminates the current culling block, and restores the previous one (if any). |
1081 */ | 1078 */ |
1082 void popCull() { | 1079 void popCull(); |
1083 if (fCullCount > 0) { | 1080 |
1084 --fCullCount; | |
1085 this->onPopCull(); | |
1086 } | |
1087 } | |
1088 ////////////////////////////////////////////////////////////////////////// | 1081 ////////////////////////////////////////////////////////////////////////// |
1089 | 1082 |
1090 /** Get the current bounder object. | 1083 /** Get the current bounder object. |
1091 The bounder's reference count is unchaged. | 1084 The bounder's reference count is unchaged. |
1092 @return the canva's bounder (or NULL). | 1085 @return the canva's bounder (or NULL). |
1093 */ | 1086 */ |
1094 SkBounder* getBounder() const { return fBounder; } | 1087 SkBounder* getBounder() const { return fBounder; } |
1095 | 1088 |
1096 /** Set a new bounder (or NULL). | 1089 /** Set a new bounder (or NULL). |
1097 Pass NULL to clear any previous bounder. | 1090 Pass NULL to clear any previous bounder. |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1394 public: | 1387 public: |
1395 explicit AutoValidateClip(SkCanvas* canvas) : fCanvas(canvas) { | 1388 explicit AutoValidateClip(SkCanvas* canvas) : fCanvas(canvas) { |
1396 fCanvas->validateClip(); | 1389 fCanvas->validateClip(); |
1397 } | 1390 } |
1398 ~AutoValidateClip() { fCanvas->validateClip(); } | 1391 ~AutoValidateClip() { fCanvas->validateClip(); } |
1399 | 1392 |
1400 private: | 1393 private: |
1401 const SkCanvas* fCanvas; | 1394 const SkCanvas* fCanvas; |
1402 }; | 1395 }; |
1403 | 1396 |
1404 #ifdef SK_DEBUG | 1397 #ifdef SK_DEBUG |
robertphillips
2014/03/20 12:23:56
// The cull stack cull rects are in device-space
f(malita)
2014/03/20 13:30:58
Done.
| |
1398 SkTDArray<SkIRect> fCullStack; | |
1399 void validateCull(const SkRect&); | |
1405 void validateClip() const; | 1400 void validateClip() const; |
1406 #else | 1401 #else |
1407 void validateClip() const {} | 1402 void validateClip() const {} |
1408 #endif | 1403 #endif |
1409 | 1404 |
1410 typedef SkRefCnt INHERITED; | 1405 typedef SkRefCnt INHERITED; |
1411 }; | 1406 }; |
1412 | 1407 |
1413 /** Stack helper class to automatically call restoreToCount() on the canvas | 1408 /** Stack helper class to automatically call restoreToCount() on the canvas |
1414 when this object goes out of scope. Use this to guarantee that the canvas | 1409 when this object goes out of scope. Use this to guarantee that the canvas |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1506 bool asROBitmap(SkBitmap*) const; | 1501 bool asROBitmap(SkBitmap*) const; |
1507 | 1502 |
1508 private: | 1503 private: |
1509 SkBitmap fBitmap; // used if peekPixels() fails | 1504 SkBitmap fBitmap; // used if peekPixels() fails |
1510 const void* fAddr; // NULL on failure | 1505 const void* fAddr; // NULL on failure |
1511 SkImageInfo fInfo; | 1506 SkImageInfo fInfo; |
1512 size_t fRowBytes; | 1507 size_t fRowBytes; |
1513 }; | 1508 }; |
1514 | 1509 |
1515 #endif | 1510 #endif |
OLD | NEW |