| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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/layer_tree_host_common.h" | 5 #include "cc/layer_tree_host_common.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
| 10 #include "cc/heads_up_display_layer_impl.h" | 10 #include "cc/heads_up_display_layer_impl.h" |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 | 279 |
| 280 // If the layer uses a CSS filter. | 280 // If the layer uses a CSS filter. |
| 281 if (!layer->filters().isEmpty() || !layer->backgroundFilters().isEmpty() ||
layer->filter()) | 281 if (!layer->filters().isEmpty() || !layer->backgroundFilters().isEmpty() ||
layer->filter()) |
| 282 return true; | 282 return true; |
| 283 | 283 |
| 284 int numDescendantsThatDrawContent = layer->drawProperties().num_descendants_
that_draw_content; | 284 int numDescendantsThatDrawContent = layer->drawProperties().num_descendants_
that_draw_content; |
| 285 | 285 |
| 286 // If the layer flattens its subtree (i.e. the layer doesn't preserve-3d), b
ut it is | 286 // If the layer flattens its subtree (i.e. the layer doesn't preserve-3d), b
ut it is |
| 287 // treated as a 3D object by its parent (i.e. parent does preserve-3d). | 287 // treated as a 3D object by its parent (i.e. parent does preserve-3d). |
| 288 if (layerIsInExisting3DRenderingContext(layer) && !layer->preserves3D() && n
umDescendantsThatDrawContent > 0) { | 288 if (layerIsInExisting3DRenderingContext(layer) && !layer->preserves3D() && n
umDescendantsThatDrawContent > 0) { |
| 289 TRACE_EVENT_INSTANT0("cc", "LayerTreeHostCommon::requireSurface flatteni
ng"); | 289 TRACE_EVENT_INSTANT0("cc", "LayerTreeHostCommon::requireSurface flatteni
ng", |
| 290 TRACE_EVENT_SCOPE_THREAD); |
| 290 return true; | 291 return true; |
| 291 } | 292 } |
| 292 | 293 |
| 293 // If the layer clips its descendants but it is not axis-aligned with respec
t to its parent. | 294 // If the layer clips its descendants but it is not axis-aligned with respec
t to its parent. |
| 294 bool layerClipsExternalContent = layerClipsSubtree(layer) || layer->hasDeleg
atedContent(); | 295 bool layerClipsExternalContent = layerClipsSubtree(layer) || layer->hasDeleg
atedContent(); |
| 295 if (layerClipsExternalContent && !axisAlignedWithRespectToParent && !layer->
drawProperties().descendants_can_clip_selves) | 296 if (layerClipsExternalContent && !axisAlignedWithRespectToParent && !layer->
drawProperties().descendants_can_clip_selves) |
| 296 { | 297 { |
| 297 TRACE_EVENT_INSTANT0("cc", "LayerTreeHostCommon::requireSurface clipping
"); | 298 TRACE_EVENT_INSTANT0("cc", "LayerTreeHostCommon::requireSurface clipping
", |
| 299 TRACE_EVENT_SCOPE_THREAD); |
| 298 return true; | 300 return true; |
| 299 } | 301 } |
| 300 | 302 |
| 301 // If the layer has some translucency and does not have a preserves-3d trans
form style. | 303 // If the layer has some translucency and does not have a preserves-3d trans
form style. |
| 302 // This condition only needs a render surface if two or more layers in the | 304 // This condition only needs a render surface if two or more layers in the |
| 303 // subtree overlap. But checking layer overlaps is unnecessarily costly so | 305 // subtree overlap. But checking layer overlaps is unnecessarily costly so |
| 304 // instead we conservatively create a surface whenever at least two layers | 306 // instead we conservatively create a surface whenever at least two layers |
| 305 // draw content for this subtree. | 307 // draw content for this subtree. |
| 306 bool atLeastTwoLayersInSubtreeDrawContent = numDescendantsThatDrawContent >
0 && (layer->drawsContent() || numDescendantsThatDrawContent > 1); | 308 bool atLeastTwoLayersInSubtreeDrawContent = numDescendantsThatDrawContent >
0 && (layer->drawsContent() || numDescendantsThatDrawContent > 1); |
| 307 | 309 |
| 308 if (layer->opacity() != 1 && !layer->preserves3D() && atLeastTwoLayersInSubt
reeDrawContent) { | 310 if (layer->opacity() != 1 && !layer->preserves3D() && atLeastTwoLayersInSubt
reeDrawContent) { |
| 309 TRACE_EVENT_INSTANT0("cc", "LayerTreeHostCommon::requireSurface opacity"
); | 311 TRACE_EVENT_INSTANT0("cc", "LayerTreeHostCommon::requireSurface opacity"
, |
| 312 TRACE_EVENT_SCOPE_THREAD); |
| 310 return true; | 313 return true; |
| 311 } | 314 } |
| 312 | 315 |
| 313 return false; | 316 return false; |
| 314 } | 317 } |
| 315 | 318 |
| 316 gfx::Transform computeScrollCompensationForThisLayer(LayerImpl* scrollingLayer,
const gfx::Transform& parentMatrix) | 319 gfx::Transform computeScrollCompensationForThisLayer(LayerImpl* scrollingLayer,
const gfx::Transform& parentMatrix) |
| 317 { | 320 { |
| 318 // For every layer that has non-zero scrollDelta, we have to compute a trans
form that can undo the | 321 // For every layer that has non-zero scrollDelta, we have to compute a trans
form that can undo the |
| 319 // scrollDelta translation. In particular, we want this matrix to premultipl
y a fixed-position layer's | 322 // scrollDelta translation. In particular, we want this matrix to premultipl
y a fixed-position layer's |
| (...skipping 882 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1202 | 1205 |
| 1203 // At this point, we think the point does hit the touch event handler region o
n the layer, but we need to walk up | 1206 // At this point, we think the point does hit the touch event handler region o
n the layer, but we need to walk up |
| 1204 // the parents to ensure that the layer was not clipped in such a way that the | 1207 // the parents to ensure that the layer was not clipped in such a way that the |
| 1205 // hit point actually should not hit the layer. | 1208 // hit point actually should not hit the layer. |
| 1206 if (pointIsClippedBySurfaceOrClipRect(screenSpacePoint, layerImpl)) | 1209 if (pointIsClippedBySurfaceOrClipRect(screenSpacePoint, layerImpl)) |
| 1207 return false; | 1210 return false; |
| 1208 | 1211 |
| 1209 return true; | 1212 return true; |
| 1210 } | 1213 } |
| 1211 } // namespace cc | 1214 } // namespace cc |
| OLD | NEW |