summaryrefslogtreecommitdiffstats
path: root/src/gui/image
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/image')
-rw-r--r--src/gui/image/qicon.cpp2
-rw-r--r--src/gui/image/qimage.cpp36
-rw-r--r--src/gui/image/qimagereader.cpp4
-rw-r--r--src/gui/image/qpnghandler.cpp4
-rw-r--r--src/gui/image/qxpmhandler.cpp2
5 files changed, 29 insertions, 19 deletions
diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp
index fdb2ab0f9b..4f31414e10 100644
--- a/src/gui/image/qicon.cpp
+++ b/src/gui/image/qicon.cpp
@@ -174,7 +174,7 @@ void QPixmapIconEngine::paint(QPainter *painter, const QRect &rect, QIcon::Mode
auto paintDevice = painter->device();
qreal dpr = paintDevice ? paintDevice->devicePixelRatio() : qApp->devicePixelRatio();
const QSize pixmapSize = rect.size() * dpr;
- QPixmap px = pixmap(pixmapSize, mode, state);
+ QPixmap px = scaledPixmap(pixmapSize, mode, state, dpr);
painter->drawPixmap(rect, px);
}
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp
index 7ca5b13373..9a9ab873ff 100644
--- a/src/gui/image/qimage.cpp
+++ b/src/gui/image/qimage.cpp
@@ -1709,10 +1709,14 @@ void QImage::fill(uint pixel)
w, d->height, d->bytes_per_line);
return;
} else if (d->depth == 16) {
+ if (d->format == Format_RGB444)
+ pixel |= 0xf000;
qt_rectfill<quint16>(reinterpret_cast<quint16*>(d->data), pixel,
0, 0, d->width, d->height, d->bytes_per_line);
return;
} else if (d->depth == 24) {
+ if (d->format == Format_RGB666)
+ pixel |= 0xfc0000;
qt_rectfill<quint24>(reinterpret_cast<quint24*>(d->data), pixel,
0, 0, d->width, d->height, d->bytes_per_line);
return;
@@ -1781,6 +1785,8 @@ void QImage::fill(const QColor &color)
if (!d)
return;
+ QRgba64 opaque = color.rgba64();
+ opaque.setAlpha(65535);
switch (d->format) {
case QImage::Format_RGB32:
case QImage::Format_ARGB32:
@@ -1799,12 +1805,10 @@ void QImage::fill(const QColor &color)
fill(ARGB2RGBA(qPremultiply(color.rgba())));
break;
case QImage::Format_BGR30:
- case QImage::Format_A2BGR30_Premultiplied:
- fill(qConvertRgb64ToRgb30<PixelOrderBGR>(color.rgba64()));
+ fill(qConvertRgb64ToRgb30<PixelOrderBGR>(opaque));
break;
case QImage::Format_RGB30:
- case QImage::Format_A2RGB30_Premultiplied:
- fill(qConvertRgb64ToRgb30<PixelOrderRGB>(color.rgba64()));
+ fill(qConvertRgb64ToRgb30<PixelOrderRGB>(opaque));
break;
case QImage::Format_RGB16:
fill((uint) qConvertRgb32To16(color.rgba()));
@@ -1827,19 +1831,18 @@ void QImage::fill(const QColor &color)
else
fill((uint) 0);
break;
- case QImage::Format_RGBX64: {
- QRgba64 c = color.rgba64();
- c.setAlpha(65535);
- qt_rectfill<quint64>(reinterpret_cast<quint64*>(d->data), c,
+ case QImage::Format_RGBX64:
+ qt_rectfill<quint64>(reinterpret_cast<quint64*>(d->data), opaque,
0, 0, d->width, d->height, d->bytes_per_line);
break;
-
- }
case QImage::Format_RGBA64:
- case QImage::Format_RGBA64_Premultiplied:
qt_rectfill<quint64>(reinterpret_cast<quint64*>(d->data), color.rgba64(),
0, 0, d->width, d->height, d->bytes_per_line);
break;
+ case QImage::Format_RGBA64_Premultiplied:
+ qt_rectfill<quint64>(reinterpret_cast<quint64 *>(d->data), color.rgba64().premultiplied(),
+ 0, 0, d->width, d->height, d->bytes_per_line);
+ break;
default: {
QPainter p(this);
p.setCompositionMode(QPainter::CompositionMode_Source);
@@ -2467,7 +2470,7 @@ void QImage::setPixel(int x, int y, uint index_or_rgb)
((uint *)s)[x] = index_or_rgb;
return;
case Format_RGB16:
- ((quint16 *)s)[x] = qConvertRgb32To16(qUnpremultiply(index_or_rgb));
+ ((quint16 *)s)[x] = qConvertRgb32To16(index_or_rgb);
return;
case Format_RGBX8888:
((uint *)s)[x] = ARGB2RGBA(0xff000000 | index_or_rgb);
@@ -2488,6 +2491,10 @@ void QImage::setPixel(int x, int y, uint index_or_rgb)
case Format_A2RGB30_Premultiplied:
((uint *)s)[x] = qConvertArgb32ToA2rgb30<PixelOrderRGB>(index_or_rgb);
return;
+ case Format_RGBA64:
+ case Format_RGBA64_Premultiplied:
+ ((QRgba64 *)s)[x] = QRgba64::fromArgb32(index_or_rgb);
+ return;
case Format_Invalid:
case NImageFormats:
Q_ASSERT(false);
@@ -2497,7 +2504,10 @@ void QImage::setPixel(int x, int y, uint index_or_rgb)
}
const QPixelLayout *layout = &qPixelLayouts[d->format];
- layout->storeFromARGB32PM(s, &index_or_rgb, x, 1, nullptr, nullptr);
+ if (!hasAlphaChannel())
+ layout->storeFromRGB32(s, &index_or_rgb, x, 1, nullptr, nullptr);
+ else
+ layout->storeFromARGB32PM(s, &index_or_rgb, x, 1, nullptr, nullptr);
}
/*!
diff --git a/src/gui/image/qimagereader.cpp b/src/gui/image/qimagereader.cpp
index 611cbb1df1..fccf67b428 100644
--- a/src/gui/image/qimagereader.cpp
+++ b/src/gui/image/qimagereader.cpp
@@ -769,7 +769,7 @@ bool QImageReader::decideFormatFromContent() const
otherwise left unchanged.
If the device is not already open, QImageReader will attempt to
- open the device in \l QIODevice::ReadOnly mode by calling
+ open the device in \l {QIODeviceBase::}{ReadOnly} mode by calling
open(). Note that this does not work for certain devices, such as
QProcess, QTcpSocket and QUdpSocket, where more logic is required
to open the device.
@@ -799,7 +799,7 @@ QIODevice *QImageReader::device() const
/*!
Sets the file name of QImageReader to \a fileName. Internally,
QImageReader will create a QFile object and open it in \l
- QIODevice::ReadOnly mode, and use this when reading images.
+ {QIODeviceBase::}{ReadOnly} mode, and use this when reading images.
If \a fileName does not include a file extension (e.g., .png or .bmp),
QImageReader will cycle through all supported extensions until it finds
diff --git a/src/gui/image/qpnghandler.cpp b/src/gui/image/qpnghandler.cpp
index de913af320..20a86b4f8f 100644
--- a/src/gui/image/qpnghandler.cpp
+++ b/src/gui/image/qpnghandler.cpp
@@ -500,7 +500,7 @@ static void read_image_scaled(QImage *outImage, png_structp png_ptr, png_infop i
extern "C" {
static void qt_png_warning(png_structp /*png_ptr*/, png_const_charp message)
{
- qCWarning(lcImageIo, "libpng warning: %s", message);
+ qCInfo(lcImageIo, "libpng warning: %s", message);
}
}
@@ -590,7 +590,7 @@ bool QPngHandlerPrivate::readPngHeader()
png_get_iCCP(png_ptr, info_ptr, &name, &compressionType, &profileData, &profLen);
colorSpace = QColorSpace::fromIccProfile(QByteArray((const char *)profileData, profLen));
if (!colorSpace.isValid()) {
- qCWarning(lcImageIo) << "QPngHandler: Failed to parse ICC profile";
+ qCDebug(lcImageIo) << "QPngHandler: Failed to parse ICC profile";
} else {
QColorSpacePrivate *csD = QColorSpacePrivate::get(colorSpace);
if (csD->description.isEmpty())
diff --git a/src/gui/image/qxpmhandler.cpp b/src/gui/image/qxpmhandler.cpp
index 7b545614a7..8ec09f2480 100644
--- a/src/gui/image/qxpmhandler.cpp
+++ b/src/gui/image/qxpmhandler.cpp
@@ -934,7 +934,7 @@ static bool read_xpm_body(
colorMap.insert(xpmHash(QLatin1String(index.constData())), 0);
}
} else {
- QRgb c_rgb;
+ QRgb c_rgb = 0;
if (((buf.length()-1) % 3) && (buf[0] == '#')) {
buf.truncate(((buf.length()-1) / 4 * 3) + 1); // remove alpha channel left by imagemagick
}