OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/gfx/compositor/layer.h" | 5 #include "ui/gfx/compositor/layer.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
607 void Layer::SetTransformImmediately(const ui::Transform& transform) { | 607 void Layer::SetTransformImmediately(const ui::Transform& transform) { |
608 transform_ = transform; | 608 transform_ = transform; |
609 | 609 |
610 SetNeedsToRecomputeHole(); | 610 SetNeedsToRecomputeHole(); |
611 #if defined(USE_WEBKIT_COMPOSITOR) | 611 #if defined(USE_WEBKIT_COMPOSITOR) |
612 RecomputeTransform(); | 612 RecomputeTransform(); |
613 #endif | 613 #endif |
614 } | 614 } |
615 | 615 |
616 void Layer::SetOpacityImmediately(float opacity) { | 616 void Layer::SetOpacityImmediately(float opacity) { |
| 617 bool schedule_draw = (opacity != opacity_ && IsDrawn()); |
617 opacity_ = opacity; | 618 opacity_ = opacity; |
618 SetNeedsToRecomputeHole(); | 619 SetNeedsToRecomputeHole(); |
619 #if defined(USE_WEBKIT_COMPOSITOR) | 620 #if defined(USE_WEBKIT_COMPOSITOR) |
620 if (visible_) | 621 if (visible_) |
621 web_layer_.setOpacity(opacity); | 622 web_layer_.setOpacity(opacity); |
622 #endif | 623 #endif |
| 624 if (schedule_draw) |
| 625 ScheduleDraw(); |
623 } | 626 } |
624 | 627 |
625 void Layer::SetBoundsFromAnimation(const gfx::Rect& bounds) { | 628 void Layer::SetBoundsFromAnimation(const gfx::Rect& bounds) { |
626 SetBoundsImmediately(bounds); | 629 SetBoundsImmediately(bounds); |
627 } | 630 } |
628 | 631 |
629 void Layer::SetTransformFromAnimation(const Transform& transform) { | 632 void Layer::SetTransformFromAnimation(const Transform& transform) { |
630 SetTransformImmediately(transform); | 633 SetTransformImmediately(transform); |
631 } | 634 } |
632 | 635 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
684 #else | 687 #else |
685 unsigned int texture_id = 0; | 688 unsigned int texture_id = 0; |
686 #endif | 689 #endif |
687 web_layer_.to<WebKit::WebExternalTextureLayer>().setTextureId( | 690 web_layer_.to<WebKit::WebExternalTextureLayer>().setTextureId( |
688 should_draw ? texture_id : 0); | 691 should_draw ? texture_id : 0); |
689 } | 692 } |
690 } | 693 } |
691 #endif | 694 #endif |
692 | 695 |
693 } // namespace ui | 696 } // namespace ui |
OLD | NEW |