Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(287)

Side by Side Diff: cc/resources/ui_resource_bitmap.cc

Issue 2823003002: SkBitmap and SkPixelRef no longer need lock/unlock (Closed)
Patch Set: win fix after rebase Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/resources/ui_resource_bitmap.h ('k') | cc/test/pixel_comparator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « cc/resources/ui_resource_bitmap.h ('k') | cc/test/pixel_comparator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698