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

Side by Side Diff: cc/CCLayerTreeHostCommon.h

Issue 10940002: Add wrapper container for a vector of OwnPtr<T> (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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/CCLayerTreeHost.h ('k') | cc/CCLayerTreeHostCommon.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 #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 <public/WebTransformationMatrix.h> 11 #include <public/WebTransformationMatrix.h>
11 #include <wtf/RefPtr.h> 12 #include <wtf/RefPtr.h>
12 #include <wtf/Vector.h> 13 #include <wtf/Vector.h>
13 14
14 namespace cc { 15 namespace cc {
15 16
16 class CCLayerImpl; 17 class CCLayerImpl;
17 class CCLayerSorter; 18 class CCLayerSorter;
18 class LayerChromium; 19 class LayerChromium;
19 20
20 class CCLayerTreeHostCommon { 21 class CCLayerTreeHostCommon {
21 public: 22 public:
22 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&);
23 24
24 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);
25 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);
26 27
27 static void calculateVisibleRects(Vector<CCLayerImpl*>& renderSurfaceLayerLi st); 28 static void calculateVisibleRects(Vector<CCLayerImpl*>& renderSurfaceLayerLi st);
28 static void calculateVisibleRects(Vector<RefPtr<LayerChromium> >& renderSurf aceLayerList); 29 static void calculateVisibleRects(Vector<RefPtr<LayerChromium> >& renderSurf aceLayerList);
29 30
30 // Performs hit testing for a given renderSurfaceLayerList. 31 // Performs hit testing for a given renderSurfaceLayerList.
31 static CCLayerImpl* findLayerThatIsHitByPoint(const IntPoint& viewportPoint, Vector<CCLayerImpl*>& renderSurfaceLayerList); 32 static CCLayerImpl* findLayerThatIsHitByPoint(const IntPoint& viewportPoint, Vector<CCLayerImpl*>& renderSurfaceLayerList);
32 33
33 template<typename LayerType> static bool renderSurfaceContributesToTarget(La yerType*, int targetSurfaceLayerID); 34 template<typename LayerType> static bool renderSurfaceContributesToTarget(La yerType*, int targetSurfaceLayerID);
34 35
35 // Returns a layer with the given id if one exists in the subtree starting 36 // Returns a layer with the given id if one exists in the subtree starting
36 // from the given root layer (including mask and replica layers). 37 // from the given root layer (including mask and replica layers).
37 template<typename LayerType> static LayerType* findLayerInSubtree(LayerType* rootLayer, int layerId); 38 template<typename LayerType> static LayerType* findLayerInSubtree(LayerType* rootLayer, int layerId);
38 39
40 static LayerChromium* getChildAsRawPtr(const Vector<RefPtr<LayerChromium> >& children, size_t index)
41 {
42 return children[index].get();
43 }
44
45 static CCLayerImpl* getChildAsRawPtr(const OwnPtrVector<CCLayerImpl>& childr en, size_t index)
46 {
47 return children[index];
48 }
49
39 struct ScrollUpdateInfo { 50 struct ScrollUpdateInfo {
40 int layerId; 51 int layerId;
41 IntSize scrollDelta; 52 IntSize scrollDelta;
42 }; 53 };
43 }; 54 };
44 55
45 struct CCScrollAndScaleSet { 56 struct CCScrollAndScaleSet {
46 Vector<CCLayerTreeHostCommon::ScrollUpdateInfo> scrolls; 57 Vector<CCLayerTreeHostCommon::ScrollUpdateInfo> scrolls;
47 float pageScaleDelta; 58 float pageScaleDelta;
48 }; 59 };
(...skipping 18 matching lines...) Expand all
67 if (rootLayer->id() == layerId) 78 if (rootLayer->id() == layerId)
68 return rootLayer; 79 return rootLayer;
69 80
70 if (rootLayer->maskLayer() && rootLayer->maskLayer()->id() == layerId) 81 if (rootLayer->maskLayer() && rootLayer->maskLayer()->id() == layerId)
71 return rootLayer->maskLayer(); 82 return rootLayer->maskLayer();
72 83
73 if (rootLayer->replicaLayer() && rootLayer->replicaLayer()->id() == layerId) 84 if (rootLayer->replicaLayer() && rootLayer->replicaLayer()->id() == layerId)
74 return rootLayer->replicaLayer(); 85 return rootLayer->replicaLayer();
75 86
76 for (size_t i = 0; i < rootLayer->children().size(); ++i) { 87 for (size_t i = 0; i < rootLayer->children().size(); ++i) {
77 if (LayerType* found = findLayerInSubtree(rootLayer->children()[i].get() , layerId)) 88 if (LayerType* found = findLayerInSubtree(getChildAsRawPtr(rootLayer->ch ildren(), i), layerId))
78 return found; 89 return found;
79 } 90 }
80 return 0; 91 return 0;
81 } 92 }
82 93
83 } // namespace cc 94 } // namespace cc
84 95
85 #endif 96 #endif
OLDNEW
« no previous file with comments | « cc/CCLayerTreeHost.h ('k') | cc/CCLayerTreeHostCommon.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698