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

Unified Diff: cc/picture.cc

Issue 12184010: skia::AnalysisCanvas: implementation for IsCheapInRect(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 | « no previous file | 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 1407f55dc4a1eb5ee470f302f155666abbec5b37..383637c7b1fbee8e89d28351b244bfd4c08e2cf6 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"
@@ -109,6 +110,19 @@ void Picture::Raster(
}
bool Picture::IsCheapInRect(const gfx::Rect& layer_rect) {
Sami 2013/02/04 10:57:54 Should we make this a const method?
Tom Hudson 2013/02/05 17:02:00 Done. I also had to add contents_scale to the lis
+ skia::AnalysisCanvas canvas(gfx::RectToSkRect(layer_rect));
+ // If a picture has estimatd cost below this threshold, go ahead and
+ // wait until we have more pictures to draw (to amortize startup costs).
+ // If cost exceeds this threshold, start it now so we aren't blocked
+ // waiting for it.
+ // FIXME: Arbitrary number. Requires tuning & experimentation.
+ // Probably requires per-platform tuning; N10 average draw call takes
+ // 25x as long as Z620.
+ int pictureCostThreshold = 100;
+ canvas.drawPicture(*picture_);
+ if (canvas.getEstimatedCost() <= pictureCostThreshold) {
nduca 2013/02/04 10:34:33 love this. convert this to bool isCheap() and push
Tom Hudson 2013/02/05 17:02:00 Done.
+ return true;
+ }
return false;
}
« no previous file with comments | « no previous file | skia/ext/analysis_canvas.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698