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 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
591 content_layer_ = new_layer; | 591 content_layer_ = new_layer; |
592 | 592 |
593 mailbox_ = cc::TextureMailbox(); | 593 mailbox_ = cc::TextureMailbox(); |
594 if (mailbox_release_callback_) { | 594 if (mailbox_release_callback_) { |
595 mailbox_release_callback_->Run(0, false); | 595 mailbox_release_callback_->Run(0, false); |
596 mailbox_release_callback_.reset(); | 596 mailbox_release_callback_.reset(); |
597 } | 597 } |
598 RecomputeDrawsContentAndUVRect(); | 598 RecomputeDrawsContentAndUVRect(); |
599 } | 599 } |
600 | 600 |
601 void Layer::UpdateNinePatchLayerBitmap(const SkBitmap& bitmap, | 601 void Layer::UpdateNinePatchLayerBitmap(const SkBitmap& bitmap) { |
602 const gfx::Rect& aperture) { | |
603 DCHECK(type_ == LAYER_NINE_PATCH && nine_patch_layer_.get()); | 602 DCHECK(type_ == LAYER_NINE_PATCH && nine_patch_layer_.get()); |
604 SkBitmap bitmap_copy; | 603 SkBitmap bitmap_copy; |
605 if (bitmap.isImmutable()) { | 604 if (bitmap.isImmutable()) { |
606 bitmap_copy = bitmap; | 605 bitmap_copy = bitmap; |
607 } else { | 606 } else { |
608 // UIResourceBitmap requires an immutable copy of the input |bitmap|. | 607 // UIResourceBitmap requires an immutable copy of the input |bitmap|. |
609 bitmap.copyTo(&bitmap_copy); | 608 bitmap.copyTo(&bitmap_copy); |
610 bitmap_copy.setImmutable(); | 609 bitmap_copy.setImmutable(); |
611 } | 610 } |
612 nine_patch_layer_->SetBitmap(bitmap_copy); | 611 nine_patch_layer_->SetBitmap(bitmap_copy); |
| 612 } |
| 613 |
| 614 void Layer::UpdateNinePatchLayerAperture(const gfx::Rect& aperture) { |
| 615 DCHECK(type_ == LAYER_NINE_PATCH && nine_patch_layer_.get()); |
613 nine_patch_layer_->SetAperture(aperture); | 616 nine_patch_layer_->SetAperture(aperture); |
614 } | 617 } |
615 | 618 |
616 void Layer::UpdateNinePatchLayerBorder(const gfx::Rect& border) { | 619 void Layer::UpdateNinePatchLayerBorder(const gfx::Rect& border) { |
617 DCHECK(type_ == LAYER_NINE_PATCH && nine_patch_layer_.get()); | 620 DCHECK(type_ == LAYER_NINE_PATCH && nine_patch_layer_.get()); |
618 nine_patch_layer_->SetBorder(border); | 621 nine_patch_layer_->SetBorder(border); |
619 } | 622 } |
620 | 623 |
621 void Layer::SetColor(SkColor color) { GetAnimator()->SetColor(color); } | 624 void Layer::SetColor(SkColor color) { GetAnimator()->SetColor(color); } |
622 | 625 |
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1038 children_.end(), | 1041 children_.end(), |
1039 std::bind2nd(std::mem_fun(&Layer::RemoveAnimatorsInTreeFromCollection), | 1042 std::bind2nd(std::mem_fun(&Layer::RemoveAnimatorsInTreeFromCollection), |
1040 collection)); | 1043 collection)); |
1041 } | 1044 } |
1042 | 1045 |
1043 bool Layer::IsAnimating() const { | 1046 bool Layer::IsAnimating() const { |
1044 return animator_.get() && animator_->is_animating(); | 1047 return animator_.get() && animator_->is_animating(); |
1045 } | 1048 } |
1046 | 1049 |
1047 } // namespace ui | 1050 } // namespace ui |
OLD | NEW |