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..cecf0eadd6d09654947dcf6f3778102282ff3439 100644 |
| --- a/cc/resources/ui_resource_bitmap.h |
| +++ b/cc/resources/ui_resource_bitmap.h |
| @@ -8,41 +8,48 @@ |
| #include "base/memory/ref_counted.h" |
| #include "base/memory/scoped_ptr.h" |
| #include "cc/base/cc_export.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>; |
| + UIResourceBitmap(SkPixelRef* pixel_ref, |
|
danakj
2013/09/05 19:23:38
Is this passing ownership with a raw pointer? If s
powei
2013/09/05 20:37:35
SkPixelRef is ref-counted, so this is not taking o
danakj
2013/09/05 20:38:57
Please use skia::RefPtr, and skia::AdoptRef() a re
powei
2013/09/05 21:34:08
Done. Thanks for letting me know. This is much b
|
| + UIResourceFormat format, |
| + gfx::Size size); |
| + |
| + explicit UIResourceBitmap(const SkBitmap& skbitmap); |
| + |
| + UIResourceBitmap(const UIResourceBitmap& src); |
| + |
| + UIResourceBitmap& operator=(const UIResourceBitmap& src); |
| + |
| + explicit UIResourceBitmap(); |
| - UIResourceBitmap(); |
| ~UIResourceBitmap(); |
| - scoped_ptr<uint8_t[]> pixels_; |
| + private: |
| + void Create(SkPixelRef* pixel_ref, UIResourceFormat format, gfx::Size size); |
| + |
| + SkPixelRef* pixel_ref_; |
|
jdduke (slow)
2013/09/05 18:39:53
Hmm, if we're going to use an SkPixelRef backing,
aelias_OOO_until_Jul13
2013/09/05 18:42:32
No, because we intend to support ETC1 compressed b
jdduke (slow)
2013/09/05 18:51:05
I see, though I wasn't proposing we expose the SkB
powei
2013/09/05 20:37:35
I'm a little worried that might cause some confusi
aelias_OOO_until_Jul13
2013/09/06 04:17:37
I think SkPixelRef is the right level of abstracti
|
| UIResourceFormat format_; |
| gfx::Size size_; |
| - |
| - DISALLOW_COPY_AND_ASSIGN(UIResourceBitmap); |
| }; |
| } // namespace cc |