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