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

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

Issue 953093002: cc: Derive draw opacity from property trees (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make opacity tree-building optional Created 5 years, 10 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/trees/draw_property_utils.h » ('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 1300 matching lines...) Expand 10 before | Expand all | Expand 10 after
1311 offset_to_transform_parent().y()); 1311 offset_to_transform_parent().y());
1312 } else { 1312 } else {
1313 // Surfaces need to apply their sublayer scale. 1313 // Surfaces need to apply their sublayer scale.
1314 xform.Scale(target_node->data.sublayer_scale.x(), 1314 xform.Scale(target_node->data.sublayer_scale.x(),
1315 target_node->data.sublayer_scale.y()); 1315 target_node->data.sublayer_scale.y());
1316 } 1316 }
1317 xform.Scale(1.0 / contents_scale_x(), 1.0 / contents_scale_y()); 1317 xform.Scale(1.0 / contents_scale_x(), 1.0 / contents_scale_y());
1318 return xform; 1318 return xform;
1319 } 1319 }
1320 1320
1321 float Layer::DrawOpacityFromPropertyTrees(const OpacityTree& tree) const {
1322 if (!render_target())
1323 return 0.f;
1324
1325 const OpacityNode* target_node =
1326 tree.Node(render_target()->opacity_tree_index());
1327 const OpacityNode* node = tree.Node(opacity_tree_index());
1328 if (node == target_node)
1329 return 1.f;
1330
1331 float draw_opacity = 1.f;
1332 while (node != target_node) {
1333 draw_opacity *= node->data;
1334 node = tree.parent(node);
1335 }
1336 return draw_opacity;
1337 }
1338
1321 void Layer::SetFrameTimingRequests( 1339 void Layer::SetFrameTimingRequests(
1322 const std::vector<FrameTimingRequest>& requests) { 1340 const std::vector<FrameTimingRequest>& requests) {
1323 frame_timing_requests_ = requests; 1341 frame_timing_requests_ = requests;
1324 frame_timing_requests_dirty_ = true; 1342 frame_timing_requests_dirty_ = true;
1325 SetNeedsCommit(); 1343 SetNeedsCommit();
1326 } 1344 }
1327 1345
1328 } // namespace cc 1346 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/layer.h ('k') | cc/trees/draw_property_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698