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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 gfx::Rect minimal_surface_rect = target_surface_rect; | 55 gfx::Rect minimal_surface_rect = target_surface_rect; |
56 minimal_surface_rect.Intersect(layer_rect_in_target_space); | 56 minimal_surface_rect.Intersect(layer_rect_in_target_space); |
57 | 57 |
58 // Project the corners of the target surface rect into the layer space. | 58 // Project the corners of the target surface rect into the layer space. |
59 // This bounding rectangle may be larger than it needs to be (being | 59 // This bounding rectangle may be larger than it needs to be (being |
60 // axis-aligned), but is a reasonable filter on the space to consider. | 60 // axis-aligned), but is a reasonable filter on the space to consider. |
61 // Non-invertible transforms will create an empty rect here. | 61 // Non-invertible transforms will create an empty rect here. |
62 | 62 |
63 gfx::Transform surface_to_layer(gfx::Transform::kSkipInitialization); | 63 gfx::Transform surface_to_layer(gfx::Transform::kSkipInitialization); |
64 if (!transform.GetInverse(&surface_to_layer)) { | 64 if (!transform.GetInverse(&surface_to_layer)) { |
65 // TODO(shawnsingh): Either we need to handle uninvertible transforms | 65 // TODO(shawnsingh): Some uninvertible transforms may be visible, but |
66 // here, or DCHECK that the transform is invertible. | 66 // their behaviour is undefined thoughout the compositor. Make their |
| 67 // behaviour well-defined and allow the visible content rect to be non- |
| 68 // empty when needed. |
| 69 return gfx::Rect(); |
67 } | 70 } |
| 71 |
68 gfx::Rect layer_rect = gfx::ToEnclosingRect(MathUtil::ProjectClippedRect( | 72 gfx::Rect layer_rect = gfx::ToEnclosingRect(MathUtil::ProjectClippedRect( |
69 surface_to_layer, gfx::RectF(minimal_surface_rect))); | 73 surface_to_layer, gfx::RectF(minimal_surface_rect))); |
70 layer_rect.Intersect(layer_bound_rect); | 74 layer_rect.Intersect(layer_bound_rect); |
71 return layer_rect; | 75 return layer_rect; |
72 } | 76 } |
73 | 77 |
74 gfx::Rect LayerTreeHostCommon::CalculateVisibleRect( | 78 gfx::Rect LayerTreeHostCommon::CalculateVisibleRect( |
75 gfx::Rect target_surface_rect, | 79 gfx::Rect target_surface_rect, |
76 gfx::Rect layer_bound_rect, | 80 gfx::Rect layer_bound_rect, |
77 const gfx::Transform& transform) { | 81 const gfx::Transform& transform) { |
(...skipping 1504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1582 // At this point, we think the point does hit the touch event handler region | 1586 // At this point, we think the point does hit the touch event handler region |
1583 // on the layer, but we need to walk up the parents to ensure that the layer | 1587 // on the layer, but we need to walk up the parents to ensure that the layer |
1584 // was not clipped in such a way that the hit point actually should not hit | 1588 // was not clipped in such a way that the hit point actually should not hit |
1585 // the layer. | 1589 // the layer. |
1586 if (PointIsClippedBySurfaceOrClipRect(screen_space_point, layer_impl)) | 1590 if (PointIsClippedBySurfaceOrClipRect(screen_space_point, layer_impl)) |
1587 return false; | 1591 return false; |
1588 | 1592 |
1589 return true; | 1593 return true; |
1590 } | 1594 } |
1591 } // namespace cc | 1595 } // namespace cc |
OLD | NEW |