summaryrefslogtreecommitdiffstats
path: root/src/gui/painting
diff options
context:
space:
mode:
authorGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2024-03-01 19:15:06 +0100
committerGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2024-04-04 16:08:22 +0100
commit7f72a93e874f5e52612983ad3b764f07216bf62e (patch)
tree957a24c97e355f2f9e5c0369898acaa981bdf39b /src/gui/painting
parentadb49d65e0774fa6be0b0d9d490c6f1fc5066a1b (diff)
Port QImage::Format_CMYK32 to CMYK8888
Follow the established convention that byte-oriented image formats have the "8888" suffix, not "32". The old enum name is temporarily left to help port other submodules. This work has been kindly sponsored by the QGIS project (https://qgis.org/). Change-Id: I4b6f10cb22312b614cb9cf4b0ac439907276c538 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/gui/painting')
-rw-r--r--src/gui/painting/qdrawhelper.cpp12
-rw-r--r--src/gui/painting/qpainter.cpp2
-rw-r--r--src/gui/painting/qpdf.cpp12
-rw-r--r--src/gui/painting/qpixellayout.cpp22
4 files changed, 24 insertions, 24 deletions
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp
index 1ffe88e459..8b17a4fedc 100644
--- a/src/gui/painting/qdrawhelper.cpp
+++ b/src/gui/painting/qdrawhelper.cpp
@@ -397,7 +397,7 @@ static DestFetchProc destFetchProc[] =
destFetch, // Format_RGBX32FPx4
destFetch, // Format_RGBA32FPx4
destFetch, // Format_RGBA32FPx4_Premultiplied
- destFetch, // Format_CMYK32
+ destFetch, // Format_CMYK8888
};
static_assert(std::size(destFetchProc) == QImage::NImageFormats);
@@ -457,7 +457,7 @@ static DestFetchProc64 destFetchProc64[] =
destFetch64, // Format_RGBX32FPx4
destFetch64, // Format_RGBA32FPx4
destFetch64, // Format_RGBA32FPx4_Premultiplied
- destFetch64, // Format_CMYK32
+ destFetch64, // Format_CMYK8888
};
static_assert(std::size(destFetchProc64) == QImage::NImageFormats);
@@ -516,7 +516,7 @@ static DestFetchProcFP destFetchProcFP[] =
destFetchRGBFP, // Format_RGBX32FPx4
destFetchFP, // Format_RGBA32FPx4
destFetchRGBFP, // Format_RGBA32FPx4_Premultiplied
- destFetchFP, // Format_CMYK32
+ destFetchFP, // Format_CMYK8888
};
static_assert(std::size(destFetchProcFP) == QImage::NImageFormats);
@@ -710,7 +710,7 @@ static DestStoreProc destStoreProc[] =
destStore, // Format_RGBX32FPx4
destStore, // Format_RGBA32FPx4
destStore, // Format_RGBA32FPx4_Premultiplied
- destStore, // Format_CMYK32
+ destStore, // Format_CMYK8888
};
static_assert(std::size(destStoreProc) == QImage::NImageFormats);
@@ -813,7 +813,7 @@ static DestStoreProc64 destStoreProc64[] =
destStore64, // Format_RGBX32FPx4
destStore64, // Format_RGBA32FPx4
destStore64, // Format_RGBA32FPx4_Premultiplied
- destStore64, // Format_CMYK32
+ destStore64, // Format_CMYK8888
};
static_assert(std::size(destStoreProc64) == QImage::NImageFormats);
@@ -3128,7 +3128,7 @@ static SourceFetchProc sourceFetchUntransformed[] = {
fetchUntransformed, // RGBX32Px4
fetchUntransformed, // RGBA32FPx4
fetchUntransformed, // RGBA32FPx4_Premultiplied
- fetchUntransformed, // CMYK32
+ fetchUntransformed, // CMYK8888
};
static_assert(std::size(sourceFetchUntransformed) == QImage::NImageFormats);
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp
index 148cc6c5dd..f4b9741eed 100644
--- a/src/gui/painting/qpainter.cpp
+++ b/src/gui/painting/qpainter.cpp
@@ -1766,7 +1766,7 @@ bool QPainter::begin(QPaintDevice *pd)
qt_cleanup_painter_state(d);
return false;
} else if (img->format() == QImage::Format_Indexed8 ||
- img->format() == QImage::Format_CMYK32) {
+ img->format() == QImage::Format_CMYK8888) {
// Painting on these formats is not supported.
qWarning() << "QPainter::begin: Cannot paint on an image with the"
<< img->format()
diff --git a/src/gui/painting/qpdf.cpp b/src/gui/painting/qpdf.cpp
index eb80ace232..38f2a9b803 100644
--- a/src/gui/painting/qpdf.cpp
+++ b/src/gui/painting/qpdf.cpp
@@ -3056,7 +3056,7 @@ int QPdfEnginePrivate::addImage(const QImage &img, bool *bitmap, bool lossless,
format = QImage::Format_Mono;
} else {
*bitmap = false;
- if (format != QImage::Format_RGB32 && format != QImage::Format_ARGB32 && format != QImage::Format_CMYK32) {
+ if (format != QImage::Format_RGB32 && format != QImage::Format_ARGB32 && format != QImage::Format_CMYK8888) {
image = image.convertToFormat(QImage::Format_ARGB32);
format = QImage::Format_ARGB32;
}
@@ -3086,14 +3086,14 @@ int QPdfEnginePrivate::addImage(const QImage &img, bool *bitmap, bool lossless,
QBuffer buffer(&imageData);
QImageWriter writer(&buffer, "jpeg");
writer.setQuality(94);
- if (format == QImage::Format_CMYK32) {
+ if (format == QImage::Format_CMYK8888) {
// PDFs require CMYK colors not to be inverted in the JPEG encoding
writer.setSubType("CMYK");
}
writer.write(image);
dct = true;
- if (format != QImage::Format_RGB32 && format != QImage::Format_CMYK32) {
+ if (format != QImage::Format_RGB32 && format != QImage::Format_CMYK8888) {
softMaskData.resize(w * h);
uchar *sdata = (uchar *)softMaskData.data();
for (int y = 0; y < h; ++y) {
@@ -3108,7 +3108,7 @@ int QPdfEnginePrivate::addImage(const QImage &img, bool *bitmap, bool lossless,
}
}
} else {
- if (format == QImage::Format_CMYK32) {
+ if (format == QImage::Format_CMYK8888) {
imageData.resize(grayscale ? w * h : w * h * 4);
uchar *data = (uchar *)imageData.data();
const qsizetype bytesPerLine = image.bytesPerLine();
@@ -3154,7 +3154,7 @@ int QPdfEnginePrivate::addImage(const QImage &img, bool *bitmap, bool lossless,
}
}
}
- if (format == QImage::Format_RGB32 || format == QImage::Format_CMYK32)
+ if (format == QImage::Format_RGB32 || format == QImage::Format_CMYK8888)
hasAlpha = hasMask = false;
}
int maskObject = 0;
@@ -3182,7 +3182,7 @@ int QPdfEnginePrivate::addImage(const QImage &img, bool *bitmap, bool lossless,
const WriteImageOption option = [&]() {
if (grayscale)
return WriteImageOption::Grayscale;
- if (format == QImage::Format_CMYK32)
+ if (format == QImage::Format_CMYK8888)
return WriteImageOption::CMYK;
return WriteImageOption::RGB;
}();
diff --git a/src/gui/painting/qpixellayout.cpp b/src/gui/painting/qpixellayout.cpp
index 1f34650e57..c6c27a3521 100644
--- a/src/gui/painting/qpixellayout.cpp
+++ b/src/gui/painting/qpixellayout.cpp
@@ -1658,7 +1658,7 @@ static const QRgba64 *QT_FASTCALL fetchRGBA32FPMToRGBA64PM(QRgba64 *buffer, cons
return buffer;
}
-inline const uint *qt_convertCMYK32ToARGB32PM(uint *buffer, const uint *src, int count)
+inline const uint *qt_convertCMYK8888ToARGB32PM(uint *buffer, const uint *src, int count)
{
UNALIASED_CONVERSION_LOOP(buffer, src, count, [](uint s) {
const QColor color = QCmyk32::fromCmyk32(s).toColor();
@@ -1667,12 +1667,12 @@ inline const uint *qt_convertCMYK32ToARGB32PM(uint *buffer, const uint *src, int
return buffer;
}
-static void QT_FASTCALL convertCMYK32ToARGB32PM(uint *buffer, int count, const QList<QRgb> *)
+static void QT_FASTCALL convertCMYK8888ToARGB32PM(uint *buffer, int count, const QList<QRgb> *)
{
- qt_convertCMYK32ToARGB32PM(buffer, buffer, count);
+ qt_convertCMYK8888ToARGB32PM(buffer, buffer, count);
}
-static const QRgba64 *QT_FASTCALL convertCMYK32ToToRGBA64PM(QRgba64 *buffer, const uint *src, int count,
+static const QRgba64 *QT_FASTCALL convertCMYK8888ToToRGBA64PM(QRgba64 *buffer, const uint *src, int count,
const QList<QRgb> *, QDitherInfo *)
{
for (int i = 0; i < count; ++i)
@@ -1680,7 +1680,7 @@ static const QRgba64 *QT_FASTCALL convertCMYK32ToToRGBA64PM(QRgba64 *buffer, con
return buffer;
}
-static const uint *QT_FASTCALL fetchCMYK32ToARGB32PM(uint *buffer, const uchar *src, int index, int count,
+static const uint *QT_FASTCALL fetchCMYK8888ToARGB32PM(uint *buffer, const uchar *src, int index, int count,
const QList<QRgb> *, QDitherInfo *)
{
const uint *s = reinterpret_cast<const uint *>(src) + index;
@@ -1689,7 +1689,7 @@ static const uint *QT_FASTCALL fetchCMYK32ToARGB32PM(uint *buffer, const uchar *
return buffer;
}
-static const QRgba64 *QT_FASTCALL fetchCMYK32ToRGBA64PM(QRgba64 *buffer, const uchar *src, int index, int count,
+static const QRgba64 *QT_FASTCALL fetchCMYK8888ToRGBA64PM(QRgba64 *buffer, const uchar *src, int index, int count,
const QList<QRgb> *, QDitherInfo *)
{
const uint *s = reinterpret_cast<const uint *>(src) + index;
@@ -1698,7 +1698,7 @@ static const QRgba64 *QT_FASTCALL fetchCMYK32ToRGBA64PM(QRgba64 *buffer, const u
return buffer;
}
-static void QT_FASTCALL storeCMYKFromARGB32PM(uchar *dest, const uint *src, int index, int count,
+static void QT_FASTCALL storeCMYK8888FromARGB32PM(uchar *dest, const uint *src, int index, int count,
const QList<QRgb> *, QDitherInfo *)
{
uint *d = reinterpret_cast<uint *>(dest) + index;
@@ -1708,7 +1708,7 @@ static void QT_FASTCALL storeCMYKFromARGB32PM(uchar *dest, const uint *src, int
}
}
-static void QT_FASTCALL storeCMYKFromRGB32(uchar *dest, const uint *src, int index, int count,
+static void QT_FASTCALL storeCMYK8888FromRGB32(uchar *dest, const uint *src, int index, int count,
const QList<QRgb> *, QDitherInfo *)
{
uint *d = reinterpret_cast<uint *>(dest) + index;
@@ -1841,9 +1841,9 @@ QPixelLayout qPixelLayouts[] = {
fetchRGB32FToRGB32, fetchRGBA32FPMToRGBA64PM,
storeRGB32FFromRGB32, storeRGB32FFromRGB32 }, // Format_RGBA32FPx4_Premultiplied
{ false, false, QPixelLayout::BPP32, nullptr,
- convertCMYK32ToARGB32PM, convertCMYK32ToToRGBA64PM,
- fetchCMYK32ToARGB32PM, fetchCMYK32ToRGBA64PM,
- storeCMYKFromARGB32PM, storeCMYKFromRGB32 }, // Format_CMYK32
+ convertCMYK8888ToARGB32PM, convertCMYK8888ToToRGBA64PM,
+ fetchCMYK8888ToARGB32PM, fetchCMYK8888ToRGBA64PM,
+ storeCMYK8888FromARGB32PM, storeCMYK8888FromRGB32 }, // Format_CMYK8888
};
static_assert(std::size(qPixelLayouts) == QImage::NImageFormats);