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

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: reverted whitespace change 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
« no previous file with comments | « cc/layer_tree_host_common.h ('k') | cc/layer_tree_host_common_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 layerToRemove->clearRenderSurface(); 424 layerToRemove->clearRenderSurface();
425 } 425 }
426 426
427 // Recursively walks the layer tree starting at the given node and computes all the 427 // Recursively walks the layer tree starting at the given node and computes all the
428 // necessary transformations, clipRects, render surfaces, etc. 428 // necessary transformations, clipRects, render surfaces, etc.
429 template<typename LayerType, typename LayerList, typename RenderSurfaceType> 429 template<typename LayerType, typename LayerList, typename RenderSurfaceType>
430 static void calculateDrawPropertiesInternal(LayerType* layer, const gfx::Transfo rm& parentMatrix, 430 static void calculateDrawPropertiesInternal(LayerType* layer, const gfx::Transfo rm& parentMatrix,
431 const gfx::Transform& fullHierarchyMatrix, const gfx::Transform& currentScro llCompensationMatrix, 431 const gfx::Transform& fullHierarchyMatrix, const gfx::Transform& currentScro llCompensationMatrix,
432 const gfx::Rect& clipRectFromAncestor, const gfx::Rect& clipRectFromAncestor InDescendantSpace, bool ancestorClipsSubtree, 432 const gfx::Rect& clipRectFromAncestor, const gfx::Rect& clipRectFromAncestor InDescendantSpace, bool ancestorClipsSubtree,
433 RenderSurfaceType* nearestAncestorThatMovesPixels, LayerList& renderSurfaceL ayerList, LayerList& layerList, 433 RenderSurfaceType* nearestAncestorThatMovesPixels, LayerList& renderSurfaceL ayerList, LayerList& layerList,
434 LayerSorter* layerSorter, int maxTextureSize, float deviceScaleFactor, float pageScaleFactor, gfx::Rect& drawableContentRectOfSubtree) 434 LayerSorter* layerSorter, int maxTextureSize, float deviceScaleFactor, float pageScaleFactor, bool subtreeCanUseLCDText,
435 gfx::Rect& drawableContentRectOfSubtree)
435 { 436 {
436 // This function computes the new matrix transformations recursively for thi s 437 // This function computes the new matrix transformations recursively for thi s
437 // layer and all its descendants. It also computes the appropriate render su rfaces. 438 // layer and all its descendants. It also computes the appropriate render su rfaces.
438 // Some important points to remember: 439 // Some important points to remember:
439 // 440 //
440 // 0. Here, transforms are notated in Matrix x Vector order, and in words we describe what 441 // 0. Here, transforms are notated in Matrix x Vector order, and in words we describe what
441 // the transform does from left to right. 442 // the transform does from left to right.
442 // 443 //
443 // 1. In our terminology, the "layer origin" refers to the top-left corner o f a layer, and the 444 // 1. In our terminology, the "layer origin" refers to the top-left corner o f a layer, and the
444 // positive Y-axis points downwards. This interpretation is valid because the orthographic 445 // positive Y-axis points downwards. This interpretation is valid because the orthographic
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 bool subtreeShouldBeClipped = false; 533 bool subtreeShouldBeClipped = false;
533 534
534 // This value is cached on the stack so that we don't have to inverse-projec t 535 // This value is cached on the stack so that we don't have to inverse-projec t
535 // the surface's clipRect redundantly for every layer. This value is the 536 // the surface's clipRect redundantly for every layer. This value is the
536 // same as the surface's clipRect, except that instead of being described 537 // same as the surface's clipRect, except that instead of being described
537 // in the target surface space (i.e. the ancestor surface space), it is 538 // in the target surface space (i.e. the ancestor surface space), it is
538 // described in the current surface space. 539 // described in the current surface space.
539 gfx::Rect clipRectForSubtreeInDescendantSpace; 540 gfx::Rect clipRectForSubtreeInDescendantSpace;
540 541
541 float accumulatedDrawOpacity = layer->opacity(); 542 float accumulatedDrawOpacity = layer->opacity();
542 bool drawOpacityIsAnimating = layer->opacityIsAnimating(); 543 bool animatingOpacityToTarget = layer->opacityIsAnimating();
544 bool animatingOpacityToScreen = animatingOpacityToTarget;
543 if (layer->parent()) { 545 if (layer->parent()) {
544 accumulatedDrawOpacity *= layer->parent()->drawOpacity(); 546 accumulatedDrawOpacity *= layer->parent()->drawOpacity();
545 drawOpacityIsAnimating |= layer->parent()->drawOpacityIsAnimating(); 547 animatingOpacityToTarget |= layer->parent()->drawOpacityIsAnimating();
548 animatingOpacityToScreen |= layer->parent()->screenSpaceOpacityIsAnimati ng();
546 } 549 }
547 550
548 bool animatingTransformToTarget = layer->transformIsAnimating(); 551 bool animatingTransformToTarget = layer->transformIsAnimating();
549 bool animatingTransformToScreen = animatingTransformToTarget; 552 bool animatingTransformToScreen = animatingTransformToTarget;
550 if (layer->parent()) { 553 if (layer->parent()) {
551 animatingTransformToTarget |= layer->parent()->drawTransformIsAnimating( ); 554 animatingTransformToTarget |= layer->parent()->drawTransformIsAnimating( );
552 animatingTransformToScreen |= layer->parent()->screenSpaceTransformIsAni mating(); 555 animatingTransformToScreen |= layer->parent()->screenSpaceTransformIsAni mating();
553 } 556 }
554 557
555 gfx::Size bounds = layer->bounds(); 558 gfx::Size bounds = layer->bounds();
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
591 layerDrawProperties.target_space_transform = combinedTransform; 594 layerDrawProperties.target_space_transform = combinedTransform;
592 // M[draw] = M[parent] * LT * S[layer2content] 595 // M[draw] = M[parent] * LT * S[layer2content]
593 layerDrawProperties.target_space_transform.Scale(1.0 / layer->contentsScaleX (), 1.0 / layer->contentsScaleY()); 596 layerDrawProperties.target_space_transform.Scale(1.0 / layer->contentsScaleX (), 1.0 / layer->contentsScaleY());
594 597
595 // layerScreenSpaceTransform represents the transform between root layer's " screen space" and local content space. 598 // layerScreenSpaceTransform represents the transform between root layer's " screen space" and local content space.
596 layerDrawProperties.screen_space_transform = fullHierarchyMatrix; 599 layerDrawProperties.screen_space_transform = fullHierarchyMatrix;
597 if (!layer->preserves3D()) 600 if (!layer->preserves3D())
598 MathUtil::flattenTransformTo2d(layerDrawProperties.screen_space_transfor m); 601 MathUtil::flattenTransformTo2d(layerDrawProperties.screen_space_transfor m);
599 layerDrawProperties.screen_space_transform.PreconcatTransform(layerDrawPrope rties.target_space_transform); 602 layerDrawProperties.screen_space_transform.PreconcatTransform(layerDrawPrope rties.target_space_transform);
600 603
604 // Adjusting text AA method during animation may cause repaints, which in-tu rn causes jank.
605 bool adjustTextAA = !animatingOpacityToScreen && !animatingTransformToScreen ;
606 // To avoid color fringing, LCD text should only be used on opaque layers wi th just integral translation.
607 bool layerCanUseLCDText = subtreeCanUseLCDText &&
608 (accumulatedDrawOpacity == 1.0) &&
609 layerDrawProperties.target_space_transform.IsIdent ityOrIntegerTranslation();
610
601 gfx::RectF contentRect(gfx::PointF(), layer->contentBounds()); 611 gfx::RectF contentRect(gfx::PointF(), layer->contentBounds());
602 612
603 // fullHierarchyMatrix is the matrix that transforms objects between screen space (except projection matrix) and the most recent RenderSurfaceImpl's space. 613 // fullHierarchyMatrix is the matrix that transforms objects between screen space (except projection matrix) and the most recent RenderSurfaceImpl's space.
604 // nextHierarchyMatrix will only change if this layer uses a new RenderSurfa ceImpl, otherwise remains the same. 614 // nextHierarchyMatrix will only change if this layer uses a new RenderSurfa ceImpl, otherwise remains the same.
605 gfx::Transform nextHierarchyMatrix = fullHierarchyMatrix; 615 gfx::Transform nextHierarchyMatrix = fullHierarchyMatrix;
606 gfx::Transform sublayerMatrix; 616 gfx::Transform sublayerMatrix;
607 617
608 gfx::Vector2dF renderSurfaceSublayerScale = MathUtil::computeTransform2dScal eComponents(combinedTransform); 618 gfx::Vector2dF renderSurfaceSublayerScale = MathUtil::computeTransform2dScal eComponents(combinedTransform);
609 619
610 if (subtreeShouldRenderToSeparateSurface(layer, combinedTransform.IsScaleOrT ranslation())) { 620 if (subtreeShouldRenderToSeparateSurface(layer, combinedTransform.IsScaleOrT ranslation())) {
(...skipping 20 matching lines...) Expand all
631 layerDrawProperties.target_space_transform.Scale(renderSurfaceSublayerSc ale.x() / layer->contentsScaleX(), renderSurfaceSublayerScale.y() / layer->conte ntsScaleY()); 641 layerDrawProperties.target_space_transform.Scale(renderSurfaceSublayerSc ale.x() / layer->contentsScaleX(), renderSurfaceSublayerScale.y() / layer->conte ntsScaleY());
632 642
633 // Inside the surface's subtree, we scale everything to the owning layer 's scale. 643 // Inside the surface's subtree, we scale everything to the owning layer 's scale.
634 // The sublayer matrix transforms centered layer rects into target 644 // The sublayer matrix transforms centered layer rects into target
635 // surface content space. 645 // surface content space.
636 DCHECK(sublayerMatrix.IsIdentity()); 646 DCHECK(sublayerMatrix.IsIdentity());
637 sublayerMatrix.Scale(renderSurfaceSublayerScale.x(), renderSurfaceSublay erScale.y()); 647 sublayerMatrix.Scale(renderSurfaceSublayerScale.x(), renderSurfaceSublay erScale.y());
638 648
639 // The opacity value is moved from the layer to its surface, so that the entire subtree properly inherits opacity. 649 // The opacity value is moved from the layer to its surface, so that the entire subtree properly inherits opacity.
640 renderSurface->setDrawOpacity(accumulatedDrawOpacity); 650 renderSurface->setDrawOpacity(accumulatedDrawOpacity);
641 renderSurface->setDrawOpacityIsAnimating(drawOpacityIsAnimating); 651 renderSurface->setDrawOpacityIsAnimating(animatingOpacityToTarget);
652 animatingOpacityToTarget = false;
642 layerDrawProperties.opacity = 1; 653 layerDrawProperties.opacity = 1;
643 layerDrawProperties.opacity_is_animating = false; 654 layerDrawProperties.opacity_is_animating = animatingOpacityToTarget;
655 layerDrawProperties.screen_space_opacity_is_animating = animatingOpacity ToScreen;
644 656
645 renderSurface->setTargetSurfaceTransformsAreAnimating(animatingTransform ToTarget); 657 renderSurface->setTargetSurfaceTransformsAreAnimating(animatingTransform ToTarget);
646 renderSurface->setScreenSpaceTransformsAreAnimating(animatingTransformTo Screen); 658 renderSurface->setScreenSpaceTransformsAreAnimating(animatingTransformTo Screen);
647 animatingTransformToTarget = false; 659 animatingTransformToTarget = false;
648 layerDrawProperties.target_space_transform_is_animating = animatingTrans formToTarget; 660 layerDrawProperties.target_space_transform_is_animating = animatingTrans formToTarget;
649 layerDrawProperties.screen_space_transform_is_animating = animatingTrans formToScreen; 661 layerDrawProperties.screen_space_transform_is_animating = animatingTrans formToScreen;
650 662
651 // Update the aggregate hierarchy matrix to include the transform of the 663 // Update the aggregate hierarchy matrix to include the transform of the
652 // newly created RenderSurfaceImpl. 664 // newly created RenderSurfaceImpl.
653 nextHierarchyMatrix.PreconcatTransform(renderSurface->drawTransform()); 665 nextHierarchyMatrix.PreconcatTransform(renderSurface->drawTransform());
(...skipping 26 matching lines...) Expand all
680 if (ancestorClipsSubtree) { 692 if (ancestorClipsSubtree) {
681 renderSurface->setClipRect(clipRectFromAncestor); 693 renderSurface->setClipRect(clipRectFromAncestor);
682 clipRectForSubtreeInDescendantSpace = gfx::ToEnclosingRect(MathUtil: :projectClippedRect(MathUtil::inverse(renderSurface->drawTransform()), renderSur face->clipRect())); 694 clipRectForSubtreeInDescendantSpace = gfx::ToEnclosingRect(MathUtil: :projectClippedRect(MathUtil::inverse(renderSurface->drawTransform()), renderSur face->clipRect()));
683 } else { 695 } else {
684 renderSurface->setClipRect(gfx::Rect()); 696 renderSurface->setClipRect(gfx::Rect());
685 clipRectForSubtreeInDescendantSpace = clipRectFromAncestorInDescenda ntSpace; 697 clipRectForSubtreeInDescendantSpace = clipRectFromAncestorInDescenda ntSpace;
686 } 698 }
687 699
688 renderSurface->setNearestAncestorThatMovesPixels(nearestAncestorThatMove sPixels); 700 renderSurface->setNearestAncestorThatMovesPixels(nearestAncestorThatMove sPixels);
689 701
702 // If the new render surface is drawn translucent or with a non-integral translation
703 // then the subtree that gets drawn on this render surface cannot use LC D text.
704 subtreeCanUseLCDText = layerCanUseLCDText;
705
690 renderSurfaceLayerList.push_back(layer); 706 renderSurfaceLayerList.push_back(layer);
691 } else { 707 } else {
692 DCHECK(layer->parent()); 708 DCHECK(layer->parent());
693 709
694 // Note: layerDrawProperties.target_space_transform is computed above, 710 // Note: layerDrawProperties.target_space_transform is computed above,
695 // before this if-else statement. 711 // before this if-else statement.
696 layerDrawProperties.target_space_transform_is_animating = animatingTrans formToTarget; 712 layerDrawProperties.target_space_transform_is_animating = animatingTrans formToTarget;
697 layerDrawProperties.screen_space_transform_is_animating = animatingTrans formToScreen; 713 layerDrawProperties.screen_space_transform_is_animating = animatingTrans formToScreen;
698 layerDrawProperties.opacity = accumulatedDrawOpacity; 714 layerDrawProperties.opacity = accumulatedDrawOpacity;
699 layerDrawProperties.opacity_is_animating = drawOpacityIsAnimating; 715 layerDrawProperties.opacity_is_animating = animatingOpacityToTarget;
716 layerDrawProperties.screen_space_opacity_is_animating = animatingOpacity ToScreen;
700 sublayerMatrix = combinedTransform; 717 sublayerMatrix = combinedTransform;
701 718
702 layer->clearRenderSurface(); 719 layer->clearRenderSurface();
703 720
704 // Layers without renderSurfaces directly inherit the ancestor's clip st atus. 721 // Layers without renderSurfaces directly inherit the ancestor's clip st atus.
705 subtreeShouldBeClipped = ancestorClipsSubtree; 722 subtreeShouldBeClipped = ancestorClipsSubtree;
706 if (ancestorClipsSubtree) 723 if (ancestorClipsSubtree)
707 clipRectForSubtree = clipRectFromAncestor; 724 clipRectForSubtree = clipRectFromAncestor;
708 725
709 // The surface's cached clipRect value propagates regardless of what cli pping goes on between layers here. 726 // The surface's cached clipRect value propagates regardless of what cli pping goes on between layers here.
710 clipRectForSubtreeInDescendantSpace = clipRectFromAncestorInDescendantSp ace; 727 clipRectForSubtreeInDescendantSpace = clipRectFromAncestorInDescendantSp ace;
711 728
712 // Layers that are not their own renderTarget will render into the targe t of their nearest ancestor. 729 // Layers that are not their own renderTarget will render into the targe t of their nearest ancestor.
713 layerDrawProperties.render_target = layer->parent()->renderTarget(); 730 layerDrawProperties.render_target = layer->parent()->renderTarget();
714 } 731 }
715 732
733 if (adjustTextAA)
734 layerDrawProperties.can_use_lcd_text = layerCanUseLCDText;
735
716 gfx::Rect rectInTargetSpace = ToEnclosingRect(MathUtil::mapClippedRect(layer ->drawTransform(), contentRect)); 736 gfx::Rect rectInTargetSpace = ToEnclosingRect(MathUtil::mapClippedRect(layer ->drawTransform(), contentRect));
717 737
718 if (layerClipsSubtree(layer)) { 738 if (layerClipsSubtree(layer)) {
719 subtreeShouldBeClipped = true; 739 subtreeShouldBeClipped = true;
720 if (ancestorClipsSubtree && !layer->renderSurface()) { 740 if (ancestorClipsSubtree && !layer->renderSurface()) {
721 clipRectForSubtree = clipRectFromAncestor; 741 clipRectForSubtree = clipRectFromAncestor;
722 clipRectForSubtree.Intersect(rectInTargetSpace); 742 clipRectForSubtree.Intersect(rectInTargetSpace);
723 } else 743 } else
724 clipRectForSubtree = rectInTargetSpace; 744 clipRectForSubtree = rectInTargetSpace;
725 } 745 }
(...skipping 18 matching lines...) Expand all
744 descendants.push_back(layer); 764 descendants.push_back(layer);
745 765
746 gfx::Transform nextScrollCompensationMatrix = computeScrollCompensationMatri xForChildren(layer, parentMatrix, currentScrollCompensationMatrix);; 766 gfx::Transform nextScrollCompensationMatrix = computeScrollCompensationMatri xForChildren(layer, parentMatrix, currentScrollCompensationMatrix);;
747 767
748 gfx::Rect accumulatedDrawableContentRectOfChildren; 768 gfx::Rect accumulatedDrawableContentRectOfChildren;
749 for (size_t i = 0; i < layer->children().size(); ++i) { 769 for (size_t i = 0; i < layer->children().size(); ++i) {
750 LayerType* child = LayerTreeHostCommon::getChildAsRawPtr(layer->children (), i); 770 LayerType* child = LayerTreeHostCommon::getChildAsRawPtr(layer->children (), i);
751 gfx::Rect drawableContentRectOfChildSubtree; 771 gfx::Rect drawableContentRectOfChildSubtree;
752 calculateDrawPropertiesInternal<LayerType, LayerList, RenderSurfaceType> (child, sublayerMatrix, nextHierarchyMatrix, nextScrollCompensationMatrix, 772 calculateDrawPropertiesInternal<LayerType, LayerList, RenderSurfaceType> (child, sublayerMatrix, nextHierarchyMatrix, nextScrollCompensationMatrix,
753 clipRectForSubtree, clipRectForSubtreeInDescendantSpace, subtreeShouldBeClipped , nearestAncestorThatMovesPixels, 773 clipRectForSubtree, clipRectForSubtreeInDescendantSpace, subtreeShouldBeClipped , nearestAncestorThatMovesPixels,
754 renderSurfaceLayerList, descendants, layerSorter, maxTextureSize, deviceScaleFa ctor, pageScaleFactor, drawableContentRectOfChildSubtree); 774 renderSurfaceLayerList, descendants, layerSorter, maxTextureSize, deviceScaleFa ctor, pageScaleFactor,
775 subtreeCanUseLCDText, drawableContentRectOfChildSubtree);
755 if (!drawableContentRectOfChildSubtree.IsEmpty()) { 776 if (!drawableContentRectOfChildSubtree.IsEmpty()) {
756 accumulatedDrawableContentRectOfChildren.Union(drawableContentRectOf ChildSubtree); 777 accumulatedDrawableContentRectOfChildren.Union(drawableContentRectOf ChildSubtree);
757 if (child->renderSurface()) 778 if (child->renderSurface())
758 descendants.push_back(child); 779 descendants.push_back(child);
759 } 780 }
760 } 781 }
761 782
762 if (layer->renderSurface() && !isRootLayer(layer) && !layer->renderSurface() ->layerList().size()) { 783 if (layer->renderSurface() && !isRootLayer(layer) && !layer->renderSurface() ->layerList().size()) {
763 removeSurfaceForEarlyExit(layer, renderSurfaceLayerList); 784 removeSurfaceForEarlyExit(layer, renderSurfaceLayerList);
764 return; 785 return;
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
865 886
866 if (layer->renderSurface()) 887 if (layer->renderSurface())
867 drawableContentRectOfSubtree = gfx::ToEnclosingRect(layer->renderSurface ()->drawableContentRect()); 888 drawableContentRectOfSubtree = gfx::ToEnclosingRect(layer->renderSurface ()->drawableContentRect());
868 else 889 else
869 drawableContentRectOfSubtree = localDrawableContentRectOfSubtree; 890 drawableContentRectOfSubtree = localDrawableContentRectOfSubtree;
870 891
871 if (layer->hasContributingDelegatedRenderPasses()) 892 if (layer->hasContributingDelegatedRenderPasses())
872 layer->renderTarget()->renderSurface()->addContributingDelegatedRenderPa ssLayer(layer); 893 layer->renderTarget()->renderSurface()->addContributingDelegatedRenderPa ssLayer(layer);
873 } 894 }
874 895
875 void LayerTreeHostCommon::calculateDrawProperties(Layer* rootLayer, const gfx::S ize& deviceViewportSize, float deviceScaleFactor, float pageScaleFactor, int max TextureSize, std::vector<scoped_refptr<Layer> >& renderSurfaceLayerList) 896 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)
876 { 897 {
877 gfx::Rect totalDrawableContentRect; 898 gfx::Rect totalDrawableContentRect;
878 gfx::Transform identityMatrix; 899 gfx::Transform identityMatrix;
879 gfx::Transform deviceScaleTransform; 900 gfx::Transform deviceScaleTransform;
880 deviceScaleTransform.Scale(deviceScaleFactor, deviceScaleFactor); 901 deviceScaleTransform.Scale(deviceScaleFactor, deviceScaleFactor);
881 std::vector<scoped_refptr<Layer> > dummyLayerList; 902 std::vector<scoped_refptr<Layer> > dummyLayerList;
882 903
883 // The root layer's renderSurface should receive the deviceViewport as the i nitial clipRect. 904 // The root layer's renderSurface should receive the deviceViewport as the i nitial clipRect.
884 bool subtreeShouldBeClipped = true; 905 bool subtreeShouldBeClipped = true;
885 gfx::Rect deviceViewportRect(gfx::Point(), deviceViewportSize); 906 gfx::Rect deviceViewportRect(gfx::Point(), deviceViewportSize);
886 907
887 // This function should have received a root layer. 908 // This function should have received a root layer.
888 DCHECK(isRootLayer(rootLayer)); 909 DCHECK(isRootLayer(rootLayer));
889 910
890 cc::calculateDrawPropertiesInternal<Layer, std::vector<scoped_refptr<Layer> >, RenderSurface>( 911 cc::calculateDrawPropertiesInternal<Layer, std::vector<scoped_refptr<Layer> >, RenderSurface>(
891 rootLayer, deviceScaleTransform, identityMatrix, identityMatrix, 912 rootLayer, deviceScaleTransform, identityMatrix, identityMatrix,
892 deviceViewportRect, deviceViewportRect, subtreeShouldBeClipped, 0, rende rSurfaceLayerList, 913 deviceViewportRect, deviceViewportRect, subtreeShouldBeClipped, 0, rende rSurfaceLayerList,
893 dummyLayerList, 0, maxTextureSize, 914 dummyLayerList, 0, maxTextureSize,
894 deviceScaleFactor, pageScaleFactor, totalDrawableContentRect); 915 deviceScaleFactor, pageScaleFactor, canUseLCDText, totalDrawableContentR ect);
895 916
896 // The dummy layer list should not have been used. 917 // The dummy layer list should not have been used.
897 DCHECK(dummyLayerList.size() == 0); 918 DCHECK(dummyLayerList.size() == 0);
898 // A root layer renderSurface should always exist after calculateDrawPropert ies. 919 // A root layer renderSurface should always exist after calculateDrawPropert ies.
899 DCHECK(rootLayer->renderSurface()); 920 DCHECK(rootLayer->renderSurface());
900 } 921 }
901 922
902 void LayerTreeHostCommon::calculateDrawProperties(LayerImpl* rootLayer, const gf x::Size& deviceViewportSize, float deviceScaleFactor, float pageScaleFactor, int maxTextureSize, std::vector<LayerImpl*>& renderSurfaceLayerList) 923 void LayerTreeHostCommon::calculateDrawProperties(LayerImpl* rootLayer, const gf x::Size& deviceViewportSize, float deviceScaleFactor, float pageScaleFactor, int maxTextureSize, bool canUseLCDText, std::vector<LayerImpl*>& renderSurfaceLayer List)
903 { 924 {
904 gfx::Rect totalDrawableContentRect; 925 gfx::Rect totalDrawableContentRect;
905 gfx::Transform identityMatrix; 926 gfx::Transform identityMatrix;
906 gfx::Transform deviceScaleTransform; 927 gfx::Transform deviceScaleTransform;
907 deviceScaleTransform.Scale(deviceScaleFactor, deviceScaleFactor); 928 deviceScaleTransform.Scale(deviceScaleFactor, deviceScaleFactor);
908 std::vector<LayerImpl*> dummyLayerList; 929 std::vector<LayerImpl*> dummyLayerList;
909 LayerSorter layerSorter; 930 LayerSorter layerSorter;
910 931
911 // The root layer's renderSurface should receive the deviceViewport as the i nitial clipRect. 932 // The root layer's renderSurface should receive the deviceViewport as the i nitial clipRect.
912 bool subtreeShouldBeClipped = true; 933 bool subtreeShouldBeClipped = true;
913 gfx::Rect deviceViewportRect(gfx::Point(), deviceViewportSize); 934 gfx::Rect deviceViewportRect(gfx::Point(), deviceViewportSize);
914 935
915 // This function should have received a root layer. 936 // This function should have received a root layer.
916 DCHECK(isRootLayer(rootLayer)); 937 DCHECK(isRootLayer(rootLayer));
917 938
918 cc::calculateDrawPropertiesInternal<LayerImpl, std::vector<LayerImpl*>, Rend erSurfaceImpl>( 939 cc::calculateDrawPropertiesInternal<LayerImpl, std::vector<LayerImpl*>, Rend erSurfaceImpl>(
919 rootLayer, deviceScaleTransform, identityMatrix, identityMatrix, 940 rootLayer, deviceScaleTransform, identityMatrix, identityMatrix,
920 deviceViewportRect, deviceViewportRect, subtreeShouldBeClipped, 0, rende rSurfaceLayerList, 941 deviceViewportRect, deviceViewportRect, subtreeShouldBeClipped, 0, rende rSurfaceLayerList,
921 dummyLayerList, &layerSorter, maxTextureSize, 942 dummyLayerList, &layerSorter, maxTextureSize,
922 deviceScaleFactor, pageScaleFactor, totalDrawableContentRect); 943 deviceScaleFactor, pageScaleFactor, canUseLCDText, totalDrawableContentR ect);
923 944
924 // The dummy layer list should not have been used. 945 // The dummy layer list should not have been used.
925 DCHECK(dummyLayerList.size() == 0); 946 DCHECK(dummyLayerList.size() == 0);
926 // A root layer renderSurface should always exist after calculateDrawPropert ies. 947 // A root layer renderSurface should always exist after calculateDrawPropert ies.
927 DCHECK(rootLayer->renderSurface()); 948 DCHECK(rootLayer->renderSurface());
928 } 949 }
929 950
930 static bool pointHitsRect(const gfx::PointF& screenSpacePoint, const gfx::Transf orm& localSpaceToScreenSpaceTransform, gfx::RectF localSpaceRect) 951 static bool pointHitsRect(const gfx::PointF& screenSpacePoint, const gfx::Transf orm& localSpaceToScreenSpaceTransform, gfx::RectF localSpaceRect)
931 { 952 {
932 // If the transform is not invertible, then assume that this point doesn't h it this rect. 953 // 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
1044 1065
1045 foundLayer = currentLayer; 1066 foundLayer = currentLayer;
1046 break; 1067 break;
1047 } 1068 }
1048 1069
1049 // This can potentially return 0, which means the screenSpacePoint did not s uccessfully hit test any layers, not even the root layer. 1070 // This can potentially return 0, which means the screenSpacePoint did not s uccessfully hit test any layers, not even the root layer.
1050 return foundLayer; 1071 return foundLayer;
1051 } 1072 }
1052 1073
1053 } // namespace cc 1074 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layer_tree_host_common.h ('k') | cc/layer_tree_host_common_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698