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" |
(...skipping 26 matching lines...) Expand all Loading... |
37 gfx::Size GetSize() const { return size_; } | 37 gfx::Size GetSize() const { return size_; } |
38 UIResourceFormat GetFormat() const { return format_; } | 38 UIResourceFormat GetFormat() const { return format_; } |
39 UIResourceWrapMode GetWrapMode() const { return wrap_mode_; } | 39 UIResourceWrapMode GetWrapMode() const { return wrap_mode_; } |
40 void SetWrapMode(UIResourceWrapMode wrap_mode) { wrap_mode_ = wrap_mode; } | 40 void SetWrapMode(UIResourceWrapMode wrap_mode) { wrap_mode_ = wrap_mode; } |
41 bool GetOpaque() const { return opaque_; } | 41 bool GetOpaque() const { return opaque_; } |
42 void SetOpaque(bool opaque) { opaque_ = opaque; } | 42 void SetOpaque(bool opaque) { opaque_ = opaque; } |
43 | 43 |
44 // User must ensure that |skbitmap| is immutable. The SkBitmap Format should | 44 // User must ensure that |skbitmap| is immutable. The SkBitmap Format should |
45 // be 32-bit RGBA. | 45 // be 32-bit RGBA. |
46 explicit UIResourceBitmap(const SkBitmap& skbitmap); | 46 explicit UIResourceBitmap(const SkBitmap& skbitmap); |
47 UIResourceBitmap(const skia::RefPtr<SkPixelRef>& pixel_ref, gfx::Size size); | 47 UIResourceBitmap(const gfx::Size& size, bool is_opaque); |
| 48 UIResourceBitmap(const skia::RefPtr<SkPixelRef>& pixel_ref, |
| 49 const gfx::Size& size); |
48 ~UIResourceBitmap(); | 50 ~UIResourceBitmap(); |
49 | 51 |
50 private: | 52 private: |
51 friend class AutoLockUIResourceBitmap; | 53 friend class AutoLockUIResourceBitmap; |
52 | 54 |
53 void Create(const skia::RefPtr<SkPixelRef>& pixel_ref, | 55 void Create(const skia::RefPtr<SkPixelRef>& pixel_ref, |
54 gfx::Size size, | 56 const gfx::Size& size, |
55 UIResourceFormat format); | 57 UIResourceFormat format); |
56 | 58 |
57 skia::RefPtr<SkPixelRef> pixel_ref_; | 59 skia::RefPtr<SkPixelRef> pixel_ref_; |
58 UIResourceFormat format_; | 60 UIResourceFormat format_; |
59 UIResourceWrapMode wrap_mode_; | 61 UIResourceWrapMode wrap_mode_; |
60 gfx::Size size_; | 62 gfx::Size size_; |
61 bool opaque_; | 63 bool opaque_; |
62 }; | 64 }; |
63 | 65 |
64 class CC_EXPORT AutoLockUIResourceBitmap { | 66 class CC_EXPORT AutoLockUIResourceBitmap { |
65 public: | 67 public: |
66 explicit AutoLockUIResourceBitmap(const UIResourceBitmap& bitmap); | 68 explicit AutoLockUIResourceBitmap(const UIResourceBitmap& bitmap); |
67 ~AutoLockUIResourceBitmap(); | 69 ~AutoLockUIResourceBitmap(); |
68 const uint8_t* GetPixels() const; | 70 const uint8_t* GetPixels() const; |
69 | 71 |
70 private: | 72 private: |
71 const UIResourceBitmap& bitmap_; | 73 const UIResourceBitmap& bitmap_; |
72 }; | 74 }; |
73 | 75 |
74 } // namespace cc | 76 } // namespace cc |
75 | 77 |
76 #endif // CC_RESOURCES_UI_RESOURCE_BITMAP_H_ | 78 #endif // CC_RESOURCES_UI_RESOURCE_BITMAP_H_ |
OLD | NEW |