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" |
11 #include "CCLayerIterator.h" | 11 #include "CCLayerIterator.h" |
12 #include "CCLayerSorter.h" | 12 #include "CCLayerSorter.h" |
13 #include "CCMathUtil.h" | 13 #include "CCMathUtil.h" |
14 #include "CCRenderSurface.h" | 14 #include "CCRenderSurface.h" |
15 #include "FloatQuad.h" | 15 #include "FloatQuad.h" |
16 #include "IntRect.h" | 16 #include "IntRect.h" |
17 #include "LayerChromium.h" | 17 #include "LayerChromium.h" |
18 #include "RenderSurfaceChromium.h" | 18 #include "RenderSurfaceChromium.h" |
19 #include <public/WebTransformationMatrix.h> | 19 #include <public/WebTransformationMatrix.h> |
20 | 20 |
21 using WebKit::WebTransformationMatrix; | 21 using WebKit::WebTransformationMatrix; |
22 | 22 |
23 namespace WebCore { | 23 namespace cc { |
24 | 24 |
25 IntRect CCLayerTreeHostCommon::calculateVisibleRect(const IntRect& targetSurface
Rect, const IntRect& layerBoundRect, const WebTransformationMatrix& transform) | 25 IntRect CCLayerTreeHostCommon::calculateVisibleRect(const IntRect& targetSurface
Rect, const IntRect& layerBoundRect, const WebTransformationMatrix& transform) |
26 { | 26 { |
27 // Is this layer fully contained within the target surface? | 27 // Is this layer fully contained within the target surface? |
28 IntRect layerInSurfaceSpace = CCMathUtil::mapClippedRect(transform, layerBou
ndRect); | 28 IntRect layerInSurfaceSpace = CCMathUtil::mapClippedRect(transform, layerBou
ndRect); |
29 if (targetSurfaceRect.contains(layerInSurfaceSpace)) | 29 if (targetSurfaceRect.contains(layerInSurfaceSpace)) |
30 return layerBoundRect; | 30 return layerBoundRect; |
31 | 31 |
32 // If the layer doesn't fill up the entire surface, then find the part of | 32 // If the layer doesn't fill up the entire surface, then find the part of |
33 // the surface rect where the layer could be visible. This avoids trying to | 33 // the surface rect where the layer could be visible. This avoids trying to |
(...skipping 741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
775 | 775 |
776 void CCLayerTreeHostCommon::calculateDrawTransforms(LayerChromium* rootLayer, co
nst IntSize& deviceViewportSize, float deviceScaleFactor, int maxTextureSize, Ve
ctor<RefPtr<LayerChromium> >& renderSurfaceLayerList) | 776 void CCLayerTreeHostCommon::calculateDrawTransforms(LayerChromium* rootLayer, co
nst IntSize& deviceViewportSize, float deviceScaleFactor, int maxTextureSize, Ve
ctor<RefPtr<LayerChromium> >& renderSurfaceLayerList) |
777 { | 777 { |
778 IntRect totalDrawableContentRect; | 778 IntRect totalDrawableContentRect; |
779 WebTransformationMatrix identityMatrix; | 779 WebTransformationMatrix identityMatrix; |
780 WebTransformationMatrix deviceScaleTransform; | 780 WebTransformationMatrix deviceScaleTransform; |
781 deviceScaleTransform.scale(deviceScaleFactor); | 781 deviceScaleTransform.scale(deviceScaleFactor); |
782 | 782 |
783 setupRootLayerAndSurfaceForRecursion<LayerChromium, Vector<RefPtr<LayerChrom
ium> > >(rootLayer, renderSurfaceLayerList, deviceViewportSize); | 783 setupRootLayerAndSurfaceForRecursion<LayerChromium, Vector<RefPtr<LayerChrom
ium> > >(rootLayer, renderSurfaceLayerList, deviceViewportSize); |
784 | 784 |
785 WebCore::calculateDrawTransformsInternal<LayerChromium, Vector<RefPtr<LayerC
hromium> >, RenderSurfaceChromium, void>(rootLayer, rootLayer, deviceScaleTransf
orm, identityMatrix, identityMatrix, | 785 cc::calculateDrawTransformsInternal<LayerChromium, Vector<RefPtr<LayerChromi
um> >, RenderSurfaceChromium, void>(rootLayer, rootLayer, deviceScaleTransform,
identityMatrix, identityMatrix, |
786
rootLayer->renderSurface()->contentRect
(), true, 0, renderSurfaceLayerList, | 786
rootLayer->renderSurface()->contentRect
(), true, 0, renderSurfaceLayerList, |
787
rootLayer->renderSurface()->layerList()
, 0, maxTextureSize, deviceScaleFactor, totalDrawableContentRect); | 787
rootLayer->renderSurface()->layerList()
, 0, maxTextureSize, deviceScaleFactor, totalDrawableContentRect); |
788 } | 788 } |
789 | 789 |
790 void CCLayerTreeHostCommon::calculateDrawTransforms(CCLayerImpl* rootLayer, cons
t IntSize& deviceViewportSize, float deviceScaleFactor, CCLayerSorter* layerSort
er, int maxTextureSize, Vector<CCLayerImpl*>& renderSurfaceLayerList) | 790 void CCLayerTreeHostCommon::calculateDrawTransforms(CCLayerImpl* rootLayer, cons
t IntSize& deviceViewportSize, float deviceScaleFactor, CCLayerSorter* layerSort
er, int maxTextureSize, Vector<CCLayerImpl*>& renderSurfaceLayerList) |
791 { | 791 { |
792 IntRect totalDrawableContentRect; | 792 IntRect totalDrawableContentRect; |
793 WebTransformationMatrix identityMatrix; | 793 WebTransformationMatrix identityMatrix; |
794 WebTransformationMatrix deviceScaleTransform; | 794 WebTransformationMatrix deviceScaleTransform; |
795 deviceScaleTransform.scale(deviceScaleFactor); | 795 deviceScaleTransform.scale(deviceScaleFactor); |
796 | 796 |
797 setupRootLayerAndSurfaceForRecursion<CCLayerImpl, Vector<CCLayerImpl*> >(roo
tLayer, renderSurfaceLayerList, deviceViewportSize); | 797 setupRootLayerAndSurfaceForRecursion<CCLayerImpl, Vector<CCLayerImpl*> >(roo
tLayer, renderSurfaceLayerList, deviceViewportSize); |
798 | 798 |
799 WebCore::calculateDrawTransformsInternal<CCLayerImpl, Vector<CCLayerImpl*>,
CCRenderSurface, CCLayerSorter>(rootLayer, rootLayer, deviceScaleTransform, iden
tityMatrix, identityMatrix, | 799 cc::calculateDrawTransformsInternal<CCLayerImpl, Vector<CCLayerImpl*>, CCRen
derSurface, CCLayerSorter>(rootLayer, rootLayer, deviceScaleTransform, identityM
atrix, identityMatrix, |
800
rootLayer->renderSurface()->contentRect(), true,
0, renderSurfaceLayerList, | 800
rootLayer->renderSurface()->contentRect(), true,
0, renderSurfaceLayerList, |
801
rootLayer->renderSurface()->layerList(), layerSo
rter, maxTextureSize, deviceScaleFactor, totalDrawableContentRect); | 801
rootLayer->renderSurface()->layerList(), layerSo
rter, maxTextureSize, deviceScaleFactor, totalDrawableContentRect); |
802 } | 802 } |
803 | 803 |
804 void CCLayerTreeHostCommon::calculateVisibleRects(Vector<RefPtr<LayerChromium> >
& renderSurfaceLayerList) | 804 void CCLayerTreeHostCommon::calculateVisibleRects(Vector<RefPtr<LayerChromium> >
& renderSurfaceLayerList) |
805 { | 805 { |
806 calculateVisibleRectsInternal<LayerChromium, Vector<RefPtr<LayerChromium> >,
RenderSurfaceChromium>(renderSurfaceLayerList); | 806 calculateVisibleRectsInternal<LayerChromium, Vector<RefPtr<LayerChromium> >,
RenderSurfaceChromium>(renderSurfaceLayerList); |
807 } | 807 } |
808 | 808 |
809 void CCLayerTreeHostCommon::calculateVisibleRects(Vector<CCLayerImpl*>& renderSu
rfaceLayerList) | 809 void CCLayerTreeHostCommon::calculateVisibleRects(Vector<CCLayerImpl*>& renderSu
rfaceLayerList) |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
875 continue; | 875 continue; |
876 | 876 |
877 foundLayer = currentLayer; | 877 foundLayer = currentLayer; |
878 break; | 878 break; |
879 } | 879 } |
880 | 880 |
881 // This can potentially return 0, which means the viewportPoint did not succ
essfully hit test any layers, not even the root layer. | 881 // This can potentially return 0, which means the viewportPoint did not succ
essfully hit test any layers, not even the root layer. |
882 return foundLayer; | 882 return foundLayer; |
883 } | 883 } |
884 | 884 |
885 } // namespace WebCore | 885 } // namespace cc |
OLD | NEW |