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

Side by Side Diff: cc/layer_impl.cc

Issue 11280263: Organize internal properties of cc/ layer types (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
« cc/layer_impl.h ('K') | « cc/layer_impl.h ('k') | no next file » | 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 "cc/debug_border_draw_quad.h" 9 #include "cc/debug_border_draw_quad.h"
10 #include "cc/debug_colors.h" 10 #include "cc/debug_colors.h"
11 #include "cc/layer_sorter.h" 11 #include "cc/layer_sorter.h"
12 #include "cc/layer_tree_host_impl.h" 12 #include "cc/layer_tree_host_impl.h"
13 #include "cc/math_util.h" 13 #include "cc/math_util.h"
14 #include "cc/proxy.h" 14 #include "cc/proxy.h"
15 #include "cc/quad_sink.h" 15 #include "cc/quad_sink.h"
16 #include "cc/scrollbar_animation_controller.h" 16 #include "cc/scrollbar_animation_controller.h"
17 #include "third_party/skia/include/core/SkImageFilter.h" 17 #include "third_party/skia/include/core/SkImageFilter.h"
18 #include "ui/gfx/point_conversions.h" 18 #include "ui/gfx/point_conversions.h"
19 #include "ui/gfx/rect_conversions.h" 19 #include "ui/gfx/rect_conversions.h"
20 20
21 namespace cc { 21 namespace cc {
22 22
23
23 LayerImpl::LayerImpl(int id) 24 LayerImpl::LayerImpl(int id)
24 : m_parent(0) 25 : m_parent(0)
25 , m_maskLayerId(-1) 26 , m_maskLayerId(-1)
26 , m_replicaLayerId(-1) 27 , m_replicaLayerId(-1)
27 , m_layerId(id) 28 , m_layerId(id)
28 , m_layerTreeHostImpl(0) 29 , m_layerTreeHostImpl(0)
29 , m_anchorPoint(0.5, 0.5) 30 , m_anchorPoint(0.5, 0.5)
30 , m_anchorPointZ(0) 31 , m_anchorPointZ(0)
31 , m_contentsScaleX(1.0) 32 , m_contentsScaleX(1.0)
32 , m_contentsScaleY(1.0) 33 , m_contentsScaleY(1.0)
33 , m_scrollable(false) 34 , m_scrollable(false)
34 , m_shouldScrollOnMainThread(false) 35 , m_shouldScrollOnMainThread(false)
35 , m_haveWheelEventHandlers(false) 36 , m_haveWheelEventHandlers(false)
36 , m_backgroundColor(0) 37 , m_backgroundColor(0)
37 , m_doubleSided(true) 38 , m_doubleSided(true)
38 , m_layerPropertyChanged(false) 39 , m_layerPropertyChanged(false)
39 , m_layerSurfacePropertyChanged(false) 40 , m_layerSurfacePropertyChanged(false)
40 , m_masksToBounds(false) 41 , m_masksToBounds(false)
41 , m_contentsOpaque(false) 42 , m_contentsOpaque(false)
42 , m_opacity(1.0) 43 , m_opacity(1.0)
43 , m_preserves3D(false) 44 , m_preserves3D(false)
44 , m_useParentBackfaceVisibility(false) 45 , m_useParentBackfaceVisibility(false)
45 , m_drawCheckerboardForMissingTiles(false) 46 , m_drawCheckerboardForMissingTiles(false)
46 , m_useLCDText(false) 47 , m_useLCDText(false)
47 , m_drawsContent(false) 48 , m_drawsContent(false)
48 , m_forceRenderSurface(false) 49 , m_forceRenderSurface(false)
49 , m_isContainerForFixedPositionLayers(false) 50 , m_isContainerForFixedPositionLayers(false)
50 , m_fixedToContainerLayer(false) 51 , m_fixedToContainerLayer(false)
51 , m_renderTarget(0)
52 , m_drawDepth(0) 52 , m_drawDepth(0)
53 , m_drawOpacity(0)
54 , m_drawOpacityIsAnimating(false)
55 , m_filter(0) 53 , m_filter(0)
56 , m_drawTransformIsAnimating(false)
57 , m_screenSpaceTransformIsAnimating(false)
58 , m_isClipped(false)
59 #ifndef NDEBUG 54 #ifndef NDEBUG
60 , m_betweenWillDrawAndDidDraw(false) 55 , m_betweenWillDrawAndDidDraw(false)
61 #endif 56 #endif
62 , m_layerAnimationController(LayerAnimationController::create(this)) 57 , m_layerAnimationController(LayerAnimationController::create(this))
63 { 58 {
64 DCHECK(m_layerId > 0); 59 DCHECK(m_layerId > 0);
65 } 60 }
66 61
67 LayerImpl::~LayerImpl() 62 LayerImpl::~LayerImpl()
68 { 63 {
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 result += m_children[i]->descendantsDrawContent(); 116 result += m_children[i]->descendantsDrawContent();
122 if (result > 1) 117 if (result > 1)
123 return result; 118 return result;
124 } 119 }
125 return result; 120 return result;
126 } 121 }
127 122
128 scoped_ptr<SharedQuadState> LayerImpl::createSharedQuadState() const 123 scoped_ptr<SharedQuadState> LayerImpl::createSharedQuadState() const
129 { 124 {
130 scoped_ptr<SharedQuadState> state = SharedQuadState::Create(); 125 scoped_ptr<SharedQuadState> state = SharedQuadState::Create();
131 state->SetAll(m_drawTransform, m_visibleContentRect, m_drawableContentRect, m_ clipRect, m_isClipped, m_drawOpacity); 126 state->SetAll(m_drawProperties.drawTransform, m_drawProperties.visibleContentR ect, m_drawProperties.drawableContentRect, m_drawProperties.clipRect, m_drawProp erties.isClipped, m_drawProperties.drawOpacity);
132 return state.Pass(); 127 return state.Pass();
133 } 128 }
134 129
135 void LayerImpl::willDraw(ResourceProvider*) 130 void LayerImpl::willDraw(ResourceProvider*)
136 { 131 {
137 #ifndef NDEBUG 132 #ifndef NDEBUG
138 // willDraw/didDraw must be matched. 133 // willDraw/didDraw must be matched.
139 DCHECK(!m_betweenWillDrawAndDidDraw); 134 DCHECK(!m_betweenWillDrawAndDidDraw);
140 m_betweenWillDrawAndDidDraw = true; 135 m_betweenWillDrawAndDidDraw = true;
141 #endif 136 #endif
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 285
291 void LayerImpl::dumpLayerProperties(std::string* str, int indent) const 286 void LayerImpl::dumpLayerProperties(std::string* str, int indent) const
292 { 287 {
293 std::string indentStr = indentString(indent); 288 std::string indentStr = indentString(indent);
294 str->append(indentStr); 289 str->append(indentStr);
295 base::StringAppendF(str, "layer ID: %d\n", m_layerId); 290 base::StringAppendF(str, "layer ID: %d\n", m_layerId);
296 291
297 str->append(indentStr); 292 str->append(indentStr);
298 base::StringAppendF(str, "bounds: %d, %d\n", bounds().width(), bounds().heig ht()); 293 base::StringAppendF(str, "bounds: %d, %d\n", bounds().width(), bounds().heig ht());
299 294
300 if (m_renderTarget) { 295 if (m_drawProperties.renderTarget) {
301 str->append(indentStr); 296 str->append(indentStr);
302 base::StringAppendF(str, "renderTarget: %d\n", m_renderTarget->m_layerId ); 297 base::StringAppendF(str, "renderTarget: %d\n", m_drawProperties.renderTa rget->m_layerId);
303 } 298 }
304 299
305 str->append(indentStr); 300 str->append(indentStr);
306 base::StringAppendF(str, "position: %f, %f\n", m_position.x(), m_position.y( )); 301 base::StringAppendF(str, "position: %f, %f\n", m_position.x(), m_position.y( ));
307 302
308 str->append(indentStr); 303 str->append(indentStr);
309 base::StringAppendF(str, "contentsOpaque: %d\n", m_contentsOpaque); 304 base::StringAppendF(str, "contentsOpaque: %d\n", m_contentsOpaque);
310 305
311 str->append(indentStr); 306 str->append(indentStr);
307 const gfx::Transform& transform = m_drawProperties.drawTransform;
312 base::StringAppendF(str, "drawTransform: %f, %f, %f, %f // %f, %f, %f, %f // %f, %f, %f, %f // %f, %f, %f, %f\n", 308 base::StringAppendF(str, "drawTransform: %f, %f, %f, %f // %f, %f, %f, %f // %f, %f, %f, %f // %f, %f, %f, %f\n",
313 m_drawTransform.matrix().getDouble(0, 0), m_drawTransform.matrix().getDo uble(0, 1), m_drawTransform.matrix().getDouble(0, 2), m_drawTransform.matrix().g etDouble(0, 3), 309 transform.matrix().getDouble(0, 0), transform.matrix().getDouble(0, 1), transform.matrix().getDouble(0, 2), transform.matrix().getDouble(0, 3),
314 m_drawTransform.matrix().getDouble(1, 0), m_drawTransform.matrix().getDo uble(1, 1), m_drawTransform.matrix().getDouble(1, 2), m_drawTransform.matrix().g etDouble(1, 3), 310 transform.matrix().getDouble(1, 0), transform.matrix().getDouble(1, 1), transform.matrix().getDouble(1, 2), transform.matrix().getDouble(1, 3),
315 m_drawTransform.matrix().getDouble(2, 0), m_drawTransform.matrix().getDo uble(2, 1), m_drawTransform.matrix().getDouble(2, 2), m_drawTransform.matrix().g etDouble(2, 3), 311 transform.matrix().getDouble(2, 0), transform.matrix().getDouble(2, 1), transform.matrix().getDouble(2, 2), transform.matrix().getDouble(2, 3),
316 m_drawTransform.matrix().getDouble(3, 0), m_drawTransform.matrix().getDo uble(3, 1), m_drawTransform.matrix().getDouble(3, 2), m_drawTransform.matrix().g etDouble(3, 3)); 312 transform.matrix().getDouble(3, 0), transform.matrix().getDouble(3, 1), transform.matrix().getDouble(3, 2), transform.matrix().getDouble(3, 3));
317 313
318 str->append(indentStr); 314 str->append(indentStr);
319 base::StringAppendF(str, "drawsContent: %s\n", m_drawsContent ? "yes" : "no" ); 315 base::StringAppendF(str, "drawsContent: %s\n", m_drawsContent ? "yes" : "no" );
320 } 316 }
321 317
322 void sortLayers(std::vector<LayerImpl*>::iterator first, std::vector<LayerImpl*> ::iterator end, LayerSorter* layerSorter) 318 void sortLayers(std::vector<LayerImpl*>::iterator first, std::vector<LayerImpl*> ::iterator end, LayerSorter* layerSorter)
323 { 319 {
324 TRACE_EVENT0("cc", "LayerImpl::sortLayers"); 320 TRACE_EVENT0("cc", "LayerImpl::sortLayers");
325 layerSorter->sort(first, end); 321 layerSorter->sort(first, end);
326 } 322 }
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
726 722
727 void LayerImpl::setVerticalScrollbarLayer(ScrollbarLayerImpl* scrollbarLayer) 723 void LayerImpl::setVerticalScrollbarLayer(ScrollbarLayerImpl* scrollbarLayer)
728 { 724 {
729 if (!m_scrollbarAnimationController) 725 if (!m_scrollbarAnimationController)
730 m_scrollbarAnimationController = ScrollbarAnimationController::create(th is); 726 m_scrollbarAnimationController = ScrollbarAnimationController::create(th is);
731 m_scrollbarAnimationController->setVerticalScrollbarLayer(scrollbarLayer); 727 m_scrollbarAnimationController->setVerticalScrollbarLayer(scrollbarLayer);
732 m_scrollbarAnimationController->updateScrollOffset(this); 728 m_scrollbarAnimationController->updateScrollOffset(this);
733 } 729 }
734 730
735 } // namespace cc 731 } // namespace cc
OLDNEW
« cc/layer_impl.h ('K') | « cc/layer_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698