OLD | NEW |
1 // Copyright 2010 The Chromium Authors. All rights reserved. | 1 // Copyright 2010 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/layer.h" | 5 #include "cc/layers/layer.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/atomic_sequence_num.h" | 9 #include "base/atomic_sequence_num.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 1090 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1101 } | 1101 } |
1102 | 1102 |
1103 bool Layer::NeedMoreUpdates() { | 1103 bool Layer::NeedMoreUpdates() { |
1104 return false; | 1104 return false; |
1105 } | 1105 } |
1106 | 1106 |
1107 bool Layer::IsSuitableForGpuRasterization() const { | 1107 bool Layer::IsSuitableForGpuRasterization() const { |
1108 return true; | 1108 return true; |
1109 } | 1109 } |
1110 | 1110 |
1111 scoped_refptr<base::debug::ConvertableToTraceFormat> Layer::TakeDebugInfo() { | 1111 scoped_refptr<base::trace_event::ConvertableToTraceFormat> |
| 1112 Layer::TakeDebugInfo() { |
1112 if (client_) | 1113 if (client_) |
1113 return client_->TakeDebugInfo(); | 1114 return client_->TakeDebugInfo(); |
1114 else | 1115 else |
1115 return nullptr; | 1116 return nullptr; |
1116 } | 1117 } |
1117 | 1118 |
1118 void Layer::SetHasRenderSurface(bool has_render_surface) { | 1119 void Layer::SetHasRenderSurface(bool has_render_surface) { |
1119 if (has_render_surface_ == has_render_surface) | 1120 if (has_render_surface_ == has_render_surface) |
1120 return; | 1121 return; |
1121 has_render_surface_ = has_render_surface; | 1122 has_render_surface_ = has_render_surface; |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1291 if (transform_tree_index() >= 0) { | 1292 if (transform_tree_index() >= 0) { |
1292 gfx::Transform ssxform = tree.Node(transform_tree_index())->data.to_screen; | 1293 gfx::Transform ssxform = tree.Node(transform_tree_index())->data.to_screen; |
1293 xform.ConcatTransform(ssxform); | 1294 xform.ConcatTransform(ssxform); |
1294 } | 1295 } |
1295 xform.Scale(1.0 / contents_scale_x(), 1.0 / contents_scale_y()); | 1296 xform.Scale(1.0 / contents_scale_x(), 1.0 / contents_scale_y()); |
1296 return xform; | 1297 return xform; |
1297 } | 1298 } |
1298 | 1299 |
1299 gfx::Transform Layer::draw_transform_from_property_trees( | 1300 gfx::Transform Layer::draw_transform_from_property_trees( |
1300 const TransformTree& tree) const { | 1301 const TransformTree& tree) const { |
1301 gfx::Transform xform(1, 0, 0, 1, offset_to_transform_parent().x(), | 1302 const TransformNode* node = tree.Node(transform_tree_index()); |
1302 offset_to_transform_parent().y()); | 1303 // TODO(vollick): ultimately we'll need to find this information (whether or |
1303 if (transform_tree_index() >= 0) { | 1304 // not we establish a render surface) somewhere other than the layer. |
1304 const TransformNode* node = tree.Node(transform_tree_index()); | 1305 const TransformNode* target_node = |
1305 gfx::Transform ssxform; | 1306 has_render_surface_ ? node : tree.Node(node->data.content_target_id); |
1306 tree.ComputeTransform(node->id, node->data.target_id, &ssxform); | 1307 |
1307 xform.ConcatTransform(ssxform); | 1308 gfx::Transform xform; |
| 1309 const bool owns_non_root_surface = parent() && render_surface(); |
| 1310 if (!owns_non_root_surface) { |
| 1311 // If you're not the root, or you don't own a surface, you need to apply |
| 1312 // your local offset. |
| 1313 xform = node->data.to_target; |
| 1314 xform.Translate(offset_to_transform_parent().x(), |
| 1315 offset_to_transform_parent().y()); |
| 1316 } else { |
| 1317 // Surfaces need to apply their sublayer scale. |
| 1318 xform.Scale(target_node->data.sublayer_scale.x(), |
| 1319 target_node->data.sublayer_scale.y()); |
1308 } | 1320 } |
1309 xform.Scale(1.0 / contents_scale_x(), 1.0 / contents_scale_y()); | 1321 xform.Scale(1.0 / contents_scale_x(), 1.0 / contents_scale_y()); |
1310 return xform; | 1322 return xform; |
1311 } | 1323 } |
1312 | 1324 |
1313 void Layer::SetFrameTimingRequests( | 1325 void Layer::SetFrameTimingRequests( |
1314 const std::vector<FrameTimingRequest>& requests) { | 1326 const std::vector<FrameTimingRequest>& requests) { |
1315 frame_timing_requests_ = requests; | 1327 frame_timing_requests_ = requests; |
1316 frame_timing_requests_dirty_ = true; | 1328 frame_timing_requests_dirty_ = true; |
1317 SetNeedsCommit(); | 1329 SetNeedsCommit(); |
1318 } | 1330 } |
1319 | 1331 |
1320 } // namespace cc | 1332 } // namespace cc |
OLD | NEW |