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

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: 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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 isSolidColor_ = false; 195 isSolidColor_ = false;
196 } 196 }
197 } 197 }
198 198
199 void AnalysisDevice::drawPaint(const SkDraw&, const SkPaint& paint) { 199 void AnalysisDevice::drawPaint(const SkDraw&, const SkPaint& paint) {
200 estimatedCost_ += kUnknownExpensiveCost; 200 estimatedCost_ += kUnknownExpensiveCost;
201 if (hasBitmap(paint)) { 201 if (hasBitmap(paint)) {
202 estimatedCost_ += kUnknownBitmapCost; 202 estimatedCost_ += kUnknownBitmapCost;
203 addBitmapFromPaint(paint); 203 addBitmapFromPaint(paint);
204 } 204 }
205 isSolidColor_ = false; 205 isSolidColor_ =
206 (isSolidColor_ && isSolidColorPaint(paint) && paint.getColor() == color_);
206 isTransparent_ = false; 207 isTransparent_ = false;
207 } 208 }
208 209
209 void AnalysisDevice::drawPoints(const SkDraw&, SkCanvas::PointMode mode, 210 void AnalysisDevice::drawPoints(const SkDraw&, SkCanvas::PointMode mode,
210 size_t count, const SkPoint[], 211 size_t count, const SkPoint[],
211 const SkPaint& paint) { 212 const SkPaint& paint) {
212 estimatedCost_ += kUnknownExpensiveCost; 213 estimatedCost_ += kUnknownExpensiveCost;
213 if (hasBitmap(paint)) { 214 if (hasBitmap(paint)) {
214 estimatedCost_ += kUnknownBitmapCost; 215 estimatedCost_ += kUnknownBitmapCost;
215 addBitmapFromPaint(paint); 216 addBitmapFromPaint(paint);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 else if (paint.getAlpha() != 0 || 257 else if (paint.getAlpha() != 0 ||
257 xferMode != SkXfermode::kSrc_Mode) { 258 xferMode != SkXfermode::kSrc_Mode) {
258 isTransparent_ = false; 259 isTransparent_ = false;
259 } 260 }
260 261
261 // This bitmap is solid if and only if the following holds. 262 // This bitmap is solid if and only if the following holds.
262 // Note that this might be overly conservative: 263 // Note that this might be overly conservative:
263 // - We're not in "forced not solid" mode 264 // - We're not in "forced not solid" mode
264 // - Paint is solid color 265 // - Paint is solid color
265 // - The quad is a full tile quad 266 // - The quad is a full tile quad
267 // - The exception is if the tile is already solid tile,
268 // and we're drawing the same solid color paint then
269 // the tile remains solid.
266 if (!isForcedNotSolid_ && 270 if (!isForcedNotSolid_ &&
267 isSolidColorPaint(paint) && 271 isSolidColorPaint(paint) &&
268 doesCoverCanvas) { 272 (doesCoverCanvas || (isSolidColor_ && paint.getColor() == color_))) {
269 isSolidColor_ = true; 273 isSolidColor_ = true;
270 color_ = paint.getColor(); 274 color_ = paint.getColor();
271 hasText_ = false; 275 hasText_ = false;
272 } 276 }
273 else { 277 else {
274 isSolidColor_ = false; 278 isSolidColor_ = false;
275 } 279 }
276 } 280 }
277 281
278 void AnalysisDevice::drawOval(const SkDraw&, const SkRect& oval, 282 void AnalysisDevice::drawOval(const SkDraw&, const SkRect& oval,
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 if (savedStackSize_ < forceNotTransparentStackLevel_) { 563 if (savedStackSize_ < forceNotTransparentStackLevel_) {
560 (static_cast<AnalysisDevice*>(getDevice()))->setForceNotTransparent(false) ; 564 (static_cast<AnalysisDevice*>(getDevice()))->setForceNotTransparent(false) ;
561 forceNotTransparentStackLevel_ = kNoLayer; 565 forceNotTransparentStackLevel_ = kNoLayer;
562 } 566 }
563 } 567 }
564 } 568 }
565 569
566 } // namespace skia 570 } // namespace skia
567 571
568 572
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698