• Halla Rempt's avatar
    Use allGray instead of isGrayScale to determine whether the brush tip is grayscale · f35496cf
    Halla Rempt authored
    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->colortable.at(i) != qRgb(i,i,i))
                    return false;
            return true;
        return false;