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

Side by Side Diff: ui/compositor/layer_owner.cc

Issue 271533014: Make ui::Layer use the cc:LayerTreeHost scale factor directly (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 7 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ui/compositor/layer_owner.h" 5 #include "ui/compositor/layer_owner.h"
6 6
7 #include "ui/compositor/layer_owner_delegate.h" 7 #include "ui/compositor/layer_owner_delegate.h"
8 8
9 namespace ui { 9 namespace ui {
10 10
(...skipping 22 matching lines...) Expand all
33 return old_layer.Pass(); 33 return old_layer.Pass();
34 34
35 LayerDelegate* old_delegate = old_layer->delegate(); 35 LayerDelegate* old_delegate = old_layer->delegate();
36 old_layer->set_delegate(NULL); 36 old_layer->set_delegate(NULL);
37 37
38 const gfx::Rect layer_bounds(old_layer->bounds()); 38 const gfx::Rect layer_bounds(old_layer->bounds());
39 Layer* new_layer = new ui::Layer(old_layer->type()); 39 Layer* new_layer = new ui::Layer(old_layer->type());
40 SetLayer(new_layer); 40 SetLayer(new_layer);
41 new_layer->SetVisible(old_layer->GetTargetVisibility()); 41 new_layer->SetVisible(old_layer->GetTargetVisibility());
42 new_layer->SetOpacity(old_layer->GetTargetOpacity()); 42 new_layer->SetOpacity(old_layer->GetTargetOpacity());
43 new_layer->set_scale_content(old_layer->scale_content());
44 new_layer->SetBounds(layer_bounds); 43 new_layer->SetBounds(layer_bounds);
45 new_layer->SetMasksToBounds(old_layer->GetMasksToBounds()); 44 new_layer->SetMasksToBounds(old_layer->GetMasksToBounds());
46 new_layer->set_name(old_layer->name()); 45 new_layer->set_name(old_layer->name());
47 new_layer->SetFillsBoundsOpaquely(old_layer->fills_bounds_opaquely()); 46 new_layer->SetFillsBoundsOpaquely(old_layer->fills_bounds_opaquely());
48 new_layer->SetFillsBoundsCompletely(old_layer->FillsBoundsCompletely()); 47 new_layer->SetFillsBoundsCompletely(old_layer->FillsBoundsCompletely());
49 48
50 // Install new layer as a sibling of the old layer, stacked below it. 49 // Install new layer as a sibling of the old layer, stacked below it.
51 if (old_layer->parent()) { 50 if (old_layer->parent()) {
52 old_layer->parent()->Add(new_layer); 51 old_layer->parent()->Add(new_layer);
53 old_layer->parent()->StackBelow(new_layer, old_layer.get()); 52 old_layer->parent()->StackBelow(new_layer, old_layer.get());
(...skipping 22 matching lines...) Expand all
76 void LayerOwner::DestroyLayer() { 75 void LayerOwner::DestroyLayer() {
77 layer_ = NULL; 76 layer_ = NULL;
78 layer_owner_.reset(); 77 layer_owner_.reset();
79 } 78 }
80 79
81 bool LayerOwner::OwnsLayer() const { 80 bool LayerOwner::OwnsLayer() const {
82 return !!layer_owner_; 81 return !!layer_owner_;
83 } 82 }
84 83
85 } // namespace ui 84 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698