| 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/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 546 scoped_refptr<cc::TextureLayer> new_layer = | 546 scoped_refptr<cc::TextureLayer> new_layer = |
| 547 cc::TextureLayer::CreateForMailbox(UILayerSettings(), this); | 547 cc::TextureLayer::CreateForMailbox(UILayerSettings(), this); |
| 548 new_layer->SetFlipped(true); | 548 new_layer->SetFlipped(true); |
| 549 SwitchToLayer(new_layer); | 549 SwitchToLayer(new_layer); |
| 550 texture_layer_ = new_layer; | 550 texture_layer_ = new_layer; |
| 551 // Reset the frame_size_in_dip_ so that SetTextureSize() will not early out, | 551 // Reset the frame_size_in_dip_ so that SetTextureSize() will not early out, |
| 552 // the frame_size_in_dip_ was for a previous (different) |texture_layer_|. | 552 // the frame_size_in_dip_ was for a previous (different) |texture_layer_|. |
| 553 frame_size_in_dip_ = gfx::Size(); | 553 frame_size_in_dip_ = gfx::Size(); |
| 554 } | 554 } |
| 555 if (mailbox_release_callback_) | 555 if (mailbox_release_callback_) |
| 556 mailbox_release_callback_->Run(0, false); | 556 mailbox_release_callback_->Run(gpu::SyncToken(), false); |
| 557 mailbox_release_callback_ = release_callback.Pass(); | 557 mailbox_release_callback_ = release_callback.Pass(); |
| 558 mailbox_ = mailbox; | 558 mailbox_ = mailbox; |
| 559 SetTextureSize(texture_size_in_dip); | 559 SetTextureSize(texture_size_in_dip); |
| 560 } | 560 } |
| 561 | 561 |
| 562 void Layer::SetTextureSize(gfx::Size texture_size_in_dip) { | 562 void Layer::SetTextureSize(gfx::Size texture_size_in_dip) { |
| 563 DCHECK(texture_layer_.get()); | 563 DCHECK(texture_layer_.get()); |
| 564 if (frame_size_in_dip_ == texture_size_in_dip) | 564 if (frame_size_in_dip_ == texture_size_in_dip) |
| 565 return; | 565 return; |
| 566 frame_size_in_dip_ = texture_size_in_dip; | 566 frame_size_in_dip_ = texture_size_in_dip; |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 616 if (solid_color_layer_.get()) | 616 if (solid_color_layer_.get()) |
| 617 return; | 617 return; |
| 618 | 618 |
| 619 scoped_refptr<cc::SolidColorLayer> new_layer = | 619 scoped_refptr<cc::SolidColorLayer> new_layer = |
| 620 cc::SolidColorLayer::Create(UILayerSettings()); | 620 cc::SolidColorLayer::Create(UILayerSettings()); |
| 621 SwitchToLayer(new_layer); | 621 SwitchToLayer(new_layer); |
| 622 solid_color_layer_ = new_layer; | 622 solid_color_layer_ = new_layer; |
| 623 | 623 |
| 624 mailbox_ = cc::TextureMailbox(); | 624 mailbox_ = cc::TextureMailbox(); |
| 625 if (mailbox_release_callback_) { | 625 if (mailbox_release_callback_) { |
| 626 mailbox_release_callback_->Run(0, false); | 626 mailbox_release_callback_->Run(gpu::SyncToken(), false); |
| 627 mailbox_release_callback_.reset(); | 627 mailbox_release_callback_.reset(); |
| 628 } | 628 } |
| 629 RecomputeDrawsContentAndUVRect(); | 629 RecomputeDrawsContentAndUVRect(); |
| 630 } | 630 } |
| 631 | 631 |
| 632 void Layer::UpdateNinePatchLayerImage(const gfx::ImageSkia& image) { | 632 void Layer::UpdateNinePatchLayerImage(const gfx::ImageSkia& image) { |
| 633 DCHECK(type_ == LAYER_NINE_PATCH && nine_patch_layer_.get()); | 633 DCHECK(type_ == LAYER_NINE_PATCH && nine_patch_layer_.get()); |
| 634 nine_patch_layer_image_ = image; | 634 nine_patch_layer_image_ = image; |
| 635 SkBitmap bitmap = nine_patch_layer_image_.GetRepresentation( | 635 SkBitmap bitmap = nine_patch_layer_image_.GetRepresentation( |
| 636 device_scale_factor_).sk_bitmap(); | 636 device_scale_factor_).sk_bitmap(); |
| (...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1099 children_.end(), | 1099 children_.end(), |
| 1100 std::bind2nd(std::mem_fun(&Layer::RemoveAnimatorsInTreeFromCollection), | 1100 std::bind2nd(std::mem_fun(&Layer::RemoveAnimatorsInTreeFromCollection), |
| 1101 collection)); | 1101 collection)); |
| 1102 } | 1102 } |
| 1103 | 1103 |
| 1104 bool Layer::IsAnimating() const { | 1104 bool Layer::IsAnimating() const { |
| 1105 return animator_.get() && animator_->is_animating(); | 1105 return animator_.get() && animator_->is_animating(); |
| 1106 } | 1106 } |
| 1107 | 1107 |
| 1108 } // namespace ui | 1108 } // namespace ui |
| OLD | NEW |