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/layer.h" | 7 #include "cc/layer.h" |
8 #include "cc/layer_impl.h" | 8 #include "cc/layer_impl.h" |
9 #include "cc/layer_iterator.h" | 9 #include "cc/layer_iterator.h" |
10 #include "cc/layer_sorter.h" | 10 #include "cc/layer_sorter.h" |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
383 replicaMaskLayer->setContentsScale(contentsScale); | 383 replicaMaskLayer->setContentsScale(contentsScale); |
384 } | 384 } |
385 | 385 |
386 // Recursively walks the layer tree starting at the given node and computes all the | 386 // Recursively walks the layer tree starting at the given node and computes all the |
387 // necessary transformations, clipRects, render surfaces, etc. | 387 // necessary transformations, clipRects, render surfaces, etc. |
388 template<typename LayerType, typename LayerList, typename RenderSurfaceType, typ ename LayerSorter> | 388 template<typename LayerType, typename LayerList, typename RenderSurfaceType, typ ename LayerSorter> |
389 static void calculateDrawTransformsInternal(LayerType* layer, const WebTransform ationMatrix& parentMatrix, | 389 static void calculateDrawTransformsInternal(LayerType* layer, const WebTransform ationMatrix& parentMatrix, |
390 const WebTransformationMatrix& fullHierarchyMatrix, const WebTransformationM atrix& currentScrollCompensationMatrix, | 390 const WebTransformationMatrix& fullHierarchyMatrix, const WebTransformationM atrix& currentScrollCompensationMatrix, |
391 const gfx::Rect& clipRectFromAncestor, bool ancestorClipsSubtree, | 391 const gfx::Rect& clipRectFromAncestor, bool ancestorClipsSubtree, |
392 RenderSurfaceType* nearestAncestorThatMovesPixels, LayerList& renderSurfaceL ayerList, LayerList& layerList, | 392 RenderSurfaceType* nearestAncestorThatMovesPixels, LayerList& renderSurfaceL ayerList, LayerList& layerList, |
393 LayerSorter* layerSorter, int maxTextureSize, float deviceScaleFactor, float pageScaleFactor, gfx::Rect& drawableContentRectOfSubtree) | 393 LayerSorter* layerSorter, int maxTextureSize, float deviceScaleFactor, float pageScaleFactor, bool canUseLCDText, |
394 gfx::Rect& drawableContentRectOfSubtree) | |
394 { | 395 { |
395 // This function computes the new matrix transformations recursively for thi s | 396 // This function computes the new matrix transformations recursively for thi s |
396 // layer and all its descendants. It also computes the appropriate render su rfaces. | 397 // layer and all its descendants. It also computes the appropriate render su rfaces. |
397 // Some important points to remember: | 398 // Some important points to remember: |
398 // | 399 // |
399 // 0. Here, transforms are notated in Matrix x Vector order, and in words we describe what | 400 // 0. Here, transforms are notated in Matrix x Vector order, and in words we describe what |
400 // the transform does from left to right. | 401 // the transform does from left to right. |
401 // | 402 // |
402 // 1. In our terminology, the "layer origin" refers to the top-left corner o f a layer, and the | 403 // 1. In our terminology, the "layer origin" refers to the top-left corner o f a layer, and the |
403 // positive Y-axis points downwards. This interpretation is valid because the orthographic | 404 // positive Y-axis points downwards. This interpretation is valid because the orthographic |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
478 drawableContentRectOfSubtree = gfx::Rect(); | 479 drawableContentRectOfSubtree = gfx::Rect(); |
479 | 480 |
480 // The root layer cannot skip calcDrawTransforms. | 481 // The root layer cannot skip calcDrawTransforms. |
481 if (!isRootLayer(layer) && subtreeShouldBeSkipped(layer)) | 482 if (!isRootLayer(layer) && subtreeShouldBeSkipped(layer)) |
482 return; | 483 return; |
483 | 484 |
484 gfx::Rect clipRectForSubtree; | 485 gfx::Rect clipRectForSubtree; |
485 bool subtreeShouldBeClipped = false; | 486 bool subtreeShouldBeClipped = false; |
486 | 487 |
487 float drawOpacity = layer->opacity(); | 488 float drawOpacity = layer->opacity(); |
488 bool drawOpacityIsAnimating = layer->opacityIsAnimating(); | 489 bool animatingOpacityToTarget = layer->opacityIsAnimating(); |
489 if (layer->parent() && layer->parent()->preserves3D()) { | 490 bool animatingOpacityToScreen = animatingOpacityToTarget; |
490 drawOpacity *= layer->parent()->drawOpacity(); | 491 if (layer->parent()) { |
491 drawOpacityIsAnimating |= layer->parent()->drawOpacityIsAnimating(); | 492 if (layer->parent()->preserves3D()) { |
493 drawOpacity *= layer->parent()->drawOpacity(); | |
494 animatingOpacityToTarget |= layer->parent()->drawOpacityIsAnimating( ); | |
495 } | |
496 animatingOpacityToScreen |= layer->parent()->screenSpaceOpacityIsAnimati ng(); | |
492 } | 497 } |
493 | 498 |
494 bool animatingTransformToTarget = layer->transformIsAnimating(); | 499 bool animatingTransformToTarget = layer->transformIsAnimating(); |
495 bool animatingTransformToScreen = animatingTransformToTarget; | 500 bool animatingTransformToScreen = animatingTransformToTarget; |
496 if (layer->parent()) { | 501 if (layer->parent()) { |
497 animatingTransformToTarget |= layer->parent()->drawTransformIsAnimating( ); | 502 animatingTransformToTarget |= layer->parent()->drawTransformIsAnimating( ); |
498 animatingTransformToScreen |= layer->parent()->screenSpaceTransformIsAni mating(); | 503 animatingTransformToScreen |= layer->parent()->screenSpaceTransformIsAni mating(); |
499 } | 504 } |
500 | 505 |
501 gfx::Size bounds = layer->bounds(); | 506 gfx::Size bounds = layer->bounds(); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
537 1.0 / layer->contentsScaleY()); | 542 1.0 / layer->contentsScaleY()); |
538 } | 543 } |
539 | 544 |
540 // layerScreenSpaceTransform represents the transform between root layer's " screen space" and local content space. | 545 // layerScreenSpaceTransform represents the transform between root layer's " screen space" and local content space. |
541 WebTransformationMatrix layerScreenSpaceTransform = fullHierarchyMatrix; | 546 WebTransformationMatrix layerScreenSpaceTransform = fullHierarchyMatrix; |
542 if (!layer->preserves3D()) | 547 if (!layer->preserves3D()) |
543 MathUtil::flattenTransformTo2d(layerScreenSpaceTransform); | 548 MathUtil::flattenTransformTo2d(layerScreenSpaceTransform); |
544 layerScreenSpaceTransform.multiply(drawTransform); | 549 layerScreenSpaceTransform.multiply(drawTransform); |
545 layer->setScreenSpaceTransform(layerScreenSpaceTransform); | 550 layer->setScreenSpaceTransform(layerScreenSpaceTransform); |
546 | 551 |
552 // Adjusting text AA method during animation may cause repaints, which in-tu rn jank. | |
enne (OOO)
2012/11/14 17:42:15
Grammar. "which in turn causes jank." maybe?
alokp
2012/11/16 04:41:11
Done.
| |
553 bool adjustTextAA = !animatingOpacityToScreen && !animatingTransformToScreen ; | |
554 // To avoid color fringing, LCD text should only be used on opaque layers wi th just integral translation. | |
enne (OOO)
2012/11/14 17:42:15
If this is true, where is the check for opaque()?
alokp
2012/11/16 04:41:11
We check for draw-opacity here. Check for content-
enne (OOO)
2012/11/16 17:36:38
Can you point me at where this check is currently
alokp
2012/11/16 21:33:52
http://trac.webkit.org/browser/trunk/Source/WebCor
| |
555 bool layerCanUseLCDText = adjustTextAA && canUseLCDText && (drawOpacity == 1 .0) && drawTransform.isIntegerTranslation(); | |
enne (OOO)
2012/11/14 17:42:15
Can you rename canUseLCDText to something more lik
alokp
2012/11/16 04:41:11
Done.
| |
556 | |
547 gfx::RectF contentRect(gfx::PointF(), layer->contentBounds()); | 557 gfx::RectF contentRect(gfx::PointF(), layer->contentBounds()); |
548 | 558 |
549 // fullHierarchyMatrix is the matrix that transforms objects between screen space (except projection matrix) and the most recent RenderSurfaceImpl's space. | 559 // fullHierarchyMatrix is the matrix that transforms objects between screen space (except projection matrix) and the most recent RenderSurfaceImpl's space. |
550 // nextHierarchyMatrix will only change if this layer uses a new RenderSurfa ceImpl, otherwise remains the same. | 560 // nextHierarchyMatrix will only change if this layer uses a new RenderSurfa ceImpl, otherwise remains the same. |
551 WebTransformationMatrix nextHierarchyMatrix = fullHierarchyMatrix; | 561 WebTransformationMatrix nextHierarchyMatrix = fullHierarchyMatrix; |
552 WebTransformationMatrix sublayerMatrix; | 562 WebTransformationMatrix sublayerMatrix; |
553 | 563 |
554 gfx::Vector2dF renderSurfaceSublayerScale = MathUtil::computeTransform2dScal eComponents(combinedTransform); | 564 gfx::Vector2dF renderSurfaceSublayerScale = MathUtil::computeTransform2dScal eComponents(combinedTransform); |
555 | 565 |
556 if (subtreeShouldRenderToSeparateSurface(layer, isScaleOrTranslation(combine dTransform))) { | 566 if (subtreeShouldRenderToSeparateSurface(layer, isScaleOrTranslation(combine dTransform))) { |
(...skipping 22 matching lines...) Expand all Loading... | |
579 layer->setDrawTransform(layerDrawTransform); | 589 layer->setDrawTransform(layerDrawTransform); |
580 | 590 |
581 // Inside the surface's subtree, we scale everything to the owning layer 's scale. | 591 // Inside the surface's subtree, we scale everything to the owning layer 's scale. |
582 // The sublayer matrix transforms centered layer rects into target | 592 // The sublayer matrix transforms centered layer rects into target |
583 // surface content space. | 593 // surface content space. |
584 sublayerMatrix.makeIdentity(); | 594 sublayerMatrix.makeIdentity(); |
585 sublayerMatrix.scaleNonUniform(renderSurfaceSublayerScale.x(), renderSur faceSublayerScale.y()); | 595 sublayerMatrix.scaleNonUniform(renderSurfaceSublayerScale.x(), renderSur faceSublayerScale.y()); |
586 | 596 |
587 // The opacity value is moved from the layer to its surface, so that the entire subtree properly inherits opacity. | 597 // The opacity value is moved from the layer to its surface, so that the entire subtree properly inherits opacity. |
588 renderSurface->setDrawOpacity(drawOpacity); | 598 renderSurface->setDrawOpacity(drawOpacity); |
589 renderSurface->setDrawOpacityIsAnimating(drawOpacityIsAnimating); | 599 renderSurface->setDrawOpacityIsAnimating(animatingOpacityToTarget); |
600 animatingOpacityToTarget = false; | |
590 layer->setDrawOpacity(1); | 601 layer->setDrawOpacity(1); |
591 layer->setDrawOpacityIsAnimating(false); | 602 layer->setDrawOpacityIsAnimating(animatingOpacityToTarget); |
603 layer->setScreenSpaceOpacityIsAnimating(animatingOpacityToScreen); | |
592 | 604 |
593 renderSurface->setTargetSurfaceTransformsAreAnimating(animatingTransform ToTarget); | 605 renderSurface->setTargetSurfaceTransformsAreAnimating(animatingTransform ToTarget); |
594 renderSurface->setScreenSpaceTransformsAreAnimating(animatingTransformTo Screen); | 606 renderSurface->setScreenSpaceTransformsAreAnimating(animatingTransformTo Screen); |
595 animatingTransformToTarget = false; | 607 animatingTransformToTarget = false; |
596 layer->setDrawTransformIsAnimating(animatingTransformToTarget); | 608 layer->setDrawTransformIsAnimating(animatingTransformToTarget); |
597 layer->setScreenSpaceTransformIsAnimating(animatingTransformToScreen); | 609 layer->setScreenSpaceTransformIsAnimating(animatingTransformToScreen); |
598 | 610 |
599 // Update the aggregate hierarchy matrix to include the transform of the | 611 // Update the aggregate hierarchy matrix to include the transform of the |
600 // newly created RenderSurfaceImpl. | 612 // newly created RenderSurfaceImpl. |
601 nextHierarchyMatrix.multiply(renderSurface->drawTransform()); | 613 nextHierarchyMatrix.multiply(renderSurface->drawTransform()); |
(...skipping 20 matching lines...) Expand all Loading... | |
622 nearestAncestorThatMovesPixels = renderSurface; | 634 nearestAncestorThatMovesPixels = renderSurface; |
623 | 635 |
624 // The render surface clipRect is expressed in the space where this surf ace draws, i.e. the same space as clipRectFromAncestor. | 636 // The render surface clipRect is expressed in the space where this surf ace draws, i.e. the same space as clipRectFromAncestor. |
625 if (ancestorClipsSubtree) | 637 if (ancestorClipsSubtree) |
626 renderSurface->setClipRect(clipRectFromAncestor); | 638 renderSurface->setClipRect(clipRectFromAncestor); |
627 else | 639 else |
628 renderSurface->setClipRect(gfx::Rect()); | 640 renderSurface->setClipRect(gfx::Rect()); |
629 | 641 |
630 renderSurface->setNearestAncestorThatMovesPixels(nearestAncestorThatMove sPixels); | 642 renderSurface->setNearestAncestorThatMovesPixels(nearestAncestorThatMove sPixels); |
631 | 643 |
644 // If the new render surface is drawn translucent or with a non-integral translation | |
645 // then the subtree that gets drawn on this render surface cannot use LC D text. | |
646 canUseLCDText = layerCanUseLCDText; | |
647 | |
632 renderSurfaceLayerList.push_back(layer); | 648 renderSurfaceLayerList.push_back(layer); |
633 } else { | 649 } else { |
634 DCHECK(layer->parent()); | 650 DCHECK(layer->parent()); |
635 | 651 |
636 layer->setDrawTransform(drawTransform); | 652 layer->setDrawTransform(drawTransform); |
637 layer->setDrawTransformIsAnimating(animatingTransformToTarget); | 653 layer->setDrawTransformIsAnimating(animatingTransformToTarget); |
638 layer->setScreenSpaceTransformIsAnimating(animatingTransformToScreen); | 654 layer->setScreenSpaceTransformIsAnimating(animatingTransformToScreen); |
639 sublayerMatrix = combinedTransform; | 655 sublayerMatrix = combinedTransform; |
640 | 656 |
641 layer->setDrawOpacity(drawOpacity); | 657 layer->setDrawOpacity(drawOpacity); |
642 layer->setDrawOpacityIsAnimating(drawOpacityIsAnimating); | 658 layer->setDrawOpacityIsAnimating(animatingOpacityToTarget); |
659 layer->setScreenSpaceOpacityIsAnimating(animatingOpacityToScreen); | |
643 | 660 |
644 layer->clearRenderSurface(); | 661 layer->clearRenderSurface(); |
645 | 662 |
646 // Layers without renderSurfaces directly inherit the ancestor's clip st atus. | 663 // Layers without renderSurfaces directly inherit the ancestor's clip st atus. |
647 subtreeShouldBeClipped = ancestorClipsSubtree; | 664 subtreeShouldBeClipped = ancestorClipsSubtree; |
648 if (ancestorClipsSubtree) | 665 if (ancestorClipsSubtree) |
649 clipRectForSubtree = clipRectFromAncestor; | 666 clipRectForSubtree = clipRectFromAncestor; |
650 | 667 |
651 // Layers that are not their own renderTarget will render into the targe t of their nearest ancestor. | 668 // Layers that are not their own renderTarget will render into the targe t of their nearest ancestor. |
652 layer->setRenderTarget(layer->parent()->renderTarget()); | 669 layer->setRenderTarget(layer->parent()->renderTarget()); |
653 } | 670 } |
654 | 671 |
672 if (adjustTextAA) | |
673 layer->setCanUseLCDText(layerCanUseLCDText); | |
674 | |
655 gfx::Rect rectInTargetSpace = ToEnclosingRect(MathUtil::mapClippedRect(layer ->drawTransform(), contentRect)); | 675 gfx::Rect rectInTargetSpace = ToEnclosingRect(MathUtil::mapClippedRect(layer ->drawTransform(), contentRect)); |
656 | 676 |
657 if (layerClipsSubtree(layer)) { | 677 if (layerClipsSubtree(layer)) { |
658 subtreeShouldBeClipped = true; | 678 subtreeShouldBeClipped = true; |
659 if (ancestorClipsSubtree && !layer->renderSurface()) { | 679 if (ancestorClipsSubtree && !layer->renderSurface()) { |
660 clipRectForSubtree = clipRectFromAncestor; | 680 clipRectForSubtree = clipRectFromAncestor; |
661 clipRectForSubtree.Intersect(rectInTargetSpace); | 681 clipRectForSubtree.Intersect(rectInTargetSpace); |
662 } else | 682 } else |
663 clipRectForSubtree = rectInTargetSpace; | 683 clipRectForSubtree = rectInTargetSpace; |
664 } | 684 } |
(...skipping 16 matching lines...) Expand all Loading... | |
681 descendants.push_back(layer); | 701 descendants.push_back(layer); |
682 | 702 |
683 WebTransformationMatrix nextScrollCompensationMatrix = computeScrollCompensa tionMatrixForChildren(layer, parentMatrix, currentScrollCompensationMatrix);; | 703 WebTransformationMatrix nextScrollCompensationMatrix = computeScrollCompensa tionMatrixForChildren(layer, parentMatrix, currentScrollCompensationMatrix);; |
684 | 704 |
685 gfx::Rect accumulatedDrawableContentRectOfChildren; | 705 gfx::Rect accumulatedDrawableContentRectOfChildren; |
686 for (size_t i = 0; i < layer->children().size(); ++i) { | 706 for (size_t i = 0; i < layer->children().size(); ++i) { |
687 LayerType* child = LayerTreeHostCommon::getChildAsRawPtr(layer->children (), i); | 707 LayerType* child = LayerTreeHostCommon::getChildAsRawPtr(layer->children (), i); |
688 gfx::Rect drawableContentRectOfChildSubtree; | 708 gfx::Rect drawableContentRectOfChildSubtree; |
689 calculateDrawTransformsInternal<LayerType, LayerList, RenderSurfaceType, LayerSorter>(child, sublayerMatrix, nextHierarchyMatrix, nextScrollCompensation Matrix, | 709 calculateDrawTransformsInternal<LayerType, LayerList, RenderSurfaceType, LayerSorter>(child, sublayerMatrix, nextHierarchyMatrix, nextScrollCompensation Matrix, |
690 clipRectForSubtree, subtreeShouldBeClipped, nearestAncestorThatMov esPixels, | 710 clipRectForSubtree, subtreeShouldBeClipped, nearestAncestorThatMov esPixels, |
691 renderSurfaceLayerList, descendants, layerSorter, maxTextureSize, deviceScaleFactor, pageScaleFactor, drawableContentRectOfChildSubtree); | 711 renderSurfaceLayerList, descendants, layerSorter, maxTextureSize, deviceScaleFactor, pageScaleFactor, canUseLCDText, |
712 drawableContentRectOfChildSubtree); | |
692 if (!drawableContentRectOfChildSubtree.IsEmpty()) { | 713 if (!drawableContentRectOfChildSubtree.IsEmpty()) { |
693 accumulatedDrawableContentRectOfChildren.Union(drawableContentRectOf ChildSubtree); | 714 accumulatedDrawableContentRectOfChildren.Union(drawableContentRectOf ChildSubtree); |
694 if (child->renderSurface()) | 715 if (child->renderSurface()) |
695 descendants.push_back(child); | 716 descendants.push_back(child); |
696 } | 717 } |
697 } | 718 } |
698 | 719 |
699 // Compute the total drawableContentRect for this subtree (the rect is in ta rgetSurface space) | 720 // Compute the total drawableContentRect for this subtree (the rect is in ta rgetSurface space) |
700 gfx::Rect localDrawableContentRectOfSubtree = accumulatedDrawableContentRect OfChildren; | 721 gfx::Rect localDrawableContentRectOfSubtree = accumulatedDrawableContentRect OfChildren; |
701 if (layer->drawsContent()) | 722 if (layer->drawsContent()) |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
800 | 821 |
801 if (layer->renderSurface()) | 822 if (layer->renderSurface()) |
802 drawableContentRectOfSubtree = gfx::ToEnclosingRect(layer->renderSurface ()->drawableContentRect()); | 823 drawableContentRectOfSubtree = gfx::ToEnclosingRect(layer->renderSurface ()->drawableContentRect()); |
803 else | 824 else |
804 drawableContentRectOfSubtree = localDrawableContentRectOfSubtree; | 825 drawableContentRectOfSubtree = localDrawableContentRectOfSubtree; |
805 | 826 |
806 if (layer->hasContributingDelegatedRenderPasses()) | 827 if (layer->hasContributingDelegatedRenderPasses()) |
807 layer->renderTarget()->renderSurface()->addContributingDelegatedRenderPa ssLayer(layer); | 828 layer->renderTarget()->renderSurface()->addContributingDelegatedRenderPa ssLayer(layer); |
808 } | 829 } |
809 | 830 |
810 void LayerTreeHostCommon::calculateDrawTransforms(Layer* rootLayer, const gfx::S ize& deviceViewportSize, float deviceScaleFactor, float pageScaleFactor, int max TextureSize, std::vector<scoped_refptr<Layer> >& renderSurfaceLayerList) | 831 void LayerTreeHostCommon::calculateDrawTransforms(Layer* rootLayer, const gfx::S ize& deviceViewportSize, float deviceScaleFactor, float pageScaleFactor, int max TextureSize, bool canUseLCDText, std::vector<scoped_refptr<Layer> >& renderSurfa ceLayerList) |
811 { | 832 { |
812 gfx::Rect totalDrawableContentRect; | 833 gfx::Rect totalDrawableContentRect; |
813 WebTransformationMatrix identityMatrix; | 834 WebTransformationMatrix identityMatrix; |
814 WebTransformationMatrix deviceScaleTransform; | 835 WebTransformationMatrix deviceScaleTransform; |
815 deviceScaleTransform.scale(deviceScaleFactor); | 836 deviceScaleTransform.scale(deviceScaleFactor); |
816 std::vector<scoped_refptr<Layer> > dummyLayerList; | 837 std::vector<scoped_refptr<Layer> > dummyLayerList; |
817 | 838 |
818 // The root layer's renderSurface should receive the deviceViewport as the i nitial clipRect. | 839 // The root layer's renderSurface should receive the deviceViewport as the i nitial clipRect. |
819 bool subtreeShouldBeClipped = true; | 840 bool subtreeShouldBeClipped = true; |
820 gfx::Rect deviceViewportRect(gfx::Point(), deviceViewportSize); | 841 gfx::Rect deviceViewportRect(gfx::Point(), deviceViewportSize); |
821 | 842 |
822 // This function should have received a root layer. | 843 // This function should have received a root layer. |
823 DCHECK(isRootLayer(rootLayer)); | 844 DCHECK(isRootLayer(rootLayer)); |
824 | 845 |
825 cc::calculateDrawTransformsInternal<Layer, std::vector<scoped_refptr<Layer> >, RenderSurface, void>( | 846 cc::calculateDrawTransformsInternal<Layer, std::vector<scoped_refptr<Layer> >, RenderSurface, void>( |
826 rootLayer, deviceScaleTransform, identityMatrix, identityMatrix, | 847 rootLayer, deviceScaleTransform, identityMatrix, identityMatrix, |
827 deviceViewportRect, subtreeShouldBeClipped, 0, renderSurfaceLayerList, | 848 deviceViewportRect, subtreeShouldBeClipped, 0, renderSurfaceLayerList, |
828 dummyLayerList, 0, maxTextureSize, | 849 dummyLayerList, 0, maxTextureSize, |
829 deviceScaleFactor, pageScaleFactor, totalDrawableContentRect); | 850 deviceScaleFactor, pageScaleFactor, canUseLCDText, totalDrawableContentR ect); |
830 | 851 |
831 // The dummy layer list should not have been used. | 852 // The dummy layer list should not have been used. |
832 DCHECK(dummyLayerList.size() == 0); | 853 DCHECK(dummyLayerList.size() == 0); |
833 // A root layer renderSurface should always exist after calculateDrawTransfo rms. | 854 // A root layer renderSurface should always exist after calculateDrawTransfo rms. |
834 DCHECK(rootLayer->renderSurface()); | 855 DCHECK(rootLayer->renderSurface()); |
835 } | 856 } |
836 | 857 |
837 void LayerTreeHostCommon::calculateDrawTransforms(LayerImpl* rootLayer, const gf x::Size& deviceViewportSize, float deviceScaleFactor, float pageScaleFactor, Lay erSorter* layerSorter, int maxTextureSize, std::vector<LayerImpl*>& renderSurfac eLayerList) | 858 void LayerTreeHostCommon::calculateDrawTransforms(LayerImpl* rootLayer, const gf x::Size& deviceViewportSize, float deviceScaleFactor, float pageScaleFactor, Lay erSorter* layerSorter, int maxTextureSize, bool canUseLCDText, std::vector<Layer Impl*>& renderSurfaceLayerList) |
838 { | 859 { |
839 gfx::Rect totalDrawableContentRect; | 860 gfx::Rect totalDrawableContentRect; |
840 WebTransformationMatrix identityMatrix; | 861 WebTransformationMatrix identityMatrix; |
841 WebTransformationMatrix deviceScaleTransform; | 862 WebTransformationMatrix deviceScaleTransform; |
842 deviceScaleTransform.scale(deviceScaleFactor); | 863 deviceScaleTransform.scale(deviceScaleFactor); |
843 std::vector<LayerImpl*> dummyLayerList; | 864 std::vector<LayerImpl*> dummyLayerList; |
844 | 865 |
845 // The root layer's renderSurface should receive the deviceViewport as the i nitial clipRect. | 866 // The root layer's renderSurface should receive the deviceViewport as the i nitial clipRect. |
846 bool subtreeShouldBeClipped = true; | 867 bool subtreeShouldBeClipped = true; |
847 gfx::Rect deviceViewportRect(gfx::Point(), deviceViewportSize); | 868 gfx::Rect deviceViewportRect(gfx::Point(), deviceViewportSize); |
848 | 869 |
849 // This function should have received a root layer. | 870 // This function should have received a root layer. |
850 DCHECK(isRootLayer(rootLayer)); | 871 DCHECK(isRootLayer(rootLayer)); |
851 | 872 |
852 cc::calculateDrawTransformsInternal<LayerImpl, std::vector<LayerImpl*>, Rend erSurfaceImpl, LayerSorter>( | 873 cc::calculateDrawTransformsInternal<LayerImpl, std::vector<LayerImpl*>, Rend erSurfaceImpl, LayerSorter>( |
853 rootLayer, deviceScaleTransform, identityMatrix, identityMatrix, | 874 rootLayer, deviceScaleTransform, identityMatrix, identityMatrix, |
854 deviceViewportRect, subtreeShouldBeClipped, 0, renderSurfaceLayerList, | 875 deviceViewportRect, subtreeShouldBeClipped, 0, renderSurfaceLayerList, |
855 dummyLayerList, layerSorter, maxTextureSize, | 876 dummyLayerList, layerSorter, maxTextureSize, |
856 deviceScaleFactor, pageScaleFactor, totalDrawableContentRect); | 877 deviceScaleFactor, pageScaleFactor, canUseLCDText, totalDrawableContentR ect); |
857 | 878 |
858 // The dummy layer list should not have been used. | 879 // The dummy layer list should not have been used. |
859 DCHECK(dummyLayerList.size() == 0); | 880 DCHECK(dummyLayerList.size() == 0); |
860 // A root layer renderSurface should always exist after calculateDrawTransfo rms. | 881 // A root layer renderSurface should always exist after calculateDrawTransfo rms. |
861 DCHECK(rootLayer->renderSurface()); | 882 DCHECK(rootLayer->renderSurface()); |
862 } | 883 } |
863 | 884 |
864 static bool pointHitsRect(const gfx::PointF& screenSpacePoint, const WebTransfor mationMatrix& localSpaceToScreenSpaceTransform, gfx::RectF localSpaceRect) | 885 static bool pointHitsRect(const gfx::PointF& screenSpacePoint, const WebTransfor mationMatrix& localSpaceToScreenSpaceTransform, gfx::RectF localSpaceRect) |
865 { | 886 { |
866 // If the transform is not invertible, then assume that this point doesn't h it this rect. | 887 // If the transform is not invertible, then assume that this point doesn't h it this rect. |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
926 | 947 |
927 foundLayer = currentLayer; | 948 foundLayer = currentLayer; |
928 break; | 949 break; |
929 } | 950 } |
930 | 951 |
931 // This can potentially return 0, which means the screenSpacePoint did not s uccessfully hit test any layers, not even the root layer. | 952 // This can potentially return 0, which means the screenSpacePoint did not s uccessfully hit test any layers, not even the root layer. |
932 return foundLayer; | 953 return foundLayer; |
933 } | 954 } |
934 | 955 |
935 } // namespace cc | 956 } // namespace cc |
OLD | NEW |