Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(174)

Side by Side Diff: ui/compositor/layer.cc

Issue 14367021: Rename ClampToMin and ClampToMax (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 906 matching lines...) Expand 10 before | Expand all | Expand 10 after
917 917
918 void Layer::RecomputeDrawsContentAndUVRect() { 918 void Layer::RecomputeDrawsContentAndUVRect() {
919 DCHECK(cc_layer_); 919 DCHECK(cc_layer_);
920 gfx::Size size(bounds_.size()); 920 gfx::Size size(bounds_.size());
921 if (texture_layer_.get()) { 921 if (texture_layer_.get()) {
922 DCHECK(texture_); 922 DCHECK(texture_);
923 923
924 float texture_scale_factor = 1.0f / texture_->device_scale_factor(); 924 float texture_scale_factor = 1.0f / texture_->device_scale_factor();
925 gfx::Size texture_size = gfx::ToFlooredSize( 925 gfx::Size texture_size = gfx::ToFlooredSize(
926 gfx::ScaleSize(texture_->size(), texture_scale_factor)); 926 gfx::ScaleSize(texture_->size(), texture_scale_factor));
927 size.ClampToMax(texture_size); 927 size.ClampToUpperBound(texture_size);
928 928
929 gfx::PointF uv_top_left(0.f, 0.f); 929 gfx::PointF uv_top_left(0.f, 0.f);
930 gfx::PointF uv_bottom_right( 930 gfx::PointF uv_bottom_right(
931 static_cast<float>(size.width())/texture_size.width(), 931 static_cast<float>(size.width())/texture_size.width(),
932 static_cast<float>(size.height())/texture_size.height()); 932 static_cast<float>(size.height())/texture_size.height());
933 texture_layer_->SetUV(uv_top_left, uv_bottom_right); 933 texture_layer_->SetUV(uv_top_left, uv_bottom_right);
934 } else if (delegated_renderer_layer_.get()) { 934 } else if (delegated_renderer_layer_.get()) {
935 delegated_renderer_layer_->SetDisplaySize( 935 delegated_renderer_layer_->SetDisplaySize(
936 ConvertSizeToPixel(this, delegated_frame_size_in_dip_)); 936 ConvertSizeToPixel(this, delegated_frame_size_in_dip_));
937 size.ClampToMax(delegated_frame_size_in_dip_); 937 size.ClampToUpperBound(delegated_frame_size_in_dip_);
938 } 938 }
939 cc_layer_->SetBounds(ConvertSizeToPixel(this, size)); 939 cc_layer_->SetBounds(ConvertSizeToPixel(this, size));
940 } 940 }
941 941
942 void Layer::RecomputePosition() { 942 void Layer::RecomputePosition() {
943 cc_layer_->SetPosition(gfx::ScalePoint( 943 cc_layer_->SetPosition(gfx::ScalePoint(
944 gfx::PointF(bounds_.x(), bounds_.y()), 944 gfx::PointF(bounds_.x(), bounds_.y()),
945 device_scale_factor_)); 945 device_scale_factor_));
946 } 946 }
947 947
948 } // namespace ui 948 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698