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

Unified Diff: skia/ext/analysis_canvas.cc

Issue 63443003: cc: Combine analysis and raster (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Chunk mismatch Created 7 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 side-by-side diff with in-line comments
Download patch
Index: skia/ext/analysis_canvas.cc
diff --git a/skia/ext/analysis_canvas.cc b/skia/ext/analysis_canvas.cc
index 9db42f17ab67093694b1998ffa801ecfc3ea886f..2b2f32129eeb401857ece480ab7bc5b0dcaf0c17 100644
--- a/skia/ext/analysis_canvas.cc
+++ b/skia/ext/analysis_canvas.cc
@@ -10,7 +10,6 @@
#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 {
@@ -70,8 +69,18 @@ bool IsFullQuad(const SkDraw& draw,
namespace skia {
+AnalysisDevice::AnalysisDevice(const SkBitmap& bitmap, SkRect analysis_rect)
+ : 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),
@@ -138,7 +147,7 @@ void AnalysisDevice::drawRect(const SkDraw& draw,
const SkRect& rect,
const SkPaint& paint) {
bool does_cover_canvas =
- IsFullQuad(draw, SkRect::MakeWH(width(), height()), rect);
+ IsFullQuad(draw, analysis_rect_, rect);
SkXfermode::Mode xfermode;
SkXfermode::AsMode(paint.getXfermode(), &xfermode);
@@ -269,7 +278,7 @@ void AnalysisDevice::drawPosTextOnPath(const SkDraw& draw,
#endif
void AnalysisDevice::drawVertices(const SkDraw& draw,
- SkCanvas::VertexMode,
+ SkCanvas::VertexMode mode,
int vertex_count,
const SkPoint verts[],
const SkPoint texs[],
@@ -307,11 +316,6 @@ 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) {
return INHERITED::clipRect(rect, op, do_aa);
}
@@ -363,9 +367,10 @@ int AnalysisCanvas::saveLayer(const SkRect* bounds,
// 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(SkRect::MakeWH(getDevice()->width(),
- getDevice()->height())))) {
+ (bounds && !bounds->contains(analysis_rect))) {
if (force_not_solid_stack_level_ == kNoLayer) {
force_not_solid_stack_level_ = saved_stack_size_;
(static_cast<AnalysisDevice*>(getDevice()))->SetForceNotSolid(true);

Powered by Google App Engine
This is Rietveld 408576698