QQuickPaintedItem with opaquePainting
-
Hi, I am on embedded Linux using LinuxFB plugin and software backend. I am using transparent window background and I have a translucent
QQuickPaintedItem
on the bottom with some small UI on top. In this case I can usesetOpaquePainting(true);
since there is nothing under the item that it needs to blend with, and it is significantly faster.You can pan the contents of this item by dragging with mouse, but it might take significant amount of time to paint. So I implemented it as moving the item (so part of the screen will be empty as you move it, but that's acceptable) and on mouse release recenter it and repaint at this new position. This way you don't "paint" the item into the render target while you're dragging it, only the render target is being redrawn at different position in the scene.
However, I noticed that this "draw" time increases with the number of partially transparent pixels in the render target. Fully transparent is as fast as fully opaque. Only explanation I could come up with is that the render target is in premultiplied format and whatever it is drawing into is not. In that case even though it is not blending, it needs to divide each channel by alpha if it is not 0 or 255. Is that the case? If so, is there any way to choose the format of the render target?
For a while I considered using 1x1 pixel checkerboard of black and transparent as a background. It doesn't look as bad as I expected, but sharpness setting on a monitor can affect it a lot. It also flickers because of the pixel response time, but that could be worked around by making sure x+y is always even.