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

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

Issue 295193002: Get rid of graphics layer anchor points, and replace with transform origin. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix nit. Created 6 years, 6 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
« no previous file with comments | « ui/compositor/compositor.cc ('k') | ui/compositor/layer_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 solid_color_layer_ = NULL; 479 solid_color_layer_ = NULL;
480 texture_layer_ = NULL; 480 texture_layer_ = NULL;
481 delegated_renderer_layer_ = NULL; 481 delegated_renderer_layer_ = NULL;
482 482
483 cc_layer_->AddLayerAnimationEventObserver(this); 483 cc_layer_->AddLayerAnimationEventObserver(this);
484 for (size_t i = 0; i < children_.size(); ++i) { 484 for (size_t i = 0; i < children_.size(); ++i) {
485 DCHECK(children_[i]->cc_layer_); 485 DCHECK(children_[i]->cc_layer_);
486 cc_layer_->AddChild(children_[i]->cc_layer_); 486 cc_layer_->AddChild(children_[i]->cc_layer_);
487 } 487 }
488 cc_layer_->SetLayerClient(this); 488 cc_layer_->SetLayerClient(this);
489 cc_layer_->SetAnchorPoint(gfx::PointF()); 489 cc_layer_->SetTransformOrigin(gfx::Point3F());
490 cc_layer_->SetContentsOpaque(fills_bounds_opaquely_); 490 cc_layer_->SetContentsOpaque(fills_bounds_opaquely_);
491 cc_layer_->SetForceRenderSurface(force_render_surface_); 491 cc_layer_->SetForceRenderSurface(force_render_surface_);
492 cc_layer_->SetIsDrawable(type_ != LAYER_NOT_DRAWN); 492 cc_layer_->SetIsDrawable(type_ != LAYER_NOT_DRAWN);
493 cc_layer_->SetHideLayerAndSubtree(!visible_); 493 cc_layer_->SetHideLayerAndSubtree(!visible_);
494 } 494 }
495 495
496 void Layer::SwitchCCLayerForTest() { 496 void Layer::SwitchCCLayerForTest() {
497 scoped_refptr<cc::Layer> new_layer; 497 scoped_refptr<cc::Layer> new_layer;
498 if (Layer::UsingPictureLayer()) 498 if (Layer::UsingPictureLayer())
499 new_layer = cc::PictureLayer::Create(this); 499 new_layer = cc::PictureLayer::Create(this);
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
890 if (type_ == LAYER_SOLID_COLOR) { 890 if (type_ == LAYER_SOLID_COLOR) {
891 solid_color_layer_ = cc::SolidColorLayer::Create(); 891 solid_color_layer_ = cc::SolidColorLayer::Create();
892 cc_layer_ = solid_color_layer_.get(); 892 cc_layer_ = solid_color_layer_.get();
893 } else { 893 } else {
894 if (Layer::UsingPictureLayer()) 894 if (Layer::UsingPictureLayer())
895 content_layer_ = cc::PictureLayer::Create(this); 895 content_layer_ = cc::PictureLayer::Create(this);
896 else 896 else
897 content_layer_ = cc::ContentLayer::Create(this); 897 content_layer_ = cc::ContentLayer::Create(this);
898 cc_layer_ = content_layer_.get(); 898 cc_layer_ = content_layer_.get();
899 } 899 }
900 cc_layer_->SetAnchorPoint(gfx::PointF()); 900 cc_layer_->SetTransformOrigin(gfx::Point3F());
901 cc_layer_->SetContentsOpaque(true); 901 cc_layer_->SetContentsOpaque(true);
902 cc_layer_->SetIsDrawable(type_ != LAYER_NOT_DRAWN); 902 cc_layer_->SetIsDrawable(type_ != LAYER_NOT_DRAWN);
903 cc_layer_->AddLayerAnimationEventObserver(this); 903 cc_layer_->AddLayerAnimationEventObserver(this);
904 cc_layer_->SetLayerClient(this); 904 cc_layer_->SetLayerClient(this);
905 RecomputePosition(); 905 RecomputePosition();
906 } 906 }
907 907
908 gfx::Transform Layer::transform() const { 908 gfx::Transform Layer::transform() const {
909 return cc_layer_->transform(); 909 return cc_layer_->transform();
910 } 910 }
(...skipping 13 matching lines...) Expand all
924 delegated_renderer_layer_->SetDisplaySize(frame_size_in_dip_); 924 delegated_renderer_layer_->SetDisplaySize(frame_size_in_dip_);
925 } 925 }
926 cc_layer_->SetBounds(size); 926 cc_layer_->SetBounds(size);
927 } 927 }
928 928
929 void Layer::RecomputePosition() { 929 void Layer::RecomputePosition() {
930 cc_layer_->SetPosition(gfx::PointF(bounds_.x(), bounds_.y())); 930 cc_layer_->SetPosition(gfx::PointF(bounds_.x(), bounds_.y()));
931 } 931 }
932 932
933 } // namespace ui 933 } // namespace ui
OLDNEW
« no previous file with comments | « ui/compositor/compositor.cc ('k') | ui/compositor/layer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698