| OLD | NEW |
| 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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 // Disconnect the old layer, but don't delete it. | 151 // Disconnect the old layer, but don't delete it. |
| 152 ui::Layer* old_layer = AcquireLayer(); | 152 ui::Layer* old_layer = AcquireLayer(); |
| 153 if (!old_layer) | 153 if (!old_layer) |
| 154 return NULL; | 154 return NULL; |
| 155 | 155 |
| 156 old_layer->set_delegate(NULL); | 156 old_layer->set_delegate(NULL); |
| 157 float mailbox_scale_factor; | 157 float mailbox_scale_factor; |
| 158 cc::TextureMailbox old_mailbox = | 158 cc::TextureMailbox old_mailbox = |
| 159 old_layer->GetTextureMailbox(&mailbox_scale_factor); | 159 old_layer->GetTextureMailbox(&mailbox_scale_factor); |
| 160 scoped_refptr<ui::Texture> old_texture = old_layer->external_texture(); | 160 scoped_refptr<ui::Texture> old_texture = old_layer->external_texture(); |
| 161 if (delegate_ && old_texture) | 161 if (delegate_ && old_texture.get()) |
| 162 old_layer->SetExternalTexture(delegate_->CopyTexture()); | 162 old_layer->SetExternalTexture(delegate_->CopyTexture()); |
| 163 | 163 |
| 164 layer_ = new ui::Layer(old_layer->type()); | 164 layer_ = new ui::Layer(old_layer->type()); |
| 165 layer_owner_.reset(layer_); | 165 layer_owner_.reset(layer_); |
| 166 layer_->SetVisible(old_layer->visible()); | 166 layer_->SetVisible(old_layer->visible()); |
| 167 layer_->set_scale_content(old_layer->scale_content()); | 167 layer_->set_scale_content(old_layer->scale_content()); |
| 168 layer_->set_delegate(this); | 168 layer_->set_delegate(this); |
| 169 layer_->SetMasksToBounds(old_layer->GetMasksToBounds()); | 169 layer_->SetMasksToBounds(old_layer->GetMasksToBounds()); |
| 170 // Move the original texture to the new layer if the old layer has a | 170 // Move the original texture to the new layer if the old layer has a |
| 171 // texture and we could copy it into the old layer, | 171 // texture and we could copy it into the old layer, |
| 172 // crbug.com/175211. | 172 // crbug.com/175211. |
| 173 if (delegate_ && old_texture) { | 173 if (delegate_ && old_texture.get()) { |
| 174 layer_->SetExternalTexture(old_texture); | 174 layer_->SetExternalTexture(old_texture.get()); |
| 175 } else if (old_mailbox.IsSharedMemory()) { | 175 } else if (old_mailbox.IsSharedMemory()) { |
| 176 base::SharedMemory* old_buffer = old_mailbox.shared_memory(); | 176 base::SharedMemory* old_buffer = old_mailbox.shared_memory(); |
| 177 const size_t size = old_mailbox.shared_memory_size_in_bytes(); | 177 const size_t size = old_mailbox.shared_memory_size_in_bytes(); |
| 178 | 178 |
| 179 scoped_ptr<base::SharedMemory> new_buffer(new base::SharedMemory); | 179 scoped_ptr<base::SharedMemory> new_buffer(new base::SharedMemory); |
| 180 new_buffer->CreateAndMapAnonymous(size); | 180 new_buffer->CreateAndMapAnonymous(size); |
| 181 | 181 |
| 182 if (old_buffer->memory() && new_buffer->memory()) { | 182 if (old_buffer->memory() && new_buffer->memory()) { |
| 183 memcpy(new_buffer->memory(), old_buffer->memory(), size); | 183 memcpy(new_buffer->memory(), old_buffer->memory(), size); |
| 184 base::SharedMemory* new_buffer_raw_ptr = new_buffer.get(); | 184 base::SharedMemory* new_buffer_raw_ptr = new_buffer.get(); |
| (...skipping 947 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1132 bool contains_mouse = false; | 1132 bool contains_mouse = false; |
| 1133 if (IsVisible()) { | 1133 if (IsVisible()) { |
| 1134 RootWindow* root_window = GetRootWindow(); | 1134 RootWindow* root_window = GetRootWindow(); |
| 1135 contains_mouse = root_window && | 1135 contains_mouse = root_window && |
| 1136 ContainsPointInRoot(root_window->GetLastMouseLocationInRoot()); | 1136 ContainsPointInRoot(root_window->GetLastMouseLocationInRoot()); |
| 1137 } | 1137 } |
| 1138 return contains_mouse; | 1138 return contains_mouse; |
| 1139 } | 1139 } |
| 1140 | 1140 |
| 1141 } // namespace aura | 1141 } // namespace aura |
| OLD | NEW |