Index: cc/CCLayerTreeHostImpl.h |
=================================================================== |
--- cc/CCLayerTreeHostImpl.h (revision 156389) |
+++ cc/CCLayerTreeHostImpl.h (working copy) |
@@ -42,6 +42,34 @@ |
virtual void postAnimationEventsToMainThreadOnImplThread(PassOwnPtr<CCAnimationEventsVector>, double wallClockTime) = 0; |
}; |
+// CCPinchZoomViewport models the bounds and offset of the viewport that is used during a pinch-zoom operation. |
+// It tracks the layout-space dimensions of the viewport before any applied scale, and then tracks the layout-space |
+// coordinates of the viewport respecting the pinch settings. |
+class CCPinchZoomViewport { |
+public: |
+ CCPinchZoomViewport() : m_pageScaleFactor(1) { } |
+ |
+ void setTotalPageScaleFactor(float factor) { m_pageScaleFactor = factor; } |
+ |
+ // Returns the bounds and offset of the scaled and translated viewport to use for pinch-zoom. |
+ FloatRect bounds() const; |
+ const FloatPoint& scrollDelta() const { return m_pinchViewportScrollDelta; } |
+ |
+ const FloatSize& unpinchedBounds() const { return m_unpinchedBounds; } |
+ void setUnpinchedBounds(const FloatSize& bounds) { m_unpinchedBounds = bounds; } |
+ |
+ // Apply the scroll offset in layout space to the offset of the pinch-zoom viewport. The viewport cannot be |
+ // scrolled outside of the unpinched bounds. Returns the component of the scroll that is un-applied due to |
+ // this constraint. |
+ FloatSize applyScroll(FloatSize&); |
+ |
+private: |
+ float m_pageScaleFactor; |
+ FloatPoint m_pinchViewportScrollDelta; |
+ |
+ FloatSize m_unpinchedBounds; |
+}; |
+ |
// CCLayerTreeHostImpl owns the CCLayerImpl tree as well as associated rendering state |
class CCLayerTreeHostImpl : public CCInputHandlerClient, |
public CCRendererClient, |
@@ -146,8 +174,8 @@ |
float deviceScaleFactor() const { return m_deviceScaleFactor; } |
void setDeviceScaleFactor(float); |
- float pageScale() const { return m_pageScale; } |
- void setPageScaleFactorAndLimits(float pageScale, float minPageScale, float maxPageScale); |
+ float pageScaleFactor() const { return m_pageScaleFactor; } |
+ void setPageScaleFactorAndLimits(float pageScaleFactor, float minPageScaleFactor, float maxPageScaleFactor); |
PassOwnPtr<CCScrollAndScaleSet> processScrollDeltas(); |
@@ -261,10 +289,10 @@ |
bool m_contentsTexturesPurged; |
size_t m_memoryAllocationLimitBytes; |
- float m_pageScale; |
+ float m_pageScaleFactor; |
float m_pageScaleDelta; |
float m_sentPageScaleDelta; |
- float m_minPageScale, m_maxPageScale; |
+ float m_minPageScaleFactor, m_maxPageScaleFactor; |
SkColor m_backgroundColor; |
bool m_hasTransparentBackground; |
@@ -285,6 +313,8 @@ |
// rendering and input event hit testing. |
CCLayerList m_renderSurfaceLayerList; |
+ CCPinchZoomViewport m_pinchZoomViewport; |
+ |
OwnPtr<CCFrameRateCounter> m_fpsCounter; |
OwnPtr<CCDebugRectHistory> m_debugRectHistory; |
}; |