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

Side by Side Diff: cc/layer_impl.cc

Issue 11503005: cc: Refactor content scale/bounds into draw properties (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years 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 | « cc/layer_impl.h ('k') | cc/layer_tree_host_common.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 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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 "cc/layer_impl.h" 5 #include "cc/layer_impl.h"
6 6
7 #include "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "base/stringprintf.h" 8 #include "base/stringprintf.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "cc/debug_border_draw_quad.h" 10 #include "cc/debug_border_draw_quad.h"
(...skipping 11 matching lines...) Expand all
22 namespace cc { 22 namespace cc {
23 23
24 LayerImpl::LayerImpl(LayerTreeImpl* treeImpl, int id) 24 LayerImpl::LayerImpl(LayerTreeImpl* treeImpl, int id)
25 : m_parent(0) 25 : m_parent(0)
26 , m_maskLayerId(-1) 26 , m_maskLayerId(-1)
27 , m_replicaLayerId(-1) 27 , m_replicaLayerId(-1)
28 , m_layerId(id) 28 , m_layerId(id)
29 , m_layerTreeImpl(treeImpl) 29 , m_layerTreeImpl(treeImpl)
30 , m_anchorPoint(0.5, 0.5) 30 , m_anchorPoint(0.5, 0.5)
31 , m_anchorPointZ(0) 31 , m_anchorPointZ(0)
32 , m_contentsScaleX(1.0)
33 , m_contentsScaleY(1.0)
34 , m_scrollable(false) 32 , m_scrollable(false)
35 , m_shouldScrollOnMainThread(false) 33 , m_shouldScrollOnMainThread(false)
36 , m_haveWheelEventHandlers(false) 34 , m_haveWheelEventHandlers(false)
37 , m_backgroundColor(0) 35 , m_backgroundColor(0)
38 , m_doubleSided(true) 36 , m_doubleSided(true)
39 , m_layerPropertyChanged(false) 37 , m_layerPropertyChanged(false)
40 , m_layerSurfacePropertyChanged(false) 38 , m_layerSurfacePropertyChanged(false)
41 , m_masksToBounds(false) 39 , m_masksToBounds(false)
42 , m_contentsOpaque(false) 40 , m_contentsOpaque(false)
43 , m_opacity(1.0) 41 , m_opacity(1.0)
(...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 noteLayerSurfacePropertyChanged(); 668 noteLayerSurfacePropertyChanged();
671 } 669 }
672 670
673 bool LayerImpl::transformIsAnimating() const 671 bool LayerImpl::transformIsAnimating() const
674 { 672 {
675 return m_layerAnimationController->isAnimatingProperty(ActiveAnimation::Tran sform); 673 return m_layerAnimationController->isAnimatingProperty(ActiveAnimation::Tran sform);
676 } 674 }
677 675
678 void LayerImpl::setContentBounds(const gfx::Size& contentBounds) 676 void LayerImpl::setContentBounds(const gfx::Size& contentBounds)
679 { 677 {
680 if (m_contentBounds == contentBounds) 678 if (this->contentBounds() == contentBounds)
681 return; 679 return;
682 680
683 m_contentBounds = contentBounds; 681 m_drawProperties.content_bounds = contentBounds;
684 noteLayerPropertyChanged(); 682 noteLayerPropertyChanged();
685 } 683 }
686 684
687 void LayerImpl::setContentsScale(float contentsScaleX, float contentsScaleY) 685 void LayerImpl::setContentsScale(float contentsScaleX, float contentsScaleY)
688 { 686 {
689 if (m_contentsScaleX == contentsScaleX && m_contentsScaleY == contentsScaleY ) 687 if (this->contentsScaleX() == contentsScaleX && this->contentsScaleY() == co ntentsScaleY)
690 return; 688 return;
691 689
692 m_contentsScaleX = contentsScaleX; 690 m_drawProperties.contents_scale_x = contentsScaleX;
693 m_contentsScaleY = contentsScaleY; 691 m_drawProperties.contents_scale_y = contentsScaleY;
694 noteLayerPropertyChanged(); 692 noteLayerPropertyChanged();
695 } 693 }
696 694
697 void LayerImpl::setScrollOffset(gfx::Vector2d scrollOffset) 695 void LayerImpl::setScrollOffset(gfx::Vector2d scrollOffset)
698 { 696 {
699 if (m_scrollOffset == scrollOffset) 697 if (m_scrollOffset == scrollOffset)
700 return; 698 return;
701 699
702 m_scrollOffset = scrollOffset; 700 m_scrollOffset = scrollOffset;
703 noteLayerPropertyChangedForSubtree(); 701 noteLayerPropertyChangedForSubtree();
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
784 782
785 void LayerImpl::setVerticalScrollbarLayer(ScrollbarLayerImpl* scrollbarLayer) 783 void LayerImpl::setVerticalScrollbarLayer(ScrollbarLayerImpl* scrollbarLayer)
786 { 784 {
787 if (!m_scrollbarAnimationController) 785 if (!m_scrollbarAnimationController)
788 m_scrollbarAnimationController = ScrollbarAnimationController::create(th is); 786 m_scrollbarAnimationController = ScrollbarAnimationController::create(th is);
789 m_scrollbarAnimationController->setVerticalScrollbarLayer(scrollbarLayer); 787 m_scrollbarAnimationController->setVerticalScrollbarLayer(scrollbarLayer);
790 m_scrollbarAnimationController->updateScrollOffset(this); 788 m_scrollbarAnimationController->updateScrollOffset(this);
791 } 789 }
792 790
793 } // namespace cc 791 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layer_impl.h ('k') | cc/layer_tree_host_common.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698