@@ -174,14 +174,14 @@ bool Calibrator::finish(int width, int height)
174174 y_min -= block_y * scale_y;
175175 y_max += block_y * scale_y;
176176
177- // Compute min/max coordinates .
178- // These are scaled using the values of old_axys
179- scale_x = (old_axys. x . max - old_axys. x . min )/( float )width;
180- x_min = (x_min * scale_x) + old_axys. x . min ;
181- x_max = (x_max * scale_x) + old_axys.x .min ;
182- scale_y = ( old_axys.y .max - old_axys.y .min )/( float )height ;
183- y_min = (y_min * scale_y) + old_axys.y .min ;
184- y_max = (y_max * scale_y) + old_axys.y .min ;
177+ // now, undo the transformations done by the X server, to obtain the true 'raw' value in X .
178+ // The raw value was scaled from old_axis to the device min/max, and from the device min/max
179+ // to the screen min/max
180+ // hence, the reverse transformation is from screen to old_axis
181+ x_min = scaleAxis (x_min, old_axys. x . max , old_axys.x .min , width, 0 ) ;
182+ x_max = scaleAxis (x_max, old_axys.x .max , old_axys.x .min , width, 0 ) ;
183+ y_min = scaleAxis (y_min, old_axys. y . max , old_axys.y .min , height, 0 ) ;
184+ y_max = scaleAxis (y_max, old_axys. y . max , old_axys.y .min , height, 0 ) ;
185185
186186
187187 // If x and y has to be swapped we also have to swap the parameters
0 commit comments