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_common.h" | 5 #include "cc/layer_tree_host_common.h" |
6 | 6 |
7 #include "cc/content_layer.h" | 7 #include "cc/content_layer.h" |
8 #include "cc/content_layer_client.h" | 8 #include "cc/content_layer_client.h" |
9 #include "cc/layer.h" | 9 #include "cc/layer.h" |
10 #include "cc/layer_animation_controller.h" | 10 #include "cc/layer_animation_controller.h" |
(...skipping 3432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3443 // Verify draw and screen space transforms of layers not in a surface. | 3443 // Verify draw and screen space transforms of layers not in a surface. |
3444 MockContentLayerClient delegate; | 3444 MockContentLayerClient delegate; |
3445 WebTransformationMatrix identityMatrix; | 3445 WebTransformationMatrix identityMatrix; |
3446 | 3446 |
3447 scoped_refptr<ContentLayer> parent = createDrawableContentLayer(&delegate); | 3447 scoped_refptr<ContentLayer> parent = createDrawableContentLayer(&delegate); |
3448 setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, g
fx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), true); | 3448 setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, g
fx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), true); |
3449 | 3449 |
3450 scoped_refptr<ContentLayer> child = createDrawableContentLayer(&delegate); | 3450 scoped_refptr<ContentLayer> child = createDrawableContentLayer(&delegate); |
3451 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, gf
x::PointF(0, 0), gfx::PointF(2, 2), gfx::Size(10, 10), true); | 3451 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, gf
x::PointF(0, 0), gfx::PointF(2, 2), gfx::Size(10, 10), true); |
3452 | 3452 |
| 3453 scoped_refptr<ContentLayer> childEmpty = createDrawableContentLayer(&delegat
e); |
| 3454 setLayerPropertiesForTesting(childEmpty.get(), identityMatrix, identityMatri
x, gfx::PointF(0, 0), gfx::PointF(2, 2), gfx::Size(0, 0), true); |
| 3455 |
3453 scoped_refptr<NoScaleContentLayer> childNoScale = createNoScaleDrawableConte
ntLayer(&delegate); | 3456 scoped_refptr<NoScaleContentLayer> childNoScale = createNoScaleDrawableConte
ntLayer(&delegate); |
3454 setLayerPropertiesForTesting(childNoScale.get(), identityMatrix, identityMat
rix, gfx::PointF(0, 0), gfx::PointF(2, 2), gfx::Size(10, 10), true); | 3457 setLayerPropertiesForTesting(childNoScale.get(), identityMatrix, identityMat
rix, gfx::PointF(0, 0), gfx::PointF(2, 2), gfx::Size(10, 10), true); |
3455 | 3458 |
3456 parent->addChild(child); | 3459 parent->addChild(child); |
| 3460 parent->addChild(childEmpty); |
3457 parent->addChild(childNoScale); | 3461 parent->addChild(childNoScale); |
3458 | 3462 |
3459 std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; | 3463 std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; |
3460 int dummyMaxTextureSize = 512; | 3464 int dummyMaxTextureSize = 512; |
3461 | 3465 |
3462 const double deviceScaleFactor = 2.5; | 3466 const double deviceScaleFactor = 2.5; |
3463 const double pageScaleFactor = 1; | 3467 const double pageScaleFactor = 1; |
3464 | 3468 |
3465 LayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(),
deviceScaleFactor, pageScaleFactor, dummyMaxTextureSize, renderSurfaceLayerList
); | 3469 LayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(),
deviceScaleFactor, pageScaleFactor, dummyMaxTextureSize, renderSurfaceLayerList
); |
3466 | 3470 |
3467 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor, parent); | 3471 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor, parent); |
3468 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor, child); | 3472 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor, child); |
| 3473 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor, childEmpty); |
3469 EXPECT_CONTENTS_SCALE_EQ(1, childNoScale); | 3474 EXPECT_CONTENTS_SCALE_EQ(1, childNoScale); |
3470 | 3475 |
3471 EXPECT_EQ(1u, renderSurfaceLayerList.size()); | 3476 EXPECT_EQ(1u, renderSurfaceLayerList.size()); |
3472 | 3477 |
3473 // Verify parent transforms | 3478 // Verify parent transforms |
3474 WebTransformationMatrix expectedParentTransform; | 3479 WebTransformationMatrix expectedParentTransform; |
3475 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedParentTransform, parent->screenSpace
Transform()); | 3480 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedParentTransform, parent->screenSpace
Transform()); |
3476 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedParentTransform, parent->drawTransfo
rm()); | 3481 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedParentTransform, parent->drawTransfo
rm()); |
3477 | 3482 |
3478 // Verify results of transformed parent rects | 3483 // Verify results of transformed parent rects |
3479 gfx::RectF parentContentBounds(gfx::PointF(), gfx::SizeF(parent->contentBoun
ds())); | 3484 gfx::RectF parentContentBounds(gfx::PointF(), gfx::SizeF(parent->contentBoun
ds())); |
3480 | 3485 |
3481 gfx::RectF parentDrawRect = MathUtil::mapClippedRect(parent->drawTransform()
, parentContentBounds); | 3486 gfx::RectF parentDrawRect = MathUtil::mapClippedRect(parent->drawTransform()
, parentContentBounds); |
3482 gfx::RectF parentScreenSpaceRect = MathUtil::mapClippedRect(parent->screenSp
aceTransform(), parentContentBounds); | 3487 gfx::RectF parentScreenSpaceRect = MathUtil::mapClippedRect(parent->screenSp
aceTransform(), parentContentBounds); |
3483 | 3488 |
3484 gfx::RectF expectedParentDrawRect(gfx::PointF(), parent->bounds()); | 3489 gfx::RectF expectedParentDrawRect(gfx::PointF(), parent->bounds()); |
3485 expectedParentDrawRect.Scale(deviceScaleFactor); | 3490 expectedParentDrawRect.Scale(deviceScaleFactor); |
3486 EXPECT_FLOAT_RECT_EQ(expectedParentDrawRect, parentDrawRect); | 3491 EXPECT_FLOAT_RECT_EQ(expectedParentDrawRect, parentDrawRect); |
3487 EXPECT_FLOAT_RECT_EQ(expectedParentDrawRect, parentScreenSpaceRect); | 3492 EXPECT_FLOAT_RECT_EQ(expectedParentDrawRect, parentScreenSpaceRect); |
3488 | 3493 |
3489 // Verify child transforms | 3494 // Verify child and childEmpty transforms. They should match. |
3490 WebTransformationMatrix expectedChildTransform; | 3495 WebTransformationMatrix expectedChildTransform; |
3491 expectedChildTransform.translate(deviceScaleFactor * child->position().x(),
deviceScaleFactor * child->position().y()); | 3496 expectedChildTransform.translate(deviceScaleFactor * child->position().x(),
deviceScaleFactor * child->position().y()); |
3492 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform
()); | 3497 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform
()); |
3493 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->screenSpaceTr
ansform()); | 3498 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->screenSpaceTr
ansform()); |
| 3499 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, childEmpty->drawTran
sform()); |
| 3500 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, childEmpty->screenSp
aceTransform()); |
3494 | 3501 |
3495 // Verify results of transformed child rects | 3502 // Verify results of transformed child and childEmpty rects. They should mat
ch. |
3496 gfx::RectF childContentBounds(gfx::PointF(), gfx::SizeF(child->contentBounds
())); | 3503 gfx::RectF childContentBounds(gfx::PointF(), gfx::SizeF(child->contentBounds
())); |
3497 | 3504 |
3498 gfx::RectF childDrawRect = MathUtil::mapClippedRect(child->drawTransform(),
childContentBounds); | 3505 gfx::RectF childDrawRect = MathUtil::mapClippedRect(child->drawTransform(),
childContentBounds); |
3499 gfx::RectF childScreenSpaceRect = MathUtil::mapClippedRect(child->screenSpac
eTransform(), childContentBounds); | 3506 gfx::RectF childScreenSpaceRect = MathUtil::mapClippedRect(child->screenSpac
eTransform(), childContentBounds); |
3500 | 3507 |
| 3508 gfx::RectF childEmptyDrawRect = MathUtil::mapClippedRect(childEmpty->drawTra
nsform(), childContentBounds); |
| 3509 gfx::RectF childEmptyScreenSpaceRect = MathUtil::mapClippedRect(childEmpty->
screenSpaceTransform(), childContentBounds); |
| 3510 |
3501 gfx::RectF expectedChildDrawRect(child->position(), child->bounds()); | 3511 gfx::RectF expectedChildDrawRect(child->position(), child->bounds()); |
3502 expectedChildDrawRect.Scale(deviceScaleFactor); | 3512 expectedChildDrawRect.Scale(deviceScaleFactor); |
3503 EXPECT_FLOAT_RECT_EQ(expectedChildDrawRect, childDrawRect); | 3513 EXPECT_FLOAT_RECT_EQ(expectedChildDrawRect, childDrawRect); |
3504 EXPECT_FLOAT_RECT_EQ(expectedChildDrawRect, childScreenSpaceRect); | 3514 EXPECT_FLOAT_RECT_EQ(expectedChildDrawRect, childScreenSpaceRect); |
| 3515 EXPECT_FLOAT_RECT_EQ(expectedChildDrawRect, childEmptyDrawRect); |
| 3516 EXPECT_FLOAT_RECT_EQ(expectedChildDrawRect, childEmptyScreenSpaceRect); |
3505 | 3517 |
3506 // Verify childNoScale transforms | 3518 // Verify childNoScale transforms |
3507 WebTransformationMatrix expectedChildNoScaleTransform = child->drawTransform
(); | 3519 WebTransformationMatrix expectedChildNoScaleTransform = child->drawTransform
(); |
3508 // All transforms operate on content rects. The child's content rect | 3520 // All transforms operate on content rects. The child's content rect |
3509 // incorporates device scale, but the childNoScale does not; add it here. | 3521 // incorporates device scale, but the childNoScale does not; add it here. |
3510 expectedChildNoScaleTransform.scale(deviceScaleFactor); | 3522 expectedChildNoScaleTransform.scale(deviceScaleFactor); |
3511 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildNoScaleTransform, childNoScale-
>drawTransform()); | 3523 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildNoScaleTransform, childNoScale-
>drawTransform()); |
3512 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildNoScaleTransform, childNoScale-
>screenSpaceTransform()); | 3524 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildNoScaleTransform, childNoScale-
>screenSpaceTransform()); |
3513 } | 3525 } |
3514 | 3526 |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3603 childScaleMatrix.scale(initialChildScale); | 3615 childScaleMatrix.scale(initialChildScale); |
3604 | 3616 |
3605 float fixedRasterScale = 2.5; | 3617 float fixedRasterScale = 2.5; |
3606 | 3618 |
3607 scoped_refptr<ContentLayer> parent = createDrawableContentLayer(&delegate); | 3619 scoped_refptr<ContentLayer> parent = createDrawableContentLayer(&delegate); |
3608 setLayerPropertiesForTesting(parent.get(), parentScaleMatrix, identityMatrix
, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), true); | 3620 setLayerPropertiesForTesting(parent.get(), parentScaleMatrix, identityMatrix
, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), true); |
3609 | 3621 |
3610 scoped_refptr<ContentLayer> childScale = createDrawableContentLayer(&delegat
e); | 3622 scoped_refptr<ContentLayer> childScale = createDrawableContentLayer(&delegat
e); |
3611 setLayerPropertiesForTesting(childScale.get(), childScaleMatrix, identityMat
rix, gfx::PointF(0, 0), gfx::PointF(2, 2), gfx::Size(10, 10), true); | 3623 setLayerPropertiesForTesting(childScale.get(), childScaleMatrix, identityMat
rix, gfx::PointF(0, 0), gfx::PointF(2, 2), gfx::Size(10, 10), true); |
3612 | 3624 |
| 3625 scoped_refptr<ContentLayer> childEmpty = createDrawableContentLayer(&delegat
e); |
| 3626 setLayerPropertiesForTesting(childEmpty.get(), childScaleMatrix, identityMat
rix, gfx::PointF(0, 0), gfx::PointF(2, 2), gfx::Size(0, 0), true); |
| 3627 |
3613 scoped_refptr<NoScaleContentLayer> childNoScale = createNoScaleDrawableConte
ntLayer(&delegate); | 3628 scoped_refptr<NoScaleContentLayer> childNoScale = createNoScaleDrawableConte
ntLayer(&delegate); |
3614 setLayerPropertiesForTesting(childNoScale.get(), childScaleMatrix, identityM
atrix, gfx::PointF(0, 0), gfx::PointF(12, 12), gfx::Size(10, 10), true); | 3629 setLayerPropertiesForTesting(childNoScale.get(), childScaleMatrix, identityM
atrix, gfx::PointF(0, 0), gfx::PointF(12, 12), gfx::Size(10, 10), true); |
3615 | 3630 |
3616 scoped_refptr<ContentLayer> childNoAutoScale = createDrawableContentLayer(&d
elegate); | 3631 scoped_refptr<ContentLayer> childNoAutoScale = createDrawableContentLayer(&d
elegate); |
3617 setLayerPropertiesForTesting(childNoAutoScale.get(), childScaleMatrix, ident
ityMatrix, gfx::PointF(0, 0), gfx::PointF(22, 22), gfx::Size(10, 10), true); | 3632 setLayerPropertiesForTesting(childNoAutoScale.get(), childScaleMatrix, ident
ityMatrix, gfx::PointF(0, 0), gfx::PointF(22, 22), gfx::Size(10, 10), true); |
3618 childNoAutoScale->setAutomaticallyComputeRasterScale(false); | 3633 childNoAutoScale->setAutomaticallyComputeRasterScale(false); |
3619 childNoAutoScale->setRasterScale(fixedRasterScale); | 3634 childNoAutoScale->setRasterScale(fixedRasterScale); |
3620 | 3635 |
3621 // FIXME: Remove this when pageScaleFactor is applied in the compositor. | 3636 // FIXME: Remove this when pageScaleFactor is applied in the compositor. |
3622 // Page scale should not apply to the parent. | 3637 // Page scale should not apply to the parent. |
3623 parent->setBoundsContainPageScale(true); | 3638 parent->setBoundsContainPageScale(true); |
3624 | 3639 |
3625 parent->addChild(childScale); | 3640 parent->addChild(childScale); |
| 3641 parent->addChild(childEmpty); |
3626 parent->addChild(childNoScale); | 3642 parent->addChild(childNoScale); |
3627 parent->addChild(childNoAutoScale); | 3643 parent->addChild(childNoAutoScale); |
3628 | 3644 |
3629 std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; | 3645 std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; |
3630 int dummyMaxTextureSize = 512; | 3646 int dummyMaxTextureSize = 512; |
3631 | 3647 |
3632 double deviceScaleFactor = 2.5; | 3648 double deviceScaleFactor = 2.5; |
3633 double pageScaleFactor = 1.5; | 3649 double pageScaleFactor = 1.5; |
3634 | 3650 |
3635 // FIXME: Remove this when pageScaleFactor is applied in the compositor. | 3651 // FIXME: Remove this when pageScaleFactor is applied in the compositor. |
3636 WebTransformationMatrix pageScaleMatrix; | 3652 WebTransformationMatrix pageScaleMatrix; |
3637 pageScaleMatrix.scale(pageScaleFactor); | 3653 pageScaleMatrix.scale(pageScaleFactor); |
3638 parent->setSublayerTransform(pageScaleMatrix); | 3654 parent->setSublayerTransform(pageScaleMatrix); |
3639 | 3655 |
3640 LayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(),
deviceScaleFactor, pageScaleFactor, dummyMaxTextureSize, renderSurfaceLayerList
); | 3656 LayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(),
deviceScaleFactor, pageScaleFactor, dummyMaxTextureSize, renderSurfaceLayerList
); |
3641 | 3657 |
3642 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * initialParentScale, parent); | 3658 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * initialParentScale, parent); |
3643 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor * initialParent
Scale * initialChildScale, childScale); | 3659 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor * initialParent
Scale * initialChildScale, childScale); |
| 3660 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor * initialParent
Scale * initialChildScale, childEmpty); |
3644 EXPECT_CONTENTS_SCALE_EQ(1, childNoScale); | 3661 EXPECT_CONTENTS_SCALE_EQ(1, childNoScale); |
3645 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor * fixedRasterSc
ale, childNoAutoScale); | 3662 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor * fixedRasterSc
ale, childNoAutoScale); |
3646 | 3663 |
3647 // The parent is scaled up and shouldn't need to scale during draw. The chil
d that can scale its contents should | 3664 // The parent is scaled up and shouldn't need to scale during draw. The chil
d that can scale its contents should |
3648 // also not need to scale during draw. The other should. | 3665 // also not need to scale during draw. This shouldn't change if the child ha
s empty bounds. The other children should. |
3649 // There is some rounding error due to contentBounds being a rounded integer
. | 3666 EXPECT_FLOAT_EQ(1, parent->drawTransform().m11()); |
3650 EXPECT_NEAR(parent->drawTransform().m11(), 1, 0.01); | 3667 EXPECT_FLOAT_EQ(1, parent->drawTransform().m22()); |
3651 EXPECT_NEAR(parent->drawTransform().m22(), 1, 0.01); | 3668 EXPECT_FLOAT_EQ(1, childScale->drawTransform().m11()); |
3652 EXPECT_NEAR(childScale->drawTransform().m11(), 1, 0.01); | 3669 EXPECT_FLOAT_EQ(1, childScale->drawTransform().m22()); |
3653 EXPECT_NEAR(childScale->drawTransform().m22(), 1, 0.01); | 3670 EXPECT_FLOAT_EQ(1, childEmpty->drawTransform().m11()); |
| 3671 EXPECT_FLOAT_EQ(1, childEmpty->drawTransform().m22()); |
3654 EXPECT_FLOAT_EQ(deviceScaleFactor * pageScaleFactor * initialParentScale * i
nitialChildScale, childNoScale->drawTransform().m11()); | 3672 EXPECT_FLOAT_EQ(deviceScaleFactor * pageScaleFactor * initialParentScale * i
nitialChildScale, childNoScale->drawTransform().m11()); |
3655 EXPECT_FLOAT_EQ(deviceScaleFactor * pageScaleFactor * initialParentScale * i
nitialChildScale, childNoScale->drawTransform().m22()); | 3673 EXPECT_FLOAT_EQ(deviceScaleFactor * pageScaleFactor * initialParentScale * i
nitialChildScale, childNoScale->drawTransform().m22()); |
3656 EXPECT_NEAR(childNoAutoScale->drawTransform().m11(), initialParentScale * in
itialChildScale / fixedRasterScale, 0.01); | 3674 EXPECT_FLOAT_EQ(initialParentScale * initialChildScale / fixedRasterScale, c
hildNoAutoScale->drawTransform().m11()); |
3657 EXPECT_NEAR(childNoAutoScale->drawTransform().m22(), initialParentScale * in
itialChildScale / fixedRasterScale, 0.01); | 3675 EXPECT_FLOAT_EQ(initialParentScale * initialChildScale / fixedRasterScale, c
hildNoAutoScale->drawTransform().m22()); |
3658 | 3676 |
3659 // If the transform changes, we expect the contentsScale to remain unchanged
. | 3677 // If the transform changes, we expect the contentsScale to remain unchanged
. |
3660 childScale->setTransform(identityMatrix); | 3678 childScale->setTransform(identityMatrix); |
| 3679 childEmpty->setTransform(identityMatrix); |
3661 | 3680 |
3662 renderSurfaceLayerList.clear(); | 3681 renderSurfaceLayerList.clear(); |
3663 LayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(),
deviceScaleFactor, pageScaleFactor, dummyMaxTextureSize, renderSurfaceLayerList
); | 3682 LayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(),
deviceScaleFactor, pageScaleFactor, dummyMaxTextureSize, renderSurfaceLayerList
); |
3664 | 3683 |
3665 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * initialParentScale, parent); | 3684 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * initialParentScale, parent); |
3666 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor * initialParent
Scale * initialChildScale, childScale); | 3685 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor * initialParent
Scale * initialChildScale, childScale); |
| 3686 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor * initialParent
Scale * initialChildScale, childEmpty); |
3667 EXPECT_CONTENTS_SCALE_EQ(1, childNoScale); | 3687 EXPECT_CONTENTS_SCALE_EQ(1, childNoScale); |
3668 | 3688 |
3669 // But if the deviceScaleFactor or pageScaleFactor changes, then it should b
e updated, but using the initial transform. | 3689 // But if the deviceScaleFactor or pageScaleFactor changes, then it should b
e updated, but using the initial transform. |
3670 deviceScaleFactor = 2.25; | 3690 deviceScaleFactor = 2.25; |
3671 pageScaleFactor = 1.25; | 3691 pageScaleFactor = 1.25; |
3672 | 3692 |
3673 // FIXME: Remove this when pageScaleFactor is applied in the compositor. | 3693 // FIXME: Remove this when pageScaleFactor is applied in the compositor. |
3674 pageScaleMatrix = identityMatrix; | 3694 pageScaleMatrix = identityMatrix; |
3675 pageScaleMatrix.scale(pageScaleFactor); | 3695 pageScaleMatrix.scale(pageScaleFactor); |
3676 parent->setSublayerTransform(pageScaleMatrix); | 3696 parent->setSublayerTransform(pageScaleMatrix); |
3677 | 3697 |
3678 renderSurfaceLayerList.clear(); | 3698 renderSurfaceLayerList.clear(); |
3679 LayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(),
deviceScaleFactor, pageScaleFactor, dummyMaxTextureSize, renderSurfaceLayerList
); | 3699 LayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(),
deviceScaleFactor, pageScaleFactor, dummyMaxTextureSize, renderSurfaceLayerList
); |
3680 | 3700 |
3681 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * initialParentScale, parent); | 3701 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * initialParentScale, parent); |
3682 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor * initialParent
Scale * initialChildScale, childScale); | 3702 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor * initialParent
Scale * initialChildScale, childScale); |
| 3703 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor * initialParent
Scale * initialChildScale, childEmpty); |
3683 EXPECT_CONTENTS_SCALE_EQ(1, childNoScale); | 3704 EXPECT_CONTENTS_SCALE_EQ(1, childNoScale); |
3684 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor * fixedRasterSc
ale, childNoAutoScale); | 3705 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor * fixedRasterSc
ale, childNoAutoScale); |
3685 } | 3706 } |
3686 | 3707 |
3687 TEST(LayerTreeHostCommonTest, verifySmallContentsScale) | 3708 TEST(LayerTreeHostCommonTest, verifySmallContentsScale) |
3688 { | 3709 { |
3689 MockContentLayerClient delegate; | 3710 MockContentLayerClient delegate; |
3690 WebTransformationMatrix identityMatrix; | 3711 WebTransformationMatrix identityMatrix; |
3691 | 3712 |
3692 WebTransformationMatrix parentScaleMatrix; | 3713 WebTransformationMatrix parentScaleMatrix; |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4092 EXPECT_EQ(root, LayerTreeHostCommon::findLayerInSubtree(root.get(), root->id
())); | 4113 EXPECT_EQ(root, LayerTreeHostCommon::findLayerInSubtree(root.get(), root->id
())); |
4093 EXPECT_EQ(child, LayerTreeHostCommon::findLayerInSubtree(root.get(), child->
id())); | 4114 EXPECT_EQ(child, LayerTreeHostCommon::findLayerInSubtree(root.get(), child->
id())); |
4094 EXPECT_EQ(grandChild, LayerTreeHostCommon::findLayerInSubtree(root.get(), gr
andChild->id())); | 4115 EXPECT_EQ(grandChild, LayerTreeHostCommon::findLayerInSubtree(root.get(), gr
andChild->id())); |
4095 EXPECT_EQ(maskLayer, LayerTreeHostCommon::findLayerInSubtree(root.get(), mas
kLayer->id())); | 4116 EXPECT_EQ(maskLayer, LayerTreeHostCommon::findLayerInSubtree(root.get(), mas
kLayer->id())); |
4096 EXPECT_EQ(replicaLayer, LayerTreeHostCommon::findLayerInSubtree(root.get(),
replicaLayer->id())); | 4117 EXPECT_EQ(replicaLayer, LayerTreeHostCommon::findLayerInSubtree(root.get(),
replicaLayer->id())); |
4097 EXPECT_EQ(0, LayerTreeHostCommon::findLayerInSubtree(root.get(), nonexistent
Id)); | 4118 EXPECT_EQ(0, LayerTreeHostCommon::findLayerInSubtree(root.get(), nonexistent
Id)); |
4098 } | 4119 } |
4099 | 4120 |
4100 } // namespace | 4121 } // namespace |
4101 } // namespace cc | 4122 } // namespace cc |
OLD | NEW |