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

Side by Side Diff: cc/CCLayerTreeHostCommon.cpp

Issue 10916307: Add the ubercomp DelegatedRendererLayer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use OwnPtrVector Created 8 years, 3 months 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/CCLayerImpl.h ('k') | cc/CCLayerTreeHostImpl.cpp » ('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 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 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 } 334 }
335 335
336 // Should be called just before the recursive calculateDrawTransformsInternal(). 336 // Should be called just before the recursive calculateDrawTransformsInternal().
337 template<typename LayerType, typename LayerList> 337 template<typename LayerType, typename LayerList>
338 void setupRootLayerAndSurfaceForRecursion(LayerType* rootLayer, LayerList& rende rSurfaceLayerList, const IntSize& deviceViewportSize) 338 void setupRootLayerAndSurfaceForRecursion(LayerType* rootLayer, LayerList& rende rSurfaceLayerList, const IntSize& deviceViewportSize)
339 { 339 {
340 if (!rootLayer->renderSurface()) 340 if (!rootLayer->renderSurface())
341 rootLayer->createRenderSurface(); 341 rootLayer->createRenderSurface();
342 342
343 rootLayer->renderSurface()->setContentRect(IntRect(IntPoint::zero(), deviceV iewportSize)); 343 rootLayer->renderSurface()->setContentRect(IntRect(IntPoint::zero(), deviceV iewportSize));
344 rootLayer->renderSurface()->clearLayerList(); 344 rootLayer->renderSurface()->clearLayerLists();
345 345
346 ASSERT(renderSurfaceLayerList.isEmpty()); 346 ASSERT(renderSurfaceLayerList.isEmpty());
347 renderSurfaceLayerList.append(rootLayer); 347 renderSurfaceLayerList.append(rootLayer);
348 } 348 }
349 349
350 // Recursively walks the layer tree starting at the given node and computes all the 350 // Recursively walks the layer tree starting at the given node and computes all the
351 // necessary transformations, clipRects, render surfaces, etc. 351 // necessary transformations, clipRects, render surfaces, etc.
352 template<typename LayerType, typename LayerList, typename RenderSurfaceType, typ ename LayerSorter> 352 template<typename LayerType, typename LayerList, typename RenderSurfaceType, typ ename LayerSorter>
353 static void calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay er, const WebTransformationMatrix& parentMatrix, 353 static void calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay er, const WebTransformationMatrix& parentMatrix,
354 const WebTransformationMatrix& fullHierarchyMatrix, const WebTransformationM atrix& currentScrollCompensationMatrix, 354 const WebTransformationMatrix& fullHierarchyMatrix, const WebTransformationM atrix& currentScrollCompensationMatrix,
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 521
522 if (subtreeShouldRenderToSeparateSurface(layer, isScaleOrTranslation(combine dTransform))) { 522 if (subtreeShouldRenderToSeparateSurface(layer, isScaleOrTranslation(combine dTransform))) {
523 // Check back-face visibility before continuing with this surface and it s subtree 523 // Check back-face visibility before continuing with this surface and it s subtree
524 if (!layer->doubleSided() && transformToParentIsKnown(layer) && isSurfac eBackFaceVisible(layer, combinedTransform)) 524 if (!layer->doubleSided() && transformToParentIsKnown(layer) && isSurfac eBackFaceVisible(layer, combinedTransform))
525 return; 525 return;
526 526
527 if (!layer->renderSurface()) 527 if (!layer->renderSurface())
528 layer->createRenderSurface(); 528 layer->createRenderSurface();
529 529
530 RenderSurfaceType* renderSurface = layer->renderSurface(); 530 RenderSurfaceType* renderSurface = layer->renderSurface();
531 renderSurface->clearLayerList(); 531 renderSurface->clearLayerLists();
532 532
533 // The origin of the new surface is the upper left corner of the layer. 533 // The origin of the new surface is the upper left corner of the layer.
534 renderSurface->setDrawTransform(drawTransform); 534 renderSurface->setDrawTransform(drawTransform);
535 WebTransformationMatrix layerDrawTransform; 535 WebTransformationMatrix layerDrawTransform;
536 layerDrawTransform.scale(deviceScaleFactor); 536 layerDrawTransform.scale(deviceScaleFactor);
537 if (!layer->contentBounds().isEmpty() && !layer->bounds().isEmpty()) { 537 if (!layer->contentBounds().isEmpty() && !layer->bounds().isEmpty()) {
538 layerDrawTransform.scaleNonUniform(layer->bounds().width() / static_ cast<double>(layer->contentBounds().width()), 538 layerDrawTransform.scaleNonUniform(layer->bounds().width() / static_ cast<double>(layer->contentBounds().width()),
539 layer->bounds().height() / static _cast<double>(layer->contentBounds().height())); 539 layer->bounds().height() / static _cast<double>(layer->contentBounds().height()));
540 } 540 }
541 layer->setDrawTransform(layerDrawTransform); 541 layer->setDrawTransform(layerDrawTransform);
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
690 clippedContentRect.intersect(surfaceClipRect); 690 clippedContentRect.intersect(surfaceClipRect);
691 } 691 }
692 } 692 }
693 693
694 // The RenderSurface backing texture cannot exceed the maximum supported 694 // The RenderSurface backing texture cannot exceed the maximum supported
695 // texture size. 695 // texture size.
696 clippedContentRect.setWidth(std::min(clippedContentRect.width(), maxText ureSize)); 696 clippedContentRect.setWidth(std::min(clippedContentRect.width(), maxText ureSize));
697 clippedContentRect.setHeight(std::min(clippedContentRect.height(), maxTe xtureSize)); 697 clippedContentRect.setHeight(std::min(clippedContentRect.height(), maxTe xtureSize));
698 698
699 if (clippedContentRect.isEmpty()) 699 if (clippedContentRect.isEmpty())
700 renderSurface->clearLayerList(); 700 renderSurface->clearLayerLists();
701 701
702 renderSurface->setContentRect(clippedContentRect); 702 renderSurface->setContentRect(clippedContentRect);
703 renderSurface->setScreenSpaceTransform(layer->screenSpaceTransform()); 703 renderSurface->setScreenSpaceTransform(layer->screenSpaceTransform());
704 704
705 if (layer->replicaLayer()) { 705 if (layer->replicaLayer()) {
706 WebTransformationMatrix surfaceOriginToReplicaOriginTransform; 706 WebTransformationMatrix surfaceOriginToReplicaOriginTransform;
707 surfaceOriginToReplicaOriginTransform.scale(deviceScaleFactor); 707 surfaceOriginToReplicaOriginTransform.scale(deviceScaleFactor);
708 surfaceOriginToReplicaOriginTransform.translate(layer->replicaLayer( )->position().x() + layer->replicaLayer()->anchorPoint().x() * bounds.width(), 708 surfaceOriginToReplicaOriginTransform.translate(layer->replicaLayer( )->position().x() + layer->replicaLayer()->anchorPoint().x() * bounds.width(),
709 layer->replicaLayer( )->position().y() + layer->replicaLayer()->anchorPoint().y() * bounds.height()); 709 layer->replicaLayer( )->position().y() + layer->replicaLayer()->anchorPoint().y() * bounds.height());
710 surfaceOriginToReplicaOriginTransform.multiply(layer->replicaLayer() ->transform()); 710 surfaceOriginToReplicaOriginTransform.multiply(layer->replicaLayer() ->transform());
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
746 // drawn from back to front. If the preserves-3d property is also set on the parent then 746 // drawn from back to front. If the preserves-3d property is also set on the parent then
747 // skip the sorting as the parent will sort all the descendants anyway. 747 // skip the sorting as the parent will sort all the descendants anyway.
748 if (descendants.size() && layer->preserves3D() && (!layer->parent() || !laye r->parent()->preserves3D())) 748 if (descendants.size() && layer->preserves3D() && (!layer->parent() || !laye r->parent()->preserves3D()))
749 sortLayers(&descendants.at(sortingStartIndex), descendants.end(), layerS orter); 749 sortLayers(&descendants.at(sortingStartIndex), descendants.end(), layerS orter);
750 750
751 if (layer->renderSurface()) 751 if (layer->renderSurface())
752 drawableContentRectOfSubtree = enclosingIntRect(layer->renderSurface()-> drawableContentRect()); 752 drawableContentRectOfSubtree = enclosingIntRect(layer->renderSurface()-> drawableContentRect());
753 else 753 else
754 drawableContentRectOfSubtree = localDrawableContentRectOfSubtree; 754 drawableContentRectOfSubtree = localDrawableContentRectOfSubtree;
755 755
756 return; 756 if (layer->hasContributingDelegatedRenderPasses())
757 layer->renderTarget()->renderSurface()->addContributingDelegatedRenderPa ssLayer(layer);
757 } 758 }
758 759
759 // FIXME: Instead of using the following function to set visibility rects on a s econd 760 // FIXME: Instead of using the following function to set visibility rects on a s econd
760 // tree pass, revise calculateVisibleContentRect() so that this can be done in a single 761 // tree pass, revise calculateVisibleContentRect() so that this can be done in a single
761 // pass inside calculateDrawTransformsInternal<>(). 762 // pass inside calculateDrawTransformsInternal<>().
762 template<typename LayerType, typename LayerList, typename RenderSurfaceType> 763 template<typename LayerType, typename LayerList, typename RenderSurfaceType>
763 static void calculateVisibleRectsInternal(const LayerList& renderSurfaceLayerLis t) 764 static void calculateVisibleRectsInternal(const LayerList& renderSurfaceLayerLis t)
764 { 765 {
765 // Use BackToFront since it's cheap and this isn't order-dependent. 766 // Use BackToFront since it's cheap and this isn't order-dependent.
766 typedef CCLayerIterator<LayerType, LayerList, RenderSurfaceType, CCLayerIter atorActions::BackToFront> CCLayerIteratorType; 767 typedef CCLayerIterator<LayerType, LayerList, RenderSurfaceType, CCLayerIter atorActions::BackToFront> CCLayerIteratorType;
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
884 885
885 foundLayer = currentLayer; 886 foundLayer = currentLayer;
886 break; 887 break;
887 } 888 }
888 889
889 // This can potentially return 0, which means the viewportPoint did not succ essfully hit test any layers, not even the root layer. 890 // This can potentially return 0, which means the viewportPoint did not succ essfully hit test any layers, not even the root layer.
890 return foundLayer; 891 return foundLayer;
891 } 892 }
892 893
893 } // namespace cc 894 } // namespace cc
OLDNEW
« no previous file with comments | « cc/CCLayerImpl.h ('k') | cc/CCLayerTreeHostImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698