aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/views/SkTouchGesture.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/views/SkTouchGesture.cpp')
-rw-r--r--src/views/SkTouchGesture.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/views/SkTouchGesture.cpp b/src/views/SkTouchGesture.cpp
index 31adc74b38..1828f0390b 100644
--- a/src/views/SkTouchGesture.cpp
+++ b/src/views/SkTouchGesture.cpp
@@ -14,9 +14,9 @@
#define DISCRETIZE_TRANSLATE_TO_AVOID_FLICKER true
-static const float MAX_FLING_SPEED = 1500;
+static const SkScalar MAX_FLING_SPEED = SkIntToScalar(1500);
-static float pin_max_fling(float speed) {
+static SkScalar pin_max_fling(SkScalar speed) {
if (speed > MAX_FLING_SPEED) {
speed = MAX_FLING_SPEED;
}
@@ -50,7 +50,7 @@ static void unit_axis_align(SkVector* unit) {
void SkFlingState::reset(float sx, float sy) {
fActive = true;
- fDirection.set(sx, sy);
+ fDirection.set(SkFloatToScalar(sx), SkFloatToScalar(sy));
fSpeed0 = SkPoint::Normalize(&fDirection);
fSpeed0 = pin_max_fling(fSpeed0);
fTime0 = getseconds();
@@ -82,7 +82,7 @@ bool SkFlingState::evaluateMatrix(SkMatrix* matrix) {
tx = (float)sk_float_round2int(tx);
ty = (float)sk_float_round2int(ty);
}
- matrix->setTranslate(tx, ty);
+ matrix->setTranslate(SkFloatToScalar(tx), SkFloatToScalar(ty));
// printf("---- evaluate (%g %g)\n", tx, ty);
return true;
@@ -181,8 +181,8 @@ int SkTouchGesture::findRec(void* owner) const {
return -1;
}
-static float center(float pos0, float pos1) {
- return (pos0 + pos1) * 0.5f;
+static SkScalar center(float pos0, float pos1) {
+ return SkFloatToScalar((pos0 + pos1) * 0.5f);
}
static const float MAX_ZOOM_SCALE = 4;
@@ -190,7 +190,7 @@ static const float MIN_ZOOM_SCALE = 0.25f;
float SkTouchGesture::limitTotalZoom(float scale) const {
// this query works 'cause we know that we're square-scale w/ no skew/rotation
- const float curr = fGlobalM[0];
+ const float curr = SkScalarToFloat(fGlobalM[0]);
if (scale > 1 && curr * scale > MAX_ZOOM_SCALE) {
scale = MAX_ZOOM_SCALE / curr;