Bugfix: Drawing GLType images

drawing a GLType image that’s inside a subregion crashes. It also frobs the data back out and into GL worse than just using a normal Juce image :wink:

Fix, sort of…

juce_OpenGLImage.cpp

[code] struct DataReleaser : public Image::BitmapData::BitmapDataReleaser
{
DataReleaser (OpenGLFrameBuffer& fb, int x, int y, int w, int h)
: data (w * h),
writer (fb, x, y, w, h)
{}

    ~DataReleaser()
    {
        writer.write (data);
    }

    static void initialise (OpenGLFrameBuffer& frameBuffer, Image::BitmapData& bitmapData, int x, int y)
    {
        DataReleaser* r = new DataReleaser (frameBuffer, x, y, bitmapData.width, bitmapData.height);
        bitmapData.dataReleaser = r;

        // FIX: correct data and stride
        bitmapData.data = (uint8*) r->data.getData();
        bitmapData.lineStride = (bitmapData.width * bitmapData.pixelStride + 3) & ~3; 

        ReaderType::read (frameBuffer, bitmapData, x, y);
    }
   // etc ...

}[/code]

Excellent, ta!