| Index: cc/picture.cc
|
| diff --git a/cc/picture.cc b/cc/picture.cc
|
| index 55dbd8afb890dbc707bc345d54f84e379e99a131..046f37e3d6f2a7ee83078ca1a2db853621ec6c26 100644
|
| --- a/cc/picture.cc
|
| +++ b/cc/picture.cc
|
| @@ -101,23 +101,11 @@ void Picture::Raster(
|
| SkCanvas* canvas,
|
| gfx::Rect content_rect,
|
| float contents_scale) {
|
| -char strbuf[256];
|
| -if (IsCheapInRect(content_rect)) {
|
| -sprintf(strbuf, "CHEAP Picture::Raster");
|
| -} else {
|
| -sprintf(strbuf, "EXPENSIVE Picture::Raster");
|
| -}
|
| -SkBitmap emptyBitmap;
|
| -emptyBitmap.setConfig(SkBitmap::kARGB_8888_Config, picture_->width(),
|
| - picture_->height());
|
| -skia::AnalysisDevice device(emptyBitmap);
|
| -skia::AnalysisCanvas aCanvas(&device, gfx::RectToSkRect(content_rect));
|
| -aCanvas.drawPicture(*picture_);
|
| -TRACE_EVENT1("cc", strdup(strbuf), "cost", aCanvas.getEstimatedCost());
|
| - //TRACE_EVENT2("cc", strdup(strbuf),
|
| - //"width", layer_rect_.width(), "height", layer_rect_.height());
|
| + TRACE_EVENT2("cc", "Picture::Raster",
|
| + "width", layer_rect_.width(), "height", layer_rect_.height());
|
| DCHECK(picture_);
|
|
|
| + bool isCheap = IsCheapInRect(content_rect, contents_scale);
|
| canvas->save();
|
| canvas->clipRect(gfx::RectToSkRect(content_rect));
|
| canvas->scale(contents_scale, contents_scale);
|
| @@ -126,17 +114,19 @@ TRACE_EVENT1("cc", strdup(strbuf), "cost", aCanvas.getEstimatedCost());
|
| canvas->restore();
|
| }
|
|
|
| -bool Picture::IsCheapInRect(const gfx::Rect& layer_rect) {
|
| -TRACE_EVENT0("cc", "Picture::IsCheapInRect");
|
| +bool Picture::IsCheapInRect(const gfx::Rect& layer_rect,
|
| + float contents_scale) const {
|
| + TRACE_EVENT0("cc", "Picture::IsCheapInRect");
|
| +
|
| SkBitmap emptyBitmap;
|
| - emptyBitmap.setConfig(SkBitmap::kNo_Config, picture_->width(),
|
| - picture_->height());
|
| + emptyBitmap.setConfig(SkBitmap::kNo_Config, layer_rect.width(),
|
| + layer_rect.height());
|
| skia::AnalysisDevice device(emptyBitmap);
|
| - skia::AnalysisCanvas canvas(&device, gfx::RectToSkRect(layer_rect));
|
| - // If a picture has low estimated cost, go ahead and
|
| - // wait until we have more pictures to draw (to amortize startup costs).
|
| - // If estimated cost is high, start it now so that compositing isn't
|
| - // blocked waiting for it.
|
| + skia::AnalysisCanvas canvas(&device);
|
| +
|
| + canvas.clipRect(gfx::RectToSkRect(layer_rect));
|
| + canvas.scale(contents_scale, contents_scale);
|
| + canvas.translate(layer_rect_.x(), layer_rect_.y());
|
| canvas.drawPicture(*picture_);
|
| return canvas.isCheap();
|
| }
|
|
|