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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 gfx::Rect quad_rect(bounds()); | 122 gfx::Rect quad_rect(bounds()); |
123 gfx::Rect opaque_rect(opaque ? quad_rect : gfx::Rect()); | 123 gfx::Rect opaque_rect(opaque ? quad_rect : gfx::Rect()); |
124 gfx::Rect visible_quad_rect = | 124 gfx::Rect visible_quad_rect = |
125 draw_properties().occlusion_in_content_space.GetUnoccludedContentRect( | 125 draw_properties().occlusion_in_content_space.GetUnoccludedContentRect( |
126 quad_rect); | 126 quad_rect); |
127 if (visible_quad_rect.IsEmpty()) | 127 if (visible_quad_rect.IsEmpty()) |
128 return; | 128 return; |
129 | 129 |
130 TextureDrawQuad* quad = | 130 TextureDrawQuad* quad = |
131 render_pass->CreateAndAppendDrawQuad<TextureDrawQuad>(); | 131 render_pass->CreateAndAppendDrawQuad<TextureDrawQuad>(); |
132 quad->SetNew(shared_quad_state, | 132 quad->SetNew(shared_quad_state, quad_rect, opaque_rect, visible_quad_rect, |
133 quad_rect, | 133 resource, premultiplied_alpha, uv_top_left_, uv_bottom_right_, |
134 opaque_rect, | 134 SK_ColorTRANSPARENT, vertex_opacity_, flipped, nearest_neighbor, |
135 visible_quad_rect, | 135 false); |
136 resource, | |
137 premultiplied_alpha, | |
138 uv_top_left_, | |
139 uv_bottom_right_, | |
140 SK_ColorTRANSPARENT, | |
141 vertex_opacity_, | |
142 flipped, | |
143 nearest_neighbor); | |
144 ValidateQuadResources(quad); | 136 ValidateQuadResources(quad); |
145 } | 137 } |
146 | 138 |
147 const char* UIResourceLayerImpl::LayerTypeAsString() const { | 139 const char* UIResourceLayerImpl::LayerTypeAsString() const { |
148 return "cc::UIResourceLayerImpl"; | 140 return "cc::UIResourceLayerImpl"; |
149 } | 141 } |
150 | 142 |
151 base::DictionaryValue* UIResourceLayerImpl::LayerTreeAsJson() const { | 143 base::DictionaryValue* UIResourceLayerImpl::LayerTreeAsJson() const { |
152 base::DictionaryValue* result = LayerImpl::LayerTreeAsJson(); | 144 base::DictionaryValue* result = LayerImpl::LayerTreeAsJson(); |
153 | 145 |
154 result->Set("ImageBounds", MathUtil::AsValue(image_bounds_).release()); | 146 result->Set("ImageBounds", MathUtil::AsValue(image_bounds_).release()); |
155 | 147 |
156 base::ListValue* list = new base::ListValue; | 148 base::ListValue* list = new base::ListValue; |
157 list->AppendDouble(vertex_opacity_[0]); | 149 list->AppendDouble(vertex_opacity_[0]); |
158 list->AppendDouble(vertex_opacity_[1]); | 150 list->AppendDouble(vertex_opacity_[1]); |
159 list->AppendDouble(vertex_opacity_[2]); | 151 list->AppendDouble(vertex_opacity_[2]); |
160 list->AppendDouble(vertex_opacity_[3]); | 152 list->AppendDouble(vertex_opacity_[3]); |
161 result->Set("VertexOpacity", list); | 153 result->Set("VertexOpacity", list); |
162 | 154 |
163 result->Set("UVTopLeft", MathUtil::AsValue(uv_top_left_).release()); | 155 result->Set("UVTopLeft", MathUtil::AsValue(uv_top_left_).release()); |
164 result->Set("UVBottomRight", MathUtil::AsValue(uv_bottom_right_).release()); | 156 result->Set("UVBottomRight", MathUtil::AsValue(uv_bottom_right_).release()); |
165 | 157 |
166 return result; | 158 return result; |
167 } | 159 } |
168 | 160 |
169 } // namespace cc | 161 } // namespace cc |
OLD | NEW |