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

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: rebased 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 768 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW
« no previous file with comments | « content/renderer/browser_plugin/browser_plugin_compositing_helper.cc ('k') | ui/gfx/size_base_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698