diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2014-01-23 04:26:03 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2014-01-23 04:26:03 +0100 |
commit | 5296a52fec9288f22aaf6c4a5f8141d8a36014fc (patch) | |
tree | 245b13397c32a16294021d14d9872dffc5744fdb /ftnoir_posewidget | |
parent | 6b1a0d5705d3eea34fbdc6a8acf6aa6bc225a868 (diff) |
glwidget: don't use doubles for no good reason
Diffstat (limited to 'ftnoir_posewidget')
-rw-r--r-- | ftnoir_posewidget/glwidget.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/ftnoir_posewidget/glwidget.cpp b/ftnoir_posewidget/glwidget.cpp index 590edbc6..ab8bede1 100644 --- a/ftnoir_posewidget/glwidget.cpp +++ b/ftnoir_posewidget/glwidget.cpp @@ -186,20 +186,20 @@ void GLWidget::project_quad_texture() { int qx2 = std::min<int>(ow - 1, std::max<int>(0, qx + 1.0)); int qy2 = std::min<int>(oh - 1, std::max<int>(0, qy + 1.0)); - double r = (4 * (double) orig[qy1 * orig_pitch + qx1 * orig_depth + 2] - + 1 * (double) orig[qy2 * orig_pitch + qx2 * orig_depth + 2] - + 2 * (double) orig[qy1 * orig_pitch + qx2 * orig_depth + 2] - + 2 * (double) orig[qy2 * orig_pitch + qx1 * orig_depth + 2]) / 9; + int r = (4 * orig[qy1 * orig_pitch + qx1 * orig_depth + 2] + + 1 * orig[qy2 * orig_pitch + qx2 * orig_depth + 2] + + 2 * orig[qy1 * orig_pitch + qx2 * orig_depth + 2] + + 2 * orig[qy2 * orig_pitch + qx1 * orig_depth + 2]) / 9; - double g = (4 * (double) orig[qy1 * orig_pitch + qx1 * orig_depth + 1] - + 1 * (double) orig[qy2 * orig_pitch + qx2 * orig_depth + 1] - + 2 * (double) orig[qy1 * orig_pitch + qx2 * orig_depth + 1] - + 2 * (double) orig[qy2 * orig_pitch + qx1 * orig_depth + 1]) / 9; + int g = (4 * orig[qy1 * orig_pitch + qx1 * orig_depth + 1] + + 1 * orig[qy2 * orig_pitch + qx2 * orig_depth + 1] + + 2 * orig[qy1 * orig_pitch + qx2 * orig_depth + 1] + + 2 * orig[qy2 * orig_pitch + qx1 * orig_depth + 1]) / 9; - double b = (4 * (double) orig[qy1 * orig_pitch + qx1 * orig_depth + 0] - + 1 * (double) orig[qy2 * orig_pitch + qx2 * orig_depth + 0] - + 2 * (double) orig[qy1 * orig_pitch + qx2 * orig_depth + 0] - + 2 * (double) orig[qy2 * orig_pitch + qx1 * orig_depth + 0]) / 9; + int b = (4 * orig[qy1 * orig_pitch + qx1 * orig_depth + 0] + + 1 * orig[qy2 * orig_pitch + qx2 * orig_depth + 0] + + 2 * orig[qy1 * orig_pitch + qx2 * orig_depth + 0] + + 2 * orig[qy2 * orig_pitch + qx1 * orig_depth + 0]) / 9; dest[y * dest_pitch + x * dest_depth + 0] = std::max<int>(0, std::min<int>(255, r)); dest[y * dest_pitch + x * dest_depth + 1] = std::max<int>(0, std::min<int>(255, g)); |