Alpha Image Problem

After updating to the tip from a stable version I have been using since January, my alpha channel images are now drawn wrong. I’ll try to include all the relevant info.

Runtime Images are made using ImageCache::getFromMemory() to load data packed by BinaryBuilder.

I’m drawing a subrect of an image to the same-sized screen area as an alpha channel using drawImage. So the image size is say 60 by 40, but I’m calling drawImage(Image, 0, 0, 16, 16, 0, 0, 16, 16, true).

The result is that the entire source image is now scaled down to my subrect. Previously and correctly, the subrect was cut out of the image.

This was evident before the clip rect caching changes BTW.

I should add that opaque images, i.e. changing true to false above, work properly.

Sounds easy to fix, but could you suggest a quick hack I could make to the juce demo so that I can reproduce this?

Plop this into RenderingTestCanvas::paint after the case statement. It doesn’t show the same symptom I was reporting but it does show that something is very wrong with the transform. The blue Juce logo should appear cutout over the colored one. Instead on my machine it appears below and at the wrong size.

[code] {
const unsigned w = 64;
const unsigned h = 32;
Path p;
p.addRectangle(1, 1, w, h);
g.strokePath(p, PathStrokeType(1.));

		Image im = ImageFileFormat::loadFrom (BinaryData::juce_png, BinaryData::juce_pngSize);
		g.drawImage (im, 0, 0, w, h, 0, 0, w, h, false);
		g.drawImage (im, 0, 0, w, h, 0, 0, w, h, true);

[attachment=0]Picture 5.png[/attachment]

NEWS FLASH: The above code only breaks when the rect[0, 0, w, h] is smaller than the image.

Thanks - I’ll check in a fix shortly! It was just a bug in the CoreGraphics code, I mustn’t have tested it for clip regions smaller than the image itself.