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

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

Issue 1432443004: Remove SkDevice and SkBaseDevice outside skia/ext/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: pass SkPixmap by pointer to MakeBitmapOpaque Created 5 years, 1 month 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/logging.h" 5 #include "base/logging.h"
6 #include "base/trace_event/trace_event.h" 6 #include "base/trace_event/trace_event.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/SkPath.h" 9 #include "third_party/skia/include/core/SkPath.h"
10 #include "third_party/skia/include/core/SkRRect.h" 10 #include "third_party/skia/include/core/SkRRect.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 // that the canvas is not clipped (i.e. it covers ALL of the canvas). 58 // that the canvas is not clipped (i.e. it covers ALL of the canvas).
59 bool IsFullQuad(SkCanvas* canvas, const SkRect& drawn_rect) { 59 bool IsFullQuad(SkCanvas* canvas, const SkRect& drawn_rect) {
60 if (!canvas->isClipRect()) 60 if (!canvas->isClipRect())
61 return false; 61 return false;
62 62
63 SkIRect clip_irect; 63 SkIRect clip_irect;
64 if (!canvas->getClipDeviceBounds(&clip_irect)) 64 if (!canvas->getClipDeviceBounds(&clip_irect))
65 return false; 65 return false;
66 66
67 // if the clip is smaller than the canvas, we're partly clipped, so abort. 67 // if the clip is smaller than the canvas, we're partly clipped, so abort.
68 if (!clip_irect.contains(SkIRect::MakeSize(canvas->getDeviceSize()))) 68 if (!clip_irect.contains(SkIRect::MakeSize(canvas->getBaseLayerSize())))
69 return false; 69 return false;
70 70
71 const SkMatrix& matrix = canvas->getTotalMatrix(); 71 const SkMatrix& matrix = canvas->getTotalMatrix();
72 // If the transform results in a non-axis aligned 72 // If the transform results in a non-axis aligned
73 // rect, then be conservative and return false. 73 // rect, then be conservative and return false.
74 if (!matrix.rectStaysRect()) 74 if (!matrix.rectStaysRect())
75 return false; 75 return false;
76 76
77 SkRect device_rect; 77 SkRect device_rect;
78 matrix.mapRect(&device_rect, drawn_rect); 78 matrix.mapRect(&device_rect, drawn_rect);
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 INHERITED::willSave(); 443 INHERITED::willSave();
444 } 444 }
445 445
446 SkCanvas::SaveLayerStrategy AnalysisCanvas::willSaveLayer( 446 SkCanvas::SaveLayerStrategy AnalysisCanvas::willSaveLayer(
447 const SkRect* bounds, 447 const SkRect* bounds,
448 const SkPaint* paint, 448 const SkPaint* paint,
449 SkCanvas::SaveFlags flags) { 449 SkCanvas::SaveFlags flags) {
450 450
451 ++saved_stack_size_; 451 ++saved_stack_size_;
452 452
453 SkIRect canvas_ibounds = SkIRect::MakeSize(this->getDeviceSize()); 453 SkIRect canvas_ibounds = SkIRect::MakeSize(this->getBaseLayerSize());
454 SkRect canvas_bounds; 454 SkRect canvas_bounds;
455 canvas_bounds.set(canvas_ibounds); 455 canvas_bounds.set(canvas_ibounds);
456 456
457 // If after we draw to the saved layer, we have to blend with the current 457 // If after we draw to the saved layer, we have to blend with the current
458 // layer, then we can conservatively say that the canvas will not be of 458 // layer, then we can conservatively say that the canvas will not be of
459 // solid color. 459 // solid color.
460 if ((paint && !IsSolidColorPaint(*paint)) || 460 if ((paint && !IsSolidColorPaint(*paint)) ||
461 (bounds && !bounds->contains(canvas_bounds))) { 461 (bounds && !bounds->contains(canvas_bounds))) {
462 if (force_not_solid_stack_level_ == kNoLayer) { 462 if (force_not_solid_stack_level_ == kNoLayer) {
463 force_not_solid_stack_level_ = saved_stack_size_; 463 force_not_solid_stack_level_ = saved_stack_size_;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 force_not_transparent_stack_level_ = kNoLayer; 497 force_not_transparent_stack_level_ = kNoLayer;
498 } 498 }
499 } 499 }
500 500
501 INHERITED::willRestore(); 501 INHERITED::willRestore();
502 } 502 }
503 503
504 } // namespace skia 504 } // namespace skia
505 505
506 506
OLDNEW
« no previous file with comments | « printing/pdf_metafile_skia.h ('k') | third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698