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

Side by Side Diff: cc/CCLayerTreeHostImpl.h

Issue 10916279: Chromium compositor change implementing page-scale driven pinch-zoom. (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
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 CCLayerTreeHostImpl_h 5 #ifndef CCLayerTreeHostImpl_h
6 #define CCLayerTreeHostImpl_h 6 #define CCLayerTreeHostImpl_h
7 7
8 #include "CCAnimationEvents.h" 8 #include "CCAnimationEvents.h"
9 #include "CCInputHandler.h" 9 #include "CCInputHandler.h"
10 #include "CCLayerSorter.h" 10 #include "CCLayerSorter.h"
(...skipping 24 matching lines...) Expand all
35 public: 35 public:
36 virtual void didLoseContextOnImplThread() = 0; 36 virtual void didLoseContextOnImplThread() = 0;
37 virtual void onSwapBuffersCompleteOnImplThread() = 0; 37 virtual void onSwapBuffersCompleteOnImplThread() = 0;
38 virtual void onVSyncParametersChanged(double monotonicTimebase, double inter valInSeconds) = 0; 38 virtual void onVSyncParametersChanged(double monotonicTimebase, double inter valInSeconds) = 0;
39 virtual void onCanDrawStateChanged(bool canDraw) = 0; 39 virtual void onCanDrawStateChanged(bool canDraw) = 0;
40 virtual void setNeedsRedrawOnImplThread() = 0; 40 virtual void setNeedsRedrawOnImplThread() = 0;
41 virtual void setNeedsCommitOnImplThread() = 0; 41 virtual void setNeedsCommitOnImplThread() = 0;
42 virtual void postAnimationEventsToMainThreadOnImplThread(PassOwnPtr<CCAnimat ionEventsVector>, double wallClockTime) = 0; 42 virtual void postAnimationEventsToMainThreadOnImplThread(PassOwnPtr<CCAnimat ionEventsVector>, double wallClockTime) = 0;
43 }; 43 };
44 44
45 // CCPinchZoomViewport models the bounds and offset of the viewport that is used during a pinch-zoom operation.
46 // It tracks the layout-space dimensions of the viewport before any applied scal e, and then tracks the layout-space
47 // coordinates of the viewport respecting the pinch settings.
48 class CCPinchZoomViewport {
49 public:
50 CCPinchZoomViewport() : m_pageScaleFactor(1) { }
51
52 void setTotalPageScaleFactor(float factor) { m_pageScaleFactor = factor; }
53
54 // Returns the bounds and offset of the scaled and translated viewport to us e for pinch-zoom.
55 FloatRect bounds() const;
56 const FloatPoint& scrollDelta() const { return m_pinchViewportScrollDelta; }
57
58 const FloatSize& unpinchedBounds() const { return m_unpinchedBounds; }
59 void setUnpinchedBounds(const FloatSize& bounds) { m_unpinchedBounds = bound s; }
60
61 // Apply the scroll offset in layout space to the offset of the pinch-zoom v iewport. The viewport cannot be
62 // scrolled outside of the unpinched bounds. Returns the component of the sc roll that is un-applied due to
63 // this constraint.
64 FloatSize applyScroll(FloatSize&);
65
66 private:
67 float m_pageScaleFactor;
68 FloatPoint m_pinchViewportScrollDelta;
69
70 FloatSize m_unpinchedBounds;
71 };
72
45 // CCLayerTreeHostImpl owns the CCLayerImpl tree as well as associated rendering state 73 // CCLayerTreeHostImpl owns the CCLayerImpl tree as well as associated rendering state
46 class CCLayerTreeHostImpl : public CCInputHandlerClient, 74 class CCLayerTreeHostImpl : public CCInputHandlerClient,
47 public CCRendererClient, 75 public CCRendererClient,
48 public WebKit::WebCompositorOutputSurfaceClient { 76 public WebKit::WebCompositorOutputSurfaceClient {
49 WTF_MAKE_NONCOPYABLE(CCLayerTreeHostImpl); 77 WTF_MAKE_NONCOPYABLE(CCLayerTreeHostImpl);
50 typedef Vector<CCLayerImpl*> CCLayerList; 78 typedef Vector<CCLayerImpl*> CCLayerList;
51 79
52 public: 80 public:
53 static PassOwnPtr<CCLayerTreeHostImpl> create(const CCLayerTreeSettings&, CC LayerTreeHostImplClient*); 81 static PassOwnPtr<CCLayerTreeHostImpl> create(const CCLayerTreeSettings&, CC LayerTreeHostImplClient*);
54 virtual ~CCLayerTreeHostImpl(); 82 virtual ~CCLayerTreeHostImpl();
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 bool contentsTexturesPurged() const { return m_contentsTexturesPurged; } 167 bool contentsTexturesPurged() const { return m_contentsTexturesPurged; }
140 void resetContentsTexturesPurged(); 168 void resetContentsTexturesPurged();
141 size_t memoryAllocationLimitBytes() const { return m_memoryAllocationLimitBy tes; } 169 size_t memoryAllocationLimitBytes() const { return m_memoryAllocationLimitBy tes; }
142 170
143 void setViewportSize(const IntSize& layoutViewportSize, const IntSize& devic eViewportSize); 171 void setViewportSize(const IntSize& layoutViewportSize, const IntSize& devic eViewportSize);
144 const IntSize& layoutViewportSize() const { return m_layoutViewportSize; } 172 const IntSize& layoutViewportSize() const { return m_layoutViewportSize; }
145 173
146 float deviceScaleFactor() const { return m_deviceScaleFactor; } 174 float deviceScaleFactor() const { return m_deviceScaleFactor; }
147 void setDeviceScaleFactor(float); 175 void setDeviceScaleFactor(float);
148 176
149 float pageScale() const { return m_pageScale; } 177 float pageScaleFactor() const { return m_pageScaleFactor; }
150 void setPageScaleFactorAndLimits(float pageScale, float minPageScale, float maxPageScale); 178 void setPageScaleFactorAndLimits(float pageScaleFactor, float minPageScaleFa ctor, float maxPageScaleFactor);
151 179
152 PassOwnPtr<CCScrollAndScaleSet> processScrollDeltas(); 180 PassOwnPtr<CCScrollAndScaleSet> processScrollDeltas();
153 181
154 void startPageScaleAnimation(const IntSize& tragetPosition, bool useAnchor, float scale, double durationSec); 182 void startPageScaleAnimation(const IntSize& tragetPosition, bool useAnchor, float scale, double durationSec);
155 183
156 SkColor backgroundColor() const { return m_backgroundColor; } 184 SkColor backgroundColor() const { return m_backgroundColor; }
157 void setBackgroundColor(SkColor color) { m_backgroundColor = color; } 185 void setBackgroundColor(SkColor color) { m_backgroundColor = color; }
158 186
159 bool hasTransparentBackground() const { return m_hasTransparentBackground; } 187 bool hasTransparentBackground() const { return m_hasTransparentBackground; }
160 void setHasTransparentBackground(bool transparent) { m_hasTransparentBackgro und = transparent; } 188 void setHasTransparentBackground(bool transparent) { m_hasTransparentBackgro und = transparent; }
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 int m_scrollingLayerIdFromPreviousTree; 282 int m_scrollingLayerIdFromPreviousTree;
255 bool m_scrollDeltaIsInScreenSpace; 283 bool m_scrollDeltaIsInScreenSpace;
256 CCLayerTreeSettings m_settings; 284 CCLayerTreeSettings m_settings;
257 IntSize m_layoutViewportSize; 285 IntSize m_layoutViewportSize;
258 IntSize m_deviceViewportSize; 286 IntSize m_deviceViewportSize;
259 float m_deviceScaleFactor; 287 float m_deviceScaleFactor;
260 bool m_visible; 288 bool m_visible;
261 bool m_contentsTexturesPurged; 289 bool m_contentsTexturesPurged;
262 size_t m_memoryAllocationLimitBytes; 290 size_t m_memoryAllocationLimitBytes;
263 291
264 float m_pageScale; 292 float m_pageScaleFactor;
265 float m_pageScaleDelta; 293 float m_pageScaleDelta;
266 float m_sentPageScaleDelta; 294 float m_sentPageScaleDelta;
267 float m_minPageScale, m_maxPageScale; 295 float m_minPageScaleFactor, m_maxPageScaleFactor;
268 296
269 SkColor m_backgroundColor; 297 SkColor m_backgroundColor;
270 bool m_hasTransparentBackground; 298 bool m_hasTransparentBackground;
271 299
272 // If this is true, it is necessary to traverse the layer tree ticking the a nimators. 300 // If this is true, it is necessary to traverse the layer tree ticking the a nimators.
273 bool m_needsAnimateLayers; 301 bool m_needsAnimateLayers;
274 bool m_pinchGestureActive; 302 bool m_pinchGestureActive;
275 IntPoint m_previousPinchAnchor; 303 IntPoint m_previousPinchAnchor;
276 304
277 OwnPtr<CCPageScaleAnimation> m_pageScaleAnimation; 305 OwnPtr<CCPageScaleAnimation> m_pageScaleAnimation;
278 306
279 // This is used for ticking animations slowly when hidden. 307 // This is used for ticking animations slowly when hidden.
280 OwnPtr<CCLayerTreeHostImplTimeSourceAdapter> m_timeSourceClientAdapter; 308 OwnPtr<CCLayerTreeHostImplTimeSourceAdapter> m_timeSourceClientAdapter;
281 309
282 CCLayerSorter m_layerSorter; 310 CCLayerSorter m_layerSorter;
283 311
284 // List of visible layers for the most recently prepared frame. Used for 312 // List of visible layers for the most recently prepared frame. Used for
285 // rendering and input event hit testing. 313 // rendering and input event hit testing.
286 CCLayerList m_renderSurfaceLayerList; 314 CCLayerList m_renderSurfaceLayerList;
287 315
316 CCPinchZoomViewport m_pinchZoomViewport;
317
288 OwnPtr<CCFrameRateCounter> m_fpsCounter; 318 OwnPtr<CCFrameRateCounter> m_fpsCounter;
289 OwnPtr<CCDebugRectHistory> m_debugRectHistory; 319 OwnPtr<CCDebugRectHistory> m_debugRectHistory;
290 }; 320 };
291 321
292 }; 322 };
293 323
294 #endif 324 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698