OLD | NEW |
(Empty) | |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CC_RESOURCES_UI_RESOURCE_BITMAP_H_ |
| 6 #define CC_RESOURCES_UI_RESOURCE_BITMAP_H_ |
| 7 |
| 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "ui/gfx/size.h" |
| 11 |
| 12 namespace cc { |
| 13 |
| 14 // Ref-counted bitmap class (can’t use SkBitmap because of ETC1). Thread-safety |
| 15 // ensures that both main and impl threads can hold references to the bitmap and |
| 16 // that asynchronous uploads are allowed. |
| 17 class UIResourceBitmap : public base::RefCountedThreadSafe<UIResourceBitmap> { |
| 18 public: |
| 19 enum UIResourceFormat { |
| 20 RGBA8 |
| 21 }; |
| 22 |
| 23 // Takes ownership of “pixels”. |
| 24 static scoped_refptr<UIResourceBitmap> Create(uint8_t* pixels, |
| 25 UIResourceFormat format, |
| 26 gfx::Size size); |
| 27 |
| 28 gfx::Size GetSize() const { return size_; } |
| 29 UIResourceFormat GetFormat() const { return format_; } |
| 30 uint8_t* GetPixels() { return pixels_.get(); } |
| 31 |
| 32 private: |
| 33 scoped_ptr<uint8_t[]> pixels_; |
| 34 UIResourceFormat format_; |
| 35 gfx::Size size_; |
| 36 }; |
| 37 |
| 38 } // namespace cc |
| 39 |
| 40 #endif // CC_RESOURCES_UI_RESOURCE_BITMAP_H_ |
OLD | NEW |