| OLD | NEW |
| 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 } | 74 } |
| 75 | 75 |
| 76 Layer::~Layer() | 76 Layer::~Layer() |
| 77 { | 77 { |
| 78 // Our parent should be holding a reference to us so there should be no | 78 // 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. | 79 // way for us to be destroyed while we still have a parent. |
| 80 DCHECK(!parent()); | 80 DCHECK(!parent()); |
| 81 | 81 |
| 82 // Remove the parent reference from all children. | 82 // Remove the parent reference from all children. |
| 83 removeAllChildren(); | 83 removeAllChildren(); |
| 84 | |
| 85 SkSafeUnref(m_filter); | |
| 86 } | 84 } |
| 87 | 85 |
| 88 void Layer::setUseLCDText(bool useLCDText) | 86 void Layer::setUseLCDText(bool useLCDText) |
| 89 { | 87 { |
| 90 m_useLCDText = useLCDText; | 88 m_useLCDText = useLCDText; |
| 91 } | 89 } |
| 92 | 90 |
| 93 void Layer::setLayerTreeHost(LayerTreeHost* host) | 91 void Layer::setLayerTreeHost(LayerTreeHost* host) |
| 94 { | 92 { |
| 95 if (m_layerTreeHost == host) | 93 if (m_layerTreeHost == host) |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 { | 319 { |
| 322 if (m_filters == filters) | 320 if (m_filters == filters) |
| 323 return; | 321 return; |
| 324 DCHECK(!m_filter); | 322 DCHECK(!m_filter); |
| 325 m_filters = filters; | 323 m_filters = filters; |
| 326 setNeedsCommit(); | 324 setNeedsCommit(); |
| 327 if (!filters.isEmpty()) | 325 if (!filters.isEmpty()) |
| 328 LayerTreeHost::setNeedsFilterContext(true); | 326 LayerTreeHost::setNeedsFilterContext(true); |
| 329 } | 327 } |
| 330 | 328 |
| 331 void Layer::setFilter(SkImageFilter* filter) | 329 void Layer::setFilter(const SkRefPtr<SkImageFilter>& filter) |
| 332 { | 330 { |
| 333 if (m_filter == filter) | 331 if (m_filter.get() == filter.get()) |
| 334 return; | 332 return; |
| 335 DCHECK(m_filters.isEmpty()); | 333 DCHECK(m_filters.isEmpty()); |
| 336 SkRefCnt_SafeAssign(m_filter, filter); | 334 m_filter = filter; |
| 337 setNeedsCommit(); | 335 setNeedsCommit(); |
| 338 if (filter) | 336 if (filter) |
| 339 LayerTreeHost::setNeedsFilterContext(true); | 337 LayerTreeHost::setNeedsFilterContext(true); |
| 340 } | 338 } |
| 341 | 339 |
| 342 void Layer::setBackgroundFilters(const WebKit::WebFilterOperations& backgroundFi
lters) | 340 void Layer::setBackgroundFilters(const WebKit::WebFilterOperations& backgroundFi
lters) |
| 343 { | 341 { |
| 344 if (m_backgroundFilters == backgroundFilters) | 342 if (m_backgroundFilters == backgroundFilters) |
| 345 return; | 343 return; |
| 346 m_backgroundFilters = backgroundFilters; | 344 m_backgroundFilters = backgroundFilters; |
| (...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 834 { | 832 { |
| 835 return 0; | 833 return 0; |
| 836 } | 834 } |
| 837 | 835 |
| 838 void sortLayers(std::vector<scoped_refptr<Layer> >::iterator, std::vector<scoped
_refptr<Layer> >::iterator, void*) | 836 void sortLayers(std::vector<scoped_refptr<Layer> >::iterator, std::vector<scoped
_refptr<Layer> >::iterator, void*) |
| 839 { | 837 { |
| 840 // Currently we don't use z-order to decide what to paint, so there's no nee
d to actually sort Layers. | 838 // Currently we don't use z-order to decide what to paint, so there's no nee
d to actually sort Layers. |
| 841 } | 839 } |
| 842 | 840 |
| 843 } // namespace cc | 841 } // namespace cc |
| OLD | NEW |