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

Unified Diff: ui/gfx/canvas.h

Issue 24175004: Remove dependency on ui::ScaleFactor from ui/gfx (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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
Index: ui/gfx/canvas.h
diff --git a/ui/gfx/canvas.h b/ui/gfx/canvas.h
index c8996a234a85aedfbbb1aa53c64a9806a64badfc..a0da1800991f778d57887f084ad6ffd08e3877b2 100644
--- a/ui/gfx/canvas.h
+++ b/ui/gfx/canvas.h
@@ -93,10 +93,10 @@ class UI_EXPORT Canvas {
// Creates an empty canvas with scale factor of 1x.
Canvas();
- // Creates canvas with provided DIP |size| and |scale_factor|.
+ // Creates canvas with provided DIP |size| and |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 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.
@@ -104,21 +104,18 @@ class UI_EXPORT Canvas {
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 |scale|.
+ // |sk_canvas| is assumed to be already scaled based on |scale|
// so no additional scaling is applied.
- static Canvas* CreateCanvasWithoutScaling(SkCanvas* sk_canvas,
- ui::ScaleFactor scale_factor);
+ static Canvas* CreateCanvasWithoutScaling(SkCanvas* sk_canvas, float scale);
- // Recreates the backing platform canvas with DIP |size| and |scale_factor|.
+ // Recreates the backing platform canvas with DIP |size| and |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
// this method can be private.
- void RecreateBackingCanvas(const Size& size,
- ui::ScaleFactor scale_factor,
- bool is_opaque);
+ void RecreateBackingCanvas(const Size& size, float scale, bool is_opaque);
// Compute the size required to draw some text with the provided fonts.
// Attempts to fit the text with the provided width and height. Increases
@@ -451,10 +448,10 @@ 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 scale() const { return scale_; }
private:
- Canvas(SkCanvas* canvas, ui::ScaleFactor scale_factor);
+ Canvas(SkCanvas* canvas, float scale);
// Test whether the provided rectangle intersects the current clip rect.
bool IntersectsClipRectInt(int x, int y, int w, int h);
@@ -474,7 +471,7 @@ 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_;
+ float scale_;
skia::RefPtr<skia::PlatformCanvas> owned_canvas_;
SkCanvas* canvas_;

Powered by Google App Engine
This is Rietveld 408576698