| 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/compositor/layer.h" | 5 #include "ui/compositor/layer.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 464 void Layer::SetExternalTexture(Texture* texture) { | 464 void Layer::SetExternalTexture(Texture* texture) { |
| 465 DCHECK_EQ(type_, LAYER_TEXTURED); | 465 DCHECK_EQ(type_, LAYER_TEXTURED); |
| 466 DCHECK(!solid_color_layer_); | 466 DCHECK(!solid_color_layer_); |
| 467 bool has_texture = !!texture; | 467 bool has_texture = !!texture; |
| 468 layer_updated_externally_ = has_texture; | 468 layer_updated_externally_ = has_texture; |
| 469 texture_ = texture; | 469 texture_ = texture; |
| 470 if (!!texture_layer_ != has_texture) { | 470 if (!!texture_layer_ != has_texture) { |
| 471 // Switch to a different type of layer. | 471 // Switch to a different type of layer. |
| 472 if (has_texture) { | 472 if (has_texture) { |
| 473 scoped_refptr<cc::TextureLayer> new_layer = | 473 scoped_refptr<cc::TextureLayer> new_layer = |
| 474 cc::TextureLayer::Create(this); | 474 cc::TextureLayer::Create(this, false); |
| 475 new_layer->SetFlipped(texture_->flipped()); | 475 new_layer->SetFlipped(texture_->flipped()); |
| 476 SwitchToLayer(new_layer); | 476 SwitchToLayer(new_layer); |
| 477 texture_layer_ = new_layer; | 477 texture_layer_ = new_layer; |
| 478 } else { | 478 } else { |
| 479 scoped_refptr<cc::ContentLayer> new_layer = | 479 scoped_refptr<cc::ContentLayer> new_layer = |
| 480 cc::ContentLayer::Create(this); | 480 cc::ContentLayer::Create(this); |
| 481 SwitchToLayer(new_layer); | 481 SwitchToLayer(new_layer); |
| 482 content_layer_ = new_layer; | 482 content_layer_ = new_layer; |
| 483 } | 483 } |
| 484 } | 484 } |
| (...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 916 texture_layer_->SetUV(uv_top_left, uv_bottom_right); | 916 texture_layer_->SetUV(uv_top_left, uv_bottom_right); |
| 917 } else if (delegated_renderer_layer_.get()) { | 917 } else if (delegated_renderer_layer_.get()) { |
| 918 delegated_renderer_layer_->SetDisplaySize( | 918 delegated_renderer_layer_->SetDisplaySize( |
| 919 ConvertSizeToPixel(this, delegated_frame_size_in_dip_)); | 919 ConvertSizeToPixel(this, delegated_frame_size_in_dip_)); |
| 920 size.ClampToMax(delegated_frame_size_in_dip_); | 920 size.ClampToMax(delegated_frame_size_in_dip_); |
| 921 } | 921 } |
| 922 cc_layer_->SetBounds(ConvertSizeToPixel(this, size)); | 922 cc_layer_->SetBounds(ConvertSizeToPixel(this, size)); |
| 923 } | 923 } |
| 924 | 924 |
| 925 } // namespace ui | 925 } // namespace ui |
| OLD | NEW |