Chromium Code Reviews| 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; |
| } |