summaryrefslogtreecommitdiffstats
path: root/ui/gfx/canvas.h
diff options
context:
space:
mode:
authordavemoore@chromium.org <davemoore@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-20 21:54:52 +0000
committerdavemoore@chromium.org <davemoore@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-20 21:54:52 +0000
commitd24adc83e7de8b042739c96f37588dee5ba091b3 (patch)
treee82cf26051eb22ce33a61a3f2816c39e6135675f /ui/gfx/canvas.h
parentfc28c977a4969a3ff4c4e8dee98fe67ce111ed86 (diff)
downloadchromium_src-d24adc83e7de8b042739c96f37588dee5ba091b3.zip
chromium_src-d24adc83e7de8b042739c96f37588dee5ba091b3.tar.gz
chromium_src-d24adc83e7de8b042739c96f37588dee5ba091b3.tar.bz2
Revert 224473 "Remove dependency on ui::ScaleFactor from ui/gfx"
> Remove dependency on ui::ScaleFactor from ui/gfx > > As part of the work to removed dependencies on ui/base from ui/gfx I have > changed the public api to Canvas, ImageSkia, ImageSkiaRep and ImagePNGRep > to take float scale values instead of ui::ScaleFactor. > > The notion of supported scale factors has been broken into 2 parts. > ui::SetSupportedScaleFactors remains and calls the > new ImageSkia::SetSupportedScales(). > > The initialization of the supported scale factors has been moved from layout.h > into ResourceBundle, and is done explicitly in tests that don't use > ResourceBundle. > > BUG=103304 > R=ben@chromium.org, oshima@chromium.org, sky@chromium.org > > Review URL: https://codereview.chromium.org/24175004 TBR=davemoore@chromium.org Review URL: https://codereview.chromium.org/24262008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@224499 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/gfx/canvas.h')
-rw-r--r--ui/gfx/canvas.h32
1 files changed, 16 insertions, 16 deletions
diff --git a/ui/gfx/canvas.h b/ui/gfx/canvas.h
index d6479cc..c8996a2 100644
--- a/ui/gfx/canvas.h
+++ b/ui/gfx/canvas.h
@@ -90,34 +90,34 @@ class UI_EXPORT Canvas {
NO_SUBPIXEL_RENDERING = 1 << 10,
};
- // Creates an empty canvas with image_scale of 1x.
+ // Creates an empty canvas with scale factor of 1x.
Canvas();
- // Creates canvas with provided DIP |size| and |image_scale|.
+ // Creates canvas with provided DIP |size| and |scale_factor|.
// If this canvas is not opaque, it's explicitly cleared to transparent before
// being returned.
- Canvas(const Size& size, float image_scale, bool is_opaque);
+ Canvas(const Size& size, ui::ScaleFactor scale_factor, bool is_opaque);
- // Constructs a canvas with the size and the image_scale of the provided
- // |image_rep|, and draws the |image_rep| into it.
+ // Constructs a canvas with the size and the scale factor of the
+ // provided |image_rep|, and draws the |image_rep| into it.
Canvas(const ImageSkiaRep& image_rep, bool is_opaque);
virtual ~Canvas();
- // Creates a Canvas backed by an |sk_canvas| with |image_scale_|.
- // |sk_canvas| is assumed to be already scaled based on |image_scale|
+ // Creates a Canvas backed by an |sk_canvas| with |scale_factor|.
+ // |sk_canvas| is assumed to be already scaled based on |scale_factor|
// so no additional scaling is applied.
static Canvas* CreateCanvasWithoutScaling(SkCanvas* sk_canvas,
- float image_scale);
+ ui::ScaleFactor scale_factor);
- // Recreates the backing platform canvas with DIP |size| and |image_scale_|.
+ // Recreates the backing platform canvas with DIP |size| and |scale_factor|.
// If the canvas is not opaque, it is explicitly cleared.
// This method is public so that canvas_skia_paint can recreate the platform
// canvas after having initialized the canvas.
- // TODO(pkotwicz): Push the image_scale into skia::PlatformCanvas such that
+ // TODO(pkotwicz): Push the scale factor into skia::PlatformCanvas such that
// this method can be private.
void RecreateBackingCanvas(const Size& size,
- float image_scale,
+ ui::ScaleFactor scale_factor,
bool is_opaque);
// Compute the size required to draw some text with the provided fonts.
@@ -451,16 +451,16 @@ class UI_EXPORT Canvas {
skia::PlatformCanvas* platform_canvas() const { return owned_canvas_.get(); }
SkCanvas* sk_canvas() const { return canvas_; }
- float image_scale() const { return image_scale_; }
+ ui::ScaleFactor scale_factor() const { return scale_factor_; }
private:
- Canvas(SkCanvas* canvas, float image_scale);
+ Canvas(SkCanvas* canvas, ui::ScaleFactor scale_factor);
// Test whether the provided rectangle intersects the current clip rect.
bool IntersectsClipRectInt(int x, int y, int w, int h);
bool IntersectsClipRect(const Rect& rect);
- // Returns the image rep which best matches the canvas |image_scale_|.
+ // 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.
//
@@ -473,8 +473,8 @@ class UI_EXPORT Canvas {
// 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_|.
- float image_scale_;
+ // Canvas::Scale() does not affect |scale_factor_|.
+ ui::ScaleFactor scale_factor_;
skia::RefPtr<skia::PlatformCanvas> owned_canvas_;
SkCanvas* canvas_;