[krita] libs/pigment/compositeops: Temporarily push D18467
Wolthera van Hövell tot Westerflier
null at kde.org
Wed Jan 23 18:55:56 GMT 2019
Git commit e3c2f5bed0c83462f893919098dad16d37263698 by Wolthera van Hövell tot Westerflier.
Committed on 23/01/2019 at 18:50.
Pushed by woltherav into branch 'master'.
Temporarily push D18467
This patch changes the way how opacity and flow interact. This can mean
that a lot of presets work way differently from before. Therefore artists
need to test so we can get some feedback on how the patch feels.
For more information, and to give feedback, check https://phabricator.kde.org/T8576
This is so that artists can test it via the nightly builds.
We'll try to revert it on Monday 28th of January.
Patch by William Brown.
Note: We still need to do a proper code review!
CCMAIL:kimageshop at kde.org
Ref T8576
M +3 -3 libs/pigment/compositeops/KoCompositeOpAlphaDarken.h
M +4 -14 libs/pigment/compositeops/KoOptimizedCompositeOpAlphaDarken128.h
M +4 -15 libs/pigment/compositeops/KoOptimizedCompositeOpAlphaDarken32.h
https://commits.kde.org/krita/e3c2f5bed0c83462f893919098dad16d37263698
diff --git a/libs/pigment/compositeops/KoCompositeOpAlphaDarken.h b/libs/pigment/compositeops/KoCompositeOpAlphaDarken.h
index 894781692b0..51d5d9cfa61 100644
--- a/libs/pigment/compositeops/KoCompositeOpAlphaDarken.h
+++ b/libs/pigment/compositeops/KoCompositeOpAlphaDarken.h
@@ -57,7 +57,7 @@ public:
qint32 srcInc = (params.srcRowStride == 0) ? 0 : channels_nb;
channels_type flow = scale<channels_type>(params.flow);
- channels_type opacity = mul(flow, scale<channels_type>(params.opacity));
+ channels_type opacity = scale<channels_type>(params.opacity);
quint8* dstRowStart = params.dstRowStart;
const quint8* srcRowStart = params.srcRowStart;
const quint8* maskRowStart = params.maskRowStart;
@@ -89,7 +89,7 @@ public:
if(alpha_pos != -1) {
channels_type fullFlowAlpha;
- channels_type averageOpacity = mul(flow, scale<channels_type>(*params.lastOpacity));
+ channels_type averageOpacity = scale<channels_type>(*params.lastOpacity);
if (averageOpacity > opacity) {
channels_type reverseBlend = KoColorSpaceMaths<channels_type>::divide(dstAlpha, averageOpacity);
@@ -101,7 +101,7 @@ public:
if (params.flow == 1.0) {
dstAlpha = fullFlowAlpha;
} else {
- channels_type zeroFlowAlpha = unionShapeOpacity(srcAlpha, dstAlpha);
+ channels_type zeroFlowAlpha = dstAlpha;
dstAlpha = lerp(zeroFlowAlpha, fullFlowAlpha, flow);
}
diff --git a/libs/pigment/compositeops/KoOptimizedCompositeOpAlphaDarken128.h b/libs/pigment/compositeops/KoOptimizedCompositeOpAlphaDarken128.h
index 4c020aba19e..367357d9274 100644
--- a/libs/pigment/compositeops/KoOptimizedCompositeOpAlphaDarken128.h
+++ b/libs/pigment/compositeops/KoOptimizedCompositeOpAlphaDarken128.h
@@ -29,13 +29,11 @@ struct AlphaDarkenCompositor128 {
struct OptionalParams {
OptionalParams(const KoCompositeOp::ParameterInfo& params)
: flow(params.flow)
- , averageOpacity(*params.lastOpacity * params.flow)
- , premultipliedOpacity(params.opacity * params.flow)
+ , averageOpacity(*params.lastOpacity)
{
}
float flow;
float averageOpacity;
- float premultipliedOpacity;
};
struct Pixel {
@@ -83,12 +81,7 @@ struct AlphaDarkenCompositor128 {
msk_norm_alpha = src_alpha;
}
- // we don't use directly passed value
- Q_UNUSED(opacity);
-
- // instead we should use opacity premultiplied by flow
- opacity = oparams.premultipliedOpacity;
- Vc::float_v opacity_vec(oparams.premultipliedOpacity);
+ Vc::float_v opacity_vec(opacity);
src_alpha = msk_norm_alpha * opacity_vec;
@@ -142,7 +135,7 @@ struct AlphaDarkenCompositor128 {
dst_alpha = fullFlowAlpha;
}
else {
- Vc::float_v zeroFlowAlpha = src_alpha + dst_alpha - src_alpha * dst_alpha;
+ Vc::float_v zeroFlowAlpha = dst_alpha;
Vc::float_v flow_norm_vec(oparams.flow);
dst_alpha = (fullFlowAlpha - zeroFlowAlpha) * flow_norm_vec + zeroFlowAlpha;
}
@@ -166,9 +159,6 @@ struct AlphaDarkenCompositor128 {
const float uint8Rec1 = 1.0 / 255.0;
float mskAlphaNorm = haveMask ? float(*mask) * uint8Rec1 * src[alpha_pos] : src[alpha_pos];
- Q_UNUSED(opacity);
- opacity = oparams.premultipliedOpacity;
-
float srcAlphaNorm = mskAlphaNorm * opacity;
if (dstAlphaNorm != 0) {
@@ -195,7 +185,7 @@ struct AlphaDarkenCompositor128 {
if (flow == 1.0) {
dst[alpha_pos] = fullFlowAlpha;
} else {
- float zeroFlowAlpha = unionShapeOpacity(srcAlphaNorm, dstAlphaNorm);
+ float zeroFlowAlpha = dstAlphaNorm;
dst[alpha_pos] = lerp(zeroFlowAlpha, fullFlowAlpha, flow);
}
}
diff --git a/libs/pigment/compositeops/KoOptimizedCompositeOpAlphaDarken32.h b/libs/pigment/compositeops/KoOptimizedCompositeOpAlphaDarken32.h
index 41de2b363df..6932d1aac30 100644
--- a/libs/pigment/compositeops/KoOptimizedCompositeOpAlphaDarken32.h
+++ b/libs/pigment/compositeops/KoOptimizedCompositeOpAlphaDarken32.h
@@ -31,13 +31,11 @@ struct AlphaDarkenCompositor32 {
struct OptionalParams {
OptionalParams(const KoCompositeOp::ParameterInfo& params)
: flow(params.flow),
- averageOpacity(*params.lastOpacity * params.flow),
- premultipliedOpacity(params.opacity * params.flow)
+ averageOpacity(*params.lastOpacity)
{
}
float flow;
float averageOpacity;
- float premultipliedOpacity;
};
/**
@@ -59,12 +57,7 @@ struct AlphaDarkenCompositor32 {
Vc::float_v src_alpha;
Vc::float_v dst_alpha;
- // we don't use directly passed value
- Q_UNUSED(opacity);
-
- // instead we should use opacity premultiplied by flow
- opacity = oparams.premultipliedOpacity;
- Vc::float_v opacity_vec(255.0 * oparams.premultipliedOpacity);
+ Vc::float_v opacity_vec(255.0 * opacity);
Vc::float_v average_opacity_vec(255.0 * oparams.averageOpacity);
Vc::float_v flow_norm_vec(oparams.flow);
@@ -170,8 +163,7 @@ struct AlphaDarkenCompositor32 {
if (oparams.flow == 1.0) {
dst_alpha = fullFlowAlpha;
} else {
- Vc::float_v zeroFlowAlpha = src_alpha + dst_alpha -
- dst_blend * dst_alpha;
+ Vc::float_v zeroFlowAlpha = dst_alpha;
dst_alpha = (fullFlowAlpha - zeroFlowAlpha) * flow_norm_vec + zeroFlowAlpha;
}
@@ -196,9 +188,6 @@ struct AlphaDarkenCompositor32 {
float srcAlphaNorm;
float mskAlphaNorm;
- Q_UNUSED(opacity);
- opacity = oparams.premultipliedOpacity;
-
if (haveMask) {
mskAlphaNorm = float(*mask) * uint8Rec2 * src[alpha_pos];
srcAlphaNorm = mskAlphaNorm * opacity;
@@ -234,7 +223,7 @@ struct AlphaDarkenCompositor32 {
if (flow == 1.0) {
dstAlpha = fullFlowAlpha * uint8Max;
} else {
- float zeroFlowAlpha = unionShapeOpacity(srcAlphaNorm, dstAlphaNorm);
+ float zeroFlowAlpha = dstAlphaNorm;
dstAlpha = lerp(zeroFlowAlpha, fullFlowAlpha, flow) * uint8Max;
}
More information about the kimageshop
mailing list