| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/delegated_renderer_layer_impl.h" | 7 #include "cc/delegated_renderer_layer_impl.h" |
| 8 | 8 |
| 9 #include "cc/append_quads_data.h" | 9 #include "cc/append_quads_data.h" |
| 10 #include "cc/layer_tree_host_impl.h" | 10 #include "cc/layer_tree_host_impl.h" |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 scoped_ptr<LayerImpl> rootLayer = SolidColorLayerImpl::create(1).PassAs<
LayerImpl>(); | 103 scoped_ptr<LayerImpl> rootLayer = SolidColorLayerImpl::create(1).PassAs<
LayerImpl>(); |
| 104 scoped_ptr<LayerImpl> layerBefore = SolidColorLayerImpl::create(2).PassA
s<LayerImpl>(); | 104 scoped_ptr<LayerImpl> layerBefore = SolidColorLayerImpl::create(2).PassA
s<LayerImpl>(); |
| 105 scoped_ptr<LayerImpl> layerAfter = SolidColorLayerImpl::create(3).PassAs
<LayerImpl>(); | 105 scoped_ptr<LayerImpl> layerAfter = SolidColorLayerImpl::create(3).PassAs
<LayerImpl>(); |
| 106 scoped_ptr<DelegatedRendererLayerImpl> delegatedRendererLayer = Delegate
dRendererLayerImpl::create(4); | 106 scoped_ptr<DelegatedRendererLayerImpl> delegatedRendererLayer = Delegate
dRendererLayerImpl::create(4); |
| 107 | 107 |
| 108 m_hostImpl->setViewportSize(IntSize(100, 100), IntSize(100, 100)); | 108 m_hostImpl->setViewportSize(IntSize(100, 100), IntSize(100, 100)); |
| 109 rootLayer->setBounds(IntSize(100, 100)); | 109 rootLayer->setBounds(IntSize(100, 100)); |
| 110 | 110 |
| 111 layerBefore->setPosition(IntPoint(20, 20)); | 111 layerBefore->setPosition(IntPoint(20, 20)); |
| 112 layerBefore->setBounds(IntSize(14, 14)); | 112 layerBefore->setBounds(IntSize(14, 14)); |
| 113 layerBefore->setContentBounds(IntSize(14, 14)); | |
| 114 layerBefore->setDrawsContent(true); | 113 layerBefore->setDrawsContent(true); |
| 115 layerBefore->setForceRenderSurface(true); | 114 layerBefore->setForceRenderSurface(true); |
| 116 | 115 |
| 117 layerAfter->setPosition(IntPoint(5, 5)); | 116 layerAfter->setPosition(IntPoint(5, 5)); |
| 118 layerAfter->setBounds(IntSize(15, 15)); | 117 layerAfter->setBounds(IntSize(15, 15)); |
| 119 layerAfter->setContentBounds(IntSize(15, 15)); | |
| 120 layerAfter->setDrawsContent(true); | 118 layerAfter->setDrawsContent(true); |
| 121 layerAfter->setForceRenderSurface(true); | 119 layerAfter->setForceRenderSurface(true); |
| 122 | 120 |
| 123 delegatedRendererLayer->setPosition(IntPoint(3, 3)); | 121 delegatedRendererLayer->setPosition(IntPoint(3, 3)); |
| 124 delegatedRendererLayer->setBounds(IntSize(10, 10)); | 122 delegatedRendererLayer->setBounds(IntSize(10, 10)); |
| 125 delegatedRendererLayer->setContentBounds(IntSize(10, 10)); | |
| 126 delegatedRendererLayer->setDrawsContent(true); | 123 delegatedRendererLayer->setDrawsContent(true); |
| 127 WebTransformationMatrix transform; | 124 WebTransformationMatrix transform; |
| 128 transform.translate(1, 1); | 125 transform.translate(1, 1); |
| 129 delegatedRendererLayer->setTransform(transform); | 126 delegatedRendererLayer->setTransform(transform); |
| 130 | 127 |
| 131 ScopedPtrVector<RenderPass> delegatedRenderPasses; | 128 ScopedPtrVector<RenderPass> delegatedRenderPasses; |
| 132 TestRenderPass* pass1 = addRenderPass(delegatedRenderPasses, RenderPass:
:Id(9, 6), IntRect(6, 6, 6, 6), WebTransformationMatrix()); | 129 TestRenderPass* pass1 = addRenderPass(delegatedRenderPasses, RenderPass:
:Id(9, 6), IntRect(6, 6, 6, 6), WebTransformationMatrix()); |
| 133 addQuad(pass1, IntRect(0, 0, 6, 6), 33u); | 130 addQuad(pass1, IntRect(0, 0, 6, 6), 33u); |
| 134 TestRenderPass* pass2 = addRenderPass(delegatedRenderPasses, RenderPass:
:Id(9, 7), IntRect(7, 7, 7, 7), WebTransformationMatrix()); | 131 TestRenderPass* pass2 = addRenderPass(delegatedRenderPasses, RenderPass:
:Id(9, 7), IntRect(7, 7, 7, 7), WebTransformationMatrix()); |
| 135 addQuad(pass2, IntRect(0, 0, 7, 7), 22u); | 132 addQuad(pass2, IntRect(0, 0, 7, 7), 22u); |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 : DelegatedRendererLayerImplTest() | 381 : DelegatedRendererLayerImplTest() |
| 385 { | 382 { |
| 386 scoped_ptr<LayerImpl> rootLayer = LayerImpl::create(1); | 383 scoped_ptr<LayerImpl> rootLayer = LayerImpl::create(1); |
| 387 scoped_ptr<DelegatedRendererLayerImpl> delegatedRendererLayer = Delegate
dRendererLayerImpl::create(2); | 384 scoped_ptr<DelegatedRendererLayerImpl> delegatedRendererLayer = Delegate
dRendererLayerImpl::create(2); |
| 388 | 385 |
| 389 m_hostImpl->setViewportSize(IntSize(100, 100), IntSize(100, 100)); | 386 m_hostImpl->setViewportSize(IntSize(100, 100), IntSize(100, 100)); |
| 390 rootLayer->setBounds(IntSize(100, 100)); | 387 rootLayer->setBounds(IntSize(100, 100)); |
| 391 | 388 |
| 392 delegatedRendererLayer->setPosition(IntPoint(20, 20)); | 389 delegatedRendererLayer->setPosition(IntPoint(20, 20)); |
| 393 delegatedRendererLayer->setBounds(IntSize(20, 20)); | 390 delegatedRendererLayer->setBounds(IntSize(20, 20)); |
| 394 delegatedRendererLayer->setContentBounds(IntSize(20, 20)); | |
| 395 delegatedRendererLayer->setDrawsContent(true); | 391 delegatedRendererLayer->setDrawsContent(true); |
| 396 WebTransformationMatrix transform; | 392 WebTransformationMatrix transform; |
| 397 transform.translate(10, 10); | 393 transform.translate(10, 10); |
| 398 delegatedRendererLayer->setTransform(transform); | 394 delegatedRendererLayer->setTransform(transform); |
| 399 | 395 |
| 400 ScopedPtrVector<RenderPass> delegatedRenderPasses; | 396 ScopedPtrVector<RenderPass> delegatedRenderPasses; |
| 401 IntRect passRect(0, 0, 50, 50); | 397 IntRect passRect(0, 0, 50, 50); |
| 402 TestRenderPass* pass = addRenderPass(delegatedRenderPasses, RenderPass::
Id(9, 6), passRect, WebTransformationMatrix()); | 398 TestRenderPass* pass = addRenderPass(delegatedRenderPasses, RenderPass::
Id(9, 6), passRect, WebTransformationMatrix()); |
| 403 MockQuadCuller quadSink(pass->quadList(), pass->sharedQuadStateList()); | 399 MockQuadCuller quadSink(pass->quadList(), pass->sharedQuadStateList()); |
| 404 AppendQuadsData data(pass->id()); | 400 AppendQuadsData data(pass->id()); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 EXPECT_EQ(sharedState, quadList[3]->sharedQuadState()); | 442 EXPECT_EQ(sharedState, quadList[3]->sharedQuadState()); |
| 447 | 443 |
| 448 // The state should be transformed only once. | 444 // The state should be transformed only once. |
| 449 EXPECT_RECT_EQ(IntRect(30, 30, 50, 50), sharedState->clippedRectInTarget); | 445 EXPECT_RECT_EQ(IntRect(30, 30, 50, 50), sharedState->clippedRectInTarget); |
| 450 WebTransformationMatrix expected; | 446 WebTransformationMatrix expected; |
| 451 expected.translate(30, 30); | 447 expected.translate(30, 30); |
| 452 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, sharedState->quadTransform); | 448 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, sharedState->quadTransform); |
| 453 } | 449 } |
| 454 | 450 |
| 455 } // namespace | 451 } // namespace |
| OLD | NEW |