Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 | 5 |
| 6 #include "config.h" | 6 #include "config.h" |
| 7 | 7 |
| 8 #include "CCLayerTreeHostCommon.h" | 8 #include "CCLayerTreeHostCommon.h" |
| 9 | 9 |
| 10 #include "CCLayerImpl.h" | 10 #include "CCLayerImpl.h" |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 211 { | 211 { |
| 212 // If the opacity is being animated then the opacity on the main thread is u nreliable | 212 // If the opacity is being animated then the opacity on the main thread is u nreliable |
| 213 // (since the impl thread may be using a different opacity), so it should no t be trusted. | 213 // (since the impl thread may be using a different opacity), so it should no t be trusted. |
| 214 // In particular, it should not cause the subtree to be skipped. | 214 // In particular, it should not cause the subtree to be skipped. |
| 215 return !layer->opacity() && !layer->opacityIsAnimating(); | 215 return !layer->opacity() && !layer->opacityIsAnimating(); |
| 216 } | 216 } |
| 217 | 217 |
| 218 template<typename LayerType> | 218 template<typename LayerType> |
| 219 static bool subtreeShouldRenderToSeparateSurface(LayerType* layer, bool axisAlig nedWithRespectToParent) | 219 static bool subtreeShouldRenderToSeparateSurface(LayerType* layer, bool axisAlig nedWithRespectToParent) |
| 220 { | 220 { |
| 221 // The root layer has a special render surface that is set up externally, so | |
| 222 // it shouldn't be treated as a surface in this code. | |
| 223 if (!layer->parent()) | |
| 224 return false; | |
| 225 | |
| 226 // Cache this value, because otherwise it walks the entire subtree several t imes. | |
| 227 bool descendantDrawsContent = layer->descendantDrawsContent(); | |
| 228 | |
| 229 // | 221 // |
| 230 // A layer and its descendants should render onto a new RenderSurface if any of these rules hold: | 222 // A layer and its descendants should render onto a new RenderSurface if any of these rules hold: |
| 231 // | 223 // |
| 232 | 224 |
| 225 // The root layer should always have a renderSurface. | |
| 226 if (!layer->parent()) | |
|
danakj
2012/10/09 22:21:54
<3 this
enne (OOO)
2012/10/15 18:29:45
Can you remove the inconsistent use of layer == ro
| |
| 227 return true; | |
| 228 | |
| 233 // If we force it. | 229 // If we force it. |
| 234 if (layer->forceRenderSurface()) | 230 if (layer->forceRenderSurface()) |
| 235 return true; | 231 return true; |
| 236 | 232 |
| 237 // If the layer uses a mask. | 233 // If the layer uses a mask. |
| 238 if (layer->maskLayer()) | 234 if (layer->maskLayer()) |
| 239 return true; | 235 return true; |
| 240 | 236 |
| 241 // If the layer has a reflection. | 237 // If the layer has a reflection. |
| 242 if (layer->replicaLayer()) | 238 if (layer->replicaLayer()) |
| 243 return true; | 239 return true; |
| 244 | 240 |
| 245 // If the layer uses a CSS filter. | 241 // If the layer uses a CSS filter. |
| 246 if (!layer->filters().isEmpty() || !layer->backgroundFilters().isEmpty()) | 242 if (!layer->filters().isEmpty() || !layer->backgroundFilters().isEmpty()) |
| 247 return true; | 243 return true; |
| 248 | 244 |
| 245 // Cache this value, because otherwise it walks the entire subtree several t imes. | |
| 246 bool descendantDrawsContent = layer->descendantDrawsContent(); | |
| 247 | |
| 249 // If the layer flattens its subtree (i.e. the layer doesn't preserve-3d), b ut it is | 248 // If the layer flattens its subtree (i.e. the layer doesn't preserve-3d), b ut it is |
| 250 // treated as a 3D object by its parent (i.e. parent does preserve-3d). | 249 // treated as a 3D object by its parent (i.e. parent does preserve-3d). |
| 251 if (layerIsInExisting3DRenderingContext(layer) && !layer->preserves3D() && d escendantDrawsContent) | 250 if (layerIsInExisting3DRenderingContext(layer) && !layer->preserves3D() && d escendantDrawsContent) |
| 252 return true; | 251 return true; |
| 253 | 252 |
| 254 // If the layer clips its descendants but it is not axis-aligned with respec t to its parent. | 253 // If the layer clips its descendants but it is not axis-aligned with respec t to its parent. |
| 255 if (layerClipsSubtree(layer) && !axisAlignedWithRespectToParent && descendan tDrawsContent) | 254 if (layerClipsSubtree(layer) && !axisAlignedWithRespectToParent && descendan tDrawsContent) |
| 256 return true; | 255 return true; |
| 257 | 256 |
| 258 // If the layer has opacity != 1 and does not have a preserves-3d transform style. | 257 // If the layer has opacity != 1 and does not have a preserves-3d transform style. |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 337 // The adjustment allows us to continue using the scrollCompensation on the next surface. | 336 // The adjustment allows us to continue using the scrollCompensation on the next surface. |
| 338 // Step 1 (right-most in the math): transform from the new surface to the o riginal ancestor surface | 337 // Step 1 (right-most in the math): transform from the new surface to the o riginal ancestor surface |
| 339 // Step 2: apply the scroll compensation | 338 // Step 2: apply the scroll compensation |
| 340 // Step 3: transform back to the new surface. | 339 // Step 3: transform back to the new surface. |
| 341 if (layer->renderSurface() && !nextScrollCompensationMatrix.isIdentity()) | 340 if (layer->renderSurface() && !nextScrollCompensationMatrix.isIdentity()) |
| 342 nextScrollCompensationMatrix = layer->renderSurface()->drawTransform().i nverse() * nextScrollCompensationMatrix * layer->renderSurface()->drawTransform( ); | 341 nextScrollCompensationMatrix = layer->renderSurface()->drawTransform().i nverse() * nextScrollCompensationMatrix * layer->renderSurface()->drawTransform( ); |
| 343 | 342 |
| 344 return nextScrollCompensationMatrix; | 343 return nextScrollCompensationMatrix; |
| 345 } | 344 } |
| 346 | 345 |
| 347 // Should be called just before the recursive calculateDrawTransformsInternal(). | |
| 348 template<typename LayerType, typename LayerList> | |
| 349 void setupRootLayerAndSurfaceForRecursion(LayerType* rootLayer, LayerList& rende rSurfaceLayerList, const IntSize& deviceViewportSize) | |
| 350 { | |
| 351 if (!rootLayer->renderSurface()) | |
| 352 rootLayer->createRenderSurface(); | |
| 353 | |
| 354 rootLayer->renderSurface()->setContentRect(IntRect(IntPoint::zero(), deviceV iewportSize)); | |
| 355 rootLayer->renderSurface()->clearLayerLists(); | |
| 356 | |
| 357 ASSERT(renderSurfaceLayerList.isEmpty()); | |
| 358 renderSurfaceLayerList.append(rootLayer); | |
| 359 } | |
| 360 | |
| 361 // Recursively walks the layer tree starting at the given node and computes all the | 346 // Recursively walks the layer tree starting at the given node and computes all the |
| 362 // necessary transformations, clipRects, render surfaces, etc. | 347 // necessary transformations, clipRects, render surfaces, etc. |
| 363 template<typename LayerType, typename LayerList, typename RenderSurfaceType, typ ename LayerSorter> | 348 template<typename LayerType, typename LayerList, typename RenderSurfaceType, typ ename LayerSorter> |
| 364 static void calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay er, const WebTransformationMatrix& parentMatrix, | 349 static void calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay er, const WebTransformationMatrix& parentMatrix, |
| 365 const WebTransformationMatrix& fullHierarchyMatrix, const WebTransformationM atrix& currentScrollCompensationMatrix, | 350 const WebTransformationMatrix& fullHierarchyMatrix, const WebTransformationM atrix& currentScrollCompensationMatrix, |
| 366 const IntRect& clipRectFromAncestor, bool ancestorClipsSubtree, | 351 const IntRect& clipRectFromAncestor, bool ancestorClipsSubtree, |
| 367 RenderSurfaceType* nearestAncestorThatMovesPixels, LayerList& renderSurfaceL ayerList, LayerList& layerList, | 352 RenderSurfaceType* nearestAncestorThatMovesPixels, LayerList& renderSurfaceL ayerList, LayerList& layerList, |
| 368 LayerSorter* layerSorter, int maxTextureSize, float deviceScaleFactor, IntRe ct& drawableContentRectOfSubtree) | 353 LayerSorter* layerSorter, int maxTextureSize, float deviceScaleFactor, IntRe ct& drawableContentRectOfSubtree) |
| 369 { | 354 { |
| 370 // This function computes the new matrix transformations recursively for thi s | 355 // This function computes the new matrix transformations recursively for thi s |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 445 // The replica draw transform to its target surface origin is: | 430 // The replica draw transform to its target surface origin is: |
| 446 // M[replicaDraw] = S[deviceScale] * M[surfaceDraw] * Tr[replica->pos ition() + replica->anchor()] * Tr[replica] * Tr[origin2anchor].inverse() * S[con tentsScale].inverse() | 431 // M[replicaDraw] = S[deviceScale] * M[surfaceDraw] * Tr[replica->pos ition() + replica->anchor()] * Tr[replica] * Tr[origin2anchor].inverse() * S[con tentsScale].inverse() |
| 447 // | 432 // |
| 448 // The replica draw transform to the root (screen space) origin is: | 433 // The replica draw transform to the root (screen space) origin is: |
| 449 // M[replica2root] = M[surface2root] * Tr[replica->position()] * Tr[r eplica] * Tr[origin2anchor].inverse() | 434 // M[replica2root] = M[surface2root] * Tr[replica->position()] * Tr[r eplica] * Tr[origin2anchor].inverse() |
| 450 // | 435 // |
| 451 | 436 |
| 452 // If we early-exit anywhere in this function, the drawableContentRect of th is subtree should be considered empty. | 437 // If we early-exit anywhere in this function, the drawableContentRect of th is subtree should be considered empty. |
| 453 drawableContentRectOfSubtree = IntRect(); | 438 drawableContentRectOfSubtree = IntRect(); |
| 454 | 439 |
| 455 if (subtreeShouldBeSkipped(layer)) | 440 // The root layer cannot skip calcDrawTransforms. |
| 441 if (layer != rootLayer && subtreeShouldBeSkipped(layer)) | |
| 456 return; | 442 return; |
| 457 | 443 |
| 458 IntRect clipRectForSubtree; | 444 IntRect clipRectForSubtree; |
| 459 bool subtreeShouldBeClipped = false; | 445 bool subtreeShouldBeClipped = false; |
| 460 | 446 |
| 461 float drawOpacity = layer->opacity(); | 447 float drawOpacity = layer->opacity(); |
| 462 bool drawOpacityIsAnimating = layer->opacityIsAnimating(); | 448 bool drawOpacityIsAnimating = layer->opacityIsAnimating(); |
| 463 if (layer->parent() && layer->parent()->preserves3D()) { | 449 if (layer->parent() && layer->parent()->preserves3D()) { |
| 464 drawOpacity *= layer->parent()->drawOpacity(); | 450 drawOpacity *= layer->parent()->drawOpacity(); |
| 465 drawOpacityIsAnimating |= layer->parent()->drawOpacityIsAnimating(); | 451 drawOpacityIsAnimating |= layer->parent()->drawOpacityIsAnimating(); |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 583 // The render surface clipRect is expressed in the space where this surf ace draws, i.e. the same space as clipRectFromAncestor. | 569 // The render surface clipRect is expressed in the space where this surf ace draws, i.e. the same space as clipRectFromAncestor. |
| 584 if (ancestorClipsSubtree) | 570 if (ancestorClipsSubtree) |
| 585 renderSurface->setClipRect(clipRectFromAncestor); | 571 renderSurface->setClipRect(clipRectFromAncestor); |
| 586 else | 572 else |
| 587 renderSurface->setClipRect(IntRect()); | 573 renderSurface->setClipRect(IntRect()); |
| 588 | 574 |
| 589 renderSurface->setNearestAncestorThatMovesPixels(nearestAncestorThatMove sPixels); | 575 renderSurface->setNearestAncestorThatMovesPixels(nearestAncestorThatMove sPixels); |
| 590 | 576 |
| 591 renderSurfaceLayerList.append(layer); | 577 renderSurfaceLayerList.append(layer); |
| 592 } else { | 578 } else { |
| 579 ASSERT(layer != rootLayer); | |
| 580 ASSERT(layer->parent()); | |
| 581 | |
| 593 layer->setDrawTransform(drawTransform); | 582 layer->setDrawTransform(drawTransform); |
| 594 layer->setDrawTransformIsAnimating(animatingTransformToTarget); | 583 layer->setDrawTransformIsAnimating(animatingTransformToTarget); |
| 595 layer->setScreenSpaceTransformIsAnimating(animatingTransformToScreen); | 584 layer->setScreenSpaceTransformIsAnimating(animatingTransformToScreen); |
| 596 sublayerMatrix = combinedTransform; | 585 sublayerMatrix = combinedTransform; |
| 597 | 586 |
| 598 layer->setDrawOpacity(drawOpacity); | 587 layer->setDrawOpacity(drawOpacity); |
| 599 layer->setDrawOpacityIsAnimating(drawOpacityIsAnimating); | 588 layer->setDrawOpacityIsAnimating(drawOpacityIsAnimating); |
| 600 | 589 |
| 601 if (layer != rootLayer) { | 590 layer->clearRenderSurface(); |
| 602 ASSERT(layer->parent()); | |
| 603 layer->clearRenderSurface(); | |
| 604 | 591 |
| 605 // Layers without renderSurfaces directly inherit the ancestor's cli p status. | 592 // Layers without renderSurfaces directly inherit the ancestor's clip st atus. |
| 606 subtreeShouldBeClipped = ancestorClipsSubtree; | 593 subtreeShouldBeClipped = ancestorClipsSubtree; |
| 607 if (ancestorClipsSubtree) | 594 if (ancestorClipsSubtree) |
| 608 clipRectForSubtree = clipRectFromAncestor; | 595 clipRectForSubtree = clipRectFromAncestor; |
| 609 | 596 |
| 610 // Layers that are not their own renderTarget will render into the t arget of their nearest ancestor. | 597 // Layers that are not their own renderTarget will render into the targe t of their nearest ancestor. |
| 611 layer->setRenderTarget(layer->parent()->renderTarget()); | 598 layer->setRenderTarget(layer->parent()->renderTarget()); |
| 612 } else { | |
| 613 // FIXME: This root layer special case code should eventually go awa y. https://bugs.webkit.org/show_bug.cgi?id=92290 | |
| 614 ASSERT(!layer->parent()); | |
| 615 ASSERT(layer->renderSurface()); | |
| 616 ASSERT(ancestorClipsSubtree); | |
| 617 layer->renderSurface()->setClipRect(clipRectFromAncestor); | |
| 618 subtreeShouldBeClipped = false; | |
| 619 } | |
| 620 } | 599 } |
| 621 | 600 |
| 622 IntRect rectInTargetSpace = enclosingIntRect(CCMathUtil::mapClippedRect(laye r->drawTransform(), contentRect)); | 601 IntRect rectInTargetSpace = enclosingIntRect(CCMathUtil::mapClippedRect(laye r->drawTransform(), contentRect)); |
| 623 | 602 |
| 624 if (layerClipsSubtree(layer)) { | 603 if (layerClipsSubtree(layer)) { |
| 625 subtreeShouldBeClipped = true; | 604 subtreeShouldBeClipped = true; |
| 626 if (ancestorClipsSubtree && !layer->renderSurface()) { | 605 if (ancestorClipsSubtree && !layer->renderSurface()) { |
| 627 clipRectForSubtree = clipRectFromAncestor; | 606 clipRectForSubtree = clipRectFromAncestor; |
| 628 clipRectForSubtree.intersect(rectInTargetSpace); | 607 clipRectForSubtree.intersect(rectInTargetSpace); |
| 629 } else | 608 } else |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 674 IntRect drawableContentRectOfLayer = rectInTargetSpace; | 653 IntRect drawableContentRectOfLayer = rectInTargetSpace; |
| 675 if (subtreeShouldBeClipped) | 654 if (subtreeShouldBeClipped) |
| 676 drawableContentRectOfLayer.intersect(clipRectForSubtree); | 655 drawableContentRectOfLayer.intersect(clipRectForSubtree); |
| 677 layer->setDrawableContentRect(drawableContentRectOfLayer); | 656 layer->setDrawableContentRect(drawableContentRectOfLayer); |
| 678 | 657 |
| 679 // Compute the layer's visible content rect (the rect is in content space) | 658 // Compute the layer's visible content rect (the rect is in content space) |
| 680 IntRect visibleContentRectOfLayer = calculateVisibleContentRect(layer); | 659 IntRect visibleContentRectOfLayer = calculateVisibleContentRect(layer); |
| 681 layer->setVisibleContentRect(visibleContentRectOfLayer); | 660 layer->setVisibleContentRect(visibleContentRectOfLayer); |
| 682 | 661 |
| 683 // Compute the remaining properties for the render surface, if the layer has one. | 662 // Compute the remaining properties for the render surface, if the layer has one. |
| 684 if (layer->renderSurface() && layer != rootLayer) { | 663 if (layer == rootLayer) { |
| 664 // The root layer's surface's contentRect is always the entire viewport. | |
| 665 ASSERT(layer->renderSurface()); | |
| 666 layer->renderSurface()->setContentRect(clipRectFromAncestor); | |
| 667 } else if (layer->renderSurface() && layer != rootLayer) { | |
| 685 RenderSurfaceType* renderSurface = layer->renderSurface(); | 668 RenderSurfaceType* renderSurface = layer->renderSurface(); |
| 686 IntRect clippedContentRect = localDrawableContentRectOfSubtree; | 669 IntRect clippedContentRect = localDrawableContentRectOfSubtree; |
| 687 | 670 |
| 688 // Don't clip if the layer is reflected as the reflection shouldn't be | 671 // Don't clip if the layer is reflected as the reflection shouldn't be |
| 689 // clipped. If the layer is animating, then the surface's transform to | 672 // clipped. If the layer is animating, then the surface's transform to |
| 690 // its target is not known on the main thread, and we should not use it | 673 // its target is not known on the main thread, and we should not use it |
| 691 // to clip. | 674 // to clip. |
| 692 if (!layer->replicaLayer() && transformToParentIsKnown(layer)) { | 675 if (!layer->replicaLayer() && transformToParentIsKnown(layer)) { |
| 693 // Note, it is correct to use ancestorClipsSubtree here, because we are looking at this layer's renderSurface, not the layer itself. | 676 // Note, it is correct to use ancestorClipsSubtree here, because we are looking at this layer's renderSurface, not the layer itself. |
| 694 if (ancestorClipsSubtree && !clippedContentRect.isEmpty()) { | 677 if (ancestorClipsSubtree && !clippedContentRect.isEmpty()) { |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 759 else | 742 else |
| 760 drawableContentRectOfSubtree = localDrawableContentRectOfSubtree; | 743 drawableContentRectOfSubtree = localDrawableContentRectOfSubtree; |
| 761 | 744 |
| 762 if (layer->hasContributingDelegatedRenderPasses()) | 745 if (layer->hasContributingDelegatedRenderPasses()) |
| 763 layer->renderTarget()->renderSurface()->addContributingDelegatedRenderPa ssLayer(layer); | 746 layer->renderTarget()->renderSurface()->addContributingDelegatedRenderPa ssLayer(layer); |
| 764 } | 747 } |
| 765 | 748 |
| 766 void CCLayerTreeHostCommon::calculateDrawTransforms(LayerChromium* rootLayer, co nst IntSize& deviceViewportSize, float deviceScaleFactor, int maxTextureSize, Ve ctor<RefPtr<LayerChromium> >& renderSurfaceLayerList) | 749 void CCLayerTreeHostCommon::calculateDrawTransforms(LayerChromium* rootLayer, co nst IntSize& deviceViewportSize, float deviceScaleFactor, int maxTextureSize, Ve ctor<RefPtr<LayerChromium> >& renderSurfaceLayerList) |
| 767 { | 750 { |
| 768 IntRect totalDrawableContentRect; | 751 IntRect totalDrawableContentRect; |
| 752 IntRect deviceViewportRect(IntPoint::zero(), deviceViewportSize); | |
| 769 WebTransformationMatrix identityMatrix; | 753 WebTransformationMatrix identityMatrix; |
| 770 WebTransformationMatrix deviceScaleTransform; | 754 WebTransformationMatrix deviceScaleTransform; |
| 771 deviceScaleTransform.scale(deviceScaleFactor); | 755 deviceScaleTransform.scale(deviceScaleFactor); |
| 772 | 756 Vector<RefPtr<LayerChromium> > dummyLayerList; |
| 773 setupRootLayerAndSurfaceForRecursion<LayerChromium, Vector<RefPtr<LayerChrom ium> > >(rootLayer, renderSurfaceLayerList, deviceViewportSize); | |
| 774 | 757 |
| 775 cc::calculateDrawTransformsInternal<LayerChromium, Vector<RefPtr<LayerChromi um> >, RenderSurfaceChromium, void>(rootLayer, rootLayer, deviceScaleTransform, identityMatrix, identityMatrix, | 758 cc::calculateDrawTransformsInternal<LayerChromium, Vector<RefPtr<LayerChromi um> >, RenderSurfaceChromium, void>(rootLayer, rootLayer, deviceScaleTransform, identityMatrix, identityMatrix, |
| 776 rootLayer->renderSurface()->contentRect (), true, 0, renderSurfaceLayerList, | 759 deviceViewportRect, true, 0, renderSurf aceLayerList, |
| 777 rootLayer->renderSurface()->layerList() , 0, maxTextureSize, deviceScaleFactor, totalDrawableContentRect); | 760 dummyLayerList, 0, maxTextureSize, devi ceScaleFactor, totalDrawableContentRect); |
| 761 | |
| 762 // The dummy layer list should not have been used. | |
| 763 ASSERT(dummyLayerList.size() == 0); | |
| 764 // A root layer renderSurface should always exist after calcDrawTransforms. | |
| 765 ASSERT(rootLayer->renderSurface()); | |
| 778 } | 766 } |
| 779 | 767 |
| 780 void CCLayerTreeHostCommon::calculateDrawTransforms(CCLayerImpl* rootLayer, cons t IntSize& deviceViewportSize, float deviceScaleFactor, CCLayerSorter* layerSort er, int maxTextureSize, Vector<CCLayerImpl*>& renderSurfaceLayerList) | 768 void CCLayerTreeHostCommon::calculateDrawTransforms(CCLayerImpl* rootLayer, cons t IntSize& deviceViewportSize, float deviceScaleFactor, CCLayerSorter* layerSort er, int maxTextureSize, Vector<CCLayerImpl*>& renderSurfaceLayerList) |
| 781 { | 769 { |
| 782 IntRect totalDrawableContentRect; | 770 IntRect totalDrawableContentRect; |
| 771 IntRect deviceViewportRect(IntPoint::zero(), deviceViewportSize); | |
| 783 WebTransformationMatrix identityMatrix; | 772 WebTransformationMatrix identityMatrix; |
| 784 WebTransformationMatrix deviceScaleTransform; | 773 WebTransformationMatrix deviceScaleTransform; |
| 785 deviceScaleTransform.scale(deviceScaleFactor); | 774 deviceScaleTransform.scale(deviceScaleFactor); |
| 786 | 775 Vector<CCLayerImpl*> dummyLayerList; |
| 787 setupRootLayerAndSurfaceForRecursion<CCLayerImpl, Vector<CCLayerImpl*> >(roo tLayer, renderSurfaceLayerList, deviceViewportSize); | |
| 788 | 776 |
| 789 cc::calculateDrawTransformsInternal<CCLayerImpl, Vector<CCLayerImpl*>, CCRen derSurface, CCLayerSorter>(rootLayer, rootLayer, deviceScaleTransform, identityM atrix, identityMatrix, | 777 cc::calculateDrawTransformsInternal<CCLayerImpl, Vector<CCLayerImpl*>, CCRen derSurface, CCLayerSorter>(rootLayer, rootLayer, deviceScaleTransform, identityM atrix, identityMatrix, |
| 790 rootLayer->renderSurface()->contentRect(), true, 0, renderSurfaceLayerList, | 778 deviceViewportRect, true, 0, renderSurfaceLayerL ist, |
|
danakj
2012/10/09 22:21:54
Can we remove the magic true bool here and give it
| |
| 791 rootLayer->renderSurface()->layerList(), layerSo rter, maxTextureSize, deviceScaleFactor, totalDrawableContentRect); | 779 dummyLayerList, layerSorter, maxTextureSize, dev iceScaleFactor, totalDrawableContentRect); |
| 780 | |
| 781 // The dummy layer list should not have been used. | |
| 782 ASSERT(dummyLayerList.size() == 0); | |
| 783 // A root layer renderSurface should always exist after calcDrawTransforms. | |
| 784 ASSERT(rootLayer->renderSurface()); | |
| 792 } | 785 } |
| 793 | 786 |
| 794 static bool pointHitsRect(const IntPoint& viewportPoint, const WebTransformation Matrix& localSpaceToScreenSpaceTransform, FloatRect localSpaceRect) | 787 static bool pointHitsRect(const IntPoint& viewportPoint, const WebTransformation Matrix& localSpaceToScreenSpaceTransform, FloatRect localSpaceRect) |
| 795 { | 788 { |
| 796 // If the transform is not invertible, then assume that this point doesn't h it this rect. | 789 // If the transform is not invertible, then assume that this point doesn't h it this rect. |
| 797 if (!localSpaceToScreenSpaceTransform.isInvertible()) | 790 if (!localSpaceToScreenSpaceTransform.isInvertible()) |
| 798 return false; | 791 return false; |
| 799 | 792 |
| 800 // Transform the hit test point from screen space to the local space of the given rect. | 793 // Transform the hit test point from screen space to the local space of the given rect. |
| 801 bool clipped = false; | 794 bool clipped = false; |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 856 | 849 |
| 857 foundLayer = currentLayer; | 850 foundLayer = currentLayer; |
| 858 break; | 851 break; |
| 859 } | 852 } |
| 860 | 853 |
| 861 // This can potentially return 0, which means the viewportPoint did not succ essfully hit test any layers, not even the root layer. | 854 // This can potentially return 0, which means the viewportPoint did not succ essfully hit test any layers, not even the root layer. |
| 862 return foundLayer; | 855 return foundLayer; |
| 863 } | 856 } |
| 864 | 857 |
| 865 } // namespace cc | 858 } // namespace cc |
| OLD | NEW |