Chromium Code Reviews| Index: cc/resources/ui_resource_bitmap.h |
| =================================================================== |
| --- cc/resources/ui_resource_bitmap.h (revision 0) |
| +++ cc/resources/ui_resource_bitmap.h (revision 0) |
| @@ -0,0 +1,38 @@ |
| +// Copyright 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CC_RESOURCES_UI_RESOURCE_BITMAP_H_ |
| +#define CC_RESOURCES_UI_RESOURCE_BITMAP_H_ |
| + |
| +#include "base/memory/ref_counted.h" |
| +#include "ui/gfx/size.h" |
| + |
| +namespace cc { |
| + |
| +// Ref-counted bitmap class (can’t use SkBitmap because of ETC1) |
|
enne (OOO)
2013/07/22 23:09:15
Could you also mention why this needs to be thread
powei
2013/07/24 02:28:29
Done.
|
| +class UIResourceBitmap : public base::RefCountedThreadSafe<UIResourceBitmap> { |
| + public: |
| + enum UIResourceFormat { |
| + RGBA8, |
| + ETC1 |
|
enne (OOO)
2013/07/22 23:09:15
If ETC1 isn't handled yet, please don't include it
powei
2013/07/24 02:28:29
Done.
|
| + }; |
| + |
| + // Takes ownership of “pixels”. |
| + static scoped_refptr<UIResourceBitmap> Create(void* pixels, |
|
aelias_OOO_until_Jul13
2013/07/23 00:06:48
Could these void* just be uint8_t* instead? Then
powei
2013/07/24 02:28:29
Done.
|
| + UIResourceFormat format, |
| + gfx::Size size); |
| + |
| + gfx::Size GetSize() const { return size_; } |
| + UIResourceFormat GetFormat() const { return format_; } |
| + void* GetPixels() { return pixels_.get(); } |
| + |
| + private: |
| + scoped_ptr<uint8_t[]> pixels_; |
| + UIResourceFormat format_; |
| + gfx::Size size_; |
| +}; |
| + |
| +} // namespace cc |
| + |
| +#endif // CC_RESOURCES_UI_RESOURCE_BITMAP_H_ |