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

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

Issue 2016203002: Widget opacity goes from 0 to 1, not 0 to 255. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Resync Created 4 years, 6 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
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 <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 void Layer::SetBackgroundFilters(const FilterOperations& filters) { 460 void Layer::SetBackgroundFilters(const FilterOperations& filters) {
461 DCHECK(IsPropertyChangeAllowed()); 461 DCHECK(IsPropertyChangeAllowed());
462 if (background_filters_ == filters) 462 if (background_filters_ == filters)
463 return; 463 return;
464 background_filters_ = filters; 464 background_filters_ = filters;
465 SetNeedsCommit(); 465 SetNeedsCommit();
466 } 466 }
467 467
468 void Layer::SetOpacity(float opacity) { 468 void Layer::SetOpacity(float opacity) {
469 DCHECK(IsPropertyChangeAllowed()); 469 DCHECK(IsPropertyChangeAllowed());
470 DCHECK_GE(opacity, 0.f);
471 DCHECK_LE(opacity, 1.f);
472
470 if (opacity_ == opacity) 473 if (opacity_ == opacity)
471 return; 474 return;
472 // We need to force a property tree rebuild when opacity changes from 1 to a 475 // We need to force a property tree rebuild when opacity changes from 1 to a
473 // non-1 value or vice-versa as render surfaces can change. 476 // non-1 value or vice-versa as render surfaces can change.
474 bool force_rebuild = opacity == 1.f || opacity_ == 1.f; 477 bool force_rebuild = opacity == 1.f || opacity_ == 1.f;
475 opacity_ = opacity; 478 opacity_ = opacity;
476 SetSubtreePropertyChanged(); 479 SetSubtreePropertyChanged();
477 if (layer_tree_host_ && !force_rebuild) { 480 if (layer_tree_host_ && !force_rebuild) {
478 PropertyTrees* property_trees = layer_tree_host_->property_trees(); 481 PropertyTrees* property_trees = layer_tree_host_->property_trees();
479 auto effect_id_to_index = property_trees->effect_id_to_index_map.find(id()); 482 auto effect_id_to_index = property_trees->effect_id_to_index_map.find(id());
(...skipping 1126 matching lines...) Expand 10 before | Expand all | Expand 10 after
1606 1609
1607 // On<Property>Animated is called due to an ongoing accelerated animation. 1610 // On<Property>Animated is called due to an ongoing accelerated animation.
1608 // Since this animation is also being run on the compositor thread, there 1611 // Since this animation is also being run on the compositor thread, there
1609 // is no need to request a commit to push this value over, so the value is 1612 // is no need to request a commit to push this value over, so the value is
1610 // set directly rather than by calling Set<Property>. 1613 // set directly rather than by calling Set<Property>.
1611 void Layer::OnFilterAnimated(const FilterOperations& filters) { 1614 void Layer::OnFilterAnimated(const FilterOperations& filters) {
1612 filters_ = filters; 1615 filters_ = filters;
1613 } 1616 }
1614 1617
1615 void Layer::OnOpacityAnimated(float opacity) { 1618 void Layer::OnOpacityAnimated(float opacity) {
1619 DCHECK_GE(opacity, 0.f);
1620 DCHECK_LE(opacity, 1.f);
1621
1616 if (opacity_ == opacity) 1622 if (opacity_ == opacity)
1617 return; 1623 return;
1618 opacity_ = opacity; 1624 opacity_ = opacity;
1619 // Changing the opacity may make a previously hidden layer visible, so a new 1625 // Changing the opacity may make a previously hidden layer visible, so a new
1620 // recording may be needed. 1626 // recording may be needed.
1621 SetNeedsUpdate(); 1627 SetNeedsUpdate();
1622 if (layer_tree_host_) { 1628 if (layer_tree_host_) {
1623 PropertyTrees* property_trees = layer_tree_host_->property_trees(); 1629 PropertyTrees* property_trees = layer_tree_host_->property_trees();
1624 if (property_trees->IsInIdToIndexMap(PropertyTrees::TreeType::EFFECT, 1630 if (property_trees->IsInIdToIndexMap(PropertyTrees::TreeType::EFFECT,
1625 id())) { 1631 id())) {
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
1824 ->data.num_copy_requests_in_subtree; 1830 ->data.num_copy_requests_in_subtree;
1825 } 1831 }
1826 1832
1827 gfx::Transform Layer::screen_space_transform() const { 1833 gfx::Transform Layer::screen_space_transform() const {
1828 DCHECK_NE(transform_tree_index_, -1); 1834 DCHECK_NE(transform_tree_index_, -1);
1829 return draw_property_utils::ScreenSpaceTransform( 1835 return draw_property_utils::ScreenSpaceTransform(
1830 this, layer_tree_host_->property_trees()->transform_tree); 1836 this, layer_tree_host_->property_trees()->transform_tree);
1831 } 1837 }
1832 1838
1833 } // namespace cc 1839 } // namespace cc
OLDNEW
« no previous file with comments | « ash/wm/overview/window_grid.cc ('k') | chrome/browser/ui/views/download/download_started_animation_views.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698