DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

Link: http://www.fltk.org/str.php?L2797
Version: 1.3-current


I researched what the other implementations of fl_create_offscreen() do:

    MAC: calls calloc() to allocate a buffer of w*h*4 in size,
         then calls GBitmapContextCreate(). The latter doesn't
         say one way or the other what happens if w|h are zero:
        
http://developer.apple.com/library/mac/documentation/graphicsimaging/reference/CGBitmapContext/Reference/reference.html#//apple_ref/c/func/CGBitmapContextCreate
         I'm not sure what calloc() does if the bytes requested are 0,
         I don't think the man page says.
         I imagine the overall behavior is 'undefined' on the Mac.

    WINDOWS: calls CreateCompatibleBitmap() which says if w|h are zero,
             it acts as if a 1x1 window was requested:
            
http://msdn.microsoft.com/en-us/library/dd183488%28v=vs.85%29.aspx

    X: Calls XCreatePixmap() which is explicit that w|h must not be 0.
       Not sure what the return value is.

So we have a little of everything:
    X explicitly doesn't want w|h==0,
    Mac seems undefined
    Win tries to be nice by assuming you're crazy, and makes a 1x1
        so that a valid buffer is returned.

While I think Win's behavior is prudent, it's perhaps being too kind.

I kinda think we should return NULL, document it, and make sure we
check for NULL everywhere. That would be harder, but perhaps more
correct.


Link: http://www.fltk.org/str.php?L2797
Version: 1.3-current

_______________________________________________
fltk-bugs mailing list
fltk-bugs@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk-bugs

Reply via email to