Chromium Code Reviews| Index: cc/resources/ui_resource_bitmap.h |
| diff --git a/cc/resources/ui_resource_bitmap.h b/cc/resources/ui_resource_bitmap.h |
| index dbf70690792c2801457abf68b0ff9cb7ee51639b..bef4c64050aabfabd9b4f45e12a973e39e1e752d 100644 |
| --- a/cc/resources/ui_resource_bitmap.h |
| +++ b/cc/resources/ui_resource_bitmap.h |
| @@ -8,41 +8,47 @@ |
| #include "base/memory/ref_counted.h" |
| #include "base/memory/scoped_ptr.h" |
| #include "cc/base/cc_export.h" |
| +#include "skia/ext/refptr.h" |
| +#include "third_party/skia/include/core/SkPixelRef.h" |
| #include "third_party/skia/include/core/SkTypes.h" |
| #include "ui/gfx/size.h" |
| +class SkBitmap; |
| + |
| namespace cc { |
| // Ref-counted bitmap class (can’t use SkBitmap because of ETC1). Thread-safety |
| // ensures that both main and impl threads can hold references to the bitmap and |
| // that asynchronous uploads are allowed. |
| -class CC_EXPORT UIResourceBitmap |
| - : public base::RefCountedThreadSafe<UIResourceBitmap> { |
| +class CC_EXPORT UIResourceBitmap { |
| public: |
| enum UIResourceFormat { |
| - RGBA8 |
| + RGBA8, |
| + INVALID_FORMAT |
| }; |
| - // Takes ownership of “pixels”. |
| - static scoped_refptr<UIResourceBitmap> Create(uint8_t* pixels, |
| - UIResourceFormat format, |
| - gfx::Size size); |
| - |
| gfx::Size GetSize() const { return size_; } |
| UIResourceFormat GetFormat() const { return format_; } |
| - uint8_t* GetPixels() { return pixels_.get(); } |
| + uint8_t* GetPixels() const; |
| - private: |
| - friend class base::RefCountedThreadSafe<UIResourceBitmap>; |
| + explicit UIResourceBitmap(const SkBitmap& skbitmap); |
| + |
| + UIResourceBitmap(const UIResourceBitmap& src); |
| + |
| + UIResourceBitmap& operator=(const UIResourceBitmap& src); |
| + |
| + explicit UIResourceBitmap(); |
|
aelias_OOO_until_Jul13
2013/09/06 04:17:38
Can we get rid of this default constructor and the
powei
2013/09/09 17:57:18
Done.
|
| - UIResourceBitmap(); |
| ~UIResourceBitmap(); |
| - scoped_ptr<uint8_t[]> pixels_; |
| + private: |
| + void Create(const skia::RefPtr<SkPixelRef>& pixel_ref, |
| + UIResourceFormat format, |
| + gfx::Size size); |
| + |
| + skia::RefPtr<SkPixelRef> pixel_ref_; |
| UIResourceFormat format_; |
| gfx::Size size_; |
| - |
| - DISALLOW_COPY_AND_ASSIGN(UIResourceBitmap); |
| }; |
| } // namespace cc |