OLD | NEW |
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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 if (is_forced_not_solid_) | 88 if (is_forced_not_solid_) |
89 is_solid_color_ = false; | 89 is_solid_color_ = false; |
90 } | 90 } |
91 | 91 |
92 void AnalysisCanvas::SetForceNotTransparent(bool flag) { | 92 void AnalysisCanvas::SetForceNotTransparent(bool flag) { |
93 is_forced_not_transparent_ = flag; | 93 is_forced_not_transparent_ = flag; |
94 if (is_forced_not_transparent_) | 94 if (is_forced_not_transparent_) |
95 is_transparent_ = false; | 95 is_transparent_ = false; |
96 } | 96 } |
97 | 97 |
98 void AnalysisCanvas::clear(SkColor color) { | |
99 is_transparent_ = (!is_forced_not_transparent_ && SkColorGetA(color) == 0); | |
100 | |
101 if (!is_forced_not_solid_ && SkColorGetA(color) == 255) { | |
102 is_solid_color_ = true; | |
103 color_ = color; | |
104 } else { | |
105 is_solid_color_ = false; | |
106 } | |
107 } | |
108 | |
109 void AnalysisCanvas::drawPaint(const SkPaint& paint) { | 98 void AnalysisCanvas::drawPaint(const SkPaint& paint) { |
110 SkRect rect; | 99 SkRect rect; |
111 getClipBounds(&rect); | 100 getClipBounds(&rect); |
112 drawRect(rect, paint); | 101 drawRect(rect, paint); |
113 } | 102 } |
114 | 103 |
115 void AnalysisCanvas::drawPoints(SkCanvas::PointMode mode, | 104 void AnalysisCanvas::drawPoints(SkCanvas::PointMode mode, |
116 size_t count, | 105 size_t count, |
117 const SkPoint points[], | 106 const SkPoint points[], |
118 const SkPaint& paint) { | 107 const SkPaint& paint) { |
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
464 force_not_transparent_stack_level_ = kNoLayer; | 453 force_not_transparent_stack_level_ = kNoLayer; |
465 } | 454 } |
466 } | 455 } |
467 | 456 |
468 INHERITED::willRestore(); | 457 INHERITED::willRestore(); |
469 } | 458 } |
470 | 459 |
471 } // namespace skia | 460 } // namespace skia |
472 | 461 |
473 | 462 |
OLD | NEW |