Index: skia/ext/analysis_canvas.cc |
diff --git a/skia/ext/analysis_canvas.cc b/skia/ext/analysis_canvas.cc |
index 79b44a6d9c3a22d88b01dc1f757fec8e85e35cf1..e77ff2b72c775db92408700a6644899a8c67fbf7 100644 |
--- a/skia/ext/analysis_canvas.cc |
+++ b/skia/ext/analysis_canvas.cc |
@@ -10,6 +10,7 @@ |
#include "third_party/skia/include/core/SkRRect.h" |
#include "third_party/skia/include/core/SkShader.h" |
#include "third_party/skia/src/core/SkRasterClip.h" |
+#include "ui/gfx/rect_conversions.h" |
namespace { |
@@ -69,24 +70,14 @@ |
namespace skia { |
-AnalysisDevice::AnalysisDevice(const SkBitmap& bitmap, SkRect analysis_rect) |
+AnalysisDevice::AnalysisDevice(const SkBitmap& bitmap) |
: INHERITED(bitmap), |
- analysis_rect_(analysis_rect), |
is_forced_not_solid_(false), |
is_forced_not_transparent_(false), |
is_solid_color_(true), |
is_transparent_(true), |
has_text_(false) {} |
-AnalysisDevice::AnalysisDevice(const SkBitmap& bitmap) |
- : INHERITED(bitmap), |
- analysis_rect_(SkRect::MakeWH(bitmap.width(), bitmap.height())), |
- is_forced_not_solid_(false), |
- is_forced_not_transparent_(false), |
- is_solid_color_(true), |
- is_transparent_(true), |
- has_text_(false) {} |
- |
AnalysisDevice::~AnalysisDevice() {} |
bool AnalysisDevice::GetColorIfSolid(SkColor* color) const { |
@@ -146,13 +137,8 @@ |
void AnalysisDevice::drawRect(const SkDraw& draw, |
const SkRect& rect, |
const SkPaint& paint) { |
- // Early out of work where possible. It could be the case that a picture |
- // draws text and then clears, but this is unlikely. |
- if (has_text_ && !is_solid_color_) |
- return; |
- |
bool does_cover_canvas = |
- IsFullQuad(draw, analysis_rect_, rect); |
+ IsFullQuad(draw, SkRect::MakeWH(width(), height()), rect); |
SkXfermode::Mode xfermode; |
SkXfermode::AsMode(paint.getXfermode(), &xfermode); |
@@ -293,7 +279,7 @@ |
#endif |
void AnalysisDevice::drawVertices(const SkDraw& draw, |
- SkCanvas::VertexMode mode, |
+ SkCanvas::VertexMode, |
int vertex_count, |
const SkPoint verts[], |
const SkPoint texs[], |
@@ -329,6 +315,11 @@ |
bool AnalysisCanvas::HasText() const { |
return (static_cast<AnalysisDevice*>(getDevice()))->HasText(); |
+} |
+ |
+bool AnalysisCanvas::abortDrawing() { |
+ // Early out as soon as we have detected that the tile has text. |
+ return HasText(); |
} |
bool AnalysisCanvas::clipRect(const SkRect& rect, SkRegion::Op op, bool do_aa) { |
@@ -382,10 +373,9 @@ |
// If after we draw to the saved layer, we have to blend with the current |
// layer, then we can conservatively say that the canvas will not be of |
// solid color. |
- SkRect analysis_rect = |
- static_cast<AnalysisDevice*>(getDevice())->AnalysisRect(); |
if ((paint && !IsSolidColorPaint(*paint)) || |
- (bounds && !bounds->contains(analysis_rect))) { |
+ (bounds && !bounds->contains(SkRect::MakeWH(getDevice()->width(), |
+ getDevice()->height())))) { |
if (force_not_solid_stack_level_ == kNoLayer) { |
force_not_solid_stack_level_ = saved_stack_size_; |
(static_cast<AnalysisDevice*>(getDevice()))->SetForceNotSolid(true); |