• Sharaf Zaman's avatar
    Render meshgradient on QImage and then on QPainter · 7d06c391
    Sharaf Zaman authored
    Primary reason for this is, that rendering meshpatches
    every single time a translation is done, is very
    expensive. So, we render it the first time and reuse it.
    
    The way we do it is:
    
    1) First we render the patch in scaled-up version of
       QImage, this helps us with loss of quality which is
       a consequence of `QPainter&` passed in
       `KoMeshGradientBackground::paint` as a scaled version.
    
    2) We render the whole patch on QImage, not just the patch
       inside clipped region.
    
    3) Then we render the QImage on QPainter in user coordinates
       i.e independent from the shape.
    
    NOTE: One thing which has to be taken care of is, when we resize
    the shape, the patch is resized as well. Which is one of the
    expected behavior. But there is one more behavior, that is
    the patches should not be scaled, which can help us with
    having only selected portion of the patches in view.
    
    Maniphest: T13101
    7d06c391