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

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

Issue 1869753003: Replace many skia::RefPtr with sk_sp<> in cc/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fmalita review - deconstify sk_sp<>s Created 4 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
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 #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 <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
11 11
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "cc/base/cc_export.h" 13 #include "cc/base/cc_export.h"
14 #include "skia/ext/refptr.h"
15 #include "third_party/skia/include/core/SkPixelRef.h" 14 #include "third_party/skia/include/core/SkPixelRef.h"
16 #include "ui/gfx/geometry/size.h" 15 #include "ui/gfx/geometry/size.h"
17 16
18 class SkBitmap; 17 class SkBitmap;
19 18
20 namespace cc { 19 namespace cc {
21 20
22 class ETC1PixelRef; 21 class ETC1PixelRef;
23 22
24 // A bitmap class that contains a ref-counted reference to a SkPixelRef that 23 // A bitmap class that contains a ref-counted reference to a SkPixelRef that
(...skipping 10 matching lines...) Expand all
35 34
36 gfx::Size GetSize() const { return size_; } 35 gfx::Size GetSize() const { return size_; }
37 UIResourceFormat GetFormat() const { return format_; } 36 UIResourceFormat GetFormat() const { return format_; }
38 bool GetOpaque() const { return opaque_; } 37 bool GetOpaque() const { return opaque_; }
39 void SetOpaque(bool opaque) { opaque_ = opaque; } 38 void SetOpaque(bool opaque) { opaque_ = opaque; }
40 39
41 // User must ensure that |skbitmap| is immutable. The SkBitmap Format should 40 // User must ensure that |skbitmap| is immutable. The SkBitmap Format should
42 // be 32-bit RGBA or 8-bit ALPHA. 41 // be 32-bit RGBA or 8-bit ALPHA.
43 explicit UIResourceBitmap(const SkBitmap& skbitmap); 42 explicit UIResourceBitmap(const SkBitmap& skbitmap);
44 UIResourceBitmap(const gfx::Size& size, bool is_opaque); 43 UIResourceBitmap(const gfx::Size& size, bool is_opaque);
45 UIResourceBitmap(const skia::RefPtr<SkPixelRef>& pixel_ref, 44 UIResourceBitmap(sk_sp<SkPixelRef> pixel_ref, const gfx::Size& size);
46 const gfx::Size& size);
47 UIResourceBitmap(const UIResourceBitmap& other); 45 UIResourceBitmap(const UIResourceBitmap& other);
48 ~UIResourceBitmap(); 46 ~UIResourceBitmap();
49 47
50 private: 48 private:
51 friend class AutoLockUIResourceBitmap; 49 friend class AutoLockUIResourceBitmap;
52 50
53 void Create(const skia::RefPtr<SkPixelRef>& pixel_ref, 51 void Create(sk_sp<SkPixelRef> pixel_ref,
54 const gfx::Size& size, 52 const gfx::Size& size,
55 UIResourceFormat format); 53 UIResourceFormat format);
56 54
57 skia::RefPtr<SkPixelRef> pixel_ref_; 55 sk_sp<SkPixelRef> pixel_ref_;
58 UIResourceFormat format_; 56 UIResourceFormat format_;
59 gfx::Size size_; 57 gfx::Size size_;
60 bool opaque_; 58 bool opaque_;
61 }; 59 };
62 60
63 class CC_EXPORT AutoLockUIResourceBitmap { 61 class CC_EXPORT AutoLockUIResourceBitmap {
64 public: 62 public:
65 explicit AutoLockUIResourceBitmap(const UIResourceBitmap& bitmap); 63 explicit AutoLockUIResourceBitmap(const UIResourceBitmap& bitmap);
66 ~AutoLockUIResourceBitmap(); 64 ~AutoLockUIResourceBitmap();
67 const uint8_t* GetPixels() const; 65 const uint8_t* GetPixels() const;
68 66
69 private: 67 private:
70 const UIResourceBitmap& bitmap_; 68 const UIResourceBitmap& bitmap_;
71 }; 69 };
72 70
73 } // namespace cc 71 } // namespace cc
74 72
75 #endif // CC_RESOURCES_UI_RESOURCE_BITMAP_H_ 73 #endif // CC_RESOURCES_UI_RESOURCE_BITMAP_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698