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

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

Issue 11783094: cc: Add point-based UV coordinate on TextureLayer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added unittest for clipped texture quad Created 7 years, 11 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 773 matching lines...) Expand 10 before | Expand all | Expand 10 after
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);
danakj 2013/01/15 01:48:42 nit: 0.f
Jerome 2013/01/15 17:58:12 Done.
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698