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 754 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
765 // Start with the inverse matrix of above. | 765 // Start with the inverse matrix of above. |
766 gfx::Transform transform; | 766 gfx::Transform transform; |
767 transform.matrix().set3x3(1.0f / device_scale_factor_, 0, 0, | 767 transform.matrix().set3x3(1.0f / device_scale_factor_, 0, 0, |
768 0, 1.0f / device_scale_factor_, 0, | 768 0, 1.0f / device_scale_factor_, 0, |
769 0, 0, 1); | 769 0, 0, 1); |
770 transform.ConcatTransform(transform_); | 770 transform.ConcatTransform(transform_); |
771 gfx::Transform translate; | 771 gfx::Transform translate; |
772 translate.Translate(bounds_.x(), bounds_.y()); | 772 translate.Translate(bounds_.x(), bounds_.y()); |
773 transform.ConcatTransform(translate); | 773 transform.ConcatTransform(translate); |
774 transform.ConcatTransform(scale_translate); | 774 transform.ConcatTransform(scale_translate); |
775 cc_layer_->setTransform(WebKit::WebTransformationMatrix(transform)); | 775 cc_layer_->setTransform(transform); |
776 } | 776 } |
777 | 777 |
778 void Layer::RecomputeDrawsContentAndUVRect() { | 778 void Layer::RecomputeDrawsContentAndUVRect() { |
779 DCHECK(cc_layer_); | 779 DCHECK(cc_layer_); |
780 if (!cc_layer_is_accelerated_) { | 780 if (!cc_layer_is_accelerated_) { |
781 cc_layer_->setBounds(ConvertSizeToPixel(this, bounds_.size())); | 781 cc_layer_->setBounds(ConvertSizeToPixel(this, bounds_.size())); |
782 } else { | 782 } else { |
783 DCHECK(texture_); | 783 DCHECK(texture_); |
784 | 784 |
785 float texture_scale_factor = 1.0f / texture_->device_scale_factor(); | 785 float texture_scale_factor = 1.0f / texture_->device_scale_factor(); |
786 gfx::Size texture_size = gfx::ToFlooredSize( | 786 gfx::Size texture_size = gfx::ToFlooredSize( |
787 gfx::ScaleSize(texture_->size(), texture_scale_factor)); | 787 gfx::ScaleSize(texture_->size(), texture_scale_factor)); |
788 | 788 |
789 gfx::Size size(std::min(bounds().width(), texture_size.width()), | 789 gfx::Size size(std::min(bounds().width(), texture_size.width()), |
790 std::min(bounds().height(), texture_size.height())); | 790 std::min(bounds().height(), texture_size.height())); |
791 gfx::RectF rect( | 791 gfx::RectF rect( |
792 0, | 792 0, |
793 0, | 793 0, |
794 static_cast<float>(size.width())/texture_size.width(), | 794 static_cast<float>(size.width())/texture_size.width(), |
795 static_cast<float>(size.height())/texture_size.height()); | 795 static_cast<float>(size.height())/texture_size.height()); |
796 texture_layer_->setUVRect(rect); | 796 texture_layer_->setUVRect(rect); |
797 | 797 |
798 cc_layer_->setBounds(ConvertSizeToPixel(this, size)); | 798 cc_layer_->setBounds(ConvertSizeToPixel(this, size)); |
799 } | 799 } |
800 } | 800 } |
801 | 801 |
802 } // namespace ui | 802 } // namespace ui |
OLD | NEW |