Alpha blending change with JUCE 1.36


#1

I have a custom button with this in the paintButton handler:


	g.drawImageAt(img,0,0);
	if (isMouseOverButton && !isButtonDown)
	{
		Colour c( 0x10ffffff );

		g.setColour(c);
		g.fillRect(0,0,img->getWidth(),img->getHeight());
	}

With JUCE 1.35, this gave me a nice highlight on the button without changing the color of the underlying image.

With JUCE 1.36, the color gets changed. A yellow button turns purple, a green button turns red.

It doesn’t seem to matter if I turn SSE support on or off in the low level graphics renderer.

Matt


#2

eek! Sorry - that is caused by the SSE stuff… Here’s a fix, in juce_LowLevelGraphicsSoftwareRenderer.cpp

pixloop: prefetchnta [edx] mov ax, [edx + 1] shl eax, 8 mov al, [edx] movd mm0, eax

I hate assembly language.

That’s a bit of an annoying bug, so I might patch the code that’s currently on the website with this fix.


#3

Cool, that did it.

I was wrong; it was only a problem with the SSE code. Thanks!


#4

tee-hee, I was just on my way over to report this one.

It actually caught me right out cos I have a drag and drop container that highlights with a green border if the drop content is good, and highlights red if it is bad.

It just so happens that the slight grey background caused the alpha to overflow the green highlight to red, and left me scratching my head as to why my filter was suddenly firing off so many false negatives. :shock:


#5

Yeah, sorry. The bug was a last-minute fix I made before I released it, and obviously when I tested it, the colours I was using must have been mainly green, which looks the same even when the byte order is wrong…


#6