diff options
| author | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2008-07-05 23:02:19 +0200 | 
|---|---|---|
| committer | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2008-07-05 23:02:19 +0200 | 
| commit | 5e981a4ecb4b1a2c9f575a51e3c1a6a7ba98a7cc (patch) | |
| tree | 9bc7ce93a101db90be3c9de38c8c06421aa89967 | |
| parent | 84802dd00c14ac98164fc9a7bfa1990cbf36d91c (diff) | |
fix PreviewOutputImage
| -rw-r--r-- | src/JPEGOutputImage.cxx | 2 | ||||
| -rw-r--r-- | src/PreviewOutputImage.H | 3 | ||||
| -rw-r--r-- | src/PreviewOutputImage.cxx | 27 | ||||
| -rw-r--r-- | src/Stitch.cxx | 25 | ||||
| -rw-r--r-- | src/TIFFOutputImage.cxx | 2 | 
5 files changed, 22 insertions, 37 deletions
| diff --git a/src/JPEGOutputImage.cxx b/src/JPEGOutputImage.cxx index 263eeb3..13022a9 100644 --- a/src/JPEGOutputImage.cxx +++ b/src/JPEGOutputImage.cxx @@ -13,7 +13,7 @@ extern "C" {  #include "JPEGOutputImage.H" -JPEGOutputImage::JPEGOutputImage(const char *f, int q) { +JPEGOutputImage::JPEGOutputImage(const char *f, int q) : OutputImage() {  	file = strdup(f);  	fp = NULL;  	row = NULL; diff --git a/src/PreviewOutputImage.H b/src/PreviewOutputImage.H index b4bca3b..8351422 100644 --- a/src/PreviewOutputImage.H +++ b/src/PreviewOutputImage.H @@ -20,10 +20,9 @@ class PreviewOutputImage : public OutputImage , public Fl_Widget {  		int d;  	protected: -		int init_internal(int w, int h); +		int init_internal();  		int set_pixel_internal(int x, int r, int g, int b);	  		int next_line_internal(); -		int done_internal();  	public:  		PreviewOutputImage(int X, int Y, int W, int H); diff --git a/src/PreviewOutputImage.cxx b/src/PreviewOutputImage.cxx index 0ae182e..45cb898 100644 --- a/src/PreviewOutputImage.cxx +++ b/src/PreviewOutputImage.cxx @@ -13,32 +13,29 @@  #include "PreviewOutputImage.H" -PreviewOutputImage::PreviewOutputImage(int X, int Y, int W, int H): Fl_Widget(X, Y, W, H) { +PreviewOutputImage::PreviewOutputImage(int X, int Y, int W, int H): +	OutputImage(), Fl_Widget(X, Y, W, H) {  	d = 3;  	data = NULL;  }  PreviewOutputImage::~PreviewOutputImage() { -	if (data) { +	if (data)  		free(data); -	}  }  int -PreviewOutputImage::init_internal(int w, int h) { -	data = (uchar*) malloc(w * h * d); -	memset(data, 0, w * h * d); -	size(w, h); +PreviewOutputImage::init_internal() { +	data = (uchar*) malloc(W * H * d); +	memset(data, 0, W * H * d); +	size(W, H);  	return 0;  } -	 -  int  PreviewOutputImage::set_pixel_internal(int x, int r, int g, int b) { -	if (!data) { +	if (!data)   		return 1; -	}  	long index = (line * w() * d + (x * d));  	*(data+index+0) = (unsigned char) (r / 255); @@ -57,20 +54,12 @@ PreviewOutputImage::next_line_internal() {  	return 0;  } -int -PreviewOutputImage::done_internal() { -	return 0; -} -  void  PreviewOutputImage::draw() {  	if (!data) {  		return;  	}  	fl_push_clip(x(), y(), w(), h()); -  	fl_draw_image(data, x(), y(), w(), h(), d); -  	fl_pop_clip();  } - diff --git a/src/Stitch.cxx b/src/Stitch.cxx index 65a838e..3aefb20 100644 --- a/src/Stitch.cxx +++ b/src/Stitch.cxx @@ -98,15 +98,14 @@ Stitch::resample(GipfelWidget::sample_mode_t m,  	int merged_pixel_set;  	double radius = (double) w / (view_end -view_start); -	if (merged_image) { -		merged_image->init(w, h); -	} +	if (merged_image) +		if (merged_image->init(w, h) != 0) +			merged_image = NULL; -	for (int i=0; i<MAX_PICS; i++) { -		if (single_images[i]) { -			single_images[i]->init(w, h); -		} -	} +	for (int i=0; i<MAX_PICS; i++) +		if (single_images[i])  +			if (single_images[i]->init(w, h) != 0) +				single_images[i] = NULL;  	for (int y = 0; y < h; y++) {  		double a_nick = atan((double)(y_off - y)/radius); @@ -146,14 +145,12 @@ Stitch::resample(GipfelWidget::sample_mode_t m,  		}  	} -	if (merged_image) { +	if (merged_image)  		merged_image->done(); -	} -	for (int i=0; i<MAX_PICS; i++) { -		if (single_images[i]) { + +	for (int i=0; i<MAX_PICS; i++) +		if (single_images[i])  			single_images[i]->done(); -		} -	}  	return 0;  } diff --git a/src/TIFFOutputImage.cxx b/src/TIFFOutputImage.cxx index 204bfa5..38dfd5b 100644 --- a/src/TIFFOutputImage.cxx +++ b/src/TIFFOutputImage.cxx @@ -10,7 +10,7 @@  #include "TIFFOutputImage.H" -TIFFOutputImage::TIFFOutputImage(const char *f, int b) { +TIFFOutputImage::TIFFOutputImage(const char *f, int b) : OutputImage () {  	bitspersample = (b==16)?16:8;  	file = strdup(f);  	tiff = NULL; | 
