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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 | 86 |
87 bool UIResourceLayerImpl::WillDraw(DrawMode draw_mode, | 87 bool UIResourceLayerImpl::WillDraw(DrawMode draw_mode, |
88 ResourceProvider* resource_provider) { | 88 ResourceProvider* resource_provider) { |
89 if (!ui_resource_id_ || draw_mode == DRAW_MODE_RESOURCELESS_SOFTWARE) | 89 if (!ui_resource_id_ || draw_mode == DRAW_MODE_RESOURCELESS_SOFTWARE) |
90 return false; | 90 return false; |
91 return LayerImpl::WillDraw(draw_mode, resource_provider); | 91 return LayerImpl::WillDraw(draw_mode, resource_provider); |
92 } | 92 } |
93 | 93 |
94 void UIResourceLayerImpl::AppendQuads( | 94 void UIResourceLayerImpl::AppendQuads( |
95 RenderPass* render_pass, | 95 RenderPass* render_pass, |
96 const Occlusion& occlusion_in_content_space, | |
97 AppendQuadsData* append_quads_data) { | 96 AppendQuadsData* append_quads_data) { |
98 SharedQuadState* shared_quad_state = | 97 SharedQuadState* shared_quad_state = |
99 render_pass->CreateAndAppendSharedQuadState(); | 98 render_pass->CreateAndAppendSharedQuadState(); |
100 PopulateSharedQuadState(shared_quad_state); | 99 PopulateSharedQuadState(shared_quad_state); |
101 | 100 |
102 AppendDebugBorderQuad( | 101 AppendDebugBorderQuad( |
103 render_pass, content_bounds(), shared_quad_state, append_quads_data); | 102 render_pass, content_bounds(), shared_quad_state, append_quads_data); |
104 | 103 |
105 if (!ui_resource_id_) | 104 if (!ui_resource_id_) |
106 return; | 105 return; |
107 | 106 |
108 ResourceProvider::ResourceId resource = | 107 ResourceProvider::ResourceId resource = |
109 layer_tree_impl()->ResourceIdForUIResource(ui_resource_id_); | 108 layer_tree_impl()->ResourceIdForUIResource(ui_resource_id_); |
110 | 109 |
111 if (!resource) | 110 if (!resource) |
112 return; | 111 return; |
113 | 112 |
114 static const bool flipped = false; | 113 static const bool flipped = false; |
115 static const bool nearest_neighbor = false; | 114 static const bool nearest_neighbor = false; |
116 static const bool premultiplied_alpha = true; | 115 static const bool premultiplied_alpha = true; |
117 | 116 |
118 DCHECK(!bounds().IsEmpty()); | 117 DCHECK(!bounds().IsEmpty()); |
119 | 118 |
120 bool opaque = layer_tree_impl()->IsUIResourceOpaque(ui_resource_id_) || | 119 bool opaque = layer_tree_impl()->IsUIResourceOpaque(ui_resource_id_) || |
121 contents_opaque(); | 120 contents_opaque(); |
122 | 121 |
123 gfx::Rect quad_rect(bounds()); | 122 gfx::Rect quad_rect(bounds()); |
124 gfx::Rect opaque_rect(opaque ? quad_rect : gfx::Rect()); | 123 gfx::Rect opaque_rect(opaque ? quad_rect : gfx::Rect()); |
125 gfx::Rect visible_quad_rect = | 124 gfx::Rect visible_quad_rect = |
126 occlusion_in_content_space.GetUnoccludedContentRect(quad_rect); | 125 draw_properties().occlusion_in_content_space.GetUnoccludedContentRect( |
| 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, |
133 quad_rect, | 133 quad_rect, |
134 opaque_rect, | 134 opaque_rect, |
135 visible_quad_rect, | 135 visible_quad_rect, |
136 resource, | 136 resource, |
(...skipping 22 matching lines...) Expand all Loading... |
159 list->AppendDouble(vertex_opacity_[3]); | 159 list->AppendDouble(vertex_opacity_[3]); |
160 result->Set("VertexOpacity", list); | 160 result->Set("VertexOpacity", list); |
161 | 161 |
162 result->Set("UVTopLeft", MathUtil::AsValue(uv_top_left_).release()); | 162 result->Set("UVTopLeft", MathUtil::AsValue(uv_top_left_).release()); |
163 result->Set("UVBottomRight", MathUtil::AsValue(uv_bottom_right_).release()); | 163 result->Set("UVBottomRight", MathUtil::AsValue(uv_bottom_right_).release()); |
164 | 164 |
165 return result; | 165 return result; |
166 } | 166 } |
167 | 167 |
168 } // namespace cc | 168 } // namespace cc |
OLD | NEW |