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 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
481 that it is possible that if the method returns false, the band may still | 481 that it is possible that if the method returns false, the band may still |
482 in fact be clipped out, but the converse is not true. If this method | 482 in fact be clipped out, but the converse is not true. If this method |
483 returns true, then the band is guaranteed to be clipped out. | 483 returns true, then the band is guaranteed to be clipped out. |
484 @param top The top of the horizontal band to compare with the clip | 484 @param top The top of the horizontal band to compare with the clip |
485 @param bottom The bottom of the horizontal and to compare with the clip | 485 @param bottom The bottom of the horizontal and to compare with the clip |
486 @return true if the horizontal band is completely clipped out (i.e. does | 486 @return true if the horizontal band is completely clipped out (i.e. does |
487 not intersect the current clip) | 487 not intersect the current clip) |
488 */ | 488 */ |
489 bool quickRejectY(SkScalar top, SkScalar bottom) const { | 489 bool quickRejectY(SkScalar top, SkScalar bottom) const { |
490 SkASSERT(top <= bottom); | 490 SkASSERT(top <= bottom); |
| 491 |
| 492 #ifndef SK_WILL_NEVER_DRAW_PERSPECTIVE_TEXT |
| 493 // TODO: add a hasPerspective method similar to getLocalClipBounds. This |
| 494 // would cache the SkMatrix::hasPerspective result. Alternatively, have |
| 495 // the MC stack just set a hasPerspective boolean as it is updated. |
| 496 if (this->getTotalMatrix().hasPerspective()) { |
| 497 // TODO: consider implementing some half-plane test between the |
| 498 // two Y planes and the device-bounds (i.e., project the top and |
| 499 // bottom Y planes and then determine if the clip bounds is complete
ly |
| 500 // outside either one). |
| 501 return false; |
| 502 } |
| 503 #endif |
| 504 |
491 const SkRect& clipR = this->getLocalClipBounds(); | 505 const SkRect& clipR = this->getLocalClipBounds(); |
492 // In the case where the clip is empty and we are provided with a | 506 // In the case where the clip is empty and we are provided with a |
493 // negative top and positive bottom parameter then this test will return | 507 // negative top and positive bottom parameter then this test will return |
494 // false even though it will be clipped. We have chosen to exclude that | 508 // false even though it will be clipped. We have chosen to exclude that |
495 // check as it is rare and would result double the comparisons. | 509 // check as it is rare and would result double the comparisons. |
496 return top >= clipR.fBottom || bottom <= clipR.fTop; | 510 return top >= clipR.fBottom || bottom <= clipR.fTop; |
497 } | 511 } |
498 | 512 |
499 /** Return the bounds of the current clip (in local coordinates) in the | 513 /** Return the bounds of the current clip (in local coordinates) in the |
500 bounds parameter, and return true if it is non-empty. This can be useful | 514 bounds parameter, and return true if it is non-empty. This can be useful |
(...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1271 bool asROBitmap(SkBitmap*) const; | 1285 bool asROBitmap(SkBitmap*) const; |
1272 | 1286 |
1273 private: | 1287 private: |
1274 SkBitmap fBitmap; // used if peekPixels() fails | 1288 SkBitmap fBitmap; // used if peekPixels() fails |
1275 const void* fAddr; // NULL on failure | 1289 const void* fAddr; // NULL on failure |
1276 SkImageInfo fInfo; | 1290 SkImageInfo fInfo; |
1277 size_t fRowBytes; | 1291 size_t fRowBytes; |
1278 }; | 1292 }; |
1279 | 1293 |
1280 #endif | 1294 #endif |
OLD | NEW |