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

Side by Side 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 unified diff | Download patch
« 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 2008 The Android Open Source Project 2 * Copyright 2008 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 #include "SkCanvas.h" 8 #include "SkCanvas.h"
9 #include "SkCanvasPriv.h" 9 #include "SkCanvasPriv.h"
10 #include "SkBitmapDevice.h" 10 #include "SkBitmapDevice.h"
(...skipping 1758 matching lines...) Expand 10 before | Expand all | Expand 10 after
1769 } 1769 }
1770 1770
1771 LOOPER_END 1771 LOOPER_END
1772 } 1772 }
1773 1773
1774 void SkCanvas::onDrawRect(const SkRect& r, const SkPaint& paint) { 1774 void SkCanvas::onDrawRect(const SkRect& r, const SkPaint& paint) {
1775 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawRect()"); 1775 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawRect()");
1776 SkRect storage; 1776 SkRect storage;
1777 const SkRect* bounds = NULL; 1777 const SkRect* bounds = NULL;
1778 if (paint.canComputeFastBounds()) { 1778 if (paint.canComputeFastBounds()) {
1779 bounds = &paint.computeFastBounds(r, &storage); 1779 // Skia will draw an inverted rect, because it explicitly "sorts" it dow nstream.
1780 // To prevent accidental rejecting at this stage, we have to sort it bef ore we check.
1781 SkRect tmp(r);
1782 tmp.sort();
1783
1784 bounds = &paint.computeFastBounds(tmp, &storage);
1780 if (this->quickReject(*bounds)) { 1785 if (this->quickReject(*bounds)) {
1781 return; 1786 return;
1782 } 1787 }
1783 } 1788 }
1784 1789
1785 LOOPER_BEGIN(paint, SkDrawFilter::kRect_Type, bounds) 1790 LOOPER_BEGIN(paint, SkDrawFilter::kRect_Type, bounds)
1786 1791
1787 while (iter.next()) { 1792 while (iter.next()) {
1788 iter.fDevice->drawRect(iter, r, looper.paint()); 1793 iter.fDevice->drawRect(iter, r, looper.paint());
1789 } 1794 }
(...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after
2559 } 2564 }
2560 2565
2561 if (matrix) { 2566 if (matrix) {
2562 canvas->concat(*matrix); 2567 canvas->concat(*matrix);
2563 } 2568 }
2564 } 2569 }
2565 2570
2566 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { 2571 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() {
2567 fCanvas->restoreToCount(fSaveCount); 2572 fCanvas->restoreToCount(fSaveCount);
2568 } 2573 }
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