Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(68)

Side by Side Diff: cc/layers/layer.cc

Issue 1013463003: Update from https://crrev.com/320931 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/layers/layer.h ('k') | cc/layers/picture_layer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 layer_id_(g_next_layer_id.GetNext() + 1), 45 layer_id_(g_next_layer_id.GetNext() + 1),
46 ignore_set_needs_commit_(false), 46 ignore_set_needs_commit_(false),
47 sorting_context_id_(0), 47 sorting_context_id_(0),
48 parent_(nullptr), 48 parent_(nullptr),
49 layer_tree_host_(nullptr), 49 layer_tree_host_(nullptr),
50 scroll_clip_layer_id_(INVALID_ID), 50 scroll_clip_layer_id_(INVALID_ID),
51 num_descendants_that_draw_content_(0), 51 num_descendants_that_draw_content_(0),
52 transform_tree_index_(-1), 52 transform_tree_index_(-1),
53 opacity_tree_index_(-1), 53 opacity_tree_index_(-1),
54 clip_tree_index_(-1), 54 clip_tree_index_(-1),
55 should_flatten_transform_from_property_tree_(false),
55 should_scroll_on_main_thread_(false), 56 should_scroll_on_main_thread_(false),
56 have_wheel_event_handlers_(false), 57 have_wheel_event_handlers_(false),
57 have_scroll_event_handlers_(false), 58 have_scroll_event_handlers_(false),
58 user_scrollable_horizontal_(true), 59 user_scrollable_horizontal_(true),
59 user_scrollable_vertical_(true), 60 user_scrollable_vertical_(true),
60 is_root_for_isolated_group_(false), 61 is_root_for_isolated_group_(false),
61 is_container_for_fixed_position_layers_(false), 62 is_container_for_fixed_position_layers_(false),
62 is_drawable_(false), 63 is_drawable_(false),
63 draws_content_(false), 64 draws_content_(false),
64 hide_layer_and_subtree_(false), 65 hide_layer_and_subtree_(false),
(...skipping 1222 matching lines...) Expand 10 before | Expand all | Expand 10 after
1287 return false; 1288 return false;
1288 } 1289 }
1289 1290
1290 gfx::Transform Layer::screen_space_transform_from_property_trees( 1291 gfx::Transform Layer::screen_space_transform_from_property_trees(
1291 const TransformTree& tree) const { 1292 const TransformTree& tree) const {
1292 gfx::Transform xform(1, 0, 0, 1, offset_to_transform_parent().x(), 1293 gfx::Transform xform(1, 0, 0, 1, offset_to_transform_parent().x(),
1293 offset_to_transform_parent().y()); 1294 offset_to_transform_parent().y());
1294 if (transform_tree_index() >= 0) { 1295 if (transform_tree_index() >= 0) {
1295 gfx::Transform ssxform = tree.Node(transform_tree_index())->data.to_screen; 1296 gfx::Transform ssxform = tree.Node(transform_tree_index())->data.to_screen;
1296 xform.ConcatTransform(ssxform); 1297 xform.ConcatTransform(ssxform);
1298 if (should_flatten_transform_from_property_tree_)
1299 xform.FlattenTo2d();
1297 } 1300 }
1298 xform.Scale(1.0 / contents_scale_x(), 1.0 / contents_scale_y()); 1301 xform.Scale(1.0 / contents_scale_x(), 1.0 / contents_scale_y());
1299 return xform; 1302 return xform;
1300 } 1303 }
1301 1304
1302 gfx::Transform Layer::draw_transform_from_property_trees( 1305 gfx::Transform Layer::draw_transform_from_property_trees(
1303 const TransformTree& tree) const { 1306 const TransformTree& tree) const {
1304 const TransformNode* node = tree.Node(transform_tree_index()); 1307 const TransformNode* node = tree.Node(transform_tree_index());
1305 // TODO(vollick): ultimately we'll need to find this information (whether or 1308 // TODO(vollick): ultimately we'll need to find this information (whether or
1306 // not we establish a render surface) somewhere other than the layer. 1309 // not we establish a render surface) somewhere other than the layer.
1307 const TransformNode* target_node = 1310 const TransformNode* target_node =
1308 has_render_surface_ ? node : tree.Node(node->data.content_target_id); 1311 has_render_surface_ ? node : tree.Node(node->data.content_target_id);
1309 1312
1310 gfx::Transform xform; 1313 gfx::Transform xform;
1311 const bool owns_non_root_surface = parent() && render_surface(); 1314 const bool owns_non_root_surface = parent() && render_surface();
1312 if (!owns_non_root_surface) { 1315 if (!owns_non_root_surface) {
1313 // If you're not the root, or you don't own a surface, you need to apply 1316 // If you're not the root, or you don't own a surface, you need to apply
1314 // your local offset. 1317 // your local offset.
1315 xform = node->data.to_target; 1318 xform = node->data.to_target;
1319 if (should_flatten_transform_from_property_tree_)
1320 xform.FlattenTo2d();
1316 xform.Translate(offset_to_transform_parent().x(), 1321 xform.Translate(offset_to_transform_parent().x(),
1317 offset_to_transform_parent().y()); 1322 offset_to_transform_parent().y());
1318 } else { 1323 } else {
1319 // Surfaces need to apply their sublayer scale. 1324 // Surfaces need to apply their sublayer scale.
1320 xform.Scale(target_node->data.sublayer_scale.x(), 1325 xform.Scale(target_node->data.sublayer_scale.x(),
1321 target_node->data.sublayer_scale.y()); 1326 target_node->data.sublayer_scale.y());
1322 } 1327 }
1323 xform.Scale(1.0 / contents_scale_x(), 1.0 / contents_scale_y()); 1328 xform.Scale(1.0 / contents_scale_x(), 1.0 / contents_scale_y());
1324 return xform; 1329 return xform;
1325 } 1330 }
(...skipping 17 matching lines...) Expand all
1343 } 1348 }
1344 1349
1345 void Layer::SetFrameTimingRequests( 1350 void Layer::SetFrameTimingRequests(
1346 const std::vector<FrameTimingRequest>& requests) { 1351 const std::vector<FrameTimingRequest>& requests) {
1347 frame_timing_requests_ = requests; 1352 frame_timing_requests_ = requests;
1348 frame_timing_requests_dirty_ = true; 1353 frame_timing_requests_dirty_ = true;
1349 SetNeedsCommit(); 1354 SetNeedsCommit();
1350 } 1355 }
1351 1356
1352 } // namespace cc 1357 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/layer.h ('k') | cc/layers/picture_layer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698