| 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 "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "cc/scoped_ptr_vector.h" | 9 #include "cc/scoped_ptr_vector.h" |
| 10 #include "IntRect.h" | 10 #include "ui/gfx/rect.h" |
| 11 #include "IntSize.h" | 11 #include "IntSize.h" |
| 12 #include <public/WebTransformationMatrix.h> | 12 #include <public/WebTransformationMatrix.h> |
| 13 | 13 |
| 14 namespace cc { | 14 namespace cc { |
| 15 | 15 |
| 16 class LayerImpl; | 16 class LayerImpl; |
| 17 class LayerSorter; | 17 class LayerSorter; |
| 18 class Layer; | 18 class Layer; |
| 19 | 19 |
| 20 class LayerTreeHostCommon { | 20 class LayerTreeHostCommon { |
| 21 public: | 21 public: |
| 22 static IntRect calculateVisibleRect(const IntRect& targetSurfaceRect, const
IntRect& layerBoundRect, const WebKit::WebTransformationMatrix&); | 22 static gfx::Rect calculateVisibleRect(const gfx::Rect& targetSurfaceRect, co
nst gfx::Rect& layerBoundRect, const WebKit::WebTransformationMatrix&); |
| 23 | 23 |
| 24 static void calculateDrawTransforms(Layer* rootLayer, const IntSize& deviceV
iewportSize, float deviceScaleFactor, float pageScaleFactor, int maxTextureSize,
std::vector<scoped_refptr<Layer> >& renderSurfaceLayerList); | 24 static void calculateDrawTransforms(Layer* rootLayer, const gfx::Size& devic
eViewportSize, float deviceScaleFactor, float pageScaleFactor, int maxTextureSiz
e, std::vector<scoped_refptr<Layer> >& renderSurfaceLayerList); |
| 25 static void calculateDrawTransforms(LayerImpl* rootLayer, const IntSize& dev
iceViewportSize, float deviceScaleFactor, float pageScaleFactor, LayerSorter*, i
nt maxTextureSize, std::vector<LayerImpl*>& renderSurfaceLayerList); | 25 static void calculateDrawTransforms(LayerImpl* rootLayer, const gfx::Size& d
eviceViewportSize, float deviceScaleFactor, float pageScaleFactor, LayerSorter*,
int maxTextureSize, std::vector<LayerImpl*>& renderSurfaceLayerList); |
| 26 | 26 |
| 27 // Performs hit testing for a given renderSurfaceLayerList. | 27 // Performs hit testing for a given renderSurfaceLayerList. |
| 28 static LayerImpl* findLayerThatIsHitByPoint(const IntPoint& screenSpacePoint
, std::vector<LayerImpl*>& renderSurfaceLayerList); | 28 static LayerImpl* findLayerThatIsHitByPoint(const gfx::Point& screenSpacePoi
nt, std::vector<LayerImpl*>& renderSurfaceLayerList); |
| 29 | 29 |
| 30 template<typename LayerType> static bool renderSurfaceContributesToTarget(La
yerType*, int targetSurfaceLayerID); | 30 template<typename LayerType> static bool renderSurfaceContributesToTarget(La
yerType*, int targetSurfaceLayerID); |
| 31 | 31 |
| 32 // Returns a layer with the given id if one exists in the subtree starting | 32 // Returns a layer with the given id if one exists in the subtree starting |
| 33 // from the given root layer (including mask and replica layers). | 33 // from the given root layer (including mask and replica layers). |
| 34 template<typename LayerType> static LayerType* findLayerInSubtree(LayerType*
rootLayer, int layerId); | 34 template<typename LayerType> static LayerType* findLayerInSubtree(LayerType*
rootLayer, int layerId); |
| 35 | 35 |
| 36 static Layer* getChildAsRawPtr(const std::vector<scoped_refptr<Layer> >& chi
ldren, size_t index) | 36 static Layer* getChildAsRawPtr(const std::vector<scoped_refptr<Layer> >& chi
ldren, size_t index) |
| 37 { | 37 { |
| 38 return children[index].get(); | 38 return children[index].get(); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 for (size_t i = 0; i < rootLayer->children().size(); ++i) { | 86 for (size_t i = 0; i < rootLayer->children().size(); ++i) { |
| 87 if (LayerType* found = findLayerInSubtree(getChildAsRawPtr(rootLayer->ch
ildren(), i), layerId)) | 87 if (LayerType* found = findLayerInSubtree(getChildAsRawPtr(rootLayer->ch
ildren(), i), layerId)) |
| 88 return found; | 88 return found; |
| 89 } | 89 } |
| 90 return 0; | 90 return 0; |
| 91 } | 91 } |
| 92 | 92 |
| 93 } // namespace cc | 93 } // namespace cc |
| 94 | 94 |
| 95 #endif | 95 #endif |
| OLD | NEW |