Commit c50411b3 authored by Dmitry Kazakov's avatar Dmitry Kazakov
Browse files

Remove now unused legacy implementation of colorsmudge

parent 7e2f7373
......@@ -55,29 +55,10 @@ protected:
KisSpacingInformation updateSpacingImpl(const KisPaintInformation &info) const override;
KisTimingInformation updateTimingImpl(const KisPaintInformation &info) const override;
private:
// Sets the m_maskDab _and m_maskDabRect
void updateMask(const KisPaintInformation& info, const KisDabShape &shape, const QPointF &cursorPoint);
KoColor getOverlayDullingFillColor(QPoint canvasLocalSamplePoint);
KoColor getDullingFillColor(const KisPaintInformation& info, KisOverlayPaintDeviceWrapper& activeWrapper, QPoint canvasLocalSamplePoint);
void mixSmudgePaintAt(const KisPaintInformation& info, KisOverlayPaintDeviceWrapper& activeWrapper, QRect srcDabRect, QPoint canvasLocalSamplePoint, bool useDullingMode);
inline void getTopLeftAligned(const QPointF &pos, const QPointF &hotSpot, qint32 *x, qint32 *y);
private:
bool m_firstRun;
bool m_useNewEngine;
KisImageWSP m_image;
KisOverlayPaintDeviceWrapper m_precisePainterWrapper;
KoColor m_paintColor;
KisPaintDeviceSP m_tempDev;
QScopedPointer<KisOverlayPaintDeviceWrapper> m_preciseImageDeviceWrapper;
QScopedPointer<KisPainter> m_backgroundPainter;
QScopedPointer<KisPainter> m_smudgePainter;
QScopedPointer<KisPainter> m_overlayPainter;
QScopedPointer<KisPainter> m_colorRatePainter;
QScopedPointer<KisPainter> m_finalPainter;
KoAbstractGradientSP m_gradient;
KisPressureSizeOption m_sizeOption;
KisPressureOpacityOption m_opacityOption;
......@@ -95,12 +76,9 @@ private:
QList<KisPressureHSVOption*> m_hsvOptions;
KisAirbrushOptionProperties m_airbrushOption;
QRect m_dstDabRect;
KisFixedPaintDeviceSP m_maskDab;
KisFixedPaintDeviceSP m_origDab;
QPointF m_lastPaintPos;
KoColorTransformation *m_hsvTransform {0};
const KoCompositeOp *m_preciseColorRateCompositeOp {0};
QScopedPointer<KisColorSmudgeStrategy> m_strategy;
};
......
......@@ -34,118 +34,6 @@ KisSmudgeRadiusOption::KisSmudgeRadiusOption():
setValueRange(0.0,1.0);
}
QRect KisSmudgeRadiusOption::sampleRect(const KisPaintInformation& info,
qreal diameter,
const QPoint &pos) const
{
const qreal sliderValue = computeSizeLikeValue(info);
const int smudgeRadius = ((sliderValue * diameter) * 0.5) / 100.0;
return kisGrowRect(QRect(pos, QSize(1,1)), smudgeRadius + 1);
}
void KisSmudgeRadiusOption::apply(KoColor *resultColor,
const KisPaintInformation& info,
qreal diameter,
qreal posx,
qreal posy,
KisPaintDeviceSP dev) const
{
if (!isChecked()) return;
qreal sliderValue = computeSizeLikeValue(info);
int smudgeRadius = ((sliderValue * diameter) * 0.5);
KoColor color(Qt::transparent, dev->colorSpace());
if (smudgeRadius == 1) {
dev->pixel(posx, posy, &color);
} else {
const KoColorSpace* cs = dev->colorSpace();
const int pixelSize = cs->pixelSize();
quint8* data = new quint8[pixelSize];
quint8* pixels[2];
qint16 weights[2];
pixels[1] = new quint8[pixelSize];
pixels[0] = new quint8[pixelSize];
int loop_increment = 1;
if(smudgeRadius >= 8)
{
loop_increment = (2*smudgeRadius)/16;
}
int i = 0;
int k = 0;
int j = 0;
KisRandomConstAccessorSP accessor = dev->createRandomConstAccessorNG();
accessor->moveTo(posx, posy);
memcpy(color.data(), accessor->rawDataConst(), pixelSize);
for (int y = 0; y <= smudgeRadius; y = y + loop_increment) {
for (int x = 0; x <= smudgeRadius; x = x + loop_increment) {
for(j = 0;j < 2;j++)
{
if(j == 1)
{
y = y*(-1);
}
for(k = 0;k < 2;k++)
{
if(k == 1)
{
x = x*(-1);
}
accessor->moveTo(posx + x, posy + y);
memcpy(pixels[1], accessor->rawDataConst(), pixelSize);
if(i == 0)
{
memcpy(pixels[0],accessor->rawDataConst(),pixelSize);
}
if (x == 0 && y == 0) {
// Because the sum of the weights must be 255,
// we cheat a bit, and weigh the center pixel differently in order
// to sum to 255 in total
// It's -(counts -1), because we'll add the center one implicitly
// through that calculation
weights[1] = (255 - ((i + 1) * (255 /(i+2) )) );
} else {
weights[1] = 255 /(i+2);
}
i++;
if (i>smudgeRadius){i=0;}
weights[0] = 255 - weights[1];
const quint8** cpixels = const_cast<const quint8**>(pixels);
cs->mixColorsOp()->mixColors(cpixels, weights,2, data);
memcpy(pixels[0],data,pixelSize);
}
x = x*(-1);
}
y = y*(-1);
}
}
color = KoColor(pixels[0],cs);
for (int l = 0; l < 2; l++){
delete[] pixels[l];
}
delete[] data;
}
*resultColor = color.convertedTo(resultColor->colorSpace());
}
void KisSmudgeRadiusOption::writeOptionSetting(KisPropertiesConfigurationSP setting) const
{
KisCurveOption::writeOptionSetting(setting);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment