VstGui png bug, and quick fix (win32)

DSP, Plugin and Host development discussion.
Post Reply New Topic
RELATED
PRODUCTS

Post

If you have VSTGUI_FLOAT_COORDINATES set, when using libpng, images fail to load, due to these not-so-clever casts: (png_uint_32*)&width, (png_uint_32*)&height.

in vstgui.cpp: bool CBitmap::loadFromResource (const CResourceDescription& resourceDesc)

Code: Select all

png_get_IHDR (png_ptr, info_ptr, (png_uint_32*)&width, (png_uint_32*)&height, &bit_depth, &color_type, 0, 0, 0);
width and height are CCoords which, when VSTGUI_FLOAT_COORDINATES is set, are typedef'd to be floats.

replacing that line for this seems to do the trick:

Code: Select all

png_uint_32 pngW, pngH;
png_get_IHDR (png_ptr, info_ptr, &pngW, &pngH, &bit_depth, &color_type, 0, 0, 0);
width = pngW;
height = pngH;
I'd submit the bug to sourceforge, but given the time of the last update, that seems rather pointless. If the fix introduces problems of it's own that I haven't thought of, do tell.

Why am I using VstGui? Dont' ask :wink:

EDIT: This applies to VstGui 3.5, I haven't looked at the 3.0 release.

Post Reply

Return to “DSP and Plugin Development”