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 2371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2382 root->setDrawsContent(false); | 2382 root->setDrawsContent(false); |
2383 root->renderSurface()->setContentRect(gfx::Rect(gfx::Point(), gfx::Size(root
Rect.width(), rootRect.height()))); | 2383 root->renderSurface()->setContentRect(gfx::Rect(gfx::Point(), gfx::Size(root
Rect.width(), rootRect.height()))); |
2384 | 2384 |
2385 child->setAnchorPoint(gfx::PointF(0, 0)); | 2385 child->setAnchorPoint(gfx::PointF(0, 0)); |
2386 child->setPosition(gfx::PointF(childRect.x(), childRect.y())); | 2386 child->setPosition(gfx::PointF(childRect.x(), childRect.y())); |
2387 child->setOpacity(0.5f); | 2387 child->setOpacity(0.5f); |
2388 child->setBounds(gfx::Size(childRect.width(), childRect.height())); | 2388 child->setBounds(gfx::Size(childRect.width(), childRect.height())); |
2389 child->setContentBounds(child->bounds()); | 2389 child->setContentBounds(child->bounds()); |
2390 child->setVisibleContentRect(childRect); | 2390 child->setVisibleContentRect(childRect); |
2391 child->setDrawsContent(false); | 2391 child->setDrawsContent(false); |
| 2392 child->setForceRenderSurface(true); |
2392 | 2393 |
2393 grandChild->setAnchorPoint(gfx::PointF(0, 0)); | 2394 grandChild->setAnchorPoint(gfx::PointF(0, 0)); |
2394 grandChild->setPosition(gfx::Point(grandChildRect.x(), grandChildRect.y())); | 2395 grandChild->setPosition(gfx::Point(grandChildRect.x(), grandChildRect.y())); |
2395 grandChild->setBounds(gfx::Size(grandChildRect.width(), grandChildRect.heigh
t())); | 2396 grandChild->setBounds(gfx::Size(grandChildRect.width(), grandChildRect.heigh
t())); |
2396 grandChild->setContentBounds(grandChild->bounds()); | 2397 grandChild->setContentBounds(grandChild->bounds()); |
2397 grandChild->setVisibleContentRect(grandChildRect); | 2398 grandChild->setVisibleContentRect(grandChildRect); |
2398 grandChild->setDrawsContent(true); | 2399 grandChild->setDrawsContent(true); |
2399 | 2400 |
2400 child->addChild(grandChild.Pass()); | 2401 child->addChild(grandChild.Pass()); |
2401 root->addChild(child.Pass()); | 2402 root->addChild(child.Pass()); |
(...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3131 root->setDrawsContent(true); | 3132 root->setDrawsContent(true); |
3132 layerTreeHostImpl->setRootLayer(root.Pass()); | 3133 layerTreeHostImpl->setRootLayer(root.Pass()); |
3133 | 3134 |
3134 addDrawingLayerTo(rootPtr, 2, gfx::Rect(10, 10, rootSize.width(), rootSize.h
eight()), &intermediateLayerPtr); | 3135 addDrawingLayerTo(rootPtr, 2, gfx::Rect(10, 10, rootSize.width(), rootSize.h
eight()), &intermediateLayerPtr); |
3135 intermediateLayerPtr->setDrawsContent(false); // only children draw content | 3136 intermediateLayerPtr->setDrawsContent(false); // only children draw content |
3136 | 3137 |
3137 // Surface layer is the layer that changes its opacity | 3138 // Surface layer is the layer that changes its opacity |
3138 // It will contain other layers that draw content. | 3139 // It will contain other layers that draw content. |
3139 addDrawingLayerTo(intermediateLayerPtr, 3, gfx::Rect(10, 10, rootSize.width(
), rootSize.height()), &surfaceLayerPtr); | 3140 addDrawingLayerTo(intermediateLayerPtr, 3, gfx::Rect(10, 10, rootSize.width(
), rootSize.height()), &surfaceLayerPtr); |
3140 surfaceLayerPtr->setDrawsContent(false); // only children draw content | 3141 surfaceLayerPtr->setDrawsContent(false); // only children draw content |
3141 surfaceLayerPtr->setOpacity(0.5f); // This will cause it to have a surface | 3142 surfaceLayerPtr->setOpacity(0.5f); |
| 3143 surfaceLayerPtr->setForceRenderSurface(true); // This will cause it to have
a surface |
3142 | 3144 |
3143 // Child of the surface layer will produce some quads | 3145 // Child of the surface layer will produce some quads |
3144 addDrawingLayerTo(surfaceLayerPtr, 4, gfx::Rect(5, 5, rootSize.width() - 25,
rootSize.height() - 25), &childPtr); | 3146 addDrawingLayerTo(surfaceLayerPtr, 4, gfx::Rect(5, 5, rootSize.width() - 25,
rootSize.height() - 25), &childPtr); |
3145 } | 3147 } |
3146 | 3148 |
3147 class GLRendererWithReleaseTextures : public GLRenderer { | 3149 class GLRendererWithReleaseTextures : public GLRenderer { |
3148 public: | 3150 public: |
3149 using GLRenderer::releaseRenderPassTextures; | 3151 using GLRenderer::releaseRenderPassTextures; |
3150 }; | 3152 }; |
3151 | 3153 |
(...skipping 23 matching lines...) Expand all Loading... |
3175 root->setContentBounds(rootSize); | 3177 root->setContentBounds(rootSize); |
3176 root->setDrawsContent(true); | 3178 root->setDrawsContent(true); |
3177 root->setMasksToBounds(true); | 3179 root->setMasksToBounds(true); |
3178 myHostImpl->setRootLayer(root.Pass()); | 3180 myHostImpl->setRootLayer(root.Pass()); |
3179 | 3181 |
3180 addDrawingLayerTo(rootPtr, 3, gfx::Rect(0, 0, rootSize.width(), rootSize.hei
ght()), &surfaceLayerPtr); | 3182 addDrawingLayerTo(rootPtr, 3, gfx::Rect(0, 0, rootSize.width(), rootSize.hei
ght()), &surfaceLayerPtr); |
3181 surfaceLayerPtr->setDrawsContent(false); | 3183 surfaceLayerPtr->setDrawsContent(false); |
3182 | 3184 |
3183 // Surface layer is the layer that changes its opacity | 3185 // Surface layer is the layer that changes its opacity |
3184 // It will contain other layers that draw content. | 3186 // It will contain other layers that draw content. |
3185 surfaceLayerPtr->setOpacity(0.5f); // This will cause it to have a surface | 3187 surfaceLayerPtr->setOpacity(0.5f); |
| 3188 surfaceLayerPtr->setForceRenderSurface(true); // This will cause it to have
a surface |
3186 | 3189 |
3187 addDrawingLayerTo(surfaceLayerPtr, 4, gfx::Rect(0, 0, 100, 3), 0); | 3190 addDrawingLayerTo(surfaceLayerPtr, 4, gfx::Rect(0, 0, 100, 3), 0); |
3188 addDrawingLayerTo(surfaceLayerPtr, 5, gfx::Rect(0, 97, 100, 3), 0); | 3191 addDrawingLayerTo(surfaceLayerPtr, 5, gfx::Rect(0, 97, 100, 3), 0); |
3189 | 3192 |
3190 // Rotation will put part of the child ouside the bounds of the root layer. | 3193 // Rotation will put part of the child ouside the bounds of the root layer. |
3191 // Nevertheless, the child layers should be drawn. | 3194 // Nevertheless, the child layers should be drawn. |
3192 gfx::Transform transform = surfaceLayerPtr->transform(); | 3195 gfx::Transform transform = surfaceLayerPtr->transform(); |
3193 transform.Translate(50, 50); | 3196 transform.Translate(50, 50); |
3194 transform.Rotate(35); | 3197 transform.Rotate(35); |
3195 transform.Translate(-50, -50); | 3198 transform.Translate(-50, -50); |
(...skipping 1693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4889 { | 4892 { |
4890 pinchZoomPanViewportAndScrollBoundaryTest(2); | 4893 pinchZoomPanViewportAndScrollBoundaryTest(2); |
4891 } | 4894 } |
4892 | 4895 |
4893 INSTANTIATE_TEST_CASE_P(LayerTreeHostImplTests, | 4896 INSTANTIATE_TEST_CASE_P(LayerTreeHostImplTests, |
4894 LayerTreeHostImplTest, | 4897 LayerTreeHostImplTest, |
4895 ::testing::Values(false, true)); | 4898 ::testing::Values(false, true)); |
4896 | 4899 |
4897 } // namespace | 4900 } // namespace |
4898 } // namespace cc | 4901 } // namespace cc |
OLD | NEW |