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

Unified Diff: ui/gfx/nine_image_painter.cc

Issue 1425163002: gfx: Rename canvas SaveAndUnscale to UnscaleTheDeviceScaleFactor. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ninepatchscale
Patch Set: scopedunscale: . Created 5 years, 2 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/gfx/canvas.cc ('k') | ui/gfx/scoped_canvas.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/nine_image_painter.cc
diff --git a/ui/gfx/nine_image_painter.cc b/ui/gfx/nine_image_painter.cc
index 040678d1a2fab7d5e09f6956f79ed9b2668bd618..49be5ee66ec5a19f4cc03da67cea0df28a114d48 100644
--- a/ui/gfx/nine_image_painter.cc
+++ b/ui/gfx/nine_image_painter.cc
@@ -88,8 +88,11 @@ void NineImagePainter::Paint(Canvas* canvas,
if (IsEmpty())
return;
- // Painting at physical device pixels (undo device scale factor).
- float scale = canvas->SaveAndUnscale();
+ ScopedCanvas scoped_canvas(canvas);
+
+ // Painting and doing layout at physical device pixels to avoid cracks or
+ // overlap.
+ const float scale = canvas->UndoDeviceScaleFactor();
// Since the drawing from the following Fill() calls assumes the mapped origin
// is at (0,0), we need to translate the canvas to the mapped origin.
@@ -163,8 +166,6 @@ void NineImagePainter::Paint(Canvas* canvas,
Fill(canvas, image_reps[8], width_in_pixels - i8w, height_in_pixels - i8h,
i8w, i8h, paint);
}
-
- canvas->Restore();
}
// static
« no previous file with comments | « ui/gfx/canvas.cc ('k') | ui/gfx/scoped_canvas.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698