OLD | NEW |
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 "config.h" | 5 #include "config.h" |
6 | 6 |
7 #include "CCLayerImpl.h" | 7 #include "CCLayerImpl.h" |
8 | 8 |
9 #include "CCDebugBorderDrawQuad.h" | 9 #include "CCDebugBorderDrawQuad.h" |
10 #include "CCLayerSorter.h" | 10 #include "CCLayerSorter.h" |
11 #include "base/debug/trace_event.h" | 11 #include "base/debug/trace_event.h" |
12 #include "base/stringprintf.h" | 12 #include "base/stringprintf.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 "cc/settings.h" | 17 #include "cc/settings.h" |
| 18 #include "third_party/skia/include/core/SkImageFilter.h" |
18 | 19 |
19 using WebKit::WebTransformationMatrix; | 20 using WebKit::WebTransformationMatrix; |
20 | 21 |
21 namespace cc { | 22 namespace cc { |
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) |
(...skipping 17 matching lines...) Expand all Loading... |
45 , m_drawsContent(false) | 46 , m_drawsContent(false) |
46 , m_forceRenderSurface(false) | 47 , m_forceRenderSurface(false) |
47 , m_isContainerForFixedPositionLayers(false) | 48 , m_isContainerForFixedPositionLayers(false) |
48 , m_fixedToContainerLayer(false) | 49 , m_fixedToContainerLayer(false) |
49 , m_renderTarget(0) | 50 , m_renderTarget(0) |
50 , m_drawDepth(0) | 51 , m_drawDepth(0) |
51 , m_drawOpacity(0) | 52 , m_drawOpacity(0) |
52 , m_drawOpacityIsAnimating(false) | 53 , m_drawOpacityIsAnimating(false) |
53 , m_debugBorderColor(0) | 54 , m_debugBorderColor(0) |
54 , m_debugBorderWidth(0) | 55 , m_debugBorderWidth(0) |
| 56 , m_filter(0) |
55 , m_drawTransformIsAnimating(false) | 57 , m_drawTransformIsAnimating(false) |
56 , m_screenSpaceTransformIsAnimating(false) | 58 , m_screenSpaceTransformIsAnimating(false) |
57 #ifndef NDEBUG | 59 #ifndef NDEBUG |
58 , m_betweenWillDrawAndDidDraw(false) | 60 , m_betweenWillDrawAndDidDraw(false) |
59 #endif | 61 #endif |
60 , m_layerAnimationController(LayerAnimationController::create(this)) | 62 , m_layerAnimationController(LayerAnimationController::create(this)) |
61 { | 63 { |
62 DCHECK(Proxy::isImplThread()); | 64 DCHECK(Proxy::isImplThread()); |
63 DCHECK(m_layerId > 0); | 65 DCHECK(m_layerId > 0); |
64 } | 66 } |
65 | 67 |
66 LayerImpl::~LayerImpl() | 68 LayerImpl::~LayerImpl() |
67 { | 69 { |
68 DCHECK(Proxy::isImplThread()); | 70 DCHECK(Proxy::isImplThread()); |
69 #ifndef NDEBUG | 71 #ifndef NDEBUG |
70 DCHECK(!m_betweenWillDrawAndDidDraw); | 72 DCHECK(!m_betweenWillDrawAndDidDraw); |
71 #endif | 73 #endif |
| 74 SkSafeUnref(m_filter); |
72 } | 75 } |
73 | 76 |
74 void LayerImpl::addChild(scoped_ptr<LayerImpl> child) | 77 void LayerImpl::addChild(scoped_ptr<LayerImpl> child) |
75 { | 78 { |
76 child->setParent(this); | 79 child->setParent(this); |
77 m_children.append(child.Pass()); | 80 m_children.append(child.Pass()); |
78 } | 81 } |
79 | 82 |
80 void LayerImpl::removeFromParent() | 83 void LayerImpl::removeFromParent() |
81 { | 84 { |
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 { | 469 { |
467 if (m_backgroundColor == backgroundColor) | 470 if (m_backgroundColor == backgroundColor) |
468 return; | 471 return; |
469 | 472 |
470 m_backgroundColor = backgroundColor; | 473 m_backgroundColor = backgroundColor; |
471 m_layerPropertyChanged = true; | 474 m_layerPropertyChanged = true; |
472 } | 475 } |
473 | 476 |
474 void LayerImpl::setFilters(const WebKit::WebFilterOperations& filters) | 477 void LayerImpl::setFilters(const WebKit::WebFilterOperations& filters) |
475 { | 478 { |
| 479 DCHECK(!m_filter); |
476 if (m_filters == filters) | 480 if (m_filters == filters) |
477 return; | 481 return; |
478 | 482 |
479 m_filters = filters; | 483 m_filters = filters; |
480 noteLayerPropertyChangedForSubtree(); | 484 noteLayerPropertyChangedForSubtree(); |
481 } | 485 } |
482 | 486 |
483 void LayerImpl::setBackgroundFilters(const WebKit::WebFilterOperations& backgrou
ndFilters) | 487 void LayerImpl::setBackgroundFilters(const WebKit::WebFilterOperations& backgrou
ndFilters) |
484 { | 488 { |
485 if (m_backgroundFilters == backgroundFilters) | 489 if (m_backgroundFilters == backgroundFilters) |
486 return; | 490 return; |
487 | 491 |
488 m_backgroundFilters = backgroundFilters; | 492 m_backgroundFilters = backgroundFilters; |
489 m_layerPropertyChanged = true; | 493 m_layerPropertyChanged = true; |
490 } | 494 } |
491 | 495 |
| 496 void LayerImpl::setFilter(SkImageFilter* filter) |
| 497 { |
| 498 DCHECK(m_filters.isEmpty()); |
| 499 if (m_filter == filter) |
| 500 return; |
| 501 |
| 502 SkRefCnt_SafeAssign(m_filter, filter); |
| 503 noteLayerPropertyChangedForSubtree(); |
| 504 } |
| 505 |
492 void LayerImpl::setMasksToBounds(bool masksToBounds) | 506 void LayerImpl::setMasksToBounds(bool masksToBounds) |
493 { | 507 { |
494 if (m_masksToBounds == masksToBounds) | 508 if (m_masksToBounds == masksToBounds) |
495 return; | 509 return; |
496 | 510 |
497 m_masksToBounds = masksToBounds; | 511 m_masksToBounds = masksToBounds; |
498 noteLayerPropertyChangedForSubtree(); | 512 noteLayerPropertyChangedForSubtree(); |
499 } | 513 } |
500 | 514 |
501 void LayerImpl::setContentsOpaque(bool opaque) | 515 void LayerImpl::setContentsOpaque(bool opaque) |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
671 | 685 |
672 void LayerImpl::setVerticalScrollbarLayer(ScrollbarLayerImpl* scrollbarLayer) | 686 void LayerImpl::setVerticalScrollbarLayer(ScrollbarLayerImpl* scrollbarLayer) |
673 { | 687 { |
674 if (!m_scrollbarAnimationController) | 688 if (!m_scrollbarAnimationController) |
675 m_scrollbarAnimationController = ScrollbarAnimationController::create(th
is); | 689 m_scrollbarAnimationController = ScrollbarAnimationController::create(th
is); |
676 m_scrollbarAnimationController->setVerticalScrollbarLayer(scrollbarLayer); | 690 m_scrollbarAnimationController->setVerticalScrollbarLayer(scrollbarLayer); |
677 m_scrollbarAnimationController->updateScrollOffset(this); | 691 m_scrollbarAnimationController->updateScrollOffset(this); |
678 } | 692 } |
679 | 693 |
680 } | 694 } |
OLD | NEW |