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

Unified Diff: cc/resources/ui_resource_bitmap.h

Issue 22870016: Update the nine patch layer to use UI resources (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: changed from raw SkPixelRef pointers to skia::RefPtr<SkPixelRef> Created 7 years, 3 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.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

Powered by Google App Engine
This is Rietveld 408576698