summaryrefslogtreecommitdiff
path: root/src/GipfelWidget.cxx
diff options
context:
space:
mode:
authorJohannes Hofmann <Johannes.Hofmann@gmx.de>2008-07-08 20:03:06 +0200
committerJohannes Hofmann <Johannes.Hofmann@gmx.de>2008-07-08 20:03:06 +0200
commite0b97a5b06578797a8a65796bc694e8048559a10 (patch)
tree50fd1e48b1223bae332ec651647f39a97022810f /src/GipfelWidget.cxx
parent029db5ead7c6f95f788047af2446cf302556f9d5 (diff)
cleanup
Diffstat (limited to 'src/GipfelWidget.cxx')
-rw-r--r--src/GipfelWidget.cxx27
1 files changed, 11 insertions, 16 deletions
diff --git a/src/GipfelWidget.cxx b/src/GipfelWidget.cxx
index e6e2087..d737a0f 100644
--- a/src/GipfelWidget.cxx
+++ b/src/GipfelWidget.cxx
@@ -684,21 +684,18 @@ GipfelWidget::get_pixel(GipfelWidget::sample_mode_t m,
double px, py;
int ret;
- if (img == NULL) {
+ if (img == NULL)
return 1;
- }
- if (pan->get_coordinates(a_alph, a_nick, &px, &py) != 0) {
+ if (pan->get_coordinates(a_alph, a_nick, &px, &py) != 0)
return 1;
- }
- if (m == GipfelWidget::BICUBIC) {
+ if (m == GipfelWidget::BICUBIC)
ret = get_pixel_bicubic(img, px + ((double) img->w()) / 2.0,
py + ((double) img->h()) / 2.0, r, g, b);
- } else {
+ else
ret = get_pixel_nearest(img, px + ((double) img->w()) / 2.0,
py + ((double) img->h()) / 2.0, r, g, b);
- }
return ret;
}
@@ -706,11 +703,11 @@ GipfelWidget::get_pixel(GipfelWidget::sample_mode_t m,
int
GipfelWidget::get_pixel_nearest(Fl_Image *img, double x, double y,
int *r, int *g, int *b) {
- if (isnan(x) || isnan(y)) {
+
+ if (isnan(x) || isnan(y))
return 1;
- } else {
+ else
return get_pixel(img, (int) rint(x), (int) rint(y), r, g, b);
- }
}
static inline double
@@ -739,19 +736,17 @@ GipfelWidget::get_pixel_bicubic(Fl_Image *img, double x, double y,
for (int iy = 0; iy < 4; iy++) {
for (int ix = 0; ix < 4; ix++) {
+
if (get_pixel(img, (int) fl_x + ix - 1, (int) fl_y + iy - 1,
- &ic[0], &ic[1], &ic[2]) != 0) {
+ &ic[0], &ic[1], &ic[2]) != 0)
return 1;
- }
- for (int l = 0; l < 3; l++) {
+ for (int l = 0; l < 3; l++)
c[l][ix] = (double) ic[l];
- }
}
- for (int l = 0; l < 3; l++) {
+ for (int l = 0; l < 3; l++)
c1[l][iy] = interp_cubic(dx, dx2, dx3, c[l]);
- }
}
*r = (int) rint(interp_cubic(dy, dy2, dy3, c1[0]));