Commit ca741341 authored by Boudewijn Rempt's avatar Boudewijn Rempt

Fix warning -Wclass-memaccess

In file included from /home/boud/dev/krita/libs/pigment/compositeops/KoCompositeOpCopy2.h:26,
                 from /home/boud/dev/krita/libs/pigment/colorspaces/KoAlphaColorSpace.cpp:35:
/home/boud/dev/krita/libs/pigment/compositeops/KoCompositeOpBase.h: In instantiation of ‘void KoCompositeOpBase<_CSTraits, _compositeOp>::genericComposite(const KoCompositeOp::ParameterInfo&, const QBitArray&) const [with bool useMask = true; bool alphaLocked = true; bool allChannelFlags = true; _CSTraits = KoColorSpaceTrait<half, 1, 0>; _compositeOp = AlphaColorSpaceMultiplyOp<KoColorSpaceTrait<half, 1, 0> >]’:
/home/boud/dev/krita/libs/pigment/compositeops/KoCompositeOpBase.h:67:72:   required from ‘void KoCompositeOpBase<_CSTraits, _compositeOp>::composite(const KoCompositeOp::ParameterInfo&) const [with _CSTraits = KoColorSpaceTrait<half, 1, 0>; _compositeOp = AlphaColorSpaceMultiplyOp<KoColorSpaceTrait<half, 1, 0> >]’
/home/boud/dev/krita/libs/pigment/compositeops/KoCompositeOpBase.h:58:10:   required from here
/home/boud/dev/krita/libs/pigment/compositeops/KoCompositeOpBase.h:110:27: warning: ‘void* memset(void*, int, size_t)’ clearing an object of type ‘KoCompositeOpBase<KoColorSpaceTrait<half, 1, 0>, AlphaColorSpaceMultiplyOp<KoColorSpaceTrait<half, 1, 0> > >::channels_type’ {aka ‘class half’} with no trivial copy-assignment; use assignment or value-initialization instead [-Wclass-memaccess]
                     memset(dst, 0, pixel_size);
                     ~~~~~~^~~~~~~~~~~~~~~~~~~~
parent fb573579
......@@ -61,7 +61,7 @@ if (APPLE)
endif()
if (CMAKE_COMPILER_IS_GNUCXX AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9 AND NOT WIN32)
add_definitions(-Wno-suggest-override)
add_definitions(-Wno-suggest-override -Wextra)
endif()
######################
......
......@@ -96,18 +96,18 @@ private:
const quint8* srcRowStart = params.srcRowStart;
const quint8* maskRowStart = params.maskRowStart;
for(qint32 r=0; r<params.rows; ++r) {
for (qint32 r=0; r<params.rows; ++r) {
const channels_type* src = reinterpret_cast<const channels_type*>(srcRowStart);
channels_type* dst = reinterpret_cast<channels_type*>(dstRowStart);
const quint8* mask = maskRowStart;
for(qint32 c=0; c<params.cols; ++c) {
for (qint32 c=0; c<params.cols; ++c) {
channels_type srcAlpha = (alpha_pos == -1) ? unitValue<channels_type>() : src[alpha_pos];
channels_type dstAlpha = (alpha_pos == -1) ? unitValue<channels_type>() : dst[alpha_pos];
channels_type mskAlpha = useMask ? scale<channels_type>(*mask) : unitValue<channels_type>();
if (!allChannelFlags && dstAlpha == zeroValue<channels_type>()) {
memset(dst, 0, pixel_size);
memset(reinterpret_cast<quint8*>(dst), 0, pixel_size);
}
channels_type newDstAlpha = _compositeOp::template composeColorChannels<alphaLocked,allChannelFlags>(
......
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