Commit f35496cf authored by Halla Rempt's avatar Halla Rempt
Browse files

Use allGray instead of isGrayScale to determine whether the brush tip is grayscale

This works around a bug in QImage::isGrayScale where images with
16 bits/channel are not checked with allGray, so by default are not
grayscale. These images have depth 64, which is not in the switch

bool QImage::isGrayscale() const
    if (!d)
        return false;

    if (d->format == QImage::Format_Alpha8)
        return false;

    if (d->format == QImage::Format_Grayscale8)
        return true;

    switch (depth()) {
    case 32:
    case 24:
    case 16:
        return allGray();
    case 8: {
        Q_ASSERT(d->format == QImage::Format_Indexed8);
        for (int i = 0; i < colorCount(); i++)
            if (d-> != qRgb(i,i,i))
                return false;
        return true;
    return false;

parent 1fd41188
......@@ -106,7 +106,7 @@ bool KisPngBrush::loadFromDevice(QIODevice *dev)
if (brushTipImage().isGrayscale()) {
if (brushTipImage().allGray()) {
Supports Markdown
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