| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 #ifndef SkTouchGesture_DEFINED | 8 #ifndef SkTouchGesture_DEFINED |
| 9 #define SkTouchGesture_DEFINED | 9 #define SkTouchGesture_DEFINED |
| 10 | 10 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 void touchMoved(void* owner, float x, float y); | 36 void touchMoved(void* owner, float x, float y); |
| 37 void touchEnd(void* owner); | 37 void touchEnd(void* owner); |
| 38 void reset(); | 38 void reset(); |
| 39 | 39 |
| 40 bool isActive() { return fFlinger.isActive(); } | 40 bool isActive() { return fFlinger.isActive(); } |
| 41 void stop() { fFlinger.stop(); } | 41 void stop() { fFlinger.stop(); } |
| 42 | 42 |
| 43 const SkMatrix& localM(); | 43 const SkMatrix& localM(); |
| 44 const SkMatrix& globalM() const { return fGlobalM; } | 44 const SkMatrix& globalM() const { return fGlobalM; } |
| 45 | 45 |
| 46 void setTransLimit(const SkRect& contentRect, const SkRect& windowRect); |
| 47 |
| 46 private: | 48 private: |
| 47 enum State { | 49 enum State { |
| 48 kEmpty_State, | 50 kEmpty_State, |
| 49 kTranslate_State, | 51 kTranslate_State, |
| 50 kZoom_State, | 52 kZoom_State, |
| 51 }; | 53 }; |
| 52 | 54 |
| 53 struct Rec { | 55 struct Rec { |
| 54 void* fOwner; | 56 void* fOwner; |
| 55 float fStartX, fStartY; | 57 float fStartX, fStartY; |
| 56 float fPrevX, fPrevY; | 58 float fPrevX, fPrevY; |
| 57 float fLastX, fLastY; | 59 float fLastX, fLastY; |
| 58 float fPrevT, fLastT; | 60 float fPrevT, fLastT; |
| 59 }; | 61 }; |
| 60 SkTDArray<Rec> fTouches; | 62 SkTDArray<Rec> fTouches; |
| 61 | 63 |
| 62 State fState; | 64 State fState; |
| 63 SkMatrix fLocalM, fGlobalM; | 65 SkMatrix fLocalM, fGlobalM; |
| 64 SkFlingState fFlinger; | 66 SkFlingState fFlinger; |
| 65 double fLastUpMillis; | 67 double fLastUpMillis; |
| 66 SkPoint fLastUpP; | 68 SkPoint fLastUpP; |
| 67 | 69 |
| 70 // The following rects are used to limit the translation so the content neve
r leaves the window |
| 71 SkRect fContentRect, fWindowRect; |
| 72 bool fIsTransLimited = false; |
| 68 | 73 |
| 74 void limitTrans(); // here we only limit the translation with respect to glo
balM |
| 69 void flushLocalM(); | 75 void flushLocalM(); |
| 70 int findRec(void* owner) const; | 76 int findRec(void* owner) const; |
| 71 void appendNewRec(void* owner, float x, float y); | 77 void appendNewRec(void* owner, float x, float y); |
| 72 float computePinch(const Rec&, const Rec&); | 78 float computePinch(const Rec&, const Rec&); |
| 73 float limitTotalZoom(float scale) const; | 79 float limitTotalZoom(float scale) const; |
| 74 bool handleDblTap(float, float); | 80 bool handleDblTap(float, float); |
| 75 }; | 81 }; |
| 76 | 82 |
| 77 #endif | 83 #endif |
| OLD | NEW |