OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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_RESOURCE_H_ | 5 #ifndef CC_RESOURCES_RESOURCE_H_ |
6 #define CC_RESOURCES_RESOURCE_H_ | 6 #define CC_RESOURCES_RESOURCE_H_ |
7 | 7 |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "cc/base/cc_export.h" | 10 #include "cc/base/cc_export.h" |
11 #include "cc/resources/resource_provider.h" | 11 #include "cc/resources/resource_provider.h" |
12 #include "cc/resources/resource_util.h" | 12 #include "cc/resources/resource_util.h" |
13 #include "ui/gfx/geometry/size.h" | 13 #include "ui/gfx/geometry/size.h" |
14 | 14 |
15 namespace cc { | 15 namespace cc { |
16 | 16 |
17 class CC_EXPORT Resource { | 17 class CC_EXPORT Resource { |
18 public: | 18 public: |
19 Resource() : id_(0), format_(RGBA_8888) {} | 19 Resource() : id_(0), format_(RGBA_8888) {} |
20 Resource(unsigned id, const gfx::Size& size, ResourceFormat format) | 20 Resource(unsigned id, |
21 : id_(id), | 21 const gfx::Size& size, |
22 size_(size), | 22 ResourceFormat format, |
23 format_(format) {} | 23 const gfx::ColorSpace& color_space) |
| 24 : id_(id), size_(size), format_(format), color_space_(color_space) {} |
24 | 25 |
25 ResourceId id() const { return id_; } | 26 ResourceId id() const { return id_; } |
26 gfx::Size size() const { return size_; } | 27 gfx::Size size() const { return size_; } |
27 ResourceFormat format() const { return format_; } | 28 ResourceFormat format() const { return format_; } |
| 29 const gfx::ColorSpace& color_space() const { return color_space_; } |
28 | 30 |
29 protected: | 31 protected: |
30 void set_id(ResourceId id) { id_ = id; } | 32 void set_id(ResourceId id) { id_ = id; } |
31 void set_dimensions(const gfx::Size& size, ResourceFormat format) { | 33 void set_dimensions(const gfx::Size& size, ResourceFormat format) { |
32 size_ = size; | 34 size_ = size; |
33 format_ = format; | 35 format_ = format; |
34 } | 36 } |
35 | 37 |
36 private: | 38 private: |
37 ResourceId id_; | 39 ResourceId id_; |
38 gfx::Size size_; | 40 gfx::Size size_; |
39 ResourceFormat format_; | 41 ResourceFormat format_; |
| 42 gfx::ColorSpace color_space_; |
40 | 43 |
41 DISALLOW_COPY_AND_ASSIGN(Resource); | 44 DISALLOW_COPY_AND_ASSIGN(Resource); |
42 }; | 45 }; |
43 | 46 |
44 } // namespace cc | 47 } // namespace cc |
45 | 48 |
46 #endif // CC_RESOURCES_RESOURCE_H_ | 49 #endif // CC_RESOURCES_RESOURCE_H_ |
OLD | NEW |