Commit 000fe98f authored by Dmitry Kazakov's avatar Dmitry Kazakov

Fixed warnings and a bug in the vector compositioning

parent 4b2bf03c
......@@ -420,6 +420,18 @@ void KisCompositionBenchmark::compareAlphaDarkenOps()
delete opAct;
}
void KisCompositionBenchmark::compareAlphaDarkenOpsNoMask()
{
const KoColorSpace *cs = KoColorSpaceRegistry::instance()->rgb8();
KoCompositeOp *opAct = KoOptimizedCompositeOpFactory::createAlphaDarkenOp32(cs);
KoCompositeOp *opExp = new KoCompositeOpAlphaDarken<KoBgrU8Traits>(cs);
QVERIFY(compareTwoOps(false, opAct, opExp));
delete opExp;
delete opAct;
}
void KisCompositionBenchmark::compareOverOps()
{
const KoColorSpace *cs = KoColorSpaceRegistry::instance()->rgb8();
......@@ -432,6 +444,18 @@ void KisCompositionBenchmark::compareOverOps()
delete opAct;
}
void KisCompositionBenchmark::compareOverOpsNoMask()
{
const KoColorSpace *cs = KoColorSpaceRegistry::instance()->rgb8();
KoCompositeOp *opAct = KoOptimizedCompositeOpFactory::createOverOp32(cs);
KoCompositeOp *opExp = new KoCompositeOpOver<KoBgrU8Traits>(cs);
QVERIFY(compareTwoOps(false, opAct, opExp));
delete opExp;
delete opAct;
}
void KisCompositionBenchmark::testRgb8CompositeAlphaDarkenLegacy()
{
const KoColorSpace *cs = KoColorSpaceRegistry::instance()->rgb8();
......
......@@ -29,7 +29,9 @@ private slots:
void checkRoundingOver();
void compareAlphaDarkenOps();
void compareAlphaDarkenOpsNoMask();
void compareOverOps();
void compareOverOpsNoMask();
void testRgb8CompositeAlphaDarkenLegacy();
void testRgb8CompositeAlphaDarkenOptimized();
......
......@@ -160,6 +160,10 @@ struct AlphaDarkenCompositor32 {
float srcAlphaNorm;
float mskAlphaNorm;
/**
* FIXME: precalculate this value on a higher level for
* not doing it on every cycle
*/
opacity *= flow;
if (haveMask) {
......@@ -167,7 +171,7 @@ struct AlphaDarkenCompositor32 {
srcAlphaNorm = mskAlphaNorm * opacity;
} else {
mskAlphaNorm = src[alpha_pos] * uint8Rec1;
srcAlphaNorm *= opacity;
srcAlphaNorm = mskAlphaNorm * opacity;
}
if (dstAlphaNorm != 0.0) {
......
......@@ -124,6 +124,8 @@ struct OverCompositor32 {
template <bool haveMask>
static ALWAYS_INLINE void compositeOnePixelFloat(const channels_type *src, channels_type *dst, const quint8 *mask, float opacity, float flow, const QBitArray &channelFlags)
{
Q_UNUSED(flow);
using namespace Arithmetic;
const qint32 alpha_pos = 3;
......@@ -186,6 +188,8 @@ struct OverCompositor32 {
template <bool haveMask>
static ALWAYS_INLINE void compositeOnePixel(const channels_type *src, channels_type *dst, const quint8 *mask, channels_type opacity, channels_type flow, const QBitArray &channelFlags)
{
Q_UNUSED(flow);
using namespace Arithmetic;
const qint32 alpha_pos = 3;
......
......@@ -201,17 +201,6 @@ template<bool useMask, bool useFlow, class Compositor>
{
using namespace Arithmetic;
quint8 flow;
quint8 opacity;
if (useFlow) {
flow = scale<quint8>(params.flow);
opacity = mul(flow, scale<quint8>(params.opacity));
} else {
flow = 255;
opacity = scale<quint8>(params.opacity);
}
const int vectorSize = Vc::float_v::Size;
const qint32 vectorInc = 4 * vectorSize;
const qint32 linearInc = 4;
......
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