-
Bug
-
Resolution: Done
-
P1: Critical
-
4.7.1
-
None
-
WinXP, MSVC2008, Qt 4.7.0 and 4.7.1
-
a061f032bc36f03d31ba39d2565857d1a14d9112
QEmulationPaintEngine does not forward begin/endNativePainting calls to the underlying "real" engine which leads to any QPainter::beginNativePainting() call ending up in the dummy default QPaintEngineEx::beginNativePainting() implementation instead of e.g. the one in QGL2PaintEngineEx.
This is critical in the QML case, where gradients use the ObjectBoundingMode coordinate mode which triggers the emulation paint engine usage. This means that a custom graphics/declarative item performing direct OpenGL calls will have problems when its paint() is called after painting any gradients a least once on the same painter. (effectively begin/endNativePainting will do nothing which will easily lead to confused OpenGL states and bad drawing results)
Attached is an example (plain graphicsview) app demonstrating the problem. Just step into the painter->beginNativePainting() call with a debugger.
The solution would be to make QEmulationPaintEngine forward properly all possible QPaintEngineEx functions.
(Another interesting issue might be that once QPainerPrivate::checkEmulation() triggers the emulation engine usage, it can never be turned off because of the DoNotEmulate flag check at the beginning of said function. This feels weird too and is maybe not intentional?)