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

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: Remove analysis time from rendering stats Created 6 years, 12 months 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
« no previous file with comments | « skia/ext/analysis_canvas.h ('k') | skia/ext/analysis_canvas_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: skia/ext/analysis_canvas.cc
diff --git a/skia/ext/analysis_canvas.cc b/skia/ext/analysis_canvas.cc
index e77ff2b72c775db92408700a6644899a8c67fbf7..79b44a6d9c3a22d88b01dc1f757fec8e85e35cf1 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),
@@ -137,8 +146,13 @@ void AnalysisDevice::drawPoints(const SkDraw& draw,
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, SkRect::MakeWH(width(), height()), rect);
+ IsFullQuad(draw, analysis_rect_, rect);
SkXfermode::Mode xfermode;
SkXfermode::AsMode(paint.getXfermode(), &xfermode);
@@ -279,7 +293,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[],
@@ -317,11 +331,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);
}
@@ -373,9 +382,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);
« no previous file with comments | « skia/ext/analysis_canvas.h ('k') | skia/ext/analysis_canvas_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698