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...) Expand 10 before | Expand all | Expand 10 after 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 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 setNeedsFullTreeSync(); | 360 setNeedsFullTreeSync(); |
358 } | 361 } |
359 | 362 |
360 void Layer::setFilters(const WebKit::WebFilterOperations& filters) | 363 void Layer::setFilters(const WebKit::WebFilterOperations& filters) |
361 { | 364 { |
362 if (m_filters == filters) | 365 if (m_filters == filters) |
363 return; | 366 return; |
364 DCHECK(!m_filter); | 367 DCHECK(!m_filter); |
365 m_filters = filters; | 368 m_filters = filters; |
366 setNeedsCommit(); | 369 setNeedsCommit(); |
367 if (!filters.isEmpty()) | 370 if (!filters.isEmpty() && m_layerTreeHost) |
368 LayerTreeHost::setNeedsFilterContext(true); | 371 m_layerTreeHost->setNeedsFilterContext(); |
369 } | 372 } |
370 | 373 |
371 void Layer::setFilter(const skia::RefPtr<SkImageFilter>& filter) | 374 void Layer::setFilter(const skia::RefPtr<SkImageFilter>& filter) |
372 { | 375 { |
373 if (m_filter.get() == filter.get()) | 376 if (m_filter.get() == filter.get()) |
374 return; | 377 return; |
375 DCHECK(m_filters.isEmpty()); | 378 DCHECK(m_filters.isEmpty()); |
376 m_filter = filter; | 379 m_filter = filter; |
377 setNeedsCommit(); | 380 setNeedsCommit(); |
378 if (filter) | 381 if (filter && m_layerTreeHost) |
379 LayerTreeHost::setNeedsFilterContext(true); | 382 m_layerTreeHost->setNeedsFilterContext(); |
380 } | 383 } |
381 | 384 |
382 void Layer::setBackgroundFilters(const WebKit::WebFilterOperations& backgroundFi
lters) | 385 void Layer::setBackgroundFilters(const WebKit::WebFilterOperations& backgroundFi
lters) |
383 { | 386 { |
384 if (m_backgroundFilters == backgroundFilters) | 387 if (m_backgroundFilters == backgroundFilters) |
385 return; | 388 return; |
386 m_backgroundFilters = backgroundFilters; | 389 m_backgroundFilters = backgroundFilters; |
387 setNeedsCommit(); | 390 setNeedsCommit(); |
388 if (!backgroundFilters.isEmpty()) | 391 if (!backgroundFilters.isEmpty() && m_layerTreeHost) |
389 LayerTreeHost::setNeedsFilterContext(true); | 392 m_layerTreeHost->setNeedsFilterContext(); |
390 } | 393 } |
391 | 394 |
392 void Layer::setOpacity(float opacity) | 395 void Layer::setOpacity(float opacity) |
393 { | 396 { |
394 if (m_opacity == opacity) | 397 if (m_opacity == opacity) |
395 return; | 398 return; |
396 m_opacity = opacity; | 399 m_opacity = opacity; |
397 setNeedsCommit(); | 400 setNeedsCommit(); |
398 } | 401 } |
399 | 402 |
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
865 { | 868 { |
866 return 0; | 869 return 0; |
867 } | 870 } |
868 | 871 |
869 void sortLayers(std::vector<scoped_refptr<Layer> >::iterator, std::vector<scoped
_refptr<Layer> >::iterator, void*) | 872 void sortLayers(std::vector<scoped_refptr<Layer> >::iterator, std::vector<scoped
_refptr<Layer> >::iterator, void*) |
870 { | 873 { |
871 // Currently we don't use z-order to decide what to paint, so there's no nee
d to actually sort Layers. | 874 // Currently we don't use z-order to decide what to paint, so there's no nee
d to actually sort Layers. |
872 } | 875 } |
873 | 876 |
874 } // namespace cc | 877 } // namespace cc |
OLD | NEW |