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

Unified Diff: ui/gfx/canvas.h

Issue 2509983004: Revert "Change call-sites now that SkCanvas is not ref-counted" (Closed)
Patch Set: Created 4 years, 1 month 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 | « ui/gfx/blit_unittest.cc ('k') | ui/gfx/canvas.cc » ('j') | no next file with comments »
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 521a1567f4a9835c2eb90992823fe550004a4941..ec85eb5374681b91ab0f1fbcfd71c1fb0ab8b0b3 100644
--- a/ui/gfx/canvas.h
+++ b/ui/gfx/canvas.h
@@ -89,9 +89,7 @@ class GFX_EXPORT Canvas {
// 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.
- // Note: the caller must ensure that sk_canvas outlives this object, or until
- // RecreateBackingCanvas is called.
- Canvas(SkCanvas* sk_canvas, float image_scale);
+ Canvas(sk_sp<SkCanvas> sk_canvas, float image_scale);
virtual ~Canvas();
@@ -483,7 +481,7 @@ class GFX_EXPORT Canvas {
const Rect& display_rect,
int flags);
- SkCanvas* sk_canvas() { return canvas_; }
+ SkCanvas* sk_canvas() { return canvas_.get(); }
float image_scale() const { return image_scale_; }
private:
@@ -511,12 +509,7 @@ class GFX_EXPORT Canvas {
// Canvas::Scale() does not affect |image_scale_|.
float image_scale_;
- // canvas_ is our active canvas object. Sometimes we are also the owner,
- // in which case canvas_owner_ will be set. Other times we are just
- // borrowing someone else's canvas, in which case canvas_ will point there
- // but canvas_owner_ will be null.
- std::unique_ptr<SkCanvas> canvas_owner_;
- SkCanvas* canvas_;
+ sk_sp<SkCanvas> canvas_;
DISALLOW_COPY_AND_ASSIGN(Canvas);
};
« no previous file with comments | « ui/gfx/blit_unittest.cc ('k') | ui/gfx/canvas.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698