Commit b7bd264b authored by Ivan Yossi's avatar Ivan Yossi 👌

Partially revert bd9602f5

BUG:409280
parent 990a861f
......@@ -23,7 +23,7 @@
#include <KoColorSpace.h>
#include <KoMixColorsOp.h>
#include <math.h>
#include <QtMath>
#include "kis_paint_device.h"
......@@ -44,10 +44,8 @@ void KisRandomSubAccessor::sampledOldRawData(quint8* dst)
{
const quint8* pixels[4];
qint16 weights[4];
qreal x = m_currentPoint.x();
qreal y = m_currentPoint.y();
int xz = qRound(x);
int yz = qRound(y);
int x = qFloor(m_currentPoint.x());
int y = qFloor(m_currentPoint.y());
double hsub = m_currentPoint.x() - x;
if (hsub < 0.0) {
......@@ -59,16 +57,16 @@ void KisRandomSubAccessor::sampledOldRawData(quint8* dst)
}
weights[0] = qRound((1.0 - hsub) * (1.0 - vsub) * 255);
m_randomAccessor->moveTo(xz, yz);
m_randomAccessor->moveTo(x, y);
pixels[0] = m_randomAccessor->oldRawData();
weights[1] = qRound((1.0 - vsub) * hsub * 255);
m_randomAccessor->moveTo(xz + 1, yz);
m_randomAccessor->moveTo(x + 1, y);
pixels[1] = m_randomAccessor->oldRawData();
weights[2] = qRound(vsub * (1.0 - hsub) * 255);
m_randomAccessor->moveTo(xz, yz + 1);
m_randomAccessor->moveTo(x, y + 1);
pixels[2] = m_randomAccessor->oldRawData();
weights[3] = qRound(hsub * vsub * 255);
m_randomAccessor->moveTo(xz + 1, yz + 1);
m_randomAccessor->moveTo(x + 1, y + 1);
pixels[3] = m_randomAccessor->oldRawData();
m_device->colorSpace()->mixColorsOp()->mixColors(pixels, weights, 4, dst);
......@@ -79,10 +77,8 @@ void KisRandomSubAccessor::sampledRawData(quint8* dst)
{
const quint8* pixels[4];
qint16 weights[4];
qreal x = m_currentPoint.x();
qreal y = m_currentPoint.y();
int xz = qRound(x);
int yz = qRound(y);
int x = qFloor(m_currentPoint.x());
int y = qFloor(m_currentPoint.y());
double hsub = m_currentPoint.x() - x;
if (hsub < 0.0) {
......@@ -94,16 +90,16 @@ void KisRandomSubAccessor::sampledRawData(quint8* dst)
}
weights[0] = qRound((1.0 - hsub) * (1.0 - vsub) * 255);
m_randomAccessor->moveTo(xz, yz);
m_randomAccessor->moveTo(x, y);
pixels[0] = m_randomAccessor->rawDataConst();
weights[1] = qRound((1.0 - vsub) * hsub * 255);
m_randomAccessor->moveTo(xz + 1, yz);
m_randomAccessor->moveTo(x + 1, y);
pixels[1] = m_randomAccessor->rawDataConst();
weights[2] = qRound(vsub * (1.0 - hsub) * 255);
m_randomAccessor->moveTo(xz, yz + 1);
m_randomAccessor->moveTo(x, y + 1);
pixels[2] = m_randomAccessor->rawDataConst();
weights[3] = qRound(hsub * vsub * 255);
m_randomAccessor->moveTo(xz + 1, yz + 1);
m_randomAccessor->moveTo(x + 1, y + 1);
pixels[3] = m_randomAccessor->rawDataConst();
m_device->colorSpace()->mixColorsOp()->mixColors(pixels, weights, 4, dst);
}
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