Chromium Code Reviews| 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 | 5 |
| 6 #include "config.h" | 6 #include "config.h" |
| 7 | 7 |
| 8 #include "CCLayerTreeHostCommon.h" | 8 #include "CCLayerTreeHostCommon.h" |
| 9 | 9 |
| 10 #include "CCLayerImpl.h" | 10 #include "CCLayerImpl.h" |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 326 // The adjustment allows us to continue using the scrollCompensation on the next surface. | 326 // The adjustment allows us to continue using the scrollCompensation on the next surface. |
| 327 // Step 1 (right-most in the math): transform from the new surface to the o riginal ancestor surface | 327 // Step 1 (right-most in the math): transform from the new surface to the o riginal ancestor surface |
| 328 // Step 2: apply the scroll compensation | 328 // Step 2: apply the scroll compensation |
| 329 // Step 3: transform back to the new surface. | 329 // Step 3: transform back to the new surface. |
| 330 if (layer->renderSurface() && !nextScrollCompensationMatrix.isIdentity()) | 330 if (layer->renderSurface() && !nextScrollCompensationMatrix.isIdentity()) |
| 331 nextScrollCompensationMatrix = layer->renderSurface()->drawTransform().i nverse() * nextScrollCompensationMatrix * layer->renderSurface()->drawTransform( ); | 331 nextScrollCompensationMatrix = layer->renderSurface()->drawTransform().i nverse() * nextScrollCompensationMatrix * layer->renderSurface()->drawTransform( ); |
| 332 | 332 |
| 333 return nextScrollCompensationMatrix; | 333 return nextScrollCompensationMatrix; |
| 334 } | 334 } |
| 335 | 335 |
| 336 // There is no contentsScale on impl thread. | |
| 337 static inline void updateLayerContentsScale(CCLayerImpl*, const WebTransformatio nMatrix&, float, float) { } | |
| 338 | |
| 339 static inline void updateLayerContentsScale(LayerChromium* layer, const WebTrans formationMatrix& combinedTransform, float deviceScaleFactor, float pageScaleFact or) | |
| 340 { | |
| 341 float cssScale = layer->initialCssScale(); | |
| 342 if (!cssScale) { | |
| 343 FloatPoint transformScale = CCMathUtil::computeTransform2dScaleComponent s(combinedTransform); | |
| 344 float combinedScale = fmaxf(transformScale.x(), transformScale.y()); | |
| 345 cssScale = combinedScale / deviceScaleFactor; | |
| 346 if (!layer->boundsContainPageScale()) | |
| 347 cssScale /= pageScaleFactor; | |
| 348 layer->setInitialCssScale(cssScale); | |
| 349 } | |
| 350 | |
| 351 float contentsScale = cssScale * deviceScaleFactor; | |
| 352 if (!layer->boundsContainPageScale()) | |
| 353 contentsScale *= pageScaleFactor; | |
| 354 layer->setContentsScale(contentsScale); | |
| 355 | |
| 356 LayerChromium* maskLayer = layer->maskLayer(); | |
| 357 if (maskLayer) | |
| 358 maskLayer->setContentsScale(contentsScale); | |
| 359 | |
| 360 LayerChromium* replicaMaskLayer = layer->replicaLayer() ? layer->replicaLaye r()->maskLayer() : 0; | |
| 361 if (replicaMaskLayer) | |
| 362 replicaMaskLayer->setContentsScale(contentsScale); | |
| 363 } | |
| 364 | |
| 336 // Should be called just before the recursive calculateDrawTransformsInternal(). | 365 // Should be called just before the recursive calculateDrawTransformsInternal(). |
| 337 template<typename LayerType, typename LayerList> | 366 template<typename LayerType, typename LayerList> |
| 338 void setupRootLayerAndSurfaceForRecursion(LayerType* rootLayer, LayerList& rende rSurfaceLayerList, const IntSize& deviceViewportSize) | 367 void setupRootLayerAndSurfaceForRecursion(LayerType* rootLayer, LayerList& rende rSurfaceLayerList, const IntSize& deviceViewportSize) |
| 339 { | 368 { |
| 340 if (!rootLayer->renderSurface()) | 369 if (!rootLayer->renderSurface()) |
| 341 rootLayer->createRenderSurface(); | 370 rootLayer->createRenderSurface(); |
| 342 | 371 |
| 343 rootLayer->renderSurface()->setContentRect(IntRect(IntPoint::zero(), deviceV iewportSize)); | 372 rootLayer->renderSurface()->setContentRect(IntRect(IntPoint::zero(), deviceV iewportSize)); |
| 344 rootLayer->renderSurface()->clearLayerLists(); | 373 rootLayer->renderSurface()->clearLayerLists(); |
| 345 | 374 |
| 346 ASSERT(renderSurfaceLayerList.isEmpty()); | 375 ASSERT(renderSurfaceLayerList.isEmpty()); |
| 347 renderSurfaceLayerList.append(rootLayer); | 376 renderSurfaceLayerList.append(rootLayer); |
| 348 } | 377 } |
| 349 | 378 |
| 350 // Recursively walks the layer tree starting at the given node and computes all the | 379 // Recursively walks the layer tree starting at the given node and computes all the |
| 351 // necessary transformations, clipRects, render surfaces, etc. | 380 // necessary transformations, clipRects, render surfaces, etc. |
| 352 template<typename LayerType, typename LayerList, typename RenderSurfaceType, typ ename LayerSorter> | 381 template<typename LayerType, typename LayerList, typename RenderSurfaceType, typ ename LayerSorter> |
| 353 static void calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay er, const WebTransformationMatrix& parentMatrix, | 382 static void calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay er, const WebTransformationMatrix& parentMatrix, |
| 354 const WebTransformationMatrix& fullHierarchyMatrix, const WebTransformationM atrix& currentScrollCompensationMatrix, | 383 const WebTransformationMatrix& fullHierarchyMatrix, const WebTransformationM atrix& currentScrollCompensationMatrix, |
| 355 const IntRect& clipRectFromAncestor, bool ancestorClipsSubtree, | 384 const IntRect& clipRectFromAncestor, bool ancestorClipsSubtree, |
| 356 RenderSurfaceType* nearestAncestorThatMovesPixels, LayerList& renderSurfaceL ayerList, LayerList& layerList, | 385 RenderSurfaceType* nearestAncestorThatMovesPixels, LayerList& renderSurfaceL ayerList, LayerList& layerList, |
| 357 LayerSorter* layerSorter, int maxTextureSize, float deviceScaleFactor, IntRe ct& drawableContentRectOfSubtree) | 386 LayerSorter* layerSorter, int maxTextureSize, float deviceScaleFactor, float pageScaleFactor, IntRect& drawableContentRectOfSubtree) |
| 358 { | 387 { |
| 359 // This function computes the new matrix transformations recursively for thi s | 388 // This function computes the new matrix transformations recursively for thi s |
| 360 // layer and all its descendants. It also computes the appropriate render su rfaces. | 389 // layer and all its descendants. It also computes the appropriate render su rfaces. |
| 361 // Some important points to remember: | 390 // Some important points to remember: |
| 362 // | 391 // |
| 363 // 0. Here, transforms are notated in Matrix x Vector order, and in words we describe what | 392 // 0. Here, transforms are notated in Matrix x Vector order, and in words we describe what |
| 364 // the transform does from left to right. | 393 // the transform does from left to right. |
| 365 // | 394 // |
| 366 // 1. In our terminology, the "layer origin" refers to the top-left corner o f a layer, and the | 395 // 1. In our terminology, the "layer origin" refers to the top-left corner o f a layer, and the |
| 367 // positive Y-axis points downwards. This interpretation is valid because the orthographic | 396 // positive Y-axis points downwards. This interpretation is valid because the orthographic |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 480 WebTransformationMatrix combinedTransform = parentMatrix; | 509 WebTransformationMatrix combinedTransform = parentMatrix; |
| 481 combinedTransform.multiply(layerLocalTransform); | 510 combinedTransform.multiply(layerLocalTransform); |
| 482 | 511 |
| 483 if (layer->fixedToContainerLayer()) { | 512 if (layer->fixedToContainerLayer()) { |
| 484 // Special case: this layer is a composited fixed-position layer; we nee d to | 513 // Special case: this layer is a composited fixed-position layer; we nee d to |
| 485 // explicitly compensate for all ancestors' nonzero scrollDeltas to keep this layer | 514 // explicitly compensate for all ancestors' nonzero scrollDeltas to keep this layer |
| 486 // fixed correctly. | 515 // fixed correctly. |
| 487 combinedTransform = currentScrollCompensationMatrix * combinedTransform; | 516 combinedTransform = currentScrollCompensationMatrix * combinedTransform; |
| 488 } | 517 } |
| 489 | 518 |
| 519 // The layer's contentsSize is determined from the combinedTransform, which then informs the | |
| 520 // layer's drawTransform. | |
| 521 updateLayerContentsScale(layer, combinedTransform, deviceScaleFactor, pageSc aleFactor); | |
| 522 | |
| 490 // The drawTransform that gets computed below is effectively the layer's dra wTransform, unless | 523 // The drawTransform that gets computed below is effectively the layer's dra wTransform, unless |
| 491 // the layer itself creates a renderSurface. In that case, the renderSurface re-parents the transforms. | 524 // the layer itself creates a renderSurface. In that case, the renderSurface re-parents the transforms. |
| 492 WebTransformationMatrix drawTransform = combinedTransform; | 525 WebTransformationMatrix drawTransform = combinedTransform; |
| 493 // M[draw] = M[parent] * LT * Tr[anchor2center] * Tr[center2origin] | 526 // M[draw] = M[parent] * LT * Tr[anchor2center] * Tr[center2origin] |
| 494 drawTransform.translate(-layer->bounds().width() / 2.0, -layer->bounds().hei ght() / 2.0); | 527 drawTransform.translate(-layer->bounds().width() / 2.0, -layer->bounds().hei ght() / 2.0); |
| 495 if (!layer->contentBounds().isEmpty() && !layer->bounds().isEmpty()) { | 528 if (!layer->contentBounds().isEmpty() && !layer->bounds().isEmpty()) { |
| 496 // M[draw] = M[parent] * LT * Tr[anchor2origin] * S[layer2content] | 529 // M[draw] = M[parent] * LT * Tr[anchor2origin] * S[layer2content] |
| 497 drawTransform.scaleNonUniform(layer->bounds().width() / static_cast<doub le>(layer->contentBounds().width()), | 530 drawTransform.scaleNonUniform(layer->bounds().width() / static_cast<doub le>(layer->contentBounds().width()), |
| 498 layer->bounds().height() / static_cast<dou ble>(layer->contentBounds().height())); | 531 layer->bounds().height() / static_cast<dou ble>(layer->contentBounds().height())); |
| 499 } | 532 } |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 523 // Check back-face visibility before continuing with this surface and it s subtree | 556 // Check back-face visibility before continuing with this surface and it s subtree |
| 524 if (!layer->doubleSided() && transformToParentIsKnown(layer) && isSurfac eBackFaceVisible(layer, combinedTransform)) | 557 if (!layer->doubleSided() && transformToParentIsKnown(layer) && isSurfac eBackFaceVisible(layer, combinedTransform)) |
| 525 return; | 558 return; |
| 526 | 559 |
| 527 if (!layer->renderSurface()) | 560 if (!layer->renderSurface()) |
| 528 layer->createRenderSurface(); | 561 layer->createRenderSurface(); |
| 529 | 562 |
| 530 RenderSurfaceType* renderSurface = layer->renderSurface(); | 563 RenderSurfaceType* renderSurface = layer->renderSurface(); |
| 531 renderSurface->clearLayerLists(); | 564 renderSurface->clearLayerLists(); |
| 532 | 565 |
| 533 // The origin of the new surface is the upper left corner of the layer. | 566 // The origin of the new surface is the upper left corner of the layer. The contents of the |
| 567 // the render surface match the scale of the owning layer. | |
| 534 renderSurface->setDrawTransform(drawTransform); | 568 renderSurface->setDrawTransform(drawTransform); |
| 535 WebTransformationMatrix layerDrawTransform; | 569 WebTransformationMatrix layerDrawTransform; |
| 536 layerDrawTransform.scale(deviceScaleFactor); | |
|
enne (OOO)
2012/10/03 19:52:38
This block of code is highly intentional.
The "co
| |
| 537 if (!layer->contentBounds().isEmpty() && !layer->bounds().isEmpty()) { | |
| 538 layerDrawTransform.scaleNonUniform(layer->bounds().width() / static_ cast<double>(layer->contentBounds().width()), | |
| 539 layer->bounds().height() / static _cast<double>(layer->contentBounds().height())); | |
| 540 } | |
| 541 layer->setDrawTransform(layerDrawTransform); | 570 layer->setDrawTransform(layerDrawTransform); |
| 542 | 571 |
| 572 // Inside the surface's subtree, we scale everything to the owning layer 's scale. | |
| 543 // The sublayer matrix transforms centered layer rects into target | 573 // The sublayer matrix transforms centered layer rects into target |
| 544 // surface content space. | 574 // surface content space. |
| 545 sublayerMatrix.makeIdentity(); | 575 sublayerMatrix.makeIdentity(); |
| 546 sublayerMatrix.scale(deviceScaleFactor); | 576 if (!layer->contentBounds().isEmpty() && !layer->bounds().isEmpty()) { |
| 577 sublayerMatrix.scaleNonUniform(layer->contentBounds().width() / stat ic_cast<double>(layer->bounds().width()), | |
| 578 layer->contentBounds().height() / sta tic_cast<double>(layer->bounds().height())); | |
| 579 } | |
| 547 sublayerMatrix.translate(0.5 * bounds.width(), 0.5 * bounds.height()); | 580 sublayerMatrix.translate(0.5 * bounds.width(), 0.5 * bounds.height()); |
| 548 | 581 |
| 549 // The opacity value is moved from the layer to its surface, so that the entire subtree properly inherits opacity. | 582 // The opacity value is moved from the layer to its surface, so that the entire subtree properly inherits opacity. |
| 550 renderSurface->setDrawOpacity(drawOpacity); | 583 renderSurface->setDrawOpacity(drawOpacity); |
| 551 renderSurface->setDrawOpacityIsAnimating(drawOpacityIsAnimating); | 584 renderSurface->setDrawOpacityIsAnimating(drawOpacityIsAnimating); |
| 552 layer->setDrawOpacity(1); | 585 layer->setDrawOpacity(1); |
| 553 layer->setDrawOpacityIsAnimating(false); | 586 layer->setDrawOpacityIsAnimating(false); |
| 554 | 587 |
| 555 renderSurface->setTargetSurfaceTransformsAreAnimating(animatingTransform ToTarget); | 588 renderSurface->setTargetSurfaceTransformsAreAnimating(animatingTransform ToTarget); |
| 556 renderSurface->setScreenSpaceTransformsAreAnimating(animatingTransformTo Screen); | 589 renderSurface->setScreenSpaceTransformsAreAnimating(animatingTransformTo Screen); |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 640 descendants.append(layer); | 673 descendants.append(layer); |
| 641 | 674 |
| 642 WebTransformationMatrix nextScrollCompensationMatrix = computeScrollCompensa tionMatrixForChildren(layer, parentMatrix, currentScrollCompensationMatrix);; | 675 WebTransformationMatrix nextScrollCompensationMatrix = computeScrollCompensa tionMatrixForChildren(layer, parentMatrix, currentScrollCompensationMatrix);; |
| 643 | 676 |
| 644 IntRect accumulatedDrawableContentRectOfChildren; | 677 IntRect accumulatedDrawableContentRectOfChildren; |
| 645 for (size_t i = 0; i < layer->children().size(); ++i) { | 678 for (size_t i = 0; i < layer->children().size(); ++i) { |
| 646 LayerType* child = CCLayerTreeHostCommon::getChildAsRawPtr(layer->childr en(), i); | 679 LayerType* child = CCLayerTreeHostCommon::getChildAsRawPtr(layer->childr en(), i); |
| 647 IntRect drawableContentRectOfChildSubtree; | 680 IntRect drawableContentRectOfChildSubtree; |
| 648 calculateDrawTransformsInternal<LayerType, LayerList, RenderSurfaceType, LayerSorter>(child, rootLayer, sublayerMatrix, nextHierarchyMatrix, nextScrollC ompensationMatrix, | 681 calculateDrawTransformsInternal<LayerType, LayerList, RenderSurfaceType, LayerSorter>(child, rootLayer, sublayerMatrix, nextHierarchyMatrix, nextScrollC ompensationMatrix, |
| 649 clipRectForSubtree, subtreeShouldBeClipped, nearestAncestorThatMov esPixels, | 682 clipRectForSubtree, subtreeShouldBeClipped, nearestAncestorThatMov esPixels, |
| 650 renderSurfaceLayerList, descendants, layerSorter, maxTextureSize, deviceScaleFactor, drawableContentRectOfChildSubtree); | 683 renderSurfaceLayerList, descendants, layerSorter, maxTextureSize, deviceScaleFactor, pageScaleFactor, drawableContentRectOfChildSubtree); |
| 651 if (!drawableContentRectOfChildSubtree.isEmpty()) { | 684 if (!drawableContentRectOfChildSubtree.isEmpty()) { |
| 652 accumulatedDrawableContentRectOfChildren.unite(drawableContentRectOf ChildSubtree); | 685 accumulatedDrawableContentRectOfChildren.unite(drawableContentRectOf ChildSubtree); |
| 653 if (child->renderSurface()) | 686 if (child->renderSurface()) |
| 654 descendants.append(child); | 687 descendants.append(child); |
| 655 } | 688 } |
| 656 } | 689 } |
| 657 | 690 |
| 658 // Compute the total drawableContentRect for this subtree (the rect is in ta rgetSurface space) | 691 // Compute the total drawableContentRect for this subtree (the rect is in ta rgetSurface space) |
| 659 IntRect localDrawableContentRectOfSubtree = accumulatedDrawableContentRectOf Children; | 692 IntRect localDrawableContentRectOfSubtree = accumulatedDrawableContentRectOf Children; |
| 660 if (layer->drawsContent()) | 693 if (layer->drawsContent()) |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 697 clippedContentRect.setHeight(std::min(clippedContentRect.height(), maxTe xtureSize)); | 730 clippedContentRect.setHeight(std::min(clippedContentRect.height(), maxTe xtureSize)); |
| 698 | 731 |
| 699 if (clippedContentRect.isEmpty()) | 732 if (clippedContentRect.isEmpty()) |
| 700 renderSurface->clearLayerLists(); | 733 renderSurface->clearLayerLists(); |
| 701 | 734 |
| 702 renderSurface->setContentRect(clippedContentRect); | 735 renderSurface->setContentRect(clippedContentRect); |
| 703 renderSurface->setScreenSpaceTransform(layer->screenSpaceTransform()); | 736 renderSurface->setScreenSpaceTransform(layer->screenSpaceTransform()); |
| 704 | 737 |
| 705 if (layer->replicaLayer()) { | 738 if (layer->replicaLayer()) { |
| 706 WebTransformationMatrix surfaceOriginToReplicaOriginTransform; | 739 WebTransformationMatrix surfaceOriginToReplicaOriginTransform; |
| 707 surfaceOriginToReplicaOriginTransform.scale(deviceScaleFactor); | 740 if (!layer->contentBounds().isEmpty() && !layer->bounds().isEmpty()) { |
| 741 surfaceOriginToReplicaOriginTransform.scaleNonUniform(layer->con tentBounds().width() / static_cast<double>(layer->bounds().width()), | |
| 742 layer->con tentBounds().height() / static_cast<double>(layer->bounds().height())); | |
| 743 } | |
| 744 | |
| 708 surfaceOriginToReplicaOriginTransform.translate(layer->replicaLayer( )->position().x() + layer->replicaLayer()->anchorPoint().x() * bounds.width(), | 745 surfaceOriginToReplicaOriginTransform.translate(layer->replicaLayer( )->position().x() + layer->replicaLayer()->anchorPoint().x() * bounds.width(), |
| 709 layer->replicaLayer( )->position().y() + layer->replicaLayer()->anchorPoint().y() * bounds.height()); | 746 layer->replicaLayer( )->position().y() + layer->replicaLayer()->anchorPoint().y() * bounds.height()); |
| 710 surfaceOriginToReplicaOriginTransform.multiply(layer->replicaLayer() ->transform()); | 747 surfaceOriginToReplicaOriginTransform.multiply(layer->replicaLayer() ->transform()); |
| 711 surfaceOriginToReplicaOriginTransform.translate(-layer->replicaLayer ()->anchorPoint().x() * bounds.width(), -layer->replicaLayer()->anchorPoint().y( ) * bounds.height()); | 748 surfaceOriginToReplicaOriginTransform.translate(-layer->replicaLayer ()->anchorPoint().x() * bounds.width(), -layer->replicaLayer()->anchorPoint().y( ) * bounds.height()); |
| 712 surfaceOriginToReplicaOriginTransform.scale(1 / deviceScaleFactor); | 749 |
| 750 if (!layer->contentBounds().isEmpty() && !layer->bounds().isEmpty()) { | |
| 751 surfaceOriginToReplicaOriginTransform.scaleNonUniform(layer->bou nds().width() / static_cast<double>(layer->contentBounds().width()), | |
| 752 layer->bou nds().height() / static_cast<double>(layer->contentBounds().height())); | |
| 753 } | |
| 713 | 754 |
| 714 // Compute the replica's "originTransform" that maps from the replic a's origin space to the target surface origin space. | 755 // Compute the replica's "originTransform" that maps from the replic a's origin space to the target surface origin space. |
| 715 WebTransformationMatrix replicaOriginTransform = layer->renderSurfac e()->drawTransform() * surfaceOriginToReplicaOriginTransform; | 756 WebTransformationMatrix replicaOriginTransform = layer->renderSurfac e()->drawTransform() * surfaceOriginToReplicaOriginTransform; |
| 716 renderSurface->setReplicaDrawTransform(replicaOriginTransform); | 757 renderSurface->setReplicaDrawTransform(replicaOriginTransform); |
| 717 | 758 |
| 718 // Compute the replica's "screenSpaceTransform" that maps from the r eplica's origin space to the screen's origin space. | 759 // Compute the replica's "screenSpaceTransform" that maps from the r eplica's origin space to the screen's origin space. |
| 719 WebTransformationMatrix replicaScreenSpaceTransform = layer->renderS urface()->screenSpaceTransform() * surfaceOriginToReplicaOriginTransform; | 760 WebTransformationMatrix replicaScreenSpaceTransform = layer->renderS urface()->screenSpaceTransform() * surfaceOriginToReplicaOriginTransform; |
| 720 renderSurface->setReplicaScreenSpaceTransform(replicaScreenSpaceTran sform); | 761 renderSurface->setReplicaScreenSpaceTransform(replicaScreenSpaceTran sform); |
| 721 } | 762 } |
| 722 | 763 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 775 LayerType* replicaMaskLayer = it->replicaLayer() ? it->replicaLayer( )->maskLayer() : 0; | 816 LayerType* replicaMaskLayer = it->replicaLayer() ? it->replicaLayer( )->maskLayer() : 0; |
| 776 if (replicaMaskLayer) | 817 if (replicaMaskLayer) |
| 777 replicaMaskLayer->setVisibleContentRect(IntRect(IntPoint(), it-> contentBounds())); | 818 replicaMaskLayer->setVisibleContentRect(IntRect(IntPoint(), it-> contentBounds())); |
| 778 } else if (it.representsItself()) { | 819 } else if (it.representsItself()) { |
| 779 IntRect visibleContentRect = calculateVisibleContentRect(*it); | 820 IntRect visibleContentRect = calculateVisibleContentRect(*it); |
| 780 it->setVisibleContentRect(visibleContentRect); | 821 it->setVisibleContentRect(visibleContentRect); |
| 781 } | 822 } |
| 782 } | 823 } |
| 783 } | 824 } |
| 784 | 825 |
| 785 void CCLayerTreeHostCommon::calculateDrawTransforms(LayerChromium* rootLayer, co nst IntSize& deviceViewportSize, float deviceScaleFactor, int maxTextureSize, Ve ctor<RefPtr<LayerChromium> >& renderSurfaceLayerList) | 826 void CCLayerTreeHostCommon::calculateDrawTransforms(LayerChromium* rootLayer, co nst IntSize& deviceViewportSize, float deviceScaleFactor, float pageScaleFactor, int maxTextureSize, Vector<RefPtr<LayerChromium> >& renderSurfaceLayerList) |
| 786 { | 827 { |
| 787 IntRect totalDrawableContentRect; | 828 IntRect totalDrawableContentRect; |
| 788 WebTransformationMatrix identityMatrix; | 829 WebTransformationMatrix identityMatrix; |
| 789 WebTransformationMatrix deviceScaleTransform; | 830 WebTransformationMatrix deviceScaleTransform; |
| 790 deviceScaleTransform.scale(deviceScaleFactor); | 831 deviceScaleTransform.scale(deviceScaleFactor); |
| 791 | 832 |
| 792 setupRootLayerAndSurfaceForRecursion<LayerChromium, Vector<RefPtr<LayerChrom ium> > >(rootLayer, renderSurfaceLayerList, deviceViewportSize); | 833 setupRootLayerAndSurfaceForRecursion<LayerChromium, Vector<RefPtr<LayerChrom ium> > >(rootLayer, renderSurfaceLayerList, deviceViewportSize); |
| 793 | 834 |
| 794 cc::calculateDrawTransformsInternal<LayerChromium, Vector<RefPtr<LayerChromi um> >, RenderSurfaceChromium, void>(rootLayer, rootLayer, deviceScaleTransform, identityMatrix, identityMatrix, | 835 cc::calculateDrawTransformsInternal<LayerChromium, Vector<RefPtr<LayerChromi um> >, RenderSurfaceChromium, void>(rootLayer, rootLayer, deviceScaleTransform, identityMatrix, identityMatrix, |
| 795 rootLayer->renderSurface()->contentRect (), true, 0, renderSurfaceLayerList, | 836 rootLayer->renderSurface()->contentRect(), t rue, 0, renderSurfaceLayerList, |
| 796 rootLayer->renderSurface()->layerList() , 0, maxTextureSize, deviceScaleFactor, totalDrawableContentRect); | 837 rootLayer->renderSurface()->layerList(), 0, maxTextureSize, deviceScaleFactor, pageScaleFactor, totalDrawableContentRect); |
| 797 } | 838 } |
| 798 | 839 |
| 799 void CCLayerTreeHostCommon::calculateDrawTransforms(CCLayerImpl* rootLayer, cons t IntSize& deviceViewportSize, float deviceScaleFactor, CCLayerSorter* layerSort er, int maxTextureSize, Vector<CCLayerImpl*>& renderSurfaceLayerList) | 840 void CCLayerTreeHostCommon::calculateDrawTransforms(CCLayerImpl* rootLayer, cons t IntSize& deviceViewportSize, float deviceScaleFactor, float pageScaleFactor, C CLayerSorter* layerSorter, int maxTextureSize, Vector<CCLayerImpl*>& renderSurfa ceLayerList) |
| 800 { | 841 { |
| 801 IntRect totalDrawableContentRect; | 842 IntRect totalDrawableContentRect; |
| 802 WebTransformationMatrix identityMatrix; | 843 WebTransformationMatrix identityMatrix; |
| 803 WebTransformationMatrix deviceScaleTransform; | 844 WebTransformationMatrix deviceScaleTransform; |
| 804 deviceScaleTransform.scale(deviceScaleFactor); | 845 deviceScaleTransform.scale(deviceScaleFactor); |
| 805 | 846 |
| 806 setupRootLayerAndSurfaceForRecursion<CCLayerImpl, Vector<CCLayerImpl*> >(roo tLayer, renderSurfaceLayerList, deviceViewportSize); | 847 setupRootLayerAndSurfaceForRecursion<CCLayerImpl, Vector<CCLayerImpl*> >(roo tLayer, renderSurfaceLayerList, deviceViewportSize); |
| 807 | 848 |
| 808 cc::calculateDrawTransformsInternal<CCLayerImpl, Vector<CCLayerImpl*>, CCRen derSurface, CCLayerSorter>(rootLayer, rootLayer, deviceScaleTransform, identityM atrix, identityMatrix, | 849 cc::calculateDrawTransformsInternal<CCLayerImpl, Vector<CCLayerImpl*>, CCRen derSurface, CCLayerSorter>(rootLayer, rootLayer, deviceScaleTransform, identityM atrix, identityMatrix, |
| 809 rootLayer->renderSurface()->contentRect(), true, 0, renderSurfaceLayerList, | 850 rootLayer->renderSurface()->contentRect(), true, 0, r enderSurfaceLayerList, |
| 810 rootLayer->renderSurface()->layerList(), layerSo rter, maxTextureSize, deviceScaleFactor, totalDrawableContentRect); | 851 rootLayer->renderSurface()->layerList(), layerSorter, maxTextureSize, deviceScaleFactor, pageScaleFactor, totalDrawableContentRect); |
| 811 } | 852 } |
| 812 | 853 |
| 813 void CCLayerTreeHostCommon::calculateVisibleRects(Vector<RefPtr<LayerChromium> > & renderSurfaceLayerList) | 854 void CCLayerTreeHostCommon::calculateVisibleRects(Vector<RefPtr<LayerChromium> > & renderSurfaceLayerList) |
| 814 { | 855 { |
| 815 calculateVisibleRectsInternal<LayerChromium, Vector<RefPtr<LayerChromium> >, RenderSurfaceChromium>(renderSurfaceLayerList); | 856 calculateVisibleRectsInternal<LayerChromium, Vector<RefPtr<LayerChromium> >, RenderSurfaceChromium>(renderSurfaceLayerList); |
| 816 } | 857 } |
| 817 | 858 |
| 818 void CCLayerTreeHostCommon::calculateVisibleRects(Vector<CCLayerImpl*>& renderSu rfaceLayerList) | 859 void CCLayerTreeHostCommon::calculateVisibleRects(Vector<CCLayerImpl*>& renderSu rfaceLayerList) |
| 819 { | 860 { |
| 820 calculateVisibleRectsInternal<CCLayerImpl, Vector<CCLayerImpl*>, CCRenderSur face>(renderSurfaceLayerList); | 861 calculateVisibleRectsInternal<CCLayerImpl, Vector<CCLayerImpl*>, CCRenderSur face>(renderSurfaceLayerList); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 885 | 926 |
| 886 foundLayer = currentLayer; | 927 foundLayer = currentLayer; |
| 887 break; | 928 break; |
| 888 } | 929 } |
| 889 | 930 |
| 890 // This can potentially return 0, which means the viewportPoint did not succ essfully hit test any layers, not even the root layer. | 931 // This can potentially return 0, which means the viewportPoint did not succ essfully hit test any layers, not even the root layer. |
| 891 return foundLayer; | 932 return foundLayer; |
| 892 } | 933 } |
| 893 | 934 |
| 894 } // namespace cc | 935 } // namespace cc |
| OLD | NEW |