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 1045 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1056 virtual void endCommentGroup() { | 1056 virtual void endCommentGroup() { |
1057 // do nothing. Subclasses may do something | 1057 // do nothing. Subclasses may do something |
1058 } | 1058 } |
1059 | 1059 |
1060 /** | 1060 /** |
1061 * With this call the client asserts that subsequent draw operations (up to
the | 1061 * With this call the client asserts that subsequent draw operations (up to
the |
1062 * matching popCull()) are fully contained within the given bounding box. T
he assertion | 1062 * matching popCull()) are fully contained within the given bounding box. T
he assertion |
1063 * is not enforced, but the information might be used to quick-reject comma
nd blocks, | 1063 * is not enforced, but the information might be used to quick-reject comma
nd blocks, |
1064 * so an incorrect bounding box may result in incomplete rendering. | 1064 * so an incorrect bounding box may result in incomplete rendering. |
1065 */ | 1065 */ |
1066 void pushCull(const SkRect& cullRect) { | 1066 void pushCull(const SkRect& cullRect); |
1067 ++fCullCount; | |
1068 this->onPushCull(cullRect); | |
1069 } | |
1070 | 1067 |
1071 /** | 1068 /** |
1072 * Terminates the current culling block, and restores the previous one (if
any). | 1069 * Terminates the current culling block, and restores the previous one (if
any). |
1073 */ | 1070 */ |
1074 void popCull() { | 1071 void popCull(); |
1075 if (fCullCount > 0) { | 1072 |
1076 --fCullCount; | |
1077 this->onPopCull(); | |
1078 } | |
1079 } | |
1080 ////////////////////////////////////////////////////////////////////////// | 1073 ////////////////////////////////////////////////////////////////////////// |
1081 | 1074 |
1082 /** Get the current bounder object. | 1075 /** Get the current bounder object. |
1083 The bounder's reference count is unchaged. | 1076 The bounder's reference count is unchaged. |
1084 @return the canva's bounder (or NULL). | 1077 @return the canva's bounder (or NULL). |
1085 */ | 1078 */ |
1086 SkBounder* getBounder() const { return fBounder; } | 1079 SkBounder* getBounder() const { return fBounder; } |
1087 | 1080 |
1088 /** Set a new bounder (or NULL). | 1081 /** Set a new bounder (or NULL). |
1089 Pass NULL to clear any previous bounder. | 1082 Pass NULL to clear any previous bounder. |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1387 explicit AutoValidateClip(SkCanvas* canvas) : fCanvas(canvas) { | 1380 explicit AutoValidateClip(SkCanvas* canvas) : fCanvas(canvas) { |
1388 fCanvas->validateClip(); | 1381 fCanvas->validateClip(); |
1389 } | 1382 } |
1390 ~AutoValidateClip() { fCanvas->validateClip(); } | 1383 ~AutoValidateClip() { fCanvas->validateClip(); } |
1391 | 1384 |
1392 private: | 1385 private: |
1393 const SkCanvas* fCanvas; | 1386 const SkCanvas* fCanvas; |
1394 }; | 1387 }; |
1395 | 1388 |
1396 #ifdef SK_DEBUG | 1389 #ifdef SK_DEBUG |
| 1390 // The cull stack rects are in device-space |
| 1391 SkTDArray<SkIRect> fCullStack; |
| 1392 void validateCull(const SkIRect&); |
1397 void validateClip() const; | 1393 void validateClip() const; |
1398 #else | 1394 #else |
1399 void validateClip() const {} | 1395 void validateClip() const {} |
1400 #endif | 1396 #endif |
1401 | 1397 |
1402 typedef SkRefCnt INHERITED; | 1398 typedef SkRefCnt INHERITED; |
1403 }; | 1399 }; |
1404 | 1400 |
1405 /** Stack helper class to automatically call restoreToCount() on the canvas | 1401 /** Stack helper class to automatically call restoreToCount() on the canvas |
1406 when this object goes out of scope. Use this to guarantee that the canvas | 1402 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... |
1498 bool asROBitmap(SkBitmap*) const; | 1494 bool asROBitmap(SkBitmap*) const; |
1499 | 1495 |
1500 private: | 1496 private: |
1501 SkBitmap fBitmap; // used if peekPixels() fails | 1497 SkBitmap fBitmap; // used if peekPixels() fails |
1502 const void* fAddr; // NULL on failure | 1498 const void* fAddr; // NULL on failure |
1503 SkImageInfo fInfo; | 1499 SkImageInfo fInfo; |
1504 size_t fRowBytes; | 1500 size_t fRowBytes; |
1505 }; | 1501 }; |
1506 | 1502 |
1507 #endif | 1503 #endif |
OLD | NEW |