| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CC_RESOURCES_UI_RESOURCE_BITMAP_H_ | 5 #ifndef CC_RESOURCES_UI_RESOURCE_BITMAP_H_ |
| 6 #define CC_RESOURCES_UI_RESOURCE_BITMAP_H_ | 6 #define CC_RESOURCES_UI_RESOURCE_BITMAP_H_ |
| 7 | 7 |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "cc/base/cc_export.h" | 10 #include "cc/base/cc_export.h" |
| 11 #include "third_party/skia/include/core/SkTypes.h" | 11 #include "third_party/skia/include/core/SkTypes.h" |
| 12 #include "ui/gfx/size.h" | 12 #include "ui/gfx/size.h" |
| 13 | 13 |
| 14 class SkBitmap; |
| 15 |
| 16 namespace gfx { |
| 17 class JavaBitmap; |
| 18 } |
| 19 |
| 14 namespace cc { | 20 namespace cc { |
| 15 | 21 |
| 16 // Ref-counted bitmap class (can’t use SkBitmap because of ETC1). Thread-safety | 22 // Ref-counted bitmap class (can’t use SkBitmap because of ETC1). Thread-safety |
| 17 // ensures that both main and impl threads can hold references to the bitmap and | 23 // ensures that both main and impl threads can hold references to the bitmap and |
| 18 // that asynchronous uploads are allowed. | 24 // that asynchronous uploads are allowed. |
| 19 class CC_EXPORT UIResourceBitmap | 25 class CC_EXPORT UIResourceBitmap |
| 20 : public base::RefCountedThreadSafe<UIResourceBitmap> { | 26 : public base::RefCountedThreadSafe<UIResourceBitmap> { |
| 21 public: | 27 public: |
| 22 enum UIResourceFormat { | 28 enum UIResourceFormat { |
| 23 RGBA8 | 29 RGBA8 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 38 UIResourceBitmap(); | 44 UIResourceBitmap(); |
| 39 ~UIResourceBitmap(); | 45 ~UIResourceBitmap(); |
| 40 | 46 |
| 41 scoped_ptr<uint8_t[]> pixels_; | 47 scoped_ptr<uint8_t[]> pixels_; |
| 42 UIResourceFormat format_; | 48 UIResourceFormat format_; |
| 43 gfx::Size size_; | 49 gfx::Size size_; |
| 44 | 50 |
| 45 DISALLOW_COPY_AND_ASSIGN(UIResourceBitmap); | 51 DISALLOW_COPY_AND_ASSIGN(UIResourceBitmap); |
| 46 }; | 52 }; |
| 47 | 53 |
| 54 CC_EXPORT scoped_refptr<UIResourceBitmap> CreateUIResourceBitmapFromSkBitmap( |
| 55 const SkBitmap& skbitmap); |
| 56 |
| 57 // If the resource loads successfully, it will be resized to |size|. |
| 58 CC_EXPORT scoped_refptr<UIResourceBitmap> CreateUIResourceBitmapFromJavaBitmap( |
| 59 gfx::JavaBitmap& bitmap); |
| 60 |
| 48 } // namespace cc | 61 } // namespace cc |
| 49 | 62 |
| 50 #endif // CC_RESOURCES_UI_RESOURCE_BITMAP_H_ | 63 #endif // CC_RESOURCES_UI_RESOURCE_BITMAP_H_ |
| OLD | NEW |