[calligra] krita/image: Added KisPainter::fill(...) method to fill a rectangular region with one color.
dimula73 at gmail.com
Sat Mar 26 22:00:10 CET 2011
On Sat, Mar 26, 2011 at 9:48 PM, Silvio Heinrich <plassy at web.de> wrote:
> Git commit 6fecab005a76764575f7521184168fdd3018454f by Silvio Heinrich.
> Committed on 26/03/2011 at 19:35.
> Pushed by heinrich into branch 'master'.
> Added KisPainter::fill(...) method to fill a rectangular region with one
> The method will respect the current opacity and compositeOp.
> M +62 -0 krita/image/kis_painter.cc
> M +13 -0 krita/image/kis_painter.h
> diff --git a/krita/image/kis_painter.cc b/krita/image/kis_painter.cc
> index 0cb7236..f482f03 100644
> --- a/krita/image/kis_painter.cc
> +++ b/krita/image/kis_painter.cc
> @@ -738,6 +738,68 @@ void KisPainter::bitBltOldData(const QPoint & pos,
> const KisPaintDeviceSP srcDev
> bitBltOldData(pos.x(), pos.y(), srcDev, srcRect.x(), srcRect.y(),
> srcRect.width(), srcRect.height());
> +void KisPainter::fill(qint32 x, qint32 y, qint32 width, qint32 height,
> const KoColor& color)
> + /* This check for nonsense ought to be a Q_ASSERT. However, when
> paintops are just
> + * initializing they perform some dummy passes with those parameters,
> and it must not crash */
> + if(width == 0 || height == 0 || d->device.isNull())
> + return;
> + /* Create an intermediate byte array to hold information before it is
> + * to the current paint device (aka: d->device) */
> + quint8* dstBytes = new quint8[width * height *
> + d->device->readBytes(dstBytes, x, y, width, height);
+ d->device->writeBytes(dstBytes, x, y, width, height);
I'm not sure this is a good idea to use read/writeBytes here as it leads to
huge memory allocations. We are trying to avoid using read/writeBytes
everywhere we can. I guess, it would be safer to use per-tile composition
like it is done in e.g. bitBlt (KisPaintDevice version).
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the kimageshop