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

Unified Diff: ui/compositor/layer.cc

Issue 16896017: Add a hide_layer_and_subtree() flag to cc::Layer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: hide-subtree-flag: Created 7 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 side-by-side diff with in-line comments
Download patch
« cc/trees/layer_tree_host_common.cc ('K') | « ui/compositor/layer.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/compositor/layer.cc
diff --git a/ui/compositor/layer.cc b/ui/compositor/layer.cc
index 09009eae4bea691e2d975b00da9ec28c3a4b71df..716ec83f098996b4a993d23bc0b2c4784929883f 100644
--- a/ui/compositor/layer.cc
+++ b/ui/compositor/layer.cc
@@ -47,7 +47,6 @@ Layer::Layer()
compositor_(NULL),
parent_(NULL),
visible_(true),
- is_drawn_(true),
force_render_surface_(false),
fills_bounds_opaquely_(true),
layer_updated_externally_(false),
@@ -72,7 +71,6 @@ Layer::Layer(LayerType type)
compositor_(NULL),
parent_(NULL),
visible_(true),
- is_drawn_(true),
force_render_surface_(false),
fills_bounds_opaquely_(true),
layer_updated_externally_(false),
@@ -142,7 +140,6 @@ void Layer::Add(Layer* child) {
children_.push_back(child);
cc_layer_->AddChild(child->cc_layer_);
child->OnDeviceScaleFactorChanged(device_scale_factor_);
- child->UpdateIsDrawn();
if (GetCompositor())
child->SendPendingThreadedAnimations();
}
@@ -369,24 +366,6 @@ bool Layer::GetTargetVisibility() const {
return visible_;
}
-bool Layer::IsDrawn() const {
- return is_drawn_;
-}
-
-void Layer::UpdateIsDrawn() {
- bool updated_is_drawn = visible_ && (!parent_ || parent_->IsDrawn());
-
- if (updated_is_drawn == is_drawn_)
- return;
-
- is_drawn_ = updated_is_drawn;
- cc_layer_->SetIsDrawable(is_drawn_ && type_ != LAYER_NOT_DRAWN);
-
- for (size_t i = 0; i < children_.size(); ++i) {
- children_[i]->UpdateIsDrawn();
- }
-}
-
bool Layer::ShouldDraw() const {
return type_ != LAYER_NOT_DRAWN && GetCombinedOpacity() > 0.0f;
}
@@ -478,7 +457,7 @@ void Layer::SwitchToLayer(scoped_refptr<cc::Layer> new_layer) {
cc_layer_->SetAnchorPoint(gfx::PointF());
cc_layer_->SetContentsOpaque(fills_bounds_opaquely_);
cc_layer_->SetForceRenderSurface(force_render_surface_);
- cc_layer_->SetIsDrawable(IsDrawn());
+ cc_layer_->SetHideLayerAndSubtree(!visible_);
}
void Layer::SwitchCCLayerForTest() {
@@ -751,7 +730,7 @@ void Layer::SetBoundsImmediately(const gfx::Rect& bounds) {
if (was_move) {
// Don't schedule a draw if we're invisible. We'll schedule one
// automatically when we get visible.
- if (IsDrawn())
+ if (visible_)
ScheduleDraw();
} else {
// Always schedule a paint, even if we're invisible.
@@ -773,7 +752,7 @@ void Layer::SetVisibilityImmediately(bool visible) {
return;
visible_ = visible;
- UpdateIsDrawn();
+ cc_layer_->SetHideLayerAndSubtree(!visible_);
}
void Layer::SetBrightnessImmediately(float brightness) {
« cc/trees/layer_tree_host_common.cc ('K') | « ui/compositor/layer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698