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

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

Issue 14322017: Revert "cc: Move canvas clear from picture to picture_pile_impl" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review Created 7 years, 7 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
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 "skia/ext/analysis_canvas.h" 6 #include "skia/ext/analysis_canvas.h"
7 #include "third_party/skia/include/core/SkDevice.h" 7 #include "third_party/skia/include/core/SkDevice.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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 isSolidColor_ = true; 164 isSolidColor_ = true;
165 color_ = color; 165 color_ = color;
166 } 166 }
167 else { 167 else {
168 isSolidColor_ = false; 168 isSolidColor_ = false;
169 } 169 }
170 } 170 }
171 171
172 void AnalysisDevice::drawPaint(const SkDraw&, const SkPaint& paint) { 172 void AnalysisDevice::drawPaint(const SkDraw&, const SkPaint& paint) {
173 addBitmapFromPaint(paint); 173 addBitmapFromPaint(paint);
174 isSolidColor_ = false; 174 isSolidColor_ =
175 (isSolidColor_ && isSolidColorPaint(paint) && paint.getColor() == color_);
175 isTransparent_ = false; 176 isTransparent_ = false;
176 } 177 }
177 178
178 void AnalysisDevice::drawPoints(const SkDraw&, SkCanvas::PointMode mode, 179 void AnalysisDevice::drawPoints(const SkDraw&, SkCanvas::PointMode mode,
179 size_t count, const SkPoint[], 180 size_t count, const SkPoint[],
180 const SkPaint& paint) { 181 const SkPaint& paint) {
181 addBitmapFromPaint(paint); 182 addBitmapFromPaint(paint);
182 isSolidColor_ = false; 183 isSolidColor_ = false;
183 isTransparent_ = false; 184 isTransparent_ = false;
184 } 185 }
(...skipping 27 matching lines...) Expand all
212 else if (paint.getAlpha() != 0 || 213 else if (paint.getAlpha() != 0 ||
213 xferMode != SkXfermode::kSrc_Mode) { 214 xferMode != SkXfermode::kSrc_Mode) {
214 isTransparent_ = false; 215 isTransparent_ = false;
215 } 216 }
216 217
217 // This bitmap is solid if and only if the following holds. 218 // This bitmap is solid if and only if the following holds.
218 // Note that this might be overly conservative: 219 // Note that this might be overly conservative:
219 // - We're not in "forced not solid" mode 220 // - We're not in "forced not solid" mode
220 // - Paint is solid color 221 // - Paint is solid color
221 // - The quad is a full tile quad 222 // - The quad is a full tile quad
223 // - The exception is if the tile is already solid tile,
224 // and we're drawing the same solid color paint then
225 // the tile remains solid.
Tom Hudson 2013/04/30 09:43:59 This could be a different CL? But nice catch! Does
vmpstr 2013/04/30 17:06:23 This shows up on low res tiles. However, with the
222 if (!isForcedNotSolid_ && 226 if (!isForcedNotSolid_ &&
223 isSolidColorPaint(paint) && 227 isSolidColorPaint(paint) &&
224 doesCoverCanvas) { 228 (doesCoverCanvas || (isSolidColor_ && paint.getColor() == color_))) {
225 isSolidColor_ = true; 229 isSolidColor_ = true;
226 color_ = paint.getColor(); 230 color_ = paint.getColor();
227 hasText_ = false; 231 hasText_ = false;
228 } 232 }
229 else { 233 else {
230 isSolidColor_ = false; 234 isSolidColor_ = false;
231 } 235 }
232 } 236 }
233 237
234 void AnalysisDevice::drawOval(const SkDraw&, const SkRect& oval, 238 void AnalysisDevice::drawOval(const SkDraw&, const SkRect& oval,
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 if (savedStackSize_ < forceNotTransparentStackLevel_) { 459 if (savedStackSize_ < forceNotTransparentStackLevel_) {
456 (static_cast<AnalysisDevice*>(getDevice()))->setForceNotTransparent(false) ; 460 (static_cast<AnalysisDevice*>(getDevice()))->setForceNotTransparent(false) ;
457 forceNotTransparentStackLevel_ = kNoLayer; 461 forceNotTransparentStackLevel_ = kNoLayer;
458 } 462 }
459 } 463 }
460 } 464 }
461 465
462 } // namespace skia 466 } // namespace skia
463 467
464 468
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698