ui: Fix NinePatchPainter to work in physical pixels.

This fixes NinePatchPainter to do layout in physical pixels after the
change to use slimming-paint in the ui compositor. Instead of using
the matrix on the canvas (which won't be meaningful for scale), it uses
the gfx::Canvas::SaveAndUnscale() method to move into a physical space
and do layout there.

R=oshima, sky
BUG=539496

Review URL: https://codereview.chromium.org/1424983005

Cr-Commit-Position: refs/heads/master@{#356983}
diff --git a/ui/gfx/canvas.h b/ui/gfx/canvas.h
index 0c40944..8183dfa 100644
--- a/ui/gfx/canvas.h
+++ b/ui/gfx/canvas.h
@@ -309,14 +309,11 @@
                     const SkPaint& paint);
 
   // Same as the DrawImageInt functions above. Difference being this does not
-  // do any scaling, i.e. it assumes that the source/destination/image, etc are
-  // in pixels. It does translate the destination rectangle to ensure that the
-  // image is displayed at the correct pixel coordinates.
-  void DrawImageIntInPixel(const ImageSkia& image,
-                           int src_x,
-                           int src_y,
-                           int src_w,
-                           int src_h,
+  // do any scaling, i.e. it does not scale the output by the device scale
+  // factor (the internal image_scale_). It takes an ImageSkiaRep instead of
+  // an ImageSkia as the caller chooses the exact scale/pixel representation to
+  // use, which will not be scaled while drawing it into the canvas.
+  void DrawImageIntInPixel(const ImageSkiaRep& image_rep,
                            int dest_x,
                            int dest_y,
                            int dest_w,
@@ -416,7 +413,7 @@
   // Helper for the DrawImageInt functions declared above. The |pixel|
   // parameter if true indicates that the bounds and the image are to
   // be assumed to be in pixels, i.e. no scaling needs to be performed.
-  void DrawImageIntHelper(const ImageSkia& image,
+  void DrawImageIntHelper(const ImageSkiaRep& image_rep,
                           int src_x,
                           int src_y,
                           int src_w,
@@ -427,7 +424,6 @@
                           int dest_h,
                           bool filter,
                           const SkPaint& paint,
-                          float image_scale,
                           bool pixel);
 
   // The device scale factor at which drawing on this canvas occurs.