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 24 matching lines...) Expand all Loading... |
35 , m_scrollable(false) | 35 , m_scrollable(false) |
36 , m_shouldScrollOnMainThread(false) | 36 , m_shouldScrollOnMainThread(false) |
37 , m_haveWheelEventHandlers(false) | 37 , m_haveWheelEventHandlers(false) |
38 , m_anchorPoint(0.5, 0.5) | 38 , m_anchorPoint(0.5, 0.5) |
39 , m_backgroundColor(0) | 39 , m_backgroundColor(0) |
40 , m_opacity(1.0) | 40 , m_opacity(1.0) |
41 , m_anchorPointZ(0) | 41 , m_anchorPointZ(0) |
42 , m_isContainerForFixedPositionLayers(false) | 42 , m_isContainerForFixedPositionLayers(false) |
43 , m_fixedToContainerLayer(false) | 43 , m_fixedToContainerLayer(false) |
44 , m_isDrawable(false) | 44 , m_isDrawable(false) |
| 45 , m_visible(true) |
45 , m_masksToBounds(false) | 46 , m_masksToBounds(false) |
46 , m_contentsOpaque(false) | 47 , m_contentsOpaque(false) |
47 , m_doubleSided(true) | 48 , m_doubleSided(true) |
48 , m_preserves3D(false) | 49 , m_preserves3D(false) |
49 , m_useParentBackfaceVisibility(false) | 50 , m_useParentBackfaceVisibility(false) |
50 , m_drawCheckerboardForMissingTiles(false) | 51 , m_drawCheckerboardForMissingTiles(false) |
51 , m_forceRenderSurface(false) | 52 , m_forceRenderSurface(false) |
52 , m_replicaLayer(0) | 53 , m_replicaLayer(0) |
53 , m_rasterScale(1.0) | 54 , m_rasterScale(1.0) |
54 , m_automaticallyComputeRasterScale(false) | 55 , m_automaticallyComputeRasterScale(false) |
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
540 | 541 |
541 void Layer::setIsDrawable(bool isDrawable) | 542 void Layer::setIsDrawable(bool isDrawable) |
542 { | 543 { |
543 if (m_isDrawable == isDrawable) | 544 if (m_isDrawable == isDrawable) |
544 return; | 545 return; |
545 | 546 |
546 m_isDrawable = isDrawable; | 547 m_isDrawable = isDrawable; |
547 setNeedsCommit(); | 548 setNeedsCommit(); |
548 } | 549 } |
549 | 550 |
| 551 void Layer::setVisible(bool visible) |
| 552 { |
| 553 if (m_visible == visible) |
| 554 return; |
| 555 |
| 556 m_visible = visible; |
| 557 setNeedsCommit(); |
| 558 } |
| 559 |
550 void Layer::setNeedsDisplayRect(const gfx::RectF& dirtyRect) | 560 void Layer::setNeedsDisplayRect(const gfx::RectF& dirtyRect) |
551 { | 561 { |
552 m_updateRect.Union(dirtyRect); | 562 m_updateRect.Union(dirtyRect); |
553 m_needsDisplay = true; | 563 m_needsDisplay = true; |
554 | 564 |
555 // Simply mark the contents as dirty. For non-root layers, the call to | 565 // Simply mark the contents as dirty. For non-root layers, the call to |
556 // setNeedsCommit will schedule a fresh compositing pass. | 566 // setNeedsCommit will schedule a fresh compositing pass. |
557 // For the root layer, setNeedsCommit has no effect. | 567 // For the root layer, setNeedsCommit has no effect. |
558 if (drawsContent() && !m_updateRect.IsEmpty()) | 568 if (drawsContent() && !m_updateRect.IsEmpty()) |
559 setNeedsCommit(); | 569 setNeedsCommit(); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
596 layer->setAnchorPointZ(m_anchorPointZ); | 606 layer->setAnchorPointZ(m_anchorPointZ); |
597 layer->setBackgroundColor(m_backgroundColor); | 607 layer->setBackgroundColor(m_backgroundColor); |
598 layer->setBounds(m_bounds); | 608 layer->setBounds(m_bounds); |
599 layer->setContentBounds(contentBounds()); | 609 layer->setContentBounds(contentBounds()); |
600 layer->setContentsScale(contentsScaleX(), contentsScaleY()); | 610 layer->setContentsScale(contentsScaleX(), contentsScaleY()); |
601 layer->setDebugName(m_debugName); | 611 layer->setDebugName(m_debugName); |
602 layer->setDoubleSided(m_doubleSided); | 612 layer->setDoubleSided(m_doubleSided); |
603 layer->setDrawCheckerboardForMissingTiles(m_drawCheckerboardForMissingTiles)
; | 613 layer->setDrawCheckerboardForMissingTiles(m_drawCheckerboardForMissingTiles)
; |
604 layer->setForceRenderSurface(m_forceRenderSurface); | 614 layer->setForceRenderSurface(m_forceRenderSurface); |
605 layer->setDrawsContent(drawsContent()); | 615 layer->setDrawsContent(drawsContent()); |
| 616 layer->setVisible(visible()); |
606 layer->setFilters(filters()); | 617 layer->setFilters(filters()); |
607 layer->setFilter(filter()); | 618 layer->setFilter(filter()); |
608 layer->setBackgroundFilters(backgroundFilters()); | 619 layer->setBackgroundFilters(backgroundFilters()); |
609 layer->setMasksToBounds(m_masksToBounds); | 620 layer->setMasksToBounds(m_masksToBounds); |
610 layer->setShouldScrollOnMainThread(m_shouldScrollOnMainThread); | 621 layer->setShouldScrollOnMainThread(m_shouldScrollOnMainThread); |
611 layer->setHaveWheelEventHandlers(m_haveWheelEventHandlers); | 622 layer->setHaveWheelEventHandlers(m_haveWheelEventHandlers); |
612 layer->setNonFastScrollableRegion(m_nonFastScrollableRegion); | 623 layer->setNonFastScrollableRegion(m_nonFastScrollableRegion); |
613 layer->setTouchEventHandlerRegion(m_touchEventHandlerRegion); | 624 layer->setTouchEventHandlerRegion(m_touchEventHandlerRegion); |
614 layer->setContentsOpaque(m_contentsOpaque); | 625 layer->setContentsOpaque(m_contentsOpaque); |
615 if (!opacityIsAnimating()) | 626 if (!opacityIsAnimating()) |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
865 { | 876 { |
866 return 0; | 877 return 0; |
867 } | 878 } |
868 | 879 |
869 void sortLayers(std::vector<scoped_refptr<Layer> >::iterator, std::vector<scoped
_refptr<Layer> >::iterator, void*) | 880 void sortLayers(std::vector<scoped_refptr<Layer> >::iterator, std::vector<scoped
_refptr<Layer> >::iterator, void*) |
870 { | 881 { |
871 // Currently we don't use z-order to decide what to paint, so there's no nee
d to actually sort Layers. | 882 // Currently we don't use z-order to decide what to paint, so there's no nee
d to actually sort Layers. |
872 } | 883 } |
873 | 884 |
874 } // namespace cc | 885 } // namespace cc |
OLD | NEW |