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

Unified Diff: ui/gfx/canvas.cc

Issue 1939143002: Remove all uses of skia::RefPtr and stale includes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix bad rebase Created 4 years, 7 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
« no previous file with comments | « ui/gfx/canvas.h ('k') | ui/gfx/platform_font_linux.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/canvas.cc
diff --git a/ui/gfx/canvas.cc b/ui/gfx/canvas.cc
index b88fd2d55128a7e68c91c20b20205a2ca8ff61af..6c0aa0e8f684372ec47ef402cb65535874381b3a 100644
--- a/ui/gfx/canvas.cc
+++ b/ui/gfx/canvas.cc
@@ -11,6 +11,7 @@
#include "base/logging.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "third_party/skia/include/core/SkPath.h"
+#include "third_party/skia/include/core/SkRefCnt.h"
#include "third_party/skia/include/effects/SkGradientShader.h"
#include "ui/gfx/font_list.h"
#include "ui/gfx/geometry/rect.h"
@@ -27,9 +28,9 @@ namespace gfx {
Canvas::Canvas(const Size& size, float image_scale, bool is_opaque)
: image_scale_(image_scale) {
Size pixel_size = ScaleToCeiledSize(size, image_scale);
- canvas_ = skia::AdoptRef(skia::CreatePlatformCanvas(pixel_size.width(),
- pixel_size.height(),
- is_opaque));
+ canvas_ = sk_sp<SkCanvas>(skia::CreatePlatformCanvas(pixel_size.width(),
+ pixel_size.height(),
+ is_opaque));
#if !defined(USE_CAIRO)
// skia::PlatformCanvas instances are initialized to 0 by Cairo, but
// uninitialized on other platforms.
@@ -43,7 +44,7 @@ Canvas::Canvas(const Size& size, float image_scale, bool is_opaque)
Canvas::Canvas(const ImageSkiaRep& image_rep, bool is_opaque)
: image_scale_(image_rep.scale()),
- canvas_(skia::AdoptRef(
+ canvas_(sk_sp<SkCanvas>(
skia::CreatePlatformCanvas(image_rep.pixel_width(),
image_rep.pixel_height(),
is_opaque))) {
@@ -54,11 +55,11 @@ Canvas::Canvas(const ImageSkiaRep& image_rep, bool is_opaque)
Canvas::Canvas()
: image_scale_(1.f),
- canvas_(skia::AdoptRef(skia::CreatePlatformCanvas(0, 0, false))) {}
+ canvas_(sk_sp<SkCanvas>(skia::CreatePlatformCanvas(0, 0, false))) {}
-Canvas::Canvas(const skia::RefPtr<SkCanvas>& canvas, float image_scale)
- : image_scale_(image_scale), canvas_(canvas) {
- DCHECK(canvas);
+Canvas::Canvas(sk_sp<SkCanvas> canvas, float image_scale)
+ : image_scale_(image_scale), canvas_(std::move(canvas)) {
+ DCHECK(canvas_);
}
Canvas::~Canvas() {
@@ -69,9 +70,9 @@ void Canvas::RecreateBackingCanvas(const Size& size,
bool is_opaque) {
image_scale_ = image_scale;
Size pixel_size = ScaleToFlooredSize(size, image_scale);
- canvas_ = skia::AdoptRef(skia::CreatePlatformCanvas(pixel_size.width(),
- pixel_size.height(),
- is_opaque));
+ canvas_ = sk_sp<SkCanvas>(skia::CreatePlatformCanvas(pixel_size.width(),
+ pixel_size.height(),
+ is_opaque));
SkScalar scale_scalar = SkFloatToScalar(image_scale);
canvas_->scale(scale_scalar, scale_scalar);
}
« no previous file with comments | « ui/gfx/canvas.h ('k') | ui/gfx/platform_font_linux.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698