Improve colorize effect with the GL backend

As reported in issue #176 , there is a difference between the rendering
with Qt and femtovg. It appears that this is due to incorrect
assumptions about whether the rgb values in the intermediate buffer
image for colorization have the alpha-channel pre-multiplied or not.

When rendering into the image buffer, we would pre-multiply the alpha,
but when rendering the buffer itself, femtovg's fragment shader would
assume texture type 2 and multiply the alpha again. Therefore set the
image flag to avoid that.
This commit is contained in:
Simon Hausmann 2021-04-14 19:07:18 +02:00
parent ce6aa06964
commit fad4ef677f

View file

@ -1174,7 +1174,7 @@ impl GLItemRenderer {
image_size.width as _, image_size.width as _,
image_size.height as _, image_size.height as _,
femtovg::PixelFormat::Rgba8, femtovg::PixelFormat::Rgba8,
femtovg::ImageFlags::empty(), femtovg::ImageFlags::PREMULTIPLIED,
) )
.expect("internal error allocating temporary texture for image colorization"); .expect("internal error allocating temporary texture for image colorization");