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/trees/layer_tree_host_common.h" | 5 #include "cc/trees/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/base/math_util.h" | 10 #include "cc/base/math_util.h" |
(...skipping 1249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1260 // The surface's cached clip rect value propagates regardless of what | 1260 // The surface's cached clip rect value propagates regardless of what |
1261 // clipping goes on between layers here. | 1261 // clipping goes on between layers here. |
1262 clip_rect_for_subtree_in_descendant_space = | 1262 clip_rect_for_subtree_in_descendant_space = |
1263 clip_rect_from_ancestor_in_descendant_space; | 1263 clip_rect_from_ancestor_in_descendant_space; |
1264 | 1264 |
1265 // Layers that are not their own render_target will render into the target | 1265 // Layers that are not their own render_target will render into the target |
1266 // of their nearest ancestor. | 1266 // of their nearest ancestor. |
1267 layer_draw_properties.render_target = layer->parent()->render_target(); | 1267 layer_draw_properties.render_target = layer->parent()->render_target(); |
1268 } | 1268 } |
1269 | 1269 |
| 1270 // Mark whether a layer could be drawn directly to the back buffer, for |
| 1271 // example when it could use LCD text even though it's in a non-contents |
| 1272 // opaque layer. This means that it can't be drawn to an intermediate |
| 1273 // render target and also that no blending is applied to the layer as a whole |
| 1274 // (meaning that its contents don't have to be pre-composited into a bitmap or |
| 1275 // a render target). |
| 1276 // |
| 1277 // Ignoring animations is an optimization, |
| 1278 // as it means that we're going to need some retained resources for this |
| 1279 // layer in the near future even if its opacity is 1 now. |
| 1280 layer_draw_properties.can_draw_directly_to_backbuffer = |
| 1281 IsRootLayer(layer_draw_properties.render_target) && |
| 1282 layer->draw_properties().opacity == 1.f && |
| 1283 !animating_opacity_to_screen; |
| 1284 |
1270 if (adjust_text_aa) | 1285 if (adjust_text_aa) |
1271 layer_draw_properties.can_use_lcd_text = layer_can_use_lcd_text; | 1286 layer_draw_properties.can_use_lcd_text = layer_can_use_lcd_text; |
1272 | 1287 |
1273 gfx::Rect rect_in_target_space = ToEnclosingRect( | 1288 gfx::Rect rect_in_target_space = ToEnclosingRect( |
1274 MathUtil::MapClippedRect(layer->draw_transform(), content_rect)); | 1289 MathUtil::MapClippedRect(layer->draw_transform(), content_rect)); |
1275 | 1290 |
1276 if (LayerClipsSubtree(layer)) { | 1291 if (LayerClipsSubtree(layer)) { |
1277 subtree_should_be_clipped = true; | 1292 subtree_should_be_clipped = true; |
1278 if (ancestor_clips_subtree && !layer->render_surface()) { | 1293 if (ancestor_clips_subtree && !layer->render_surface()) { |
1279 clip_rect_for_subtree = clip_rect_from_ancestor; | 1294 clip_rect_for_subtree = clip_rect_from_ancestor; |
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1806 // At this point, we think the point does hit the touch event handler region | 1821 // At this point, we think the point does hit the touch event handler region |
1807 // on the layer, but we need to walk up the parents to ensure that the layer | 1822 // on the layer, but we need to walk up the parents to ensure that the layer |
1808 // was not clipped in such a way that the hit point actually should not hit | 1823 // was not clipped in such a way that the hit point actually should not hit |
1809 // the layer. | 1824 // the layer. |
1810 if (PointIsClippedBySurfaceOrClipRect(screen_space_point, layer_impl)) | 1825 if (PointIsClippedBySurfaceOrClipRect(screen_space_point, layer_impl)) |
1811 return false; | 1826 return false; |
1812 | 1827 |
1813 return true; | 1828 return true; |
1814 } | 1829 } |
1815 } // namespace cc | 1830 } // namespace cc |
OLD | NEW |