[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: koffice/krita/plugins/paintops/defaultpaintops/duplicate
From: Sven Langkamp <sven.langkamp () gmail ! com>
Date: 2010-03-28 14:21:22
Message-ID: 20100328142122.6555AAC881 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1108294 by langkamp:
calculate duplicate dab like in smudge, fixes crash when using duplicate with some predefined brushes
BUG:221274
M +14 -10 kis_duplicateop.cpp
--- trunk/koffice/krita/plugins/paintops/defaultpaintops/duplicate/kis_duplicateop.cpp #1108293:1108294
@@ -41,6 +41,7 @@
#include <KoColorSpace.h>
#include <KoCompositeOp.h>
#include <KoInputDevice.h>
+#include <KoColorSpaceRegistry.h>
#include <kis_brush.h>
#include <kis_datamanager.h>
@@ -282,17 +283,20 @@
delete [] matrix;
}
- KisFixedPaintDeviceSP fixedDab = new KisFixedPaintDevice(m_srcdev->colorSpace());
- fixedDab->setRect(QRect(0, 0, sw, sh));
- fixedDab->initialize();
+ KisFixedPaintDeviceSP dab = 0;
+ if (brush->brushType() == IMAGE || brush->brushType() == PIPE_IMAGE) {
+ dab = brush->paintDevice(m_srcdev->colorSpace(), scale, 0.0, info, xFraction, yFraction);
+ dab->convertTo(KoColorSpaceRegistry::instance()->alpha8());
+ } else {
+ dab = cachedDab();
+ KoColor color = painter()->paintColor();
+ color.convertTo(dab->colorSpace());
+ brush->mask(dab, color, scale, scale, 0.0, info, xFraction, yFraction);
+ dab->convertTo(KoColorSpaceRegistry::instance()->alpha8());
+ }
- m_srcdev->readBytes(fixedDab->data(), fixedDab->bounds());
- brush->mask(fixedDab, scale, scale, 0.0, info, xFraction, yFraction);
- m_srcdev->writeBytes(fixedDab->data(), fixedDab->bounds());
+ QRect dstRect = QRect(x, y, dab->bounds().width(), dab->bounds().height());
- QRect dabRect = QRect(0, 0, brush->maskWidth(scale, 0.0), brush->maskHeight(scale, 0.0));
- QRect dstRect = QRect(x, y, dabRect.width(), dabRect.height());
-
if (painter()->bounds().isValid()) {
dstRect &= painter()->bounds();
}
@@ -304,7 +308,7 @@
sw = dstRect.width();
sh = dstRect.height();
- painter()->bitBlt(dstRect.x(), dstRect.y(), m_srcdev, sx, sy, sw, sh);
+ painter()->bitBlt(dstRect.x(), dstRect.y(), m_srcdev, dab, sx, sy, sw, sh);
return spacing(scale);
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic