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-24 03:25:48 +0000
committerdavemoore@chromium.org <davemoore@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-24 03:25:48 +0000
commit50b66263c3a926fd1de75248fb2100e72715696e (patch)
treea4ad06309d29bacf1c6de692a20f7d214f8ea7ab /ui/gfx/canvas.h
parent2fa342b8ed9c8777f78b3ba8b344dab24a04ef97 (diff)
downloadchromium_src-50b66263c3a926fd1de75248fb2100e72715696e.zip
chromium_src-50b66263c3a926fd1de75248fb2100e72715696e.tar.gz
chromium_src-50b66263c3a926fd1de75248fb2100e72715696e.tar.bz2
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 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=224473 Review URL: https://codereview.chromium.org/24175004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@224876 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 c8996a2..d6479cc 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 scale factor of 1x.
+ // Creates an empty canvas with image_scale of 1x.
Canvas();
- // Creates canvas with provided DIP |size| and |scale_factor|.
+ // Creates canvas with provided DIP |size| and |image_scale|.
// If this canvas is not opaque, it's explicitly cleared to transparent before
// being returned.
- Canvas(const Size& size, ui::ScaleFactor scale_factor, bool is_opaque);
+ Canvas(const Size& size, float image_scale, bool is_opaque);
- // Constructs a canvas with the size and the scale factor of the
- // provided |image_rep|, and draws the |image_rep| into it.
+ // Constructs a canvas with the size and the image_scale 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 |scale_factor|.
- // |sk_canvas| is assumed to be already scaled based on |scale_factor|
+ // Creates a Canvas backed by an |sk_canvas| with |image_scale_|.
+ // |sk_canvas| is assumed to be already scaled based on |image_scale|
// so no additional scaling is applied.
static Canvas* CreateCanvasWithoutScaling(SkCanvas* sk_canvas,
- ui::ScaleFactor scale_factor);
+ float image_scale);
- // Recreates the backing platform canvas with DIP |size| and |scale_factor|.
+ // Recreates the backing platform canvas with DIP |size| and |image_scale_|.
// 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 scale factor into skia::PlatformCanvas such that
+ // TODO(pkotwicz): Push the image_scale into skia::PlatformCanvas such that
// this method can be private.
void RecreateBackingCanvas(const Size& size,
- ui::ScaleFactor scale_factor,
+ float image_scale,
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_; }
- ui::ScaleFactor scale_factor() const { return scale_factor_; }
+ float image_scale() const { return image_scale_; }
private:
- Canvas(SkCanvas* canvas, ui::ScaleFactor scale_factor);
+ Canvas(SkCanvas* canvas, float image_scale);
// 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 |scale_factor_|.
+ // Returns the image rep which best matches the canvas |image_scale_|.
// 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 |scale_factor_|.
- ui::ScaleFactor scale_factor_;
+ // Canvas::Scale() does not affect |image_scale_|.
+ float image_scale_;
skia::RefPtr<skia::PlatformCanvas> owned_canvas_;
SkCanvas* canvas_;