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

Unified Diff: src/core/SkCanvas.cpp

Issue 908353002: check for inverted rects before we quick-reject (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add comment Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkCanvas.cpp
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index ce99546728a09171bf57aa51cb30daadeb42ede2..c523ca07dd2c644088706507ac10d824feb60473 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -1776,7 +1776,12 @@ void SkCanvas::onDrawRect(const SkRect& r, const SkPaint& paint) {
SkRect storage;
const SkRect* bounds = NULL;
if (paint.canComputeFastBounds()) {
- bounds = &paint.computeFastBounds(r, &storage);
+ // Skia will draw an inverted rect, because it explicitly "sorts" it downstream.
+ // To prevent accidental rejecting at this stage, we have to sort it before we check.
+ SkRect tmp(r);
+ tmp.sort();
+
+ bounds = &paint.computeFastBounds(tmp, &storage);
if (this->quickReject(*bounds)) {
return;
}
« 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