| 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 "cc/layer_tree_host_impl.h" | 5 #include "cc/layer_tree_host_impl.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 2351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2362 root->setDrawsContent(false); | 2362 root->setDrawsContent(false); |
| 2363 root->renderSurface()->setContentRect(gfx::Rect(gfx::Point(), gfx::Size(root
Rect.width(), rootRect.height()))); | 2363 root->renderSurface()->setContentRect(gfx::Rect(gfx::Point(), gfx::Size(root
Rect.width(), rootRect.height()))); |
| 2364 | 2364 |
| 2365 child->setAnchorPoint(gfx::PointF(0, 0)); | 2365 child->setAnchorPoint(gfx::PointF(0, 0)); |
| 2366 child->setPosition(gfx::PointF(childRect.x(), childRect.y())); | 2366 child->setPosition(gfx::PointF(childRect.x(), childRect.y())); |
| 2367 child->setOpacity(0.5f); | 2367 child->setOpacity(0.5f); |
| 2368 child->setBounds(gfx::Size(childRect.width(), childRect.height())); | 2368 child->setBounds(gfx::Size(childRect.width(), childRect.height())); |
| 2369 child->setContentBounds(child->bounds()); | 2369 child->setContentBounds(child->bounds()); |
| 2370 child->setVisibleContentRect(childRect); | 2370 child->setVisibleContentRect(childRect); |
| 2371 child->setDrawsContent(false); | 2371 child->setDrawsContent(false); |
| 2372 child->setForceRenderSurface(true); |
| 2372 | 2373 |
| 2373 grandChild->setAnchorPoint(gfx::PointF(0, 0)); | 2374 grandChild->setAnchorPoint(gfx::PointF(0, 0)); |
| 2374 grandChild->setPosition(gfx::Point(grandChildRect.x(), grandChildRect.y())); | 2375 grandChild->setPosition(gfx::Point(grandChildRect.x(), grandChildRect.y())); |
| 2375 grandChild->setBounds(gfx::Size(grandChildRect.width(), grandChildRect.heigh
t())); | 2376 grandChild->setBounds(gfx::Size(grandChildRect.width(), grandChildRect.heigh
t())); |
| 2376 grandChild->setContentBounds(grandChild->bounds()); | 2377 grandChild->setContentBounds(grandChild->bounds()); |
| 2377 grandChild->setVisibleContentRect(grandChildRect); | 2378 grandChild->setVisibleContentRect(grandChildRect); |
| 2378 grandChild->setDrawsContent(true); | 2379 grandChild->setDrawsContent(true); |
| 2379 | 2380 |
| 2380 child->addChild(grandChild.Pass()); | 2381 child->addChild(grandChild.Pass()); |
| 2381 root->addChild(child.Pass()); | 2382 root->addChild(child.Pass()); |
| (...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3111 root->setDrawsContent(true); | 3112 root->setDrawsContent(true); |
| 3112 layerTreeHostImpl->setRootLayer(root.Pass()); | 3113 layerTreeHostImpl->setRootLayer(root.Pass()); |
| 3113 | 3114 |
| 3114 addDrawingLayerTo(rootPtr, 2, gfx::Rect(10, 10, rootSize.width(), rootSize.h
eight()), &intermediateLayerPtr); | 3115 addDrawingLayerTo(rootPtr, 2, gfx::Rect(10, 10, rootSize.width(), rootSize.h
eight()), &intermediateLayerPtr); |
| 3115 intermediateLayerPtr->setDrawsContent(false); // only children draw content | 3116 intermediateLayerPtr->setDrawsContent(false); // only children draw content |
| 3116 | 3117 |
| 3117 // Surface layer is the layer that changes its opacity | 3118 // Surface layer is the layer that changes its opacity |
| 3118 // It will contain other layers that draw content. | 3119 // It will contain other layers that draw content. |
| 3119 addDrawingLayerTo(intermediateLayerPtr, 3, gfx::Rect(10, 10, rootSize.width(
), rootSize.height()), &surfaceLayerPtr); | 3120 addDrawingLayerTo(intermediateLayerPtr, 3, gfx::Rect(10, 10, rootSize.width(
), rootSize.height()), &surfaceLayerPtr); |
| 3120 surfaceLayerPtr->setDrawsContent(false); // only children draw content | 3121 surfaceLayerPtr->setDrawsContent(false); // only children draw content |
| 3121 surfaceLayerPtr->setOpacity(0.5f); // This will cause it to have a surface | 3122 surfaceLayerPtr->setOpacity(0.5f); |
| 3123 surfaceLayerPtr->setForceRenderSurface(true); // This will cause it to have
a surface |
| 3122 | 3124 |
| 3123 // Child of the surface layer will produce some quads | 3125 // Child of the surface layer will produce some quads |
| 3124 addDrawingLayerTo(surfaceLayerPtr, 4, gfx::Rect(5, 5, rootSize.width() - 25,
rootSize.height() - 25), &childPtr); | 3126 addDrawingLayerTo(surfaceLayerPtr, 4, gfx::Rect(5, 5, rootSize.width() - 25,
rootSize.height() - 25), &childPtr); |
| 3125 } | 3127 } |
| 3126 | 3128 |
| 3127 class GLRendererWithReleaseTextures : public GLRenderer { | 3129 class GLRendererWithReleaseTextures : public GLRenderer { |
| 3128 public: | 3130 public: |
| 3129 using GLRenderer::releaseRenderPassTextures; | 3131 using GLRenderer::releaseRenderPassTextures; |
| 3130 }; | 3132 }; |
| 3131 | 3133 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 3155 root->setContentBounds(rootSize); | 3157 root->setContentBounds(rootSize); |
| 3156 root->setDrawsContent(true); | 3158 root->setDrawsContent(true); |
| 3157 root->setMasksToBounds(true); | 3159 root->setMasksToBounds(true); |
| 3158 myHostImpl->setRootLayer(root.Pass()); | 3160 myHostImpl->setRootLayer(root.Pass()); |
| 3159 | 3161 |
| 3160 addDrawingLayerTo(rootPtr, 3, gfx::Rect(0, 0, rootSize.width(), rootSize.hei
ght()), &surfaceLayerPtr); | 3162 addDrawingLayerTo(rootPtr, 3, gfx::Rect(0, 0, rootSize.width(), rootSize.hei
ght()), &surfaceLayerPtr); |
| 3161 surfaceLayerPtr->setDrawsContent(false); | 3163 surfaceLayerPtr->setDrawsContent(false); |
| 3162 | 3164 |
| 3163 // Surface layer is the layer that changes its opacity | 3165 // Surface layer is the layer that changes its opacity |
| 3164 // It will contain other layers that draw content. | 3166 // It will contain other layers that draw content. |
| 3165 surfaceLayerPtr->setOpacity(0.5f); // This will cause it to have a surface | 3167 surfaceLayerPtr->setOpacity(0.5f); |
| 3168 surfaceLayerPtr->setForceRenderSurface(true); // This will cause it to have
a surface |
| 3166 | 3169 |
| 3167 addDrawingLayerTo(surfaceLayerPtr, 4, gfx::Rect(0, 0, 100, 3), 0); | 3170 addDrawingLayerTo(surfaceLayerPtr, 4, gfx::Rect(0, 0, 100, 3), 0); |
| 3168 addDrawingLayerTo(surfaceLayerPtr, 5, gfx::Rect(0, 97, 100, 3), 0); | 3171 addDrawingLayerTo(surfaceLayerPtr, 5, gfx::Rect(0, 97, 100, 3), 0); |
| 3169 | 3172 |
| 3170 // Rotation will put part of the child ouside the bounds of the root layer. | 3173 // Rotation will put part of the child ouside the bounds of the root layer. |
| 3171 // Nevertheless, the child layers should be drawn. | 3174 // Nevertheless, the child layers should be drawn. |
| 3172 WebTransformationMatrix transform = surfaceLayerPtr->transform(); | 3175 WebTransformationMatrix transform = surfaceLayerPtr->transform(); |
| 3173 transform.translate(50, 50); | 3176 transform.translate(50, 50); |
| 3174 transform.rotate(35); | 3177 transform.rotate(35); |
| 3175 transform.translate(-50, -50); | 3178 transform.translate(-50, -50); |
| (...skipping 1693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4869 { | 4872 { |
| 4870 pinchZoomPanViewportAndScrollBoundaryTest(2); | 4873 pinchZoomPanViewportAndScrollBoundaryTest(2); |
| 4871 } | 4874 } |
| 4872 | 4875 |
| 4873 INSTANTIATE_TEST_CASE_P(LayerTreeHostImplTests, | 4876 INSTANTIATE_TEST_CASE_P(LayerTreeHostImplTests, |
| 4874 LayerTreeHostImplTest, | 4877 LayerTreeHostImplTest, |
| 4875 ::testing::Values(false, true)); | 4878 ::testing::Values(false, true)); |
| 4876 | 4879 |
| 4877 } // namespace | 4880 } // namespace |
| 4878 } // namespace cc | 4881 } // namespace cc |
| OLD | NEW |