xcf: Fix fix for opacity being out of bounds

If max opacity is 255 we want the min between opacity and 255 and not the max
This commit is contained in:
Albert Astals Cid 2019-02-01 11:30:28 +01:00
parent 8e48d67568
commit 8d0b625538

View File

@ -676,7 +676,7 @@ bool XCFImageFormat::loadLayerProperties(QDataStream &xcf_io, Layer &layer)
case PROP_OPACITY:
property >> layer.opacity;
layer.opacity = std::max(layer.opacity, 255u);
layer.opacity = std::min(layer.opacity, 255u);
break;
case PROP_VISIBLE:
@ -1302,7 +1302,7 @@ bool XCFImageFormat::loadChannelProperties(QDataStream &xcf_io, Layer &layer)
case PROP_OPACITY:
property >> layer.mask_channel.opacity;
layer.mask_channel.opacity = std::max(layer.mask_channel.opacity, 255u);
layer.mask_channel.opacity = std::min(layer.mask_channel.opacity, 255u);
break;
case PROP_VISIBLE: