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

Unified Diff: cc/resources/ui_resource_bitmap.cc

Issue 1869753003: Replace many skia::RefPtr with sk_sp<> in cc/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fmalita review - deconstify sk_sp<>s Created 4 years, 8 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: cc/resources/ui_resource_bitmap.cc
diff --git a/cc/resources/ui_resource_bitmap.cc b/cc/resources/ui_resource_bitmap.cc
index b7b931256f151e6593d79dd2522c13e4237f73b6..4a4e4ba1d5bfa6beceb131dd8847d0f47fba9c85 100644
--- a/cc/resources/ui_resource_bitmap.cc
+++ b/cc/resources/ui_resource_bitmap.cc
@@ -35,7 +35,7 @@ UIResourceBitmap::UIResourceFormat SkColorTypeToUIResourceFormat(
} // namespace
-void UIResourceBitmap::Create(const skia::RefPtr<SkPixelRef>& pixel_ref,
+void UIResourceBitmap::Create(sk_sp<SkPixelRef> pixel_ref,
const gfx::Size& size,
UIResourceFormat format) {
DCHECK(size.width());
@@ -44,7 +44,7 @@ void UIResourceBitmap::Create(const skia::RefPtr<SkPixelRef>& pixel_ref,
DCHECK(pixel_ref->isImmutable());
format_ = format;
size_ = size;
- pixel_ref_ = pixel_ref;
+ pixel_ref_ = std::move(pixel_ref);
// Default values for secondary parameters.
opaque_ = (format == ETC1);
@@ -54,7 +54,7 @@ UIResourceBitmap::UIResourceBitmap(const SkBitmap& skbitmap) {
DCHECK_EQ(skbitmap.width(), skbitmap.rowBytesAsPixels());
DCHECK(skbitmap.isImmutable());
- skia::RefPtr<SkPixelRef> pixel_ref = skia::SharePtr(skbitmap.pixelRef());
+ sk_sp<SkPixelRef> pixel_ref = sk_ref_sp(skbitmap.pixelRef());
const SkImageInfo& info = pixel_ref->info();
Create(pixel_ref, gfx::Size(info.width(), info.height()),
SkColorTypeToUIResourceFormat(skbitmap.colorType()));
@@ -66,16 +66,16 @@ UIResourceBitmap::UIResourceBitmap(const gfx::Size& size, bool is_opaque) {
SkAlphaType alphaType = is_opaque ? kOpaque_SkAlphaType : kPremul_SkAlphaType;
SkImageInfo info =
SkImageInfo::MakeN32(size.width(), size.height(), alphaType);
- skia::RefPtr<SkPixelRef> pixel_ref = skia::AdoptRef(
+ sk_sp<SkPixelRef> pixel_ref(
SkMallocPixelRef::NewAllocate(info, info.minRowBytes(), NULL));
pixel_ref->setImmutable();
Create(pixel_ref, size, UIResourceBitmap::RGBA8);
f(malita) 2016/04/21 15:45:47 move(pixel_ref)
tomhudson 2016/04/25 20:20:51 Done.
SetOpaque(is_opaque);
}
-UIResourceBitmap::UIResourceBitmap(const skia::RefPtr<SkPixelRef>& pixel_ref,
+UIResourceBitmap::UIResourceBitmap(sk_sp<SkPixelRef> pixel_ref,
const gfx::Size& size) {
- Create(pixel_ref, size, UIResourceBitmap::ETC1);
+ Create(std::move(pixel_ref), size, UIResourceBitmap::ETC1);
}
UIResourceBitmap::UIResourceBitmap(const UIResourceBitmap& other) = default;

Powered by Google App Engine
This is Rietveld 408576698