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

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: Fix shadowing 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
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 608 matching lines...) Expand 10 before | Expand all | Expand 10 after
652 650
653 m_transform = transform; 651 m_transform = transform;
654 noteLayerSurfacePropertyChanged(); 652 noteLayerSurfacePropertyChanged();
655 } 653 }
656 654
657 bool LayerImpl::transformIsAnimating() const 655 bool LayerImpl::transformIsAnimating() const
658 { 656 {
659 return m_layerAnimationController->isAnimatingProperty(ActiveAnimation::Tran sform); 657 return m_layerAnimationController->isAnimatingProperty(ActiveAnimation::Tran sform);
660 } 658 }
661 659
662 void LayerImpl::setContentBounds(const gfx::Size& contentBounds) 660 void LayerImpl::setContentBounds(const gfx::Size& contentBounds)
danakj 2012/12/14 20:37:23 Random thought: What do you think of a setDrawProp
enne (OOO) 2012/12/14 22:06:05 I'm not sure. I think I'd prefer to punt on a pus
663 { 661 {
664 if (m_contentBounds == contentBounds) 662 if (this->contentBounds() == contentBounds)
665 return; 663 return;
666 664
667 m_contentBounds = contentBounds; 665 m_drawProperties.content_bounds = contentBounds;
668 noteLayerPropertyChanged(); 666 noteLayerPropertyChanged();
669 } 667 }
670 668
671 void LayerImpl::setContentsScale(float contentsScaleX, float contentsScaleY) 669 void LayerImpl::setContentsScale(float contentsScaleX, float contentsScaleY)
672 { 670 {
673 if (m_contentsScaleX == contentsScaleX && m_contentsScaleY == contentsScaleY ) 671 if (this->contentsScaleX() == contentsScaleX && this->contentsScaleY() == co ntentsScaleY)
674 return; 672 return;
675 673
676 m_contentsScaleX = contentsScaleX; 674 m_drawProperties.contents_scale_x = contentsScaleX;
677 m_contentsScaleY = contentsScaleY; 675 m_drawProperties.contents_scale_y = contentsScaleY;
678 noteLayerPropertyChanged(); 676 noteLayerPropertyChanged();
679 } 677 }
680 678
681 void LayerImpl::setScrollOffset(gfx::Vector2d scrollOffset) 679 void LayerImpl::setScrollOffset(gfx::Vector2d scrollOffset)
682 { 680 {
683 if (m_scrollOffset == scrollOffset) 681 if (m_scrollOffset == scrollOffset)
684 return; 682 return;
685 683
686 m_scrollOffset = scrollOffset; 684 m_scrollOffset = scrollOffset;
687 noteLayerPropertyChangedForSubtree(); 685 noteLayerPropertyChangedForSubtree();
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
768 766
769 void LayerImpl::setVerticalScrollbarLayer(ScrollbarLayerImpl* scrollbarLayer) 767 void LayerImpl::setVerticalScrollbarLayer(ScrollbarLayerImpl* scrollbarLayer)
770 { 768 {
771 if (!m_scrollbarAnimationController) 769 if (!m_scrollbarAnimationController)
772 m_scrollbarAnimationController = ScrollbarAnimationController::create(th is); 770 m_scrollbarAnimationController = ScrollbarAnimationController::create(th is);
773 m_scrollbarAnimationController->setVerticalScrollbarLayer(scrollbarLayer); 771 m_scrollbarAnimationController->setVerticalScrollbarLayer(scrollbarLayer);
774 m_scrollbarAnimationController->updateScrollOffset(this); 772 m_scrollbarAnimationController->updateScrollOffset(this);
775 } 773 }
776 774
777 } // namespace cc 775 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698