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

Unified Diff: ui/compositor/layer.cc

Issue 10701063: Cleanup gfx::Canvas now that 10562027 has landed (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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 | « ui/base/native_theme/native_theme_base.cc ('k') | ui/compositor/layer_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/compositor/layer.cc
diff --git a/ui/compositor/layer.cc b/ui/compositor/layer.cc
index a3ae747b8059df56d146b13ef77b935cfb073fc3..6c30d52b8a4d5367c1310326fec0796b1b6a0588 100644
--- a/ui/compositor/layer.cc
+++ b/ui/compositor/layer.cc
@@ -488,11 +488,19 @@ void Layer::paintContents(WebKit::WebCanvas* web_canvas,
WebKit::WebRect& opaque) {
#endif
TRACE_EVENT0("ui", "Layer::paintContents");
- gfx::Canvas canvas(web_canvas,
- ui::GetScaleFactorFromScale(device_scale_factor_), scale_content_);
+ scoped_ptr<gfx::Canvas> canvas(gfx::Canvas::CreateCanvasWithoutScaling(
+ web_canvas, ui::GetScaleFactorFromScale(device_scale_factor_)));
+
+ if (scale_content_) {
+ canvas->Save();
+ canvas->sk_canvas()->scale(SkFloatToScalar(device_scale_factor_),
+ SkFloatToScalar(device_scale_factor_));
+ }
if (delegate_)
- delegate_->OnPaintLayer(&canvas);
+ delegate_->OnPaintLayer(canvas.get());
+ if (scale_content_)
+ canvas->Restore();
}
unsigned Layer::prepareTexture(WebKit::WebTextureUpdater& /* updater */) {
« no previous file with comments | « ui/base/native_theme/native_theme_base.cc ('k') | ui/compositor/layer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698