From koffice-devel Sat Aug 15 07:23:48 2009 From: Ariya Hidayat Date: Sat, 15 Aug 2009 07:23:48 +0000 To: koffice-devel Subject: Re: Painting on the QImage in QPainter Canvas Message-Id: X-MARC-Message: https://marc.info/?l=koffice-devel&m=125032107901482 > I haven't seen Krita code, but the usual way to overcome this problem > is to have a persistent "scratch" QImage. Of course this QImage needs > to grow and shrink (but not aggressively) according to the said > updated rect. I just saw the patch and it does exactly what I wrote above. A slight improvement would be add some hysteresis to the size change detection so no need to recreate m_buffer if e.g. the size goes from (100, 100) to (99, 99). One nitpicky point: after recreating m_buffer, it is better to fill it with a color of your choice (you know better which color to pick), otherwise, if the subsequent drawing does not paint every single pixels, you may see some garbage on the screen. And of course, all this extra indirection can be ignored if the raster paint engine is already in use. -- Ariya Hidayat, Qt, Nokia http://www.linkedin.com/in/ariyahidayat _______________________________________________ koffice-devel mailing list koffice-devel@kde.org https://mail.kde.org/mailman/listinfo/koffice-devel