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

Side by Side Diff: ui/aura/window.cc

Issue 12211121: Set the original external texture to new layer when it's copied to the old layer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/aura/window.h" 5 #include "ui/aura/window.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 Env::GetInstance()->NotifyWindowInitialized(this); 137 Env::GetInstance()->NotifyWindowInitialized(this);
138 } 138 }
139 139
140 ui::Layer* Window::RecreateLayer() { 140 ui::Layer* Window::RecreateLayer() {
141 // Disconnect the old layer, but don't delete it. 141 // Disconnect the old layer, but don't delete it.
142 ui::Layer* old_layer = AcquireLayer(); 142 ui::Layer* old_layer = AcquireLayer();
143 if (!old_layer) 143 if (!old_layer)
144 return NULL; 144 return NULL;
145 145
146 old_layer->set_delegate(NULL); 146 old_layer->set_delegate(NULL);
147 if (delegate_ && old_layer->external_texture()) 147 scoped_refptr<ui::Texture> old_texture = old_layer->external_texture();
148 if (delegate_ && old_texture)
148 old_layer->SetExternalTexture(delegate_->CopyTexture()); 149 old_layer->SetExternalTexture(delegate_->CopyTexture());
150
149 layer_ = new ui::Layer(old_layer->type()); 151 layer_ = new ui::Layer(old_layer->type());
150 layer_owner_.reset(layer_); 152 layer_owner_.reset(layer_);
151 layer_->SetVisible(old_layer->visible()); 153 layer_->SetVisible(old_layer->visible());
152 layer_->set_scale_content(old_layer->scale_content()); 154 layer_->set_scale_content(old_layer->scale_content());
153 layer_->set_delegate(this); 155 layer_->set_delegate(this);
154 layer_->SetMasksToBounds(old_layer->GetMasksToBounds()); 156 layer_->SetMasksToBounds(old_layer->GetMasksToBounds());
157 // Move the original texture to the new layer if the old layer has a
158 // texture and we could copy it into the old layer,
159 // crbug.com/175211.
160 if (delegate_ && old_texture)
sky 2013/02/12 03:31:54 This code is also hit when maximizing. Does settin
oshima 2013/02/12 04:03:23 I tested (un)maximizing as well and it looks fine.
sky 2013/02/12 17:01:24 When you maximize/restore we change the size immed
161 layer_->SetExternalTexture(old_texture);
162
155 UpdateLayerName(name_); 163 UpdateLayerName(name_);
156 layer_->SetFillsBoundsOpaquely(!transparent_); 164 layer_->SetFillsBoundsOpaquely(!transparent_);
157 // Install new layer as a sibling of the old layer, stacked on top of it. 165 // Install new layer as a sibling of the old layer, stacked on top of it.
158 if (old_layer->parent()) { 166 if (old_layer->parent()) {
159 old_layer->parent()->Add(layer_); 167 old_layer->parent()->Add(layer_);
160 old_layer->parent()->StackAbove(layer_, old_layer); 168 old_layer->parent()->StackAbove(layer_, old_layer);
161 } 169 }
162 // Migrate all the child layers over to the new layer. Copy the list because 170 // Migrate all the child layers over to the new layer. Copy the list because
163 // the items are removed during iteration. 171 // the items are removed during iteration.
164 std::vector<ui::Layer*> children_copy = old_layer->children(); 172 std::vector<ui::Layer*> children_copy = old_layer->children();
(...skipping 864 matching lines...) Expand 10 before | Expand all | Expand 10 after
1029 bool contains_mouse = false; 1037 bool contains_mouse = false;
1030 if (IsVisible()) { 1038 if (IsVisible()) {
1031 RootWindow* root_window = GetRootWindow(); 1039 RootWindow* root_window = GetRootWindow();
1032 contains_mouse = root_window && 1040 contains_mouse = root_window &&
1033 ContainsPointInRoot(root_window->GetLastMouseLocationInRoot()); 1041 ContainsPointInRoot(root_window->GetLastMouseLocationInRoot());
1034 } 1042 }
1035 return contains_mouse; 1043 return contains_mouse;
1036 } 1044 }
1037 1045
1038 } // namespace aura 1046 } // namespace aura
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698