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

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

Issue 11308153: Migrate most of cc/ from WebKit::WebTransformationMatrix to gfx::Transform (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased to tip of tree and addressed feedback Created 8 years, 1 month 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 750 matching lines...) Expand 10 before | Expand all | Expand 10 after
761 0, device_scale_factor_, 0, 761 0, device_scale_factor_, 0,
762 0, 0, 1); 762 0, 0, 1);
763 // Start with the inverse matrix of above. 763 // Start with the inverse matrix of above.
764 gfx::Transform transform; 764 gfx::Transform transform;
765 transform.matrix().set3x3(1.0f / device_scale_factor_, 0, 0, 765 transform.matrix().set3x3(1.0f / device_scale_factor_, 0, 0,
766 0, 1.0f / device_scale_factor_, 0, 766 0, 1.0f / device_scale_factor_, 0,
767 0, 0, 1); 767 0, 0, 1);
768 transform.ConcatTransform(transform_); 768 transform.ConcatTransform(transform_);
769 transform.ConcatTranslate(bounds_.x(), bounds_.y()); 769 transform.ConcatTranslate(bounds_.x(), bounds_.y());
770 transform.ConcatTransform(scale_translate); 770 transform.ConcatTransform(scale_translate);
771 cc_layer_->setTransform(WebKit::WebTransformationMatrix(transform)); 771 cc_layer_->setTransform(transform);
772 } 772 }
773 773
774 void Layer::RecomputeDrawsContentAndUVRect() { 774 void Layer::RecomputeDrawsContentAndUVRect() {
775 DCHECK(cc_layer_); 775 DCHECK(cc_layer_);
776 if (!cc_layer_is_accelerated_) { 776 if (!cc_layer_is_accelerated_) {
777 cc_layer_->setBounds(ConvertSizeToPixel(this, bounds_.size())); 777 cc_layer_->setBounds(ConvertSizeToPixel(this, bounds_.size()));
778 } else { 778 } else {
779 DCHECK(texture_); 779 DCHECK(texture_);
780 780
781 float texture_scale_factor = 1.0f / texture_->device_scale_factor(); 781 float texture_scale_factor = 1.0f / texture_->device_scale_factor();
782 gfx::Size texture_size = gfx::ToFlooredSize( 782 gfx::Size texture_size = gfx::ToFlooredSize(
783 gfx::ScaleSize(texture_->size(), texture_scale_factor)); 783 gfx::ScaleSize(texture_->size(), texture_scale_factor));
784 784
785 gfx::Size size(std::min(bounds().width(), texture_size.width()), 785 gfx::Size size(std::min(bounds().width(), texture_size.width()),
786 std::min(bounds().height(), texture_size.height())); 786 std::min(bounds().height(), texture_size.height()));
787 gfx::RectF rect( 787 gfx::RectF rect(
788 0, 788 0,
789 0, 789 0,
790 static_cast<float>(size.width())/texture_size.width(), 790 static_cast<float>(size.width())/texture_size.width(),
791 static_cast<float>(size.height())/texture_size.height()); 791 static_cast<float>(size.height())/texture_size.height());
792 texture_layer_->setUVRect(rect); 792 texture_layer_->setUVRect(rect);
793 793
794 cc_layer_->setBounds(ConvertSizeToPixel(this, size)); 794 cc_layer_->setBounds(ConvertSizeToPixel(this, size));
795 } 795 }
796 } 796 }
797 797
798 } // namespace ui 798 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698