On Wed, Feb 12, 2014 at 08:03:17PM +0100, Egbert Eich wrote:
> From: Egbert Eich <e...@suse.com>
> 
> If minPressure == wcmMaxZ then the range left to scale is 0. Catch
> this condition and act appropriately.
> 
> Signed-off-by: Egbert Eich <e...@suse.com>
> ---
>  src/wcmCommon.c | 13 +++++++++----
>  1 file changed, 9 insertions(+), 4 deletions(-)
> 
> diff --git a/src/wcmCommon.c b/src/wcmCommon.c
> index ec7ea7e..0ea7be8 100644
> --- a/src/wcmCommon.c
> +++ b/src/wcmCommon.c
> @@ -1071,6 +1071,7 @@ normalizePressure(const WacomDevicePtr priv, const 
> WacomDeviceState *ds)
>       WacomCommonPtr common = priv->common;
>       double pressure;
>       int p = ds->pressure;
> +     int range_left;
>  
>       if (p < priv->minPressure)
>       {
> @@ -1081,10 +1082,14 @@ normalizePressure(const WacomDevicePtr priv, const 
> WacomDeviceState *ds)
>       }
>  
>       /* normalize pressure to 0..FILTER_PRESSURE_RES */
> -     pressure = xf86ScaleAxis(p - priv->minPressure,
> -                              FILTER_PRESSURE_RES, 0,
> -                              common->wcmMaxZ - priv->minPressure,
> -                              0);
> +     range_left = common->wcmMaxZ - priv->minPressure;
> +     if (range_left >= 1)
> +             pressure = xf86ScaleAxis(p - priv->minPressure,
> +                                      FILTER_PRESSURE_RES, 0,
> +                                      range_left,
> +                                      0);
> +     else
> +             pressure = FILTER_PRESSURE_RES;

Reviewed-by: Peter Hutterer <peter.hutte...@who-t.net>

Cheers,
   Peter


>  
>       return (int)pressure;
>  }
> -- 
> 1.8.1.4
> 

------------------------------------------------------------------------------
Android apps run on BlackBerry 10
Introducing the new BlackBerry 10.2.1 Runtime for Android apps.
Now with support for Jelly Bean, Bluetooth, Mapview and more.
Get your Android app in front of a whole new audience.  Start now.
http://pubads.g.doubleclick.net/gampad/clk?id=124407151&iu=/4140/ostg.clktrk
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to