Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(102)

Side by Side Diff: cc/layer_tree_host_common.cc

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

Powered by Google App Engine
This is Rietveld 408576698