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/animation.h" | 7 #include "cc/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 79 matching lines...) Loading... |
90 | 90 |
91 if (m_maskLayer) | 91 if (m_maskLayer) |
92 m_maskLayer->setLayerTreeHost(host); | 92 m_maskLayer->setLayerTreeHost(host); |
93 if (m_replicaLayer) | 93 if (m_replicaLayer) |
94 m_replicaLayer->setLayerTreeHost(host); | 94 m_replicaLayer->setLayerTreeHost(host); |
95 | 95 |
96 m_layerAnimationController->setAnimationRegistrar(host ? host->animationRegi
strar() : 0); | 96 m_layerAnimationController->setAnimationRegistrar(host ? host->animationRegi
strar() : 0); |
97 | 97 |
98 if (host && m_layerAnimationController->hasAnyAnimation()) | 98 if (host && m_layerAnimationController->hasAnyAnimation()) |
99 host->setNeedsCommit(); | 99 host->setNeedsCommit(); |
| 100 if (host && (!m_filters.isEmpty() || !m_backgroundFilters.isEmpty() || m_fil
ter)) |
| 101 m_layerTreeHost->setNeedsFilterContext(); |
| 102 |
100 } | 103 } |
101 | 104 |
102 void Layer::setNeedsCommit() | 105 void Layer::setNeedsCommit() |
103 { | 106 { |
104 if (m_ignoreSetNeedsCommit) | 107 if (m_ignoreSetNeedsCommit) |
105 return; | 108 return; |
106 if (m_layerTreeHost) | 109 if (m_layerTreeHost) |
107 m_layerTreeHost->setNeedsCommit(); | 110 m_layerTreeHost->setNeedsCommit(); |
108 } | 111 } |
109 | 112 |
(...skipping 248 matching lines...) Loading... |
358 setNeedsFullTreeSync(); | 361 setNeedsFullTreeSync(); |
359 } | 362 } |
360 | 363 |
361 void Layer::setFilters(const WebKit::WebFilterOperations& filters) | 364 void Layer::setFilters(const WebKit::WebFilterOperations& filters) |
362 { | 365 { |
363 if (m_filters == filters) | 366 if (m_filters == filters) |
364 return; | 367 return; |
365 DCHECK(!m_filter); | 368 DCHECK(!m_filter); |
366 m_filters = filters; | 369 m_filters = filters; |
367 setNeedsCommit(); | 370 setNeedsCommit(); |
368 if (!filters.isEmpty()) | 371 if (!filters.isEmpty() && m_layerTreeHost) |
369 LayerTreeHost::setNeedsFilterContext(true); | 372 m_layerTreeHost->setNeedsFilterContext(); |
370 } | 373 } |
371 | 374 |
372 void Layer::setFilter(const skia::RefPtr<SkImageFilter>& filter) | 375 void Layer::setFilter(const skia::RefPtr<SkImageFilter>& filter) |
373 { | 376 { |
374 if (m_filter.get() == filter.get()) | 377 if (m_filter.get() == filter.get()) |
375 return; | 378 return; |
376 DCHECK(m_filters.isEmpty()); | 379 DCHECK(m_filters.isEmpty()); |
377 m_filter = filter; | 380 m_filter = filter; |
378 setNeedsCommit(); | 381 setNeedsCommit(); |
379 if (filter) | 382 if (filter && m_layerTreeHost) |
380 LayerTreeHost::setNeedsFilterContext(true); | 383 m_layerTreeHost->setNeedsFilterContext(); |
381 } | 384 } |
382 | 385 |
383 void Layer::setBackgroundFilters(const WebKit::WebFilterOperations& backgroundFi
lters) | 386 void Layer::setBackgroundFilters(const WebKit::WebFilterOperations& backgroundFi
lters) |
384 { | 387 { |
385 if (m_backgroundFilters == backgroundFilters) | 388 if (m_backgroundFilters == backgroundFilters) |
386 return; | 389 return; |
387 m_backgroundFilters = backgroundFilters; | 390 m_backgroundFilters = backgroundFilters; |
388 setNeedsCommit(); | 391 setNeedsCommit(); |
389 if (!backgroundFilters.isEmpty()) | 392 if (!backgroundFilters.isEmpty() && m_layerTreeHost) |
390 LayerTreeHost::setNeedsFilterContext(true); | 393 m_layerTreeHost->setNeedsFilterContext(); |
391 } | 394 } |
392 | 395 |
393 void Layer::setOpacity(float opacity) | 396 void Layer::setOpacity(float opacity) |
394 { | 397 { |
395 if (m_opacity == opacity) | 398 if (m_opacity == opacity) |
396 return; | 399 return; |
397 m_opacity = opacity; | 400 m_opacity = opacity; |
398 setNeedsCommit(); | 401 setNeedsCommit(); |
399 } | 402 } |
400 | 403 |
(...skipping 465 matching lines...) Loading... |
866 { | 869 { |
867 return 0; | 870 return 0; |
868 } | 871 } |
869 | 872 |
870 void sortLayers(std::vector<scoped_refptr<Layer> >::iterator, std::vector<scoped
_refptr<Layer> >::iterator, void*) | 873 void sortLayers(std::vector<scoped_refptr<Layer> >::iterator, std::vector<scoped
_refptr<Layer> >::iterator, void*) |
871 { | 874 { |
872 // Currently we don't use z-order to decide what to paint, so there's no nee
d to actually sort Layers. | 875 // Currently we don't use z-order to decide what to paint, so there's no nee
d to actually sort Layers. |
873 } | 876 } |
874 | 877 |
875 } // namespace cc | 878 } // namespace cc |
OLD | NEW |