Author: manolo
Date: 2011-01-20 04:55:50 -0800 (Thu, 20 Jan 2011)
New Revision: 8294
Log:
A better solution to the crash when printing the mandelbrot demo under WIN32.
Modified:
branches/branch-1.3/src/fl_draw_image_win32.cxx
Modified: branches/branch-1.3/src/fl_draw_image_win32.cxx
===================================================================
--- branches/branch-1.3/src/fl_draw_image_win32.cxx 2011-01-20 00:37:18 UTC
(rev 8293)
+++ branches/branch-1.3/src/fl_draw_image_win32.cxx 2011-01-20 12:55:50 UTC
(rev 8294)
@@ -174,17 +174,18 @@
int linesize = (pixelsize*w+3)&~3;
static U32* buffer;
+ static long buffer_size;
int blocking = h;
{int size = linesize*h;
- if (size > MAXBUFFER) {
+ // when printing, don't limit buffer size not to get a crash in StretchDIBits
+ if (size > MAXBUFFER && Fl_Surface_Device::surface()->class_name() !=
Fl_Printer::class_id) {
size = MAXBUFFER;
blocking = MAXBUFFER/linesize;
}
- static long buffer_size;
if (size > buffer_size) {
delete[] buffer;
buffer_size = size;
- buffer = new U32[(int)(1.02* (size+3)/4)]; // some extra memory needed
when printing
+ buffer = new U32[(size+3)/4];
}}
bmi.bmiHeader.biHeight = blocking;
static U32* line_buffer;
@@ -267,6 +268,9 @@
DIB_RGB_COLORS
#endif
, SRCCOPY );
+ delete[] buffer;
+ buffer = NULL;
+ buffer_size = 0;
}
else {
SetDIBitsToDevice(fl_gc, x, y+j-k, w, k, 0, 0, 0, k,
_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit