static QImage rotated90(const QImage &image) {
QImage out(image.height(), image.width(), image.format());
QIMAGE_SANITYCHECK_MEMORY(out);
- out.setColorTable(image.colorTable());
+ if (out.depth() == 1) {
+ out.setColorTable(image.colorTable());
+ }
int w = image.width();
int h = image.height();
switch (image.format()) {
static QImage rotated270(const QImage &image) {
QImage out(image.height(), image.width(), image.format());
QIMAGE_SANITYCHECK_MEMORY(out);
- out.setColorTable(image.colorTable());
+ if (out.depth() == 1) {
+ out.setColorTable(image.colorTable());
+ }
int w = image.width();
int h = image.height();
switch (image.format()) {
*/
void QImage::setColorTable(const QVector<QRgb> &colors)
{
- if (colors.size() != 2) {
+ if (Q_UNLIKELY(colors.size() != 2)) {
qWarning("QImage::setColorTable: Color table should have two colors");
return;
}