Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(75)

Side by Side Diff: include/core/SkCanvas.h

Issue 166873004: Add check for perspective matrix in quickRejectY (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 if (this->getTotalMatrix().hasPerspective()) {
493 // To correctly handle perspective we would need to forward
494 // project a rect (as in quickReject).
reed1 2014/02/14 17:45:18 // TODO -- consider implementing some half-plane t
robertphillips 2014/02/14 18:32:40 Done.
495 return false;
496 }
497
491 const SkRect& clipR = this->getLocalClipBounds(); 498 const SkRect& clipR = this->getLocalClipBounds();
492 // In the case where the clip is empty and we are provided with a 499 // 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 500 // 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 501 // 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. 502 // check as it is rare and would result double the comparisons.
496 return top >= clipR.fBottom || bottom <= clipR.fTop; 503 return top >= clipR.fBottom || bottom <= clipR.fTop;
497 } 504 }
498 505
499 /** Return the bounds of the current clip (in local coordinates) in the 506 /** 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 507 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
1271 bool asROBitmap(SkBitmap*) const; 1278 bool asROBitmap(SkBitmap*) const;
1272 1279
1273 private: 1280 private:
1274 SkBitmap fBitmap; // used if peekPixels() fails 1281 SkBitmap fBitmap; // used if peekPixels() fails
1275 const void* fAddr; // NULL on failure 1282 const void* fAddr; // NULL on failure
1276 SkImageInfo fInfo; 1283 SkImageInfo fInfo;
1277 size_t fRowBytes; 1284 size_t fRowBytes;
1278 }; 1285 };
1279 1286
1280 #endif 1287 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698