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

Side by Side Diff: skia/ext/analysis_canvas.cc

Issue 505263002: Update AnalysisCanvas drawRect early-exit logic to match SkCanvas.cpp again. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: no, fmt for real Created 6 years, 3 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 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/debug/trace_event.h" 5 #include "base/debug/trace_event.h"
6 #include "base/logging.h" 6 #include "base/logging.h"
7 #include "skia/ext/analysis_canvas.h" 7 #include "skia/ext/analysis_canvas.h"
8 #include "third_party/skia/include/core/SkDraw.h" 8 #include "third_party/skia/include/core/SkDraw.h"
9 #include "third_party/skia/include/core/SkRRect.h" 9 #include "third_party/skia/include/core/SkRRect.h"
10 #include "third_party/skia/include/core/SkShader.h" 10 #include "third_party/skia/include/core/SkShader.h"
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 void AnalysisCanvas::drawPoints(SkCanvas::PointMode mode, 103 void AnalysisCanvas::drawPoints(SkCanvas::PointMode mode,
104 size_t count, 104 size_t count,
105 const SkPoint points[], 105 const SkPoint points[],
106 const SkPaint& paint) { 106 const SkPaint& paint) {
107 is_solid_color_ = false; 107 is_solid_color_ = false;
108 is_transparent_ = false; 108 is_transparent_ = false;
109 ++draw_op_count_; 109 ++draw_op_count_;
110 } 110 }
111 111
112 void AnalysisCanvas::drawRect(const SkRect& rect, const SkPaint& paint) { 112 void AnalysisCanvas::drawRect(const SkRect& rect, const SkPaint& paint) {
113 // This recreates the early-exit logic in SkCanvas.cpp, which aborts early 113 // This recreates the early-exit logic in SkCanvas.cpp.
114 // if the paint will "draw nothing". 114 SkRect scratch;
115 if (paint.canComputeFastBounds() &&
116 quickReject(paint.computeFastBounds(rect, &scratch))) {
117 return;
118 }
119
120 // An extra no-op check SkCanvas.cpp doesn't do.
115 if (paint.nothingToDraw()) 121 if (paint.nothingToDraw())
116 return; 122 return;
117 123
118 bool does_cover_canvas = IsFullQuad(this, rect); 124 bool does_cover_canvas = IsFullQuad(this, rect);
119 125
120 SkXfermode::Mode xfermode; 126 SkXfermode::Mode xfermode;
121 SkXfermode::AsMode(paint.getXfermode(), &xfermode); 127 SkXfermode::AsMode(paint.getXfermode(), &xfermode);
122 128
123 // This canvas will become transparent if the following holds: 129 // This canvas will become transparent if the following holds:
124 // - The quad is a full tile quad 130 // - The quad is a full tile quad
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 force_not_transparent_stack_level_ = kNoLayer; 441 force_not_transparent_stack_level_ = kNoLayer;
436 } 442 }
437 } 443 }
438 444
439 INHERITED::willRestore(); 445 INHERITED::willRestore();
440 } 446 }
441 447
442 } // namespace skia 448 } // namespace skia
443 449
444 450
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