• R/O
  • HTTP
  • SSH
  • HTTPS

提交

标签
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

A generic touchscreen calibration program for X.Org


Commit MetaInfo

修订版1f4a9b8acfa01eba0f6a62d4a36287208628c74e (tree)
时间2012-06-27 04:59:28
作者Tias Guns <tias@ulys...>
CommiterTias Guns

Log Message

calib calculation: move min/max correction before transformation

更改概述

差异

--- a/src/calibrator.cpp
+++ b/src/calibrator.cpp
@@ -160,15 +160,6 @@ bool Calibrator::finish(int width, int height)
160160 new_axis.y.min = round( (clicked.y[UL] + clicked.y[UR])/2.0 );
161161 new_axis.y.max = round( (clicked.y[LL] + clicked.y[LR])/2.0 );
162162
163- // Compute min/max coordinates.
164- // These are scaled using the values of old_axys
165- const float scale_x = (old_axys.x.max - old_axys.x.min)/(float)width;
166- new_axis.x.min = (new_axis.x.min * scale_x) + old_axys.x.min;
167- new_axis.x.max = (new_axis.x.max * scale_x) + old_axys.x.min;
168- const float scale_y = (old_axys.y.max - old_axys.y.min)/(float)height;
169- new_axis.y.min = (new_axis.y.min * scale_y) + old_axys.y.min;
170- new_axis.y.max = (new_axis.y.max * scale_y) + old_axys.y.min;
171-
172163 // Add/subtract the offset that comes from not having the points in the
173164 // corners (using the same coordinate system they are currently in)
174165 const int delta_x = (new_axis.x.max - new_axis.x.min) / (float)(num_blocks - 2);
@@ -178,6 +169,15 @@ bool Calibrator::finish(int width, int height)
178169 new_axis.y.min -= delta_y;
179170 new_axis.y.max += delta_y;
180171
172+ // Compute min/max coordinates.
173+ // These are scaled using the values of old_axys
174+ const float scale_x = (old_axys.x.max - old_axys.x.min)/(float)width;
175+ new_axis.x.min = (new_axis.x.min * scale_x) + old_axys.x.min;
176+ new_axis.x.max = (new_axis.x.max * scale_x) + old_axys.x.min;
177+ const float scale_y = (old_axys.y.max - old_axys.y.min)/(float)height;
178+ new_axis.y.min = (new_axis.y.min * scale_y) + old_axys.y.min;
179+ new_axis.y.max = (new_axis.y.max * scale_y) + old_axys.y.min;
180+
181181
182182 // If x and y has to be swapped we also have to swap the parameters
183183 if (do_swap_xy) {