diff options
| author | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2009-03-26 23:17:22 +0100 | 
|---|---|---|
| committer | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2009-03-26 23:17:22 +0100 | 
| commit | e6f3d640f4f2312c5c3b796e12e9ee785a87f4e4 (patch) | |
| tree | 4cbb074dcba3dacf6e5656267e8be46bd9979675 /src | |
| parent | 29ffdb1136d0c5926cf920b874db93421ac7c75d (diff) | |
cleanup
Diffstat (limited to 'src')
| -rw-r--r-- | src/ScreenDump.H | 2 | ||||
| -rw-r--r-- | src/ScreenDump.cxx | 20 | 
2 files changed, 12 insertions, 10 deletions
| diff --git a/src/ScreenDump.H b/src/ScreenDump.H index f527404..b9991fa 100644 --- a/src/ScreenDump.H +++ b/src/ScreenDump.H @@ -12,7 +12,7 @@  class ScreenDump {  	private: -		GipfelWidget *gipf; +		int w, h;  		unsigned char * rgb;  	public: diff --git a/src/ScreenDump.cxx b/src/ScreenDump.cxx index 20a038f..d238535 100644 --- a/src/ScreenDump.cxx +++ b/src/ScreenDump.cxx @@ -7,15 +7,17 @@  #include "JPEGOutputImage.H"  #include "ScreenDump.H" -ScreenDump::ScreenDump(GipfelWidget *g) { +ScreenDump::ScreenDump(GipfelWidget *gipf) {  	Fl_Offscreen offscreen; -	gipf = g; +	w = gipf->w(); +	h = gipf->h(); +  	Fl::flush(); -	offscreen = fl_create_offscreen(gipf->w(), gipf->h()); +	offscreen = fl_create_offscreen(w, h);  	fl_begin_offscreen(offscreen);  	gipf->draw(); -	rgb = fl_read_image(NULL, 0, 0, gipf->w(), gipf->h()); +	rgb = fl_read_image(NULL, 0, 0, w, h);  	fl_end_offscreen();  	fl_delete_offscreen(offscreen);  } @@ -28,15 +30,15 @@ int  ScreenDump::save(const char *file) {  	JPEGOutputImage out(file, 95); -	out.init(gipf->w(), gipf->h()); +	out.init(w, h); -	for (int y = 0; y < gipf->h(); y++) { -		for (int x = 0; x < gipf->w(); x++) { -			unsigned char *px = &rgb[(y * gipf->w() + x) * 3]; +	for (int y = 0; y < h; y++) { +		for (int x = 0; x < w; x++) { +			unsigned char *px = &rgb[(y * w + x) * 3];  			out.set_pixel(x, px[0] * 255, px[1] * 255, px[2] * 255);  		}  		out.next_line();  	} -	out.done(); +	return out.done();  } | 
