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 #include "cc/layers/ui_resource_layer_impl.h" | 5 #include "cc/layers/ui_resource_layer_impl.h" |
6 | 6 |
7 #include "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "cc/base/math_util.h" | 9 #include "cc/base/math_util.h" |
10 #include "cc/quads/texture_draw_quad.h" | 10 #include "cc/quads/texture_draw_quad.h" |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 | 103 |
104 if (!ui_resource_id_) | 104 if (!ui_resource_id_) |
105 return; | 105 return; |
106 | 106 |
107 ResourceProvider::ResourceId resource = | 107 ResourceProvider::ResourceId resource = |
108 layer_tree_impl()->ResourceIdForUIResource(ui_resource_id_); | 108 layer_tree_impl()->ResourceIdForUIResource(ui_resource_id_); |
109 | 109 |
110 if (!resource) | 110 if (!resource) |
111 return; | 111 return; |
112 | 112 |
113 // TODO(danakj): crbug.com/455931 | |
114 layer_tree_impl()->resource_provider()->ValidateResource(resource); | |
115 | |
116 static const bool flipped = false; | 113 static const bool flipped = false; |
117 static const bool nearest_neighbor = false; | 114 static const bool nearest_neighbor = false; |
118 static const bool premultiplied_alpha = true; | 115 static const bool premultiplied_alpha = true; |
119 | 116 |
120 DCHECK(!bounds().IsEmpty()); | 117 DCHECK(!bounds().IsEmpty()); |
121 | 118 |
122 bool opaque = layer_tree_impl()->IsUIResourceOpaque(ui_resource_id_) || | 119 bool opaque = layer_tree_impl()->IsUIResourceOpaque(ui_resource_id_) || |
123 contents_opaque(); | 120 contents_opaque(); |
124 | 121 |
125 gfx::Rect quad_rect(bounds()); | 122 gfx::Rect quad_rect(bounds()); |
(...skipping 11 matching lines...) Expand all Loading... |
137 opaque_rect, | 134 opaque_rect, |
138 visible_quad_rect, | 135 visible_quad_rect, |
139 resource, | 136 resource, |
140 premultiplied_alpha, | 137 premultiplied_alpha, |
141 uv_top_left_, | 138 uv_top_left_, |
142 uv_bottom_right_, | 139 uv_bottom_right_, |
143 SK_ColorTRANSPARENT, | 140 SK_ColorTRANSPARENT, |
144 vertex_opacity_, | 141 vertex_opacity_, |
145 flipped, | 142 flipped, |
146 nearest_neighbor); | 143 nearest_neighbor); |
| 144 ValidateQuadResources(quad); |
147 } | 145 } |
148 | 146 |
149 const char* UIResourceLayerImpl::LayerTypeAsString() const { | 147 const char* UIResourceLayerImpl::LayerTypeAsString() const { |
150 return "cc::UIResourceLayerImpl"; | 148 return "cc::UIResourceLayerImpl"; |
151 } | 149 } |
152 | 150 |
153 base::DictionaryValue* UIResourceLayerImpl::LayerTreeAsJson() const { | 151 base::DictionaryValue* UIResourceLayerImpl::LayerTreeAsJson() const { |
154 base::DictionaryValue* result = LayerImpl::LayerTreeAsJson(); | 152 base::DictionaryValue* result = LayerImpl::LayerTreeAsJson(); |
155 | 153 |
156 result->Set("ImageBounds", MathUtil::AsValue(image_bounds_).release()); | 154 result->Set("ImageBounds", MathUtil::AsValue(image_bounds_).release()); |
157 | 155 |
158 base::ListValue* list = new base::ListValue; | 156 base::ListValue* list = new base::ListValue; |
159 list->AppendDouble(vertex_opacity_[0]); | 157 list->AppendDouble(vertex_opacity_[0]); |
160 list->AppendDouble(vertex_opacity_[1]); | 158 list->AppendDouble(vertex_opacity_[1]); |
161 list->AppendDouble(vertex_opacity_[2]); | 159 list->AppendDouble(vertex_opacity_[2]); |
162 list->AppendDouble(vertex_opacity_[3]); | 160 list->AppendDouble(vertex_opacity_[3]); |
163 result->Set("VertexOpacity", list); | 161 result->Set("VertexOpacity", list); |
164 | 162 |
165 result->Set("UVTopLeft", MathUtil::AsValue(uv_top_left_).release()); | 163 result->Set("UVTopLeft", MathUtil::AsValue(uv_top_left_).release()); |
166 result->Set("UVBottomRight", MathUtil::AsValue(uv_bottom_right_).release()); | 164 result->Set("UVBottomRight", MathUtil::AsValue(uv_bottom_right_).release()); |
167 | 165 |
168 return result; | 166 return result; |
169 } | 167 } |
170 | 168 |
171 } // namespace cc | 169 } // namespace cc |
OLD | NEW |