| 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 "config.h" | 5 #include "config.h" |
| 6 | 6 |
| 7 #include "cc/layer.h" | 7 #include "cc/layer.h" |
| 8 | 8 |
| 9 #include "CCActiveAnimation.h" | 9 #include "CCActiveAnimation.h" |
| 10 #include "CCAnimationEvents.h" | 10 #include "CCAnimationEvents.h" |
| 11 #include "CCLayerAnimationController.h" | 11 #include "CCLayerAnimationController.h" |
| 12 #include "CCLayerImpl.h" | 12 #include "CCLayerImpl.h" |
| 13 #include "CCLayerTreeHost.h" | 13 #include "CCLayerTreeHost.h" |
| 14 #include "cc/settings.h" | 14 #include "cc/settings.h" |
| 15 #include "SkImageFilter.h" |
| 15 #include <public/WebAnimationDelegate.h> | 16 #include <public/WebAnimationDelegate.h> |
| 16 #include <public/WebLayerScrollClient.h> | 17 #include <public/WebLayerScrollClient.h> |
| 17 #include <public/WebSize.h> | 18 #include <public/WebSize.h> |
| 18 | 19 |
| 19 using namespace std; | 20 using namespace std; |
| 20 using WebKit::WebTransformationMatrix; | 21 using WebKit::WebTransformationMatrix; |
| 21 | 22 |
| 22 namespace cc { | 23 namespace cc { |
| 23 | 24 |
| 24 static int s_nextLayerId = 1; | 25 static int s_nextLayerId = 1; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 37 , m_layerAnimationController(CCLayerAnimationController::create(this)) | 38 , m_layerAnimationController(CCLayerAnimationController::create(this)) |
| 38 , m_scrollable(false) | 39 , m_scrollable(false) |
| 39 , m_shouldScrollOnMainThread(false) | 40 , m_shouldScrollOnMainThread(false) |
| 40 , m_haveWheelEventHandlers(false) | 41 , m_haveWheelEventHandlers(false) |
| 41 , m_nonFastScrollableRegionChanged(false) | 42 , m_nonFastScrollableRegionChanged(false) |
| 42 , m_anchorPoint(0.5, 0.5) | 43 , m_anchorPoint(0.5, 0.5) |
| 43 , m_backgroundColor(0) | 44 , m_backgroundColor(0) |
| 44 , m_debugBorderColor(0) | 45 , m_debugBorderColor(0) |
| 45 , m_debugBorderWidth(0) | 46 , m_debugBorderWidth(0) |
| 46 , m_opacity(1.0) | 47 , m_opacity(1.0) |
| 48 , m_filter(0) |
| 47 , m_anchorPointZ(0) | 49 , m_anchorPointZ(0) |
| 48 , m_isContainerForFixedPositionLayers(false) | 50 , m_isContainerForFixedPositionLayers(false) |
| 49 , m_fixedToContainerLayer(false) | 51 , m_fixedToContainerLayer(false) |
| 50 , m_isDrawable(false) | 52 , m_isDrawable(false) |
| 51 , m_masksToBounds(false) | 53 , m_masksToBounds(false) |
| 52 , m_contentsOpaque(false) | 54 , m_contentsOpaque(false) |
| 53 , m_doubleSided(true) | 55 , m_doubleSided(true) |
| 54 , m_useLCDText(false) | 56 , m_useLCDText(false) |
| 55 , m_preserves3D(false) | 57 , m_preserves3D(false) |
| 56 , m_useParentBackfaceVisibility(false) | 58 , m_useParentBackfaceVisibility(false) |
| (...skipping 17 matching lines...) Expand all Loading... |
| 74 } | 76 } |
| 75 | 77 |
| 76 LayerChromium::~LayerChromium() | 78 LayerChromium::~LayerChromium() |
| 77 { | 79 { |
| 78 // Our parent should be holding a reference to us so there should be no | 80 // 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. | 81 // way for us to be destroyed while we still have a parent. |
| 80 DCHECK(!parent()); | 82 DCHECK(!parent()); |
| 81 | 83 |
| 82 // Remove the parent reference from all children. | 84 // Remove the parent reference from all children. |
| 83 removeAllChildren(); | 85 removeAllChildren(); |
| 86 |
| 87 SkSafeUnref(m_filter); |
| 84 } | 88 } |
| 85 | 89 |
| 86 void LayerChromium::setUseLCDText(bool useLCDText) | 90 void LayerChromium::setUseLCDText(bool useLCDText) |
| 87 { | 91 { |
| 88 m_useLCDText = useLCDText; | 92 m_useLCDText = useLCDText; |
| 89 } | 93 } |
| 90 | 94 |
| 91 void LayerChromium::setLayerTreeHost(CCLayerTreeHost* host) | 95 void LayerChromium::setLayerTreeHost(CCLayerTreeHost* host) |
| 92 { | 96 { |
| 93 if (m_layerTreeHost == host) | 97 if (m_layerTreeHost == host) |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 void LayerChromium::setFilters(const WebKit::WebFilterOperations& filters) | 320 void LayerChromium::setFilters(const WebKit::WebFilterOperations& filters) |
| 317 { | 321 { |
| 318 if (m_filters == filters) | 322 if (m_filters == filters) |
| 319 return; | 323 return; |
| 320 m_filters = filters; | 324 m_filters = filters; |
| 321 setNeedsCommit(); | 325 setNeedsCommit(); |
| 322 if (!filters.isEmpty()) | 326 if (!filters.isEmpty()) |
| 323 CCLayerTreeHost::setNeedsFilterContext(true); | 327 CCLayerTreeHost::setNeedsFilterContext(true); |
| 324 } | 328 } |
| 325 | 329 |
| 330 void LayerChromium::setFilter(SkImageFilter* filter) |
| 331 { |
| 332 if (m_filter == filter) |
| 333 return; |
| 334 SkRefCnt_SafeAssign(m_filter, filter); |
| 335 setNeedsCommit(); |
| 336 if (filter) |
| 337 CCLayerTreeHost::setNeedsFilterContext(true); |
| 338 } |
| 339 |
| 326 void LayerChromium::setBackgroundFilters(const WebKit::WebFilterOperations& back
groundFilters) | 340 void LayerChromium::setBackgroundFilters(const WebKit::WebFilterOperations& back
groundFilters) |
| 327 { | 341 { |
| 328 if (m_backgroundFilters == backgroundFilters) | 342 if (m_backgroundFilters == backgroundFilters) |
| 329 return; | 343 return; |
| 330 m_backgroundFilters = backgroundFilters; | 344 m_backgroundFilters = backgroundFilters; |
| 331 setNeedsCommit(); | 345 setNeedsCommit(); |
| 332 if (!backgroundFilters.isEmpty()) | 346 if (!backgroundFilters.isEmpty()) |
| 333 CCLayerTreeHost::setNeedsFilterContext(true); | 347 CCLayerTreeHost::setNeedsFilterContext(true); |
| 334 } | 348 } |
| 335 | 349 |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 537 layer->setBounds(m_bounds); | 551 layer->setBounds(m_bounds); |
| 538 layer->setContentBounds(contentBounds()); | 552 layer->setContentBounds(contentBounds()); |
| 539 layer->setDebugBorderColor(m_debugBorderColor); | 553 layer->setDebugBorderColor(m_debugBorderColor); |
| 540 layer->setDebugBorderWidth(m_debugBorderWidth); | 554 layer->setDebugBorderWidth(m_debugBorderWidth); |
| 541 layer->setDebugName(m_debugName); | 555 layer->setDebugName(m_debugName); |
| 542 layer->setDoubleSided(m_doubleSided); | 556 layer->setDoubleSided(m_doubleSided); |
| 543 layer->setDrawCheckerboardForMissingTiles(m_drawCheckerboardForMissingTiles)
; | 557 layer->setDrawCheckerboardForMissingTiles(m_drawCheckerboardForMissingTiles)
; |
| 544 layer->setForceRenderSurface(m_forceRenderSurface); | 558 layer->setForceRenderSurface(m_forceRenderSurface); |
| 545 layer->setDrawsContent(drawsContent()); | 559 layer->setDrawsContent(drawsContent()); |
| 546 layer->setFilters(filters()); | 560 layer->setFilters(filters()); |
| 561 layer->setFilter(filter()); |
| 547 layer->setBackgroundFilters(backgroundFilters()); | 562 layer->setBackgroundFilters(backgroundFilters()); |
| 548 layer->setUseLCDText(m_useLCDText); | 563 layer->setUseLCDText(m_useLCDText); |
| 549 layer->setMasksToBounds(m_masksToBounds); | 564 layer->setMasksToBounds(m_masksToBounds); |
| 550 layer->setScrollable(m_scrollable); | 565 layer->setScrollable(m_scrollable); |
| 551 layer->setShouldScrollOnMainThread(m_shouldScrollOnMainThread); | 566 layer->setShouldScrollOnMainThread(m_shouldScrollOnMainThread); |
| 552 layer->setHaveWheelEventHandlers(m_haveWheelEventHandlers); | 567 layer->setHaveWheelEventHandlers(m_haveWheelEventHandlers); |
| 553 // Copying a Region is more expensive than most layer properties, since it i
nvolves copying two Vectors that may be | 568 // Copying a Region is more expensive than most layer properties, since it i
nvolves copying two Vectors that may be |
| 554 // arbitrarily large depending on page content, so we only push the property
if it's changed. | 569 // arbitrarily large depending on page content, so we only push the property
if it's changed. |
| 555 if (m_nonFastScrollableRegionChanged) { | 570 if (m_nonFastScrollableRegionChanged) { |
| 556 layer->setNonFastScrollableRegion(m_nonFastScrollableRegion); | 571 layer->setNonFastScrollableRegion(m_nonFastScrollableRegion); |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 788 { | 803 { |
| 789 return 0; | 804 return 0; |
| 790 } | 805 } |
| 791 | 806 |
| 792 void sortLayers(std::vector<scoped_refptr<LayerChromium> >::iterator, std::vecto
r<scoped_refptr<LayerChromium> >::iterator, void*) | 807 void sortLayers(std::vector<scoped_refptr<LayerChromium> >::iterator, std::vecto
r<scoped_refptr<LayerChromium> >::iterator, void*) |
| 793 { | 808 { |
| 794 // Currently we don't use z-order to decide what to paint, so there's no nee
d to actually sort LayerChromiums. | 809 // Currently we don't use z-order to decide what to paint, so there's no nee
d to actually sort LayerChromiums. |
| 795 } | 810 } |
| 796 | 811 |
| 797 } | 812 } |
| OLD | NEW |