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

Side by Side Diff: cc/layer.cc

Issue 11418217: Add skia::RefPtr class to wrap ref counted classes from Skia. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nit 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.h ('k') | cc/layer_impl.h » ('j') | cc/skia_refptr.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 The Chromium Authors. All rights reserved. 1 // Copyright 2010 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.h" 5 #include "cc/layer.h"
6 6
7 #include "cc/active_animation.h" 7 #include "cc/active_animation.h"
8 #include "cc/animation_events.h" 8 #include "cc/animation_events.h"
9 #include "cc/layer_animation_controller.h" 9 #include "cc/layer_animation_controller.h"
10 #include "cc/layer_impl.h" 10 #include "cc/layer_impl.h"
(...skipping 23 matching lines...) Expand all
34 , m_layerTreeHost(0) 34 , m_layerTreeHost(0)
35 , m_layerAnimationController(LayerAnimationController::create(this)) 35 , m_layerAnimationController(LayerAnimationController::create(this))
36 , m_scrollable(false) 36 , m_scrollable(false)
37 , m_shouldScrollOnMainThread(false) 37 , m_shouldScrollOnMainThread(false)
38 , m_haveWheelEventHandlers(false) 38 , m_haveWheelEventHandlers(false)
39 , m_nonFastScrollableRegionChanged(false) 39 , m_nonFastScrollableRegionChanged(false)
40 , m_touchEventHandlerRegionChanged(false) 40 , m_touchEventHandlerRegionChanged(false)
41 , m_anchorPoint(0.5, 0.5) 41 , m_anchorPoint(0.5, 0.5)
42 , m_backgroundColor(0) 42 , m_backgroundColor(0)
43 , m_opacity(1.0) 43 , m_opacity(1.0)
44 , m_filter(0)
45 , m_anchorPointZ(0) 44 , m_anchorPointZ(0)
46 , m_isContainerForFixedPositionLayers(false) 45 , m_isContainerForFixedPositionLayers(false)
47 , m_fixedToContainerLayer(false) 46 , m_fixedToContainerLayer(false)
48 , m_isDrawable(false) 47 , m_isDrawable(false)
49 , m_masksToBounds(false) 48 , m_masksToBounds(false)
50 , m_contentsOpaque(false) 49 , m_contentsOpaque(false)
51 , m_doubleSided(true) 50 , m_doubleSided(true)
52 , m_useLCDText(false) 51 , m_useLCDText(false)
53 , m_preserves3D(false) 52 , m_preserves3D(false)
54 , m_useParentBackfaceVisibility(false) 53 , m_useParentBackfaceVisibility(false)
(...skipping 19 matching lines...) Expand all
74 } 73 }
75 74
76 Layer::~Layer() 75 Layer::~Layer()
77 { 76 {
78 // Our parent should be holding a reference to us so there should be no 77 // Our parent should be holding a reference to us so there should be no
79 // way for us to be destroyed while we still have a parent. 78 // way for us to be destroyed while we still have a parent.
80 DCHECK(!parent()); 79 DCHECK(!parent());
81 80
82 // Remove the parent reference from all children. 81 // Remove the parent reference from all children.
83 removeAllChildren(); 82 removeAllChildren();
84
85 SkSafeUnref(m_filter);
86 } 83 }
87 84
88 void Layer::setUseLCDText(bool useLCDText) 85 void Layer::setUseLCDText(bool useLCDText)
89 { 86 {
90 m_useLCDText = useLCDText; 87 m_useLCDText = useLCDText;
91 } 88 }
92 89
93 void Layer::setLayerTreeHost(LayerTreeHost* host) 90 void Layer::setLayerTreeHost(LayerTreeHost* host)
94 { 91 {
95 if (m_layerTreeHost == host) 92 if (m_layerTreeHost == host)
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 { 318 {
322 if (m_filters == filters) 319 if (m_filters == filters)
323 return; 320 return;
324 DCHECK(!m_filter); 321 DCHECK(!m_filter);
325 m_filters = filters; 322 m_filters = filters;
326 setNeedsCommit(); 323 setNeedsCommit();
327 if (!filters.isEmpty()) 324 if (!filters.isEmpty())
328 LayerTreeHost::setNeedsFilterContext(true); 325 LayerTreeHost::setNeedsFilterContext(true);
329 } 326 }
330 327
331 void Layer::setFilter(SkImageFilter* filter) 328 void Layer::setFilter(const SkiaRefPtr<SkImageFilter>& filter)
332 { 329 {
333 if (m_filter == filter) 330 if (m_filter.get() == filter.get())
334 return; 331 return;
335 DCHECK(m_filters.isEmpty()); 332 DCHECK(m_filters.isEmpty());
336 SkRefCnt_SafeAssign(m_filter, filter); 333 m_filter = filter;
337 setNeedsCommit(); 334 setNeedsCommit();
338 if (filter) 335 if (filter)
339 LayerTreeHost::setNeedsFilterContext(true); 336 LayerTreeHost::setNeedsFilterContext(true);
340 } 337 }
341 338
342 void Layer::setBackgroundFilters(const WebKit::WebFilterOperations& backgroundFi lters) 339 void Layer::setBackgroundFilters(const WebKit::WebFilterOperations& backgroundFi lters)
343 { 340 {
344 if (m_backgroundFilters == backgroundFilters) 341 if (m_backgroundFilters == backgroundFilters)
345 return; 342 return;
346 m_backgroundFilters = backgroundFilters; 343 m_backgroundFilters = backgroundFilters;
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after
834 { 831 {
835 return 0; 832 return 0;
836 } 833 }
837 834
838 void sortLayers(std::vector<scoped_refptr<Layer> >::iterator, std::vector<scoped _refptr<Layer> >::iterator, void*) 835 void sortLayers(std::vector<scoped_refptr<Layer> >::iterator, std::vector<scoped _refptr<Layer> >::iterator, void*)
839 { 836 {
840 // Currently we don't use z-order to decide what to paint, so there's no nee d to actually sort Layers. 837 // Currently we don't use z-order to decide what to paint, so there's no nee d to actually sort Layers.
841 } 838 }
842 839
843 } // namespace cc 840 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layer.h ('k') | cc/layer_impl.h » ('j') | cc/skia_refptr.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698