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

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

Issue 1057283003: Remove parts of //cc we aren't using (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 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/transform_display_item.cc ('k') | cc/resources/ui_resource_bitmap.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CC_RESOURCES_UI_RESOURCE_BITMAP_H_
6 #define CC_RESOURCES_UI_RESOURCE_BITMAP_H_
7
8 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "cc/base/cc_export.h"
11 #include "skia/ext/refptr.h"
12 #include "third_party/skia/include/core/SkPixelRef.h"
13 #include "ui/gfx/geometry/size.h"
14
15 class SkBitmap;
16
17 namespace cc {
18
19 class ETC1PixelRef;
20
21 // A bitmap class that contains a ref-counted reference to a SkPixelRef that
22 // holds the content of the bitmap (cannot use SkBitmap because of ETC1).
23 // Thread-safety (by ways of SkPixelRef) ensures that both main and impl threads
24 // can hold references to the bitmap and that asynchronous uploads are allowed.
25 class CC_EXPORT UIResourceBitmap {
26 public:
27 enum UIResourceFormat {
28 RGBA8,
29 ALPHA_8,
30 ETC1
31 };
32 enum UIResourceWrapMode {
33 CLAMP_TO_EDGE,
34 REPEAT
35 };
36
37 gfx::Size GetSize() const { return size_; }
38 UIResourceFormat GetFormat() const { return format_; }
39 UIResourceWrapMode GetWrapMode() const { return wrap_mode_; }
40 void SetWrapMode(UIResourceWrapMode wrap_mode) { wrap_mode_ = wrap_mode; }
41 bool GetOpaque() const { return opaque_; }
42 void SetOpaque(bool opaque) { opaque_ = opaque; }
43
44 // User must ensure that |skbitmap| is immutable. The SkBitmap Format should
45 // be 32-bit RGBA or 8-bit ALPHA.
46 explicit UIResourceBitmap(const SkBitmap& skbitmap);
47 UIResourceBitmap(const gfx::Size& size, bool is_opaque);
48 UIResourceBitmap(const skia::RefPtr<SkPixelRef>& pixel_ref,
49 const gfx::Size& size);
50 ~UIResourceBitmap();
51
52 private:
53 friend class AutoLockUIResourceBitmap;
54
55 void Create(const skia::RefPtr<SkPixelRef>& pixel_ref,
56 const gfx::Size& size,
57 UIResourceFormat format);
58
59 skia::RefPtr<SkPixelRef> pixel_ref_;
60 UIResourceFormat format_;
61 UIResourceWrapMode wrap_mode_;
62 gfx::Size size_;
63 bool opaque_;
64 };
65
66 class CC_EXPORT AutoLockUIResourceBitmap {
67 public:
68 explicit AutoLockUIResourceBitmap(const UIResourceBitmap& bitmap);
69 ~AutoLockUIResourceBitmap();
70 const uint8_t* GetPixels() const;
71
72 private:
73 const UIResourceBitmap& bitmap_;
74 };
75
76 } // namespace cc
77
78 #endif // CC_RESOURCES_UI_RESOURCE_BITMAP_H_
OLDNEW
« no previous file with comments | « cc/resources/transform_display_item.cc ('k') | cc/resources/ui_resource_bitmap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698