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 #include "cc/layers/picture_layer_impl.h" | 5 #include "cc/layers/picture_layer_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 #include <limits> | 9 #include <limits> |
10 #include <set> | 10 #include <set> |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 | 146 |
147 layer_impl->SanityCheckTilingState(); | 147 layer_impl->SanityCheckTilingState(); |
148 | 148 |
149 // We always need to push properties. | 149 // We always need to push properties. |
150 // See http://crbug.com/303943 | 150 // See http://crbug.com/303943 |
151 // TODO(danakj): Stop always pushing properties since we don't swap tilings. | 151 // TODO(danakj): Stop always pushing properties since we don't swap tilings. |
152 needs_push_properties_ = true; | 152 needs_push_properties_ = true; |
153 } | 153 } |
154 | 154 |
155 void PictureLayerImpl::AppendQuads(RenderPass* render_pass, | 155 void PictureLayerImpl::AppendQuads(RenderPass* render_pass, |
156 const Occlusion& occlusion_in_content_space, | |
157 AppendQuadsData* append_quads_data) { | 156 AppendQuadsData* append_quads_data) { |
158 // The bounds and the pile size may differ if the pile wasn't updated (ie. | 157 // The bounds and the pile size may differ if the pile wasn't updated (ie. |
159 // PictureLayer::Update didn't happen). In that case the pile will be empty. | 158 // PictureLayer::Update didn't happen). In that case the pile will be empty. |
160 DCHECK_IMPLIES(!raster_source_->GetSize().IsEmpty(), | 159 DCHECK_IMPLIES(!raster_source_->GetSize().IsEmpty(), |
161 bounds() == raster_source_->GetSize()) | 160 bounds() == raster_source_->GetSize()) |
162 << " bounds " << bounds().ToString() << " pile " | 161 << " bounds " << bounds().ToString() << " pile " |
163 << raster_source_->GetSize().ToString(); | 162 << raster_source_->GetSize().ToString(); |
164 | 163 |
165 SharedQuadState* shared_quad_state = | 164 SharedQuadState* shared_quad_state = |
166 render_pass->CreateAndAppendSharedQuadState(); | 165 render_pass->CreateAndAppendSharedQuadState(); |
167 | 166 |
168 if (raster_source_->IsSolidColor()) { | 167 if (raster_source_->IsSolidColor()) { |
169 PopulateSharedQuadState(shared_quad_state); | 168 PopulateSharedQuadState(shared_quad_state); |
170 | 169 |
171 AppendDebugBorderQuad( | 170 AppendDebugBorderQuad( |
172 render_pass, bounds(), shared_quad_state, append_quads_data); | 171 render_pass, bounds(), shared_quad_state, append_quads_data); |
173 | 172 |
174 SolidColorLayerImpl::AppendSolidQuads( | 173 SolidColorLayerImpl::AppendSolidQuads( |
175 render_pass, occlusion_in_content_space, shared_quad_state, | 174 render_pass, draw_properties().occlusion_in_content_space, |
176 visible_content_rect(), raster_source_->GetSolidColor(), | 175 shared_quad_state, visible_content_rect(), |
177 append_quads_data); | 176 raster_source_->GetSolidColor(), append_quads_data); |
178 return; | 177 return; |
179 } | 178 } |
180 | 179 |
181 float max_contents_scale = MaximumTilingContentsScale(); | 180 float max_contents_scale = MaximumTilingContentsScale(); |
182 PopulateScaledSharedQuadState(shared_quad_state, max_contents_scale); | 181 PopulateScaledSharedQuadState(shared_quad_state, max_contents_scale); |
183 Occlusion scaled_occlusion = | 182 Occlusion scaled_occlusion = |
184 occlusion_in_content_space.GetOcclusionWithGivenDrawTransform( | 183 draw_properties() |
185 shared_quad_state->content_to_target_transform); | 184 .occlusion_in_content_space.GetOcclusionWithGivenDrawTransform( |
| 185 shared_quad_state->content_to_target_transform); |
186 | 186 |
187 if (current_draw_mode_ == DRAW_MODE_RESOURCELESS_SOFTWARE) { | 187 if (current_draw_mode_ == DRAW_MODE_RESOURCELESS_SOFTWARE) { |
188 AppendDebugBorderQuad( | 188 AppendDebugBorderQuad( |
189 render_pass, shared_quad_state->content_bounds, shared_quad_state, | 189 render_pass, shared_quad_state->content_bounds, shared_quad_state, |
190 append_quads_data, DebugColors::DirectPictureBorderColor(), | 190 append_quads_data, DebugColors::DirectPictureBorderColor(), |
191 DebugColors::DirectPictureBorderWidth(layer_tree_impl())); | 191 DebugColors::DirectPictureBorderWidth(layer_tree_impl())); |
192 | 192 |
193 gfx::Rect geometry_rect = shared_quad_state->visible_content_rect; | 193 gfx::Rect geometry_rect = shared_quad_state->visible_content_rect; |
194 gfx::Rect opaque_rect = contents_opaque() ? geometry_rect : gfx::Rect(); | 194 gfx::Rect opaque_rect = contents_opaque() ? geometry_rect : gfx::Rect(); |
195 gfx::Rect visible_geometry_rect = | 195 gfx::Rect visible_geometry_rect = |
(...skipping 1016 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1212 | 1212 |
1213 bool PictureLayerImpl::IsOnActiveOrPendingTree() const { | 1213 bool PictureLayerImpl::IsOnActiveOrPendingTree() const { |
1214 return !layer_tree_impl()->IsRecycleTree(); | 1214 return !layer_tree_impl()->IsRecycleTree(); |
1215 } | 1215 } |
1216 | 1216 |
1217 bool PictureLayerImpl::HasValidTilePriorities() const { | 1217 bool PictureLayerImpl::HasValidTilePriorities() const { |
1218 return IsOnActiveOrPendingTree() && IsDrawnRenderSurfaceLayerListMember(); | 1218 return IsOnActiveOrPendingTree() && IsDrawnRenderSurfaceLayerListMember(); |
1219 } | 1219 } |
1220 | 1220 |
1221 } // namespace cc | 1221 } // namespace cc |
OLD | NEW |