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 #ifndef CCLayerTreeHostCommon_h | 5 #ifndef CCLayerTreeHostCommon_h |
6 #define CCLayerTreeHostCommon_h | 6 #define CCLayerTreeHostCommon_h |
7 | 7 |
8 #include "IntRect.h" | 8 #include "IntRect.h" |
9 #include "IntSize.h" | 9 #include "IntSize.h" |
10 #include "cc/own_ptr_vector.h" | 10 #include "cc/own_ptr_vector.h" |
11 #include <public/WebTransformationMatrix.h> | 11 #include <public/WebTransformationMatrix.h> |
12 #include <wtf/RefPtr.h> | 12 #include <wtf/RefPtr.h> |
13 #include <wtf/Vector.h> | 13 #include <wtf/Vector.h> |
14 | 14 |
15 namespace cc { | 15 namespace cc { |
16 | 16 |
17 class CCLayerImpl; | 17 class CCLayerImpl; |
18 class CCLayerSorter; | 18 class CCLayerSorter; |
19 class LayerChromium; | 19 class LayerChromium; |
20 | 20 |
21 class CCLayerTreeHostCommon { | 21 class CCLayerTreeHostCommon { |
22 public: | 22 public: |
23 static IntRect calculateVisibleRect(const IntRect& targetSurfaceRect, const
IntRect& layerBoundRect, const WebKit::WebTransformationMatrix&); | 23 static IntRect calculateVisibleRect(const IntRect& targetSurfaceRect, const
IntRect& layerBoundRect, const WebKit::WebTransformationMatrix&); |
24 | 24 |
25 static void calculateDrawTransforms(LayerChromium* rootLayer, const IntSize&
deviceViewportSize, float deviceScaleFactor, int maxTextureSize, Vector<RefPtr<
LayerChromium> >& renderSurfaceLayerList); | 25 static void calculateDrawTransforms(LayerChromium* rootLayer, const IntSize&
deviceViewportSize, float deviceScaleFactor, int maxTextureSize, Vector<RefPtr<
LayerChromium> >& renderSurfaceLayerList); |
26 static void calculateDrawTransforms(CCLayerImpl* rootLayer, const IntSize& d
eviceViewportSize, float deviceScaleFactor, CCLayerSorter*, int maxTextureSize,
Vector<CCLayerImpl*>& renderSurfaceLayerList); | 26 static void calculateDrawTransforms(CCLayerImpl* rootLayer, const IntSize& d
eviceViewportSize, float deviceScaleFactor, CCLayerSorter*, int maxTextureSize,
Vector<CCLayerImpl*>& renderSurfaceLayerList); |
27 | 27 |
28 static void calculateVisibleRects(Vector<CCLayerImpl*>& renderSurfaceLayerLi
st); | |
29 static void calculateVisibleRects(Vector<RefPtr<LayerChromium> >& renderSurf
aceLayerList); | |
30 | |
31 // Performs hit testing for a given renderSurfaceLayerList. | 28 // Performs hit testing for a given renderSurfaceLayerList. |
32 static CCLayerImpl* findLayerThatIsHitByPoint(const IntPoint& viewportPoint,
Vector<CCLayerImpl*>& renderSurfaceLayerList); | 29 static CCLayerImpl* findLayerThatIsHitByPoint(const IntPoint& viewportPoint,
Vector<CCLayerImpl*>& renderSurfaceLayerList); |
33 | 30 |
34 template<typename LayerType> static bool renderSurfaceContributesToTarget(La
yerType*, int targetSurfaceLayerID); | 31 template<typename LayerType> static bool renderSurfaceContributesToTarget(La
yerType*, int targetSurfaceLayerID); |
35 | 32 |
36 // Returns a layer with the given id if one exists in the subtree starting | 33 // Returns a layer with the given id if one exists in the subtree starting |
37 // from the given root layer (including mask and replica layers). | 34 // from the given root layer (including mask and replica layers). |
38 template<typename LayerType> static LayerType* findLayerInSubtree(LayerType*
rootLayer, int layerId); | 35 template<typename LayerType> static LayerType* findLayerInSubtree(LayerType*
rootLayer, int layerId); |
39 | 36 |
40 static LayerChromium* getChildAsRawPtr(const Vector<RefPtr<LayerChromium> >&
children, size_t index) | 37 static LayerChromium* getChildAsRawPtr(const Vector<RefPtr<LayerChromium> >&
children, size_t index) |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 for (size_t i = 0; i < rootLayer->children().size(); ++i) { | 87 for (size_t i = 0; i < rootLayer->children().size(); ++i) { |
91 if (LayerType* found = findLayerInSubtree(getChildAsRawPtr(rootLayer->ch
ildren(), i), layerId)) | 88 if (LayerType* found = findLayerInSubtree(getChildAsRawPtr(rootLayer->ch
ildren(), i), layerId)) |
92 return found; | 89 return found; |
93 } | 90 } |
94 return 0; | 91 return 0; |
95 } | 92 } |
96 | 93 |
97 } // namespace cc | 94 } // namespace cc |
98 | 95 |
99 #endif | 96 #endif |
OLD | NEW |