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

Unified Diff: cc/picture.cc

Issue 12213018: Implementation for cc::Picture::IsCheapInRect(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Respond to skyostil's comments Created 7 years, 10 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 | « cc/picture.h ('k') | skia/ext/analysis_canvas.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/picture.cc
diff --git a/cc/picture.cc b/cc/picture.cc
index c8fcd4504283733ba585bece04cb52d6e73a9c25..23793cf8f163f3c300f74d59938cfb10f566b066 100644
--- a/cc/picture.cc
+++ b/cc/picture.cc
@@ -6,6 +6,7 @@
#include "cc/content_layer_client.h"
#include "cc/picture.h"
#include "cc/rendering_stats.h"
+#include "skia/ext/analysis_canvas.h"
#include "third_party/skia/include/core/SkCanvas.h"
#include "third_party/skia/include/core/SkData.h"
#include "third_party/skia/include/core/SkTileGridPicture.h"
@@ -101,7 +102,8 @@ void Picture::Raster(
gfx::Rect content_rect,
float contents_scale) {
TRACE_EVENT2("cc", "Picture::Raster",
- "width", layer_rect_.width(), "height", layer_rect_.height());
+ "layer width", layer_rect_.width(),
+ "layer height", layer_rect_.height());
DCHECK(picture_);
canvas->save();
@@ -113,7 +115,16 @@ void Picture::Raster(
}
bool Picture::IsCheapInRect(const gfx::Rect& layer_rect) {
- return false;
+ TRACE_EVENT0("cc", "Picture::IsCheapInRect");
+
+ SkBitmap emptyBitmap;
+ emptyBitmap.setConfig(SkBitmap::kNo_Config, layer_rect.width(),
+ layer_rect.height());
+ skia::AnalysisDevice device(emptyBitmap);
+ skia::AnalysisCanvas canvas(&device);
+
+ canvas.drawPicture(*picture_);
+ return canvas.isCheap();
}
void Picture::GatherPixelRefs(const gfx::Rect& layer_rect,
« no previous file with comments | « cc/picture.h ('k') | skia/ext/analysis_canvas.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698