OLD | NEW |
---|---|
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_TILES_TILE_DRAW_INFO_H_ | 5 #ifndef CC_TILES_TILE_DRAW_INFO_H_ |
6 #define CC_TILES_TILE_DRAW_INFO_H_ | 6 #define CC_TILES_TILE_DRAW_INFO_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/trace_event/trace_event_argument.h" | 10 #include "base/trace_event/trace_event_argument.h" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
70 bool requires_resource() const { | 70 bool requires_resource() const { |
71 return mode_ == RESOURCE_MODE || mode_ == OOM_MODE; | 71 return mode_ == RESOURCE_MODE || mode_ == OOM_MODE; |
72 } | 72 } |
73 | 73 |
74 inline bool has_resource() const { return !!resource_; } | 74 inline bool has_resource() const { return !!resource_; } |
75 | 75 |
76 inline bool has_compressed_resource() const { | 76 inline bool has_compressed_resource() const { |
77 return resource_ ? IsResourceFormatCompressed(resource_->format()) : false; | 77 return resource_ ? IsResourceFormatCompressed(resource_->format()) : false; |
78 } | 78 } |
79 | 79 |
80 bool is_checker_imaged() const { | |
vmpstr
2017/03/29 19:11:45
Just by looking at tile.h and tile_draw_info.h, th
Khushal
2017/03/31 04:31:00
Done.
| |
81 return has_resource() && resource_is_checker_imaged_; | |
82 } | |
83 | |
80 void SetSolidColorForTesting(SkColor color) { set_solid_color(color); } | 84 void SetSolidColorForTesting(SkColor color) { set_solid_color(color); } |
81 | 85 |
82 void AsValueInto(base::trace_event::TracedValue* state) const; | 86 void AsValueInto(base::trace_event::TracedValue* state) const; |
83 | 87 |
84 private: | 88 private: |
85 friend class Tile; | 89 friend class Tile; |
86 friend class TileManager; | 90 friend class TileManager; |
87 | 91 |
88 const Resource* resource() const { return resource_; } | 92 const Resource* resource() const { return resource_; } |
89 | 93 |
90 void set_resource(Resource* resource) { | 94 void set_resource(Resource* resource) { |
91 mode_ = RESOURCE_MODE; | 95 mode_ = RESOURCE_MODE; |
92 is_resource_ready_to_draw_ = false; | 96 is_resource_ready_to_draw_ = false; |
97 resource_is_checker_imaged_ = false; | |
vmpstr
2017/03/29 19:11:45
What if we set a resource that _is_ checker imaged
Khushal
2017/03/29 22:10:20
That makes sense.
Khushal
2017/03/31 04:31:00
Done.
| |
93 resource_ = resource; | 98 resource_ = resource; |
94 } | 99 } |
95 | 100 |
96 void set_resource_ready_for_draw() { | 101 void set_resource_ready_for_draw() { |
97 is_resource_ready_to_draw_ = true; | 102 is_resource_ready_to_draw_ = true; |
98 } | 103 } |
99 | 104 |
100 Resource* TakeResource(); | 105 Resource* TakeResource(); |
101 | 106 |
102 void set_solid_color(const SkColor& color) { | 107 void set_solid_color(const SkColor& color) { |
103 mode_ = SOLID_COLOR_MODE; | 108 mode_ = SOLID_COLOR_MODE; |
104 solid_color_ = color; | 109 solid_color_ = color; |
105 } | 110 } |
106 | 111 |
107 void set_oom() { mode_ = OOM_MODE; } | 112 void set_oom() { mode_ = OOM_MODE; } |
108 | 113 |
109 Mode mode_ = RESOURCE_MODE; | 114 Mode mode_ = RESOURCE_MODE; |
110 SkColor solid_color_ = SK_ColorWHITE; | 115 SkColor solid_color_ = SK_ColorWHITE; |
111 Resource* resource_ = nullptr; | 116 Resource* resource_ = nullptr; |
117 bool resource_is_checker_imaged_ = false; | |
vmpstr
2017/03/29 19:11:45
I'm not really a fan of "checker_imaged" as a name
Khushal
2017/03/29 22:10:20
At this point, may be just keep that for consisten
| |
112 bool contents_swizzled_ = false; | 118 bool contents_swizzled_ = false; |
113 bool is_resource_ready_to_draw_ = false; | 119 bool is_resource_ready_to_draw_ = false; |
114 }; | 120 }; |
115 | 121 |
116 } // namespace cc | 122 } // namespace cc |
117 | 123 |
118 #endif // CC_TILES_TILE_DRAW_INFO_H_ | 124 #endif // CC_TILES_TILE_DRAW_INFO_H_ |
OLD | NEW |