summaryrefslogtreecommitdiffstats
path: root/ui/gfx/canvas.h
diff options
context:
space:
mode:
authorpkotwicz@chromium.org <pkotwicz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-07-02 19:41:15 +0000
committerpkotwicz@chromium.org <pkotwicz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-07-02 19:41:15 +0000
commit8232da6b7154568c250bbce73052402f75475b24 (patch)
tree9f0a6a9c2066ec71a5e63a76d26a6edaf471586e /ui/gfx/canvas.h
parent0950eaef0e83ee0ea36f7cf88bb248464b6d45d0 (diff)
downloadchromium_src-8232da6b7154568c250bbce73052402f75475b24.zip
chromium_src-8232da6b7154568c250bbce73052402f75475b24.tar.gz
chromium_src-8232da6b7154568c250bbce73052402f75475b24.tar.bz2
Adds factory method to create Bitmap shader which displays correctly in High DPI
Added DrawImageInPath to Canvas API. BUG=None TEST=Manual Test Steps: Change the resize code in tray_user to properly resize based on scale factor (See TODO) Run with --force-device-scale-factor=2 --load-2x-resources Ensure that tray user avatars are not blurry Review URL: https://chromiumcodereview.appspot.com/10720003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@145176 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/gfx/canvas.h')
-rw-r--r--ui/gfx/canvas.h31
1 files changed, 20 insertions, 11 deletions
diff --git a/ui/gfx/canvas.h b/ui/gfx/canvas.h
index e7af178..1416835 100644
--- a/ui/gfx/canvas.h
+++ b/ui/gfx/canvas.h
@@ -272,7 +272,7 @@ class UI_EXPORT Canvas {
// Draws an image with the origin at the specified location. The upper left
// corner of the bitmap is rendered at the specified location.
// Parameters are specified relative to current canvas scale not in pixels.
- // Thus, |x| is 2 pixels if canvas scale = 2 & |x| = 1.
+ // Thus, x is 2 pixels if canvas scale = 2 & |x| = 1.
void DrawImageInt(const gfx::ImageSkia&, int x, int y);
// Draws an image with the origin at the specified location, using the
@@ -306,6 +306,16 @@ class UI_EXPORT Canvas {
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.
+ // Thus, x is 2 pixels if canvas scale = 2 & |x| = 1.
+ void DrawImageInPath(const gfx::ImageSkia& image,
+ int x,
+ int y,
+ const SkPath& path,
+ const SkPaint& paint);
+
// Draws text with the specified color, font and location. The text is
// aligned to the left, vertically centered, clipped to the region. If the
// text is too big, it is truncated and '...' is added to the end.
@@ -392,18 +402,17 @@ class UI_EXPORT Canvas {
// If |scale_canvas| is true, scales the canvas by |scale_factor|.
void ApplyScaleFactor(ui::ScaleFactor scale_factor, bool scale_canvas);
- // Returns the bitmap whose density best matches the current canvas scale.
- // Returns a null bitmap if |image| contains no bitmaps.
- // |bitmap_scale_factor| is set to the scale factor of the returned bitmap.
- // Builds mip map for returned bitmap if necessary.
+ // Returns the image rep which best matches the canvas |scale_factor_|.
+ // Returns a null image rep if |image| contains no image reps.
+ // Builds mip map for returned image rep if necessary.
//
// An optional additional user defined scale can be provided.
- const SkBitmap& GetBitmapToPaint(const gfx::ImageSkia& image,
- float* bitmap_scale_factor) const;
- const SkBitmap& GetBitmapToPaint(const gfx::ImageSkia& image,
- float user_defined_scale_factor_x,
- float user_defined_scale_factor_y,
- float* bitmap_scale_factor) const;
+ const gfx::ImageSkiaRep& GetImageRepToPaint(
+ const gfx::ImageSkia& image) const;
+ const gfx::ImageSkiaRep& GetImageRepToPaint(
+ const gfx::ImageSkia& image,
+ float user_defined_scale_factor_x,
+ float user_defined_scale_factor_y) const;
#if defined(OS_WIN)
// Draws text with the specified color, font and location. The text is