Commit 76c28d6a authored by Mathias Wein's avatar Mathias Wein
Browse files

Fix optimized alpha darken composite operation for float channels

The code attempted to copy a pixel via 'pixel_type' pointer,
but this template parameter does not actually describe the pixel type
(it's quint32), since 'Pixel' is defined in the template itself and
hence can't be used as template parameter.

May this template parameter should just be dropped...

But since there's no need to copy the whole pixel, just copy the color channels.

BUG:404133
parent 189e0cfa
...@@ -94,19 +94,9 @@ template<> ...@@ -94,19 +94,9 @@ template<>
struct OptimizedOpsSelector<KoRgbF32Traits> struct OptimizedOpsSelector<KoRgbF32Traits>
{ {
static KoCompositeOp* createAlphaDarkenOp(const KoColorSpace *cs) { static KoCompositeOp* createAlphaDarkenOp(const KoColorSpace *cs) {
return useCreamyAlphaDarken() ?
// TODO: optimized code is disabled for 4.2 release, KoOptimizedCompositeOpFactory::createAlphaDarkenOpCreamy128(cs) :
// because it causes bug https://bugs.kde.org/show_bug.cgi?id=404133 KoOptimizedCompositeOpFactory::createAlphaDarkenOpHard128(cs);
if (useCreamyAlphaDarken()) {
return new KoCompositeOpAlphaDarken<KoRgbF32Traits, KoAlphaDarkenParamsWrapperCreamy>(cs);
} else {
return new KoCompositeOpAlphaDarken<KoRgbF32Traits, KoAlphaDarkenParamsWrapperHard>(cs);
}
// TODO: please restore this optimized version when the bug is fixed
// return useCreamyAlphaDarken() ?
// KoOptimizedCompositeOpFactory::createAlphaDarkenOpCreamy128(cs) :
// KoOptimizedCompositeOpFactory::createAlphaDarkenOpHard128(cs);
} }
static KoCompositeOp* createOverOp(const KoColorSpace *cs) { static KoCompositeOp* createOverOp(const KoColorSpace *cs) {
......
...@@ -167,9 +167,9 @@ struct AlphaDarkenCompositor128 { ...@@ -167,9 +167,9 @@ struct AlphaDarkenCompositor128 {
dst[1] = lerp(dst[1], src[1], srcAlphaNorm); dst[1] = lerp(dst[1], src[1], srcAlphaNorm);
dst[2] = lerp(dst[2], src[2], srcAlphaNorm); dst[2] = lerp(dst[2], src[2], srcAlphaNorm);
} else { } else {
const pixel_type *s = reinterpret_cast<const pixel_type*>(src); dst[0] = src[0];
pixel_type *d = reinterpret_cast<pixel_type*>(dst); dst[1] = src[1];
*d = *s; dst[2] = src[2];
} }
float flow = oparams.flow; float flow = oparams.flow;
......
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