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

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 build Created 8 years 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 "cc/layer_tree_host_common.h" 5 #include "cc/layer_tree_host_common.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "cc/layer.h" 10 #include "cc/layer.h"
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 replicaMaskLayer->setContentsScale(contentsScale); 401 replicaMaskLayer->setContentsScale(contentsScale);
402 } 402 }
403 403
404 // Recursively walks the layer tree starting at the given node and computes all the 404 // Recursively walks the layer tree starting at the given node and computes all the
405 // necessary transformations, clipRects, render surfaces, etc. 405 // necessary transformations, clipRects, render surfaces, etc.
406 template<typename LayerType, typename LayerList, typename RenderSurfaceType> 406 template<typename LayerType, typename LayerList, typename RenderSurfaceType>
407 static void calculateDrawPropertiesInternal(LayerType* layer, const gfx::Transfo rm& parentMatrix, 407 static void calculateDrawPropertiesInternal(LayerType* layer, const gfx::Transfo rm& parentMatrix,
408 const gfx::Transform& fullHierarchyMatrix, const gfx::Transform& currentScro llCompensationMatrix, 408 const gfx::Transform& fullHierarchyMatrix, const gfx::Transform& currentScro llCompensationMatrix,
409 const gfx::Rect& clipRectFromAncestor, bool ancestorClipsSubtree, 409 const gfx::Rect& clipRectFromAncestor, bool ancestorClipsSubtree,
410 RenderSurfaceType* nearestAncestorThatMovesPixels, LayerList& renderSurfaceL ayerList, LayerList& layerList, 410 RenderSurfaceType* nearestAncestorThatMovesPixels, LayerList& renderSurfaceL ayerList, LayerList& layerList,
411 LayerSorter* layerSorter, int maxTextureSize, float deviceScaleFactor, float pageScaleFactor, gfx::Rect& drawableContentRectOfSubtree) 411 LayerSorter* layerSorter, int maxTextureSize, float deviceScaleFactor, float pageScaleFactor, bool subtreeCanUseLCDText,
412 gfx::Rect& drawableContentRectOfSubtree)
412 { 413 {
413 // This function computes the new matrix transformations recursively for thi s 414 // This function computes the new matrix transformations recursively for thi s
414 // layer and all its descendants. It also computes the appropriate render su rfaces. 415 // layer and all its descendants. It also computes the appropriate render su rfaces.
415 // Some important points to remember: 416 // Some important points to remember:
416 // 417 //
417 // 0. Here, transforms are notated in Matrix x Vector order, and in words we describe what 418 // 0. Here, transforms are notated in Matrix x Vector order, and in words we describe what
418 // the transform does from left to right. 419 // the transform does from left to right.
419 // 420 //
420 // 1. In our terminology, the "layer origin" refers to the top-left corner o f a layer, and the 421 // 1. In our terminology, the "layer origin" refers to the top-left corner o f a layer, and the
421 // positive Y-axis points downwards. This interpretation is valid because the orthographic 422 // positive Y-axis points downwards. This interpretation is valid because the orthographic
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 // As this function proceeds, these are the properties for the current 503 // As this function proceeds, these are the properties for the current
503 // layer that actually get computed. To avoid unnecessary copies 504 // layer that actually get computed. To avoid unnecessary copies
504 // (particularly for matrices), we do computations directly on these values 505 // (particularly for matrices), we do computations directly on these values
505 // when possible. 506 // when possible.
506 DrawProperties<LayerType, RenderSurfaceType>& layerDrawProperties = layer->d rawProperties(); 507 DrawProperties<LayerType, RenderSurfaceType>& layerDrawProperties = layer->d rawProperties();
507 508
508 gfx::Rect clipRectForSubtree; 509 gfx::Rect clipRectForSubtree;
509 bool subtreeShouldBeClipped = false; 510 bool subtreeShouldBeClipped = false;
510 511
511 float accumulatedDrawOpacity = layer->opacity(); 512 float accumulatedDrawOpacity = layer->opacity();
512 bool drawOpacityIsAnimating = layer->opacityIsAnimating(); 513 bool animatingOpacityToTarget = layer->opacityIsAnimating();
514 bool animatingOpacityToScreen = animatingOpacityToTarget;
513 if (layer->parent()) { 515 if (layer->parent()) {
514 accumulatedDrawOpacity *= layer->parent()->drawOpacity(); 516 accumulatedDrawOpacity *= layer->parent()->drawOpacity();
515 drawOpacityIsAnimating |= layer->parent()->drawOpacityIsAnimating(); 517 animatingOpacityToTarget |= layer->parent()->drawOpacityIsAnimating();
518 animatingOpacityToScreen |= layer->parent()->screenSpaceOpacityIsAnimati ng();
516 } 519 }
517 520
518 bool animatingTransformToTarget = layer->transformIsAnimating(); 521 bool animatingTransformToTarget = layer->transformIsAnimating();
519 bool animatingTransformToScreen = animatingTransformToTarget; 522 bool animatingTransformToScreen = animatingTransformToTarget;
520 if (layer->parent()) { 523 if (layer->parent()) {
521 animatingTransformToTarget |= layer->parent()->drawTransformIsAnimating( ); 524 animatingTransformToTarget |= layer->parent()->drawTransformIsAnimating( );
522 animatingTransformToScreen |= layer->parent()->screenSpaceTransformIsAni mating(); 525 animatingTransformToScreen |= layer->parent()->screenSpaceTransformIsAni mating();
523 } 526 }
524 527
525 gfx::Size bounds = layer->bounds(); 528 gfx::Size bounds = layer->bounds();
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 layerDrawProperties.target_space_transform = combinedTransform; 560 layerDrawProperties.target_space_transform = combinedTransform;
558 // M[draw] = M[parent] * LT * S[layer2content] 561 // M[draw] = M[parent] * LT * S[layer2content]
559 layerDrawProperties.target_space_transform.Scale(1.0 / layer->contentsScaleX (), 1.0 / layer->contentsScaleY()); 562 layerDrawProperties.target_space_transform.Scale(1.0 / layer->contentsScaleX (), 1.0 / layer->contentsScaleY());
560 563
561 // layerScreenSpaceTransform represents the transform between root layer's " screen space" and local content space. 564 // layerScreenSpaceTransform represents the transform between root layer's " screen space" and local content space.
562 layerDrawProperties.screen_space_transform = fullHierarchyMatrix; 565 layerDrawProperties.screen_space_transform = fullHierarchyMatrix;
563 if (!layer->preserves3D()) 566 if (!layer->preserves3D())
564 MathUtil::flattenTransformTo2d(layerDrawProperties.screen_space_transfor m); 567 MathUtil::flattenTransformTo2d(layerDrawProperties.screen_space_transfor m);
565 layerDrawProperties.screen_space_transform.PreconcatTransform(layerDrawPrope rties.target_space_transform); 568 layerDrawProperties.screen_space_transform.PreconcatTransform(layerDrawPrope rties.target_space_transform);
566 569
570 // Adjusting text AA method during animation may cause repaints, which in-tu rn causes jank.
571 bool adjustTextAA = !animatingOpacityToScreen && !animatingTransformToScreen ;
572 // To avoid color fringing, LCD text should only be used on opaque layers wi th just integral translation.
573 bool layerCanUseLCDText = subtreeCanUseLCDText &&
574 (accumulatedDrawOpacity == 1.0) &&
575 layerDrawProperties.target_space_transform.IsIdent ityOrIntegerTranslation();
576
567 gfx::RectF contentRect(gfx::PointF(), layer->contentBounds()); 577 gfx::RectF contentRect(gfx::PointF(), layer->contentBounds());
568 578
569 // fullHierarchyMatrix is the matrix that transforms objects between screen space (except projection matrix) and the most recent RenderSurfaceImpl's space. 579 // fullHierarchyMatrix is the matrix that transforms objects between screen space (except projection matrix) and the most recent RenderSurfaceImpl's space.
570 // nextHierarchyMatrix will only change if this layer uses a new RenderSurfa ceImpl, otherwise remains the same. 580 // nextHierarchyMatrix will only change if this layer uses a new RenderSurfa ceImpl, otherwise remains the same.
571 gfx::Transform nextHierarchyMatrix = fullHierarchyMatrix; 581 gfx::Transform nextHierarchyMatrix = fullHierarchyMatrix;
572 gfx::Transform sublayerMatrix; 582 gfx::Transform sublayerMatrix;
573 583
574 gfx::Vector2dF renderSurfaceSublayerScale = MathUtil::computeTransform2dScal eComponents(combinedTransform); 584 gfx::Vector2dF renderSurfaceSublayerScale = MathUtil::computeTransform2dScal eComponents(combinedTransform);
575 585
576 if (subtreeShouldRenderToSeparateSurface(layer, combinedTransform.IsScaleOrT ranslation())) { 586 if (subtreeShouldRenderToSeparateSurface(layer, combinedTransform.IsScaleOrT ranslation())) {
(...skipping 20 matching lines...) Expand all
597 layerDrawProperties.target_space_transform.Scale(renderSurfaceSublayerSc ale.x() / layer->contentsScaleX(), renderSurfaceSublayerScale.y() / layer->conte ntsScaleY()); 607 layerDrawProperties.target_space_transform.Scale(renderSurfaceSublayerSc ale.x() / layer->contentsScaleX(), renderSurfaceSublayerScale.y() / layer->conte ntsScaleY());
598 608
599 // Inside the surface's subtree, we scale everything to the owning layer 's scale. 609 // Inside the surface's subtree, we scale everything to the owning layer 's scale.
600 // The sublayer matrix transforms centered layer rects into target 610 // The sublayer matrix transforms centered layer rects into target
601 // surface content space. 611 // surface content space.
602 DCHECK(sublayerMatrix.IsIdentity()); 612 DCHECK(sublayerMatrix.IsIdentity());
603 sublayerMatrix.Scale(renderSurfaceSublayerScale.x(), renderSurfaceSublay erScale.y()); 613 sublayerMatrix.Scale(renderSurfaceSublayerScale.x(), renderSurfaceSublay erScale.y());
604 614
605 // The opacity value is moved from the layer to its surface, so that the entire subtree properly inherits opacity. 615 // The opacity value is moved from the layer to its surface, so that the entire subtree properly inherits opacity.
606 renderSurface->setDrawOpacity(accumulatedDrawOpacity); 616 renderSurface->setDrawOpacity(accumulatedDrawOpacity);
607 renderSurface->setDrawOpacityIsAnimating(drawOpacityIsAnimating); 617 renderSurface->setDrawOpacityIsAnimating(animatingOpacityToTarget);
618 animatingOpacityToTarget = false;
608 layerDrawProperties.opacity = 1; 619 layerDrawProperties.opacity = 1;
609 layerDrawProperties.opacity_is_animating = false; 620 layerDrawProperties.opacity_is_animating = animatingOpacityToTarget;
621 layerDrawProperties.screen_space_opacity_is_animating = animatingOpacity ToScreen;
610 622
611 renderSurface->setTargetSurfaceTransformsAreAnimating(animatingTransform ToTarget); 623 renderSurface->setTargetSurfaceTransformsAreAnimating(animatingTransform ToTarget);
612 renderSurface->setScreenSpaceTransformsAreAnimating(animatingTransformTo Screen); 624 renderSurface->setScreenSpaceTransformsAreAnimating(animatingTransformTo Screen);
613 animatingTransformToTarget = false; 625 animatingTransformToTarget = false;
614 layerDrawProperties.target_space_transform_is_animating = animatingTrans formToTarget; 626 layerDrawProperties.target_space_transform_is_animating = animatingTrans formToTarget;
615 layerDrawProperties.screen_space_transform_is_animating = animatingTrans formToScreen; 627 layerDrawProperties.screen_space_transform_is_animating = animatingTrans formToScreen;
616 628
617 // Update the aggregate hierarchy matrix to include the transform of the 629 // Update the aggregate hierarchy matrix to include the transform of the
618 // newly created RenderSurfaceImpl. 630 // newly created RenderSurfaceImpl.
619 nextHierarchyMatrix.PreconcatTransform(renderSurface->drawTransform()); 631 nextHierarchyMatrix.PreconcatTransform(renderSurface->drawTransform());
(...skipping 23 matching lines...) Expand all
643 655
644 // The render surface clipRect is expressed in the space where this surf ace draws, i.e. the same space as clipRectFromAncestor. 656 // The render surface clipRect is expressed in the space where this surf ace draws, i.e. the same space as clipRectFromAncestor.
645 renderSurface->setIsClipped(ancestorClipsSubtree); 657 renderSurface->setIsClipped(ancestorClipsSubtree);
646 if (ancestorClipsSubtree) 658 if (ancestorClipsSubtree)
647 renderSurface->setClipRect(clipRectFromAncestor); 659 renderSurface->setClipRect(clipRectFromAncestor);
648 else 660 else
649 renderSurface->setClipRect(gfx::Rect()); 661 renderSurface->setClipRect(gfx::Rect());
650 662
651 renderSurface->setNearestAncestorThatMovesPixels(nearestAncestorThatMove sPixels); 663 renderSurface->setNearestAncestorThatMovesPixels(nearestAncestorThatMove sPixels);
652 664
665 // If the new render surface is drawn translucent or with a non-integral translation
666 // then the subtree that gets drawn on this render surface cannot use LC D text.
667 subtreeCanUseLCDText = layerCanUseLCDText;
668
653 renderSurfaceLayerList.push_back(layer); 669 renderSurfaceLayerList.push_back(layer);
654 } else { 670 } else {
655 DCHECK(layer->parent()); 671 DCHECK(layer->parent());
656 672
657 // Note: layerDrawProperties.target_space_transform is computed above, 673 // Note: layerDrawProperties.target_space_transform is computed above,
658 // before this if-else statement. 674 // before this if-else statement.
659 layerDrawProperties.target_space_transform_is_animating = animatingTrans formToTarget; 675 layerDrawProperties.target_space_transform_is_animating = animatingTrans formToTarget;
660 layerDrawProperties.screen_space_transform_is_animating = animatingTrans formToScreen; 676 layerDrawProperties.screen_space_transform_is_animating = animatingTrans formToScreen;
661 layerDrawProperties.opacity = accumulatedDrawOpacity; 677 layerDrawProperties.opacity = accumulatedDrawOpacity;
662 layerDrawProperties.opacity_is_animating = drawOpacityIsAnimating; 678 layerDrawProperties.opacity_is_animating = animatingOpacityToTarget;
679 layerDrawProperties.screen_space_opacity_is_animating = animatingOpacity ToScreen;
663 sublayerMatrix = combinedTransform; 680 sublayerMatrix = combinedTransform;
664 681
665 layer->clearRenderSurface(); 682 layer->clearRenderSurface();
666 683
667 // Layers without renderSurfaces directly inherit the ancestor's clip st atus. 684 // Layers without renderSurfaces directly inherit the ancestor's clip st atus.
668 subtreeShouldBeClipped = ancestorClipsSubtree; 685 subtreeShouldBeClipped = ancestorClipsSubtree;
669 if (ancestorClipsSubtree) 686 if (ancestorClipsSubtree)
670 clipRectForSubtree = clipRectFromAncestor; 687 clipRectForSubtree = clipRectFromAncestor;
671 688
672 // Layers that are not their own renderTarget will render into the targe t of their nearest ancestor. 689 // Layers that are not their own renderTarget will render into the targe t of their nearest ancestor.
673 layerDrawProperties.render_target = layer->parent()->renderTarget(); 690 layerDrawProperties.render_target = layer->parent()->renderTarget();
674 } 691 }
675 692
693 if (adjustTextAA)
694 layer->setCanUseLCDText(layerCanUseLCDText);
695
676 gfx::Rect rectInTargetSpace = ToEnclosingRect(MathUtil::mapClippedRect(layer ->drawTransform(), contentRect)); 696 gfx::Rect rectInTargetSpace = ToEnclosingRect(MathUtil::mapClippedRect(layer ->drawTransform(), contentRect));
677 697
678 if (layerClipsSubtree(layer)) { 698 if (layerClipsSubtree(layer)) {
679 subtreeShouldBeClipped = true; 699 subtreeShouldBeClipped = true;
680 if (ancestorClipsSubtree && !layer->renderSurface()) { 700 if (ancestorClipsSubtree && !layer->renderSurface()) {
681 clipRectForSubtree = clipRectFromAncestor; 701 clipRectForSubtree = clipRectFromAncestor;
682 clipRectForSubtree.Intersect(rectInTargetSpace); 702 clipRectForSubtree.Intersect(rectInTargetSpace);
683 } else 703 } else
684 clipRectForSubtree = rectInTargetSpace; 704 clipRectForSubtree = rectInTargetSpace;
685 } 705 }
(...skipping 18 matching lines...) Expand all
704 descendants.push_back(layer); 724 descendants.push_back(layer);
705 725
706 gfx::Transform nextScrollCompensationMatrix = computeScrollCompensationMatri xForChildren(layer, parentMatrix, currentScrollCompensationMatrix);; 726 gfx::Transform nextScrollCompensationMatrix = computeScrollCompensationMatri xForChildren(layer, parentMatrix, currentScrollCompensationMatrix);;
707 727
708 gfx::Rect accumulatedDrawableContentRectOfChildren; 728 gfx::Rect accumulatedDrawableContentRectOfChildren;
709 for (size_t i = 0; i < layer->children().size(); ++i) { 729 for (size_t i = 0; i < layer->children().size(); ++i) {
710 LayerType* child = LayerTreeHostCommon::getChildAsRawPtr(layer->children (), i); 730 LayerType* child = LayerTreeHostCommon::getChildAsRawPtr(layer->children (), i);
711 gfx::Rect drawableContentRectOfChildSubtree; 731 gfx::Rect drawableContentRectOfChildSubtree;
712 calculateDrawPropertiesInternal<LayerType, LayerList, RenderSurfaceType> (child, sublayerMatrix, nextHierarchyMatrix, nextScrollCompensationMatrix, 732 calculateDrawPropertiesInternal<LayerType, LayerList, RenderSurfaceType> (child, sublayerMatrix, nextHierarchyMatrix, nextScrollCompensationMatrix,
713 clipRectForSubtree, subtreeShouldBeClipped, nearestAncestorThatMovesPixels, 733 clipRectForSubtree, subtreeShouldBeClipped, nearestAncestorThatMovesPixels,
714 renderSurfaceLayerList, descendants, layerSorter, maxTextureSize, deviceScaleFa ctor, pageScaleFactor, drawableContentRectOfChildSubtree); 734 renderSurfaceLayerList, descendants, layerSorter, maxTextureSize, deviceScaleFa ctor, pageScaleFactor,
735 subtreeCanUseLCDText, drawableContentRectOfChildSubtree);
715 if (!drawableContentRectOfChildSubtree.IsEmpty()) { 736 if (!drawableContentRectOfChildSubtree.IsEmpty()) {
716 accumulatedDrawableContentRectOfChildren.Union(drawableContentRectOf ChildSubtree); 737 accumulatedDrawableContentRectOfChildren.Union(drawableContentRectOf ChildSubtree);
717 if (child->renderSurface()) 738 if (child->renderSurface())
718 descendants.push_back(child); 739 descendants.push_back(child);
719 } 740 }
720 } 741 }
721 742
722 // Compute the total drawableContentRect for this subtree (the rect is in ta rgetSurface space) 743 // Compute the total drawableContentRect for this subtree (the rect is in ta rgetSurface space)
723 gfx::Rect localDrawableContentRectOfSubtree = accumulatedDrawableContentRect OfChildren; 744 gfx::Rect localDrawableContentRectOfSubtree = accumulatedDrawableContentRect OfChildren;
724 if (layer->drawsContent()) 745 if (layer->drawsContent())
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
834 855
835 if (layer->renderSurface()) 856 if (layer->renderSurface())
836 drawableContentRectOfSubtree = gfx::ToEnclosingRect(layer->renderSurface ()->drawableContentRect()); 857 drawableContentRectOfSubtree = gfx::ToEnclosingRect(layer->renderSurface ()->drawableContentRect());
837 else 858 else
838 drawableContentRectOfSubtree = localDrawableContentRectOfSubtree; 859 drawableContentRectOfSubtree = localDrawableContentRectOfSubtree;
839 860
840 if (layer->hasContributingDelegatedRenderPasses()) 861 if (layer->hasContributingDelegatedRenderPasses())
841 layer->renderTarget()->renderSurface()->addContributingDelegatedRenderPa ssLayer(layer); 862 layer->renderTarget()->renderSurface()->addContributingDelegatedRenderPa ssLayer(layer);
842 } 863 }
843 864
844 void LayerTreeHostCommon::calculateDrawProperties(Layer* rootLayer, const gfx::S ize& deviceViewportSize, float deviceScaleFactor, float pageScaleFactor, int max TextureSize, std::vector<scoped_refptr<Layer> >& renderSurfaceLayerList) 865 void LayerTreeHostCommon::calculateDrawProperties(Layer* rootLayer, const gfx::S ize& deviceViewportSize, float deviceScaleFactor, float pageScaleFactor, int max TextureSize, bool canUseLCDText, std::vector<scoped_refptr<Layer> >& renderSurfa ceLayerList)
845 { 866 {
846 gfx::Rect totalDrawableContentRect; 867 gfx::Rect totalDrawableContentRect;
847 gfx::Transform identityMatrix; 868 gfx::Transform identityMatrix;
848 gfx::Transform deviceScaleTransform; 869 gfx::Transform deviceScaleTransform;
849 deviceScaleTransform.Scale(deviceScaleFactor, deviceScaleFactor); 870 deviceScaleTransform.Scale(deviceScaleFactor, deviceScaleFactor);
850 std::vector<scoped_refptr<Layer> > dummyLayerList; 871 std::vector<scoped_refptr<Layer> > dummyLayerList;
851 872
852 // The root layer's renderSurface should receive the deviceViewport as the i nitial clipRect. 873 // The root layer's renderSurface should receive the deviceViewport as the i nitial clipRect.
853 bool subtreeShouldBeClipped = true; 874 bool subtreeShouldBeClipped = true;
854 gfx::Rect deviceViewportRect(gfx::Point(), deviceViewportSize); 875 gfx::Rect deviceViewportRect(gfx::Point(), deviceViewportSize);
855 876
856 // This function should have received a root layer. 877 // This function should have received a root layer.
857 DCHECK(isRootLayer(rootLayer)); 878 DCHECK(isRootLayer(rootLayer));
858 879
859 cc::calculateDrawPropertiesInternal<Layer, std::vector<scoped_refptr<Layer> >, RenderSurface>( 880 cc::calculateDrawPropertiesInternal<Layer, std::vector<scoped_refptr<Layer> >, RenderSurface>(
860 rootLayer, deviceScaleTransform, identityMatrix, identityMatrix, 881 rootLayer, deviceScaleTransform, identityMatrix, identityMatrix,
861 deviceViewportRect, subtreeShouldBeClipped, 0, renderSurfaceLayerList, 882 deviceViewportRect, subtreeShouldBeClipped, 0, renderSurfaceLayerList,
862 dummyLayerList, 0, maxTextureSize, 883 dummyLayerList, 0, maxTextureSize,
863 deviceScaleFactor, pageScaleFactor, totalDrawableContentRect); 884 deviceScaleFactor, pageScaleFactor, canUseLCDText, totalDrawableContentR ect);
864 885
865 // The dummy layer list should not have been used. 886 // The dummy layer list should not have been used.
866 DCHECK(dummyLayerList.size() == 0); 887 DCHECK(dummyLayerList.size() == 0);
867 // A root layer renderSurface should always exist after calculateDrawPropert ies. 888 // A root layer renderSurface should always exist after calculateDrawPropert ies.
868 DCHECK(rootLayer->renderSurface()); 889 DCHECK(rootLayer->renderSurface());
869 } 890 }
870 891
871 void LayerTreeHostCommon::calculateDrawProperties(LayerImpl* rootLayer, const gf x::Size& deviceViewportSize, float deviceScaleFactor, float pageScaleFactor, int maxTextureSize, std::vector<LayerImpl*>& renderSurfaceLayerList) 892 void LayerTreeHostCommon::calculateDrawProperties(LayerImpl* rootLayer, const gf x::Size& deviceViewportSize, float deviceScaleFactor, float pageScaleFactor, int maxTextureSize, bool canUseLCDText, std::vector<LayerImpl*>& renderSurfaceLayer List)
872 { 893 {
873 gfx::Rect totalDrawableContentRect; 894 gfx::Rect totalDrawableContentRect;
874 gfx::Transform identityMatrix; 895 gfx::Transform identityMatrix;
875 gfx::Transform deviceScaleTransform; 896 gfx::Transform deviceScaleTransform;
876 deviceScaleTransform.Scale(deviceScaleFactor, deviceScaleFactor); 897 deviceScaleTransform.Scale(deviceScaleFactor, deviceScaleFactor);
877 std::vector<LayerImpl*> dummyLayerList; 898 std::vector<LayerImpl*> dummyLayerList;
878 LayerSorter layerSorter; 899 LayerSorter layerSorter;
879 900
880 // The root layer's renderSurface should receive the deviceViewport as the i nitial clipRect. 901 // The root layer's renderSurface should receive the deviceViewport as the i nitial clipRect.
881 bool subtreeShouldBeClipped = true; 902 bool subtreeShouldBeClipped = true;
882 gfx::Rect deviceViewportRect(gfx::Point(), deviceViewportSize); 903 gfx::Rect deviceViewportRect(gfx::Point(), deviceViewportSize);
883 904
884 // This function should have received a root layer. 905 // This function should have received a root layer.
885 DCHECK(isRootLayer(rootLayer)); 906 DCHECK(isRootLayer(rootLayer));
886 907
887 cc::calculateDrawPropertiesInternal<LayerImpl, std::vector<LayerImpl*>, Rend erSurfaceImpl>( 908 cc::calculateDrawPropertiesInternal<LayerImpl, std::vector<LayerImpl*>, Rend erSurfaceImpl>(
888 rootLayer, deviceScaleTransform, identityMatrix, identityMatrix, 909 rootLayer, deviceScaleTransform, identityMatrix, identityMatrix,
889 deviceViewportRect, subtreeShouldBeClipped, 0, renderSurfaceLayerList, 910 deviceViewportRect, subtreeShouldBeClipped, 0, renderSurfaceLayerList,
890 dummyLayerList, &layerSorter, maxTextureSize, 911 dummyLayerList, &layerSorter, maxTextureSize,
891 deviceScaleFactor, pageScaleFactor, totalDrawableContentRect); 912 deviceScaleFactor, pageScaleFactor, canUseLCDText, totalDrawableContentR ect);
892 913
893 // The dummy layer list should not have been used. 914 // The dummy layer list should not have been used.
894 DCHECK(dummyLayerList.size() == 0); 915 DCHECK(dummyLayerList.size() == 0);
895 // A root layer renderSurface should always exist after calculateDrawPropert ies. 916 // A root layer renderSurface should always exist after calculateDrawPropert ies.
896 DCHECK(rootLayer->renderSurface()); 917 DCHECK(rootLayer->renderSurface());
897 } 918 }
898 919
899 static bool pointHitsRect(const gfx::PointF& screenSpacePoint, const gfx::Transf orm& localSpaceToScreenSpaceTransform, gfx::RectF localSpaceRect) 920 static bool pointHitsRect(const gfx::PointF& screenSpacePoint, const gfx::Transf orm& localSpaceToScreenSpaceTransform, gfx::RectF localSpaceRect)
900 { 921 {
901 // If the transform is not invertible, then assume that this point doesn't h it this rect. 922 // If the transform is not invertible, then assume that this point doesn't h it this rect.
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
1013 1034
1014 foundLayer = currentLayer; 1035 foundLayer = currentLayer;
1015 break; 1036 break;
1016 } 1037 }
1017 1038
1018 // This can potentially return 0, which means the screenSpacePoint did not s uccessfully hit test any layers, not even the root layer. 1039 // This can potentially return 0, which means the screenSpacePoint did not s uccessfully hit test any layers, not even the root layer.
1019 return foundLayer; 1040 return foundLayer;
1020 } 1041 }
1021 1042
1022 } // namespace cc 1043 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698