Chromium Code Reviews| Index: cc/resources/ui_resource_bitmap.cc |
| diff --git a/cc/resources/ui_resource_bitmap.cc b/cc/resources/ui_resource_bitmap.cc |
| index b813d973537e1b4534298e9898fc85a1ebd9ae08..3c56daa5fd68b31e13ea44412a8c2df144e22c69 100644 |
| --- a/cc/resources/ui_resource_bitmap.cc |
| +++ b/cc/resources/ui_resource_bitmap.cc |
| @@ -6,21 +6,21 @@ |
| #include "base/logging.h" |
| #include "base/memory/scoped_ptr.h" |
| -#include "cc/resources/etc1_pixel_ref.h" |
| #include "third_party/skia/include/core/SkBitmap.h" |
| +#include "third_party/skia/include/core/SkMallocPixelRef.h" |
| #include "third_party/skia/include/core/SkPixelRef.h" |
| namespace cc { |
| void UIResourceBitmap::Create(const skia::RefPtr<SkPixelRef>& pixel_ref, |
| - UIResourceFormat format, |
| - gfx::Size size) { |
| - DCHECK(size.width()); |
| - DCHECK(size.height()); |
| + UIResourceFormat format) { |
| + const SkImageInfo& info = pixel_ref->info(); |
| + DCHECK(info.fWidth); |
| + DCHECK(info.fHeight); |
| DCHECK(pixel_ref); |
| DCHECK(pixel_ref->isImmutable()); |
| format_ = format; |
| - size_ = size; |
| + size_ = gfx::Size(info.fWidth, info.fHeight); |
| pixel_ref_ = pixel_ref; |
| // Default values for secondary parameters. |
| @@ -34,23 +34,22 @@ UIResourceBitmap::UIResourceBitmap(const SkBitmap& skbitmap) { |
| DCHECK(skbitmap.isImmutable()); |
| skia::RefPtr<SkPixelRef> pixel_ref = skia::SharePtr(skbitmap.pixelRef()); |
| - Create(pixel_ref, |
| - UIResourceBitmap::RGBA8, |
| - gfx::Size(skbitmap.width(), skbitmap.height())); |
| + Create(pixel_ref, UIResourceBitmap::RGBA8); |
| SetOpaque(skbitmap.isOpaque()); |
| } |
| -UIResourceBitmap::UIResourceBitmap( |
| - const skia::RefPtr<ETC1PixelRef>& etc1_pixel_ref, |
| - gfx::Size size) { |
| - Create(etc1_pixel_ref, ETC1, size); |
| +UIResourceBitmap::UIResourceBitmap(const SkImageInfo& info) { |
| + SkPixelRef* pr = SkMallocPixelRef::NewAllocate(info, 0, 0); |
|
ccameron
2014/01/15 20:10:51
nit (optional): maybe call this one pixel_ref and
enne (OOO)
2014/01/15 20:20:38
No unwrapped raw Skia pointers, please. Can you s
reed1
2014/01/15 20:46:21
Done.
reed1
2014/01/15 20:46:21
Done.
|
| + pr->setImmutable(); |
| + skia::RefPtr<SkPixelRef> pixel_ref = skia::AdoptRef(pr); |
| + Create(pixel_ref, UIResourceBitmap::ETC1); |
| } |
| UIResourceBitmap::~UIResourceBitmap() {} |
| AutoLockUIResourceBitmap::AutoLockUIResourceBitmap( |
| - const UIResourceBitmap& bitmap) : bitmap_(bitmap) { |
| + const UIResourceBitmap& bitmap) : bitmap_(bitmap) { |
|
ccameron
2014/01/15 20:10:51
nit: indent 4 spaces
reed1
2014/01/15 20:46:21
Done.
|
| bitmap_.pixel_ref_->lockPixels(); |
| } |