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 768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
779 cc_layer_->setBounds(ConvertSizeToPixel(this, bounds_.size())); | 779 cc_layer_->setBounds(ConvertSizeToPixel(this, bounds_.size())); |
780 } else { | 780 } else { |
781 DCHECK(texture_); | 781 DCHECK(texture_); |
782 | 782 |
783 float texture_scale_factor = 1.0f / texture_->device_scale_factor(); | 783 float texture_scale_factor = 1.0f / texture_->device_scale_factor(); |
784 gfx::Size texture_size = gfx::ToFlooredSize( | 784 gfx::Size texture_size = gfx::ToFlooredSize( |
785 gfx::ScaleSize(texture_->size(), texture_scale_factor)); | 785 gfx::ScaleSize(texture_->size(), texture_scale_factor)); |
786 | 786 |
787 gfx::Size size(std::min(bounds().width(), texture_size.width()), | 787 gfx::Size size(std::min(bounds().width(), texture_size.width()), |
788 std::min(bounds().height(), texture_size.height())); | 788 std::min(bounds().height(), texture_size.height())); |
789 gfx::RectF rect( | 789 gfx::PointF uv_top_left(0.f, 0.f); |
790 0, | 790 gfx::PointF uv_bottom_right( |
791 0, | |
792 static_cast<float>(size.width())/texture_size.width(), | 791 static_cast<float>(size.width())/texture_size.width(), |
793 static_cast<float>(size.height())/texture_size.height()); | 792 static_cast<float>(size.height())/texture_size.height()); |
794 texture_layer_->setUVRect(rect); | 793 texture_layer_->setUV(uv_top_left, uv_bottom_right); |
795 | 794 |
796 cc_layer_->setBounds(ConvertSizeToPixel(this, size)); | 795 cc_layer_->setBounds(ConvertSizeToPixel(this, size)); |
797 } | 796 } |
798 } | 797 } |
799 | 798 |
800 } // namespace ui | 799 } // namespace ui |
OLD | NEW |