summaryrefslogtreecommitdiff
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
parent029db5ead7c6f95f788047af2446cf302556f9d5 (diff)
cleanup
-rw-r--r--src/GipfelWidget.cxx27
-rw-r--r--src/Stitch.cxx12
2 files changed, 17 insertions, 22 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]));
diff --git a/src/Stitch.cxx b/src/Stitch.cxx
index 3aefb20..251323d 100644
--- a/src/Stitch.cxx
+++ b/src/Stitch.cxx
@@ -125,9 +125,9 @@ Stitch::resample(GipfelWidget::sample_mode_t m,
g = std::max(std::min(g, MAX_VALUE), 0);
b = std::max(std::min(b, MAX_VALUE), 0);
- if (single_images[i]) {
+ if (single_images[i])
single_images[i]->set_pixel(x, r, g, b);
- }
+
if (!merged_pixel_set && merged_image) {
merged_image->set_pixel(x, r, g, b);
merged_pixel_set++;
@@ -135,13 +135,13 @@ Stitch::resample(GipfelWidget::sample_mode_t m,
}
}
}
- if (merged_image) {
+
+ if (merged_image)
merged_image->next_line();
- }
+
for (int i=0; i<MAX_PICS; i++) {
- if (single_images[i]) {
+ if (single_images[i])
single_images[i]->next_line();
- }
}
}