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 "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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 if (!isForcedNotSolid_ && SkColorGetA(color) == 255) { | 115 if (!isForcedNotSolid_ && SkColorGetA(color) == 255) { |
116 isSolidColor_ = true; | 116 isSolidColor_ = true; |
117 color_ = color; | 117 color_ = color; |
118 } | 118 } |
119 else { | 119 else { |
120 isSolidColor_ = false; | 120 isSolidColor_ = false; |
121 } | 121 } |
122 } | 122 } |
123 | 123 |
124 void AnalysisDevice::drawPaint(const SkDraw&, const SkPaint& paint) { | 124 void AnalysisDevice::drawPaint(const SkDraw&, const SkPaint& paint) { |
125 isSolidColor_ = | 125 isSolidColor_ = false; |
126 (isSolidColor_ && isSolidColorPaint(paint) && paint.getColor() == color_); | |
127 isTransparent_ = false; | 126 isTransparent_ = false; |
128 } | 127 } |
129 | 128 |
130 void AnalysisDevice::drawPoints(const SkDraw&, SkCanvas::PointMode mode, | 129 void AnalysisDevice::drawPoints(const SkDraw&, SkCanvas::PointMode mode, |
131 size_t count, const SkPoint[], | 130 size_t count, const SkPoint[], |
132 const SkPaint& paint) { | 131 const SkPaint& paint) { |
133 isSolidColor_ = false; | 132 isSolidColor_ = false; |
134 isTransparent_ = false; | 133 isTransparent_ = false; |
135 } | 134 } |
136 | 135 |
(...skipping 24 matching lines...) Expand all Loading... |
161 else if (paint.getAlpha() != 0 || | 160 else if (paint.getAlpha() != 0 || |
162 xferMode != SkXfermode::kSrc_Mode) { | 161 xferMode != SkXfermode::kSrc_Mode) { |
163 isTransparent_ = false; | 162 isTransparent_ = false; |
164 } | 163 } |
165 | 164 |
166 // This bitmap is solid if and only if the following holds. | 165 // This bitmap is solid if and only if the following holds. |
167 // Note that this might be overly conservative: | 166 // Note that this might be overly conservative: |
168 // - We're not in "forced not solid" mode | 167 // - We're not in "forced not solid" mode |
169 // - Paint is solid color | 168 // - Paint is solid color |
170 // - The quad is a full tile quad | 169 // - The quad is a full tile quad |
171 // - The exception is if the tile is already solid tile, | |
172 // and we're drawing the same solid color paint then | |
173 // the tile remains solid. | |
174 if (!isForcedNotSolid_ && | 170 if (!isForcedNotSolid_ && |
175 isSolidColorPaint(paint) && | 171 isSolidColorPaint(paint) && |
176 (doesCoverCanvas || (isSolidColor_ && paint.getColor() == color_))) { | 172 doesCoverCanvas) { |
177 isSolidColor_ = true; | 173 isSolidColor_ = true; |
178 color_ = paint.getColor(); | 174 color_ = paint.getColor(); |
179 hasText_ = false; | 175 hasText_ = false; |
180 } | 176 } |
181 else { | 177 else { |
182 isSolidColor_ = false; | 178 isSolidColor_ = false; |
183 } | 179 } |
184 } | 180 } |
185 | 181 |
186 void AnalysisDevice::drawOval(const SkDraw&, const SkRect& oval, | 182 void AnalysisDevice::drawOval(const SkDraw&, const SkRect& oval, |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 if (savedStackSize_ < forceNotTransparentStackLevel_) { | 385 if (savedStackSize_ < forceNotTransparentStackLevel_) { |
390 (static_cast<AnalysisDevice*>(getDevice()))->setForceNotTransparent(false)
; | 386 (static_cast<AnalysisDevice*>(getDevice()))->setForceNotTransparent(false)
; |
391 forceNotTransparentStackLevel_ = kNoLayer; | 387 forceNotTransparentStackLevel_ = kNoLayer; |
392 } | 388 } |
393 } | 389 } |
394 } | 390 } |
395 | 391 |
396 } // namespace skia | 392 } // namespace skia |
397 | 393 |
398 | 394 |
OLD | NEW |