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

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

Issue 22529002: [cc] Allow resources and ui resources to specify wrap mode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix typo and add asserts Created 7 years, 4 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 "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"
11 #include "third_party/skia/include/core/SkTypes.h" 11 #include "third_party/skia/include/core/SkTypes.h"
12 #include "ui/gfx/size.h" 12 #include "ui/gfx/size.h"
13 13
14 namespace cc { 14 namespace cc {
15 15
16 // Ref-counted bitmap class (can’t use SkBitmap because of ETC1). Thread-safety 16 // Ref-counted bitmap class (can’t use SkBitmap because of ETC1). Thread-safety
17 // ensures that both main and impl threads can hold references to the bitmap and 17 // ensures that both main and impl threads can hold references to the bitmap and
18 // that asynchronous uploads are allowed. 18 // that asynchronous uploads are allowed.
19 class CC_EXPORT UIResourceBitmap 19 class CC_EXPORT UIResourceBitmap
20 : public base::RefCountedThreadSafe<UIResourceBitmap> { 20 : public base::RefCountedThreadSafe<UIResourceBitmap> {
21 public: 21 public:
22 enum UIResourceFormat { 22 enum UIResourceFormat {
23 RGBA8 23 RGBA8
24 }; 24 };
25 enum UIResourceWrapMode {
26 ClampToEdge,
piman 2013/08/07 20:55:05 nit: chrome style = uppercase for enum values.
ccameron 2013/08/31 00:37:58 Done.
27 Repeat
28 };
25 29
26 // Takes ownership of “pixels”. 30 // Takes ownership of “pixels”.
27 static scoped_refptr<UIResourceBitmap> Create(uint8_t* pixels, 31 static scoped_refptr<UIResourceBitmap> Create(uint8_t* pixels,
28 UIResourceFormat format, 32 UIResourceFormat format,
33 UIResourceWrapMode wrap_mode,
29 gfx::Size size); 34 gfx::Size size);
30 35
31 gfx::Size GetSize() const { return size_; } 36 gfx::Size GetSize() const { return size_; }
32 UIResourceFormat GetFormat() const { return format_; } 37 UIResourceFormat GetFormat() const { return format_; }
38 UIResourceWrapMode GetWrapMode() const { return wrap_mode_; }
33 uint8_t* GetPixels() { return pixels_.get(); } 39 uint8_t* GetPixels() { return pixels_.get(); }
34 40
35 private: 41 private:
36 friend class base::RefCountedThreadSafe<UIResourceBitmap>; 42 friend class base::RefCountedThreadSafe<UIResourceBitmap>;
37 43
38 UIResourceBitmap(); 44 UIResourceBitmap();
39 ~UIResourceBitmap(); 45 ~UIResourceBitmap();
40 46
41 scoped_ptr<uint8_t[]> pixels_; 47 scoped_ptr<uint8_t[]> pixels_;
42 UIResourceFormat format_; 48 UIResourceFormat format_;
49 UIResourceWrapMode wrap_mode_;
43 gfx::Size size_; 50 gfx::Size size_;
44 51
45 DISALLOW_COPY_AND_ASSIGN(UIResourceBitmap); 52 DISALLOW_COPY_AND_ASSIGN(UIResourceBitmap);
46 }; 53 };
47 54
48 } // namespace cc 55 } // namespace cc
49 56
50 #endif // CC_RESOURCES_UI_RESOURCE_BITMAP_H_ 57 #endif // CC_RESOURCES_UI_RESOURCE_BITMAP_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698