Commit 24112528 authored by Dmitry Kazakov's avatar Dmitry Kazakov

The copy-constructor should be implemented for structures having pointers

BUG:321935,320651
parent be4f594d
......@@ -42,6 +42,31 @@ QString KoCompositeOp::categoryHSV() { return i18n("HSV"); }
QString KoCompositeOp::categoryMix() { return i18n("Mix"); }
QString KoCompositeOp::categoryMisc() { return i18n("Misc"); }
KoCompositeOp::ParameterInfo::ParameterInfo()
: opacity(1.0f),
flow(1.0f),
lastOpacity(&opacity)
{
}
KoCompositeOp::ParameterInfo::ParameterInfo(const ParameterInfo &rhs)
{
copy(rhs);
}
KoCompositeOp::ParameterInfo& KoCompositeOp::ParameterInfo::operator=(const ParameterInfo &rhs)
{
copy(rhs);
return *this;
}
void KoCompositeOp::ParameterInfo::copy(const ParameterInfo &rhs)
{
memcpy(this, &rhs, sizeof(ParameterInfo));
lastOpacity = rhs.lastOpacity == &rhs.opacity ?
&opacity : &_lastOpacityData;
}
void KoCompositeOp::ParameterInfo::updateOpacityAndAverage(float value) {
const float exponent = 0.1;
......
......@@ -56,12 +56,9 @@ public:
struct PIGMENTCMS_EXPORT ParameterInfo
{
ParameterInfo()
: opacity(1.0f),
flow(1.0f),
lastOpacity(&opacity)
{
}
ParameterInfo();
ParameterInfo(const ParameterInfo &rhs);
ParameterInfo& operator=(const ParameterInfo &rhs);
quint8* dstRowStart;
qint32 dstRowStride;
......@@ -78,6 +75,8 @@ public:
QBitArray channelFlags;
void updateOpacityAndAverage(float value);
private:
inline void copy(const ParameterInfo &rhs);
};
public:
......
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