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

Unified Diff: ui/gfx/canvas.h

Issue 262773010: Fix images drawn with the NineImagePainter class in high DPI. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased to tip Created 6 years, 7 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 | « no previous file | ui/gfx/canvas.cc » ('j') | ui/gfx/canvas.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/canvas.h
diff --git a/ui/gfx/canvas.h b/ui/gfx/canvas.h
index b3be76a839c98f7e53904074eda509127331a929..93171d54a6339c4aef6cd5d3c3d640d6037e693f 100644
--- a/ui/gfx/canvas.h
+++ b/ui/gfx/canvas.h
@@ -320,6 +320,22 @@ class GFX_EXPORT Canvas {
bool filter,
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,
+ int dest_x,
+ int dest_y,
+ int dest_w,
+ int dest_h,
+ bool filter,
+ const SkPaint& paint);
+
// Draws an |image| with the top left corner at |x| and |y|, clipped to
// |path|.
// Parameters are specified relative to current canvas scale not in pixels.
@@ -435,9 +451,27 @@ class GFX_EXPORT Canvas {
const ImageSkiaRep& GetImageRepToPaint(const ImageSkia& image) const;
const ImageSkiaRep& GetImageRepToPaint(
const ImageSkia& image,
+ float image_scale,
float user_defined_scale_factor_x,
float user_defined_scale_factor_y) const;
+ // 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,
+ int src_x,
+ int src_y,
+ int src_w,
+ int src_h,
+ int dest_x,
+ int dest_y,
+ int dest_w,
+ int dest_h,
+ bool filter,
+ const SkPaint& paint,
+ float image_scale,
+ bool pixel);
+
// The device scale factor at which drawing on this canvas occurs.
// An additional scale can be applied via Canvas::Scale(). However,
// Canvas::Scale() does not affect |image_scale_|.
« no previous file with comments | « no previous file | ui/gfx/canvas.cc » ('j') | ui/gfx/canvas.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698