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 #include "cc/resources/ui_resource_bitmap.h" | 5 #include "cc/resources/ui_resource_bitmap.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 } | 82 } |
83 | 83 |
84 UIResourceBitmap::UIResourceBitmap(sk_sp<SkPixelRef> pixel_ref, | 84 UIResourceBitmap::UIResourceBitmap(sk_sp<SkPixelRef> pixel_ref, |
85 const gfx::Size& size) { | 85 const gfx::Size& size) { |
86 Create(std::move(pixel_ref), size, UIResourceBitmap::ETC1); | 86 Create(std::move(pixel_ref), size, UIResourceBitmap::ETC1); |
87 } | 87 } |
88 | 88 |
89 UIResourceBitmap::UIResourceBitmap(const UIResourceBitmap& other) = default; | 89 UIResourceBitmap::UIResourceBitmap(const UIResourceBitmap& other) = default; |
90 | 90 |
91 UIResourceBitmap::~UIResourceBitmap() {} | 91 UIResourceBitmap::~UIResourceBitmap() {} |
92 | |
93 AutoLockUIResourceBitmap::AutoLockUIResourceBitmap( | |
94 const UIResourceBitmap& bitmap) : bitmap_(bitmap) { | |
95 bitmap_.pixel_ref_->lockPixels(); | |
96 } | |
97 | |
98 AutoLockUIResourceBitmap::~AutoLockUIResourceBitmap() { | |
99 bitmap_.pixel_ref_->unlockPixels(); | |
100 } | |
101 | |
102 const uint8_t* AutoLockUIResourceBitmap::GetPixels() const { | |
103 return static_cast<const uint8_t*>(bitmap_.pixel_ref_->pixels()); | |
104 } | |
105 | |
106 } // namespace cc | 92 } // namespace cc |
OLD | NEW |