diff options
author | Simon Hausmann <simon.hausmann@qt.io> | 2017-10-10 09:42:41 +0200 |
---|---|---|
committer | Antti Kokko <antti.kokko@qt.io> | 2017-11-28 18:41:40 +0000 |
commit | 984ad6124992c9831f57c2776aa2ed0a760149e6 (patch) | |
tree | 320236847752f32a56a1c6e18618a353172921f9 /src/gui/image/qimage_conversions.cpp | |
parent | 8298956eb084d8f0e478240a674c5ae131c8be97 (diff) |
Improve readability of code that uses the Qt signed size typev5.10.0-rc2
During the container BoF session at the Qt Contributor Summit 2017 the
name of the signed size type became a subject of discussion in the
context of readability of code using this type and the intention of
using it for all length, size and count properties throughout the entire
framework in future versions of Qt.
This change proposes qsizetype as new name for qssize_t to emphasize the
readability of code over POSIX compatibility, the former being
potentially more relevant than the latter to the majority of users of
Qt.
Change-Id: Idb99cb4a8782703c054fa463a9e5af23a918e7f3
Reviewed-by: Samuel Gaist <samuel.gaist@edeltech.ch>
Reviewed-by: David Faure <david.faure@kdab.com>
Diffstat (limited to 'src/gui/image/qimage_conversions.cpp')
-rw-r--r-- | src/gui/image/qimage_conversions.cpp | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/gui/image/qimage_conversions.cpp b/src/gui/image/qimage_conversions.cpp index 6abaa2887e..4eef617336 100644 --- a/src/gui/image/qimage_conversions.cpp +++ b/src/gui/image/qimage_conversions.cpp @@ -823,8 +823,8 @@ static bool convert_indexed8_to_ARGB_PM_inplace(QImageData *data, Qt::ImageConve const int depth = 32; - const qssize_t dst_bytes_per_line = ((data->width * depth + 31) >> 5) << 2; - const qssize_t nbytes = dst_bytes_per_line * data->height; + const qsizetype dst_bytes_per_line = ((data->width * depth + 31) >> 5) << 2; + const qsizetype nbytes = dst_bytes_per_line * data->height; uchar *const newData = (uchar *)realloc(data->data, nbytes); if (!newData) return false; @@ -877,8 +877,8 @@ static bool convert_indexed8_to_ARGB_inplace(QImageData *data, Qt::ImageConversi const int depth = 32; - const qssize_t dst_bytes_per_line = ((data->width * depth + 31) >> 5) << 2; - const qssize_t nbytes = dst_bytes_per_line * data->height; + const qsizetype dst_bytes_per_line = ((data->width * depth + 31) >> 5) << 2; + const qsizetype nbytes = dst_bytes_per_line * data->height; uchar *const newData = (uchar *)realloc(data->data, nbytes); if (!newData) return false; @@ -945,8 +945,8 @@ static bool convert_indexed8_to_RGB16_inplace(QImageData *data, Qt::ImageConvers const int depth = 16; - const qssize_t dst_bytes_per_line = ((data->width * depth + 31) >> 5) << 2; - const qssize_t nbytes = dst_bytes_per_line * data->height; + const qsizetype dst_bytes_per_line = ((data->width * depth + 31) >> 5) << 2; + const qsizetype nbytes = dst_bytes_per_line * data->height; uchar *const newData = (uchar *)realloc(data->data, nbytes); if (!newData) return false; @@ -1002,8 +1002,8 @@ static bool convert_RGB_to_RGB16_inplace(QImageData *data, Qt::ImageConversionFl const int depth = 16; - const qssize_t dst_bytes_per_line = ((data->width * depth + 31) >> 5) << 2; - const qssize_t src_bytes_per_line = data->bytes_per_line; + const qsizetype dst_bytes_per_line = ((data->width * depth + 31) >> 5) << 2; + const qsizetype src_bytes_per_line = data->bytes_per_line; quint32 *src_data = (quint32 *) data->data; quint16 *dst_data = (quint16 *) data->data; @@ -1257,9 +1257,9 @@ void dither_to_Mono(QImageData *dst, const QImageData *src, } uchar *dst_data = dst->data; - qssize_t dst_bpl = dst->bytes_per_line; + qsizetype dst_bpl = dst->bytes_per_line; const uchar *src_data = src->data; - qssize_t src_bpl = src->bytes_per_line; + qsizetype src_bpl = src->bytes_per_line; switch (dithermode) { case Diffuse: { @@ -1912,8 +1912,8 @@ static void convert_Indexed8_to_Alpha8(QImageData *dest, const QImageData *src, if (simpleCase) memcpy(dest->data, src->data, src->bytes_per_line * src->height); else { - qssize_t size = src->bytes_per_line * src->height; - for (qssize_t i = 0; i < size; ++i) { + qsizetype size = src->bytes_per_line * src->height; + for (qsizetype i = 0; i < size; ++i) { dest->data[i] = translate[src->data[i]]; } } @@ -1936,8 +1936,8 @@ static void convert_Indexed8_to_Grayscale8(QImageData *dest, const QImageData *s if (simpleCase) memcpy(dest->data, src->data, src->bytes_per_line * src->height); else { - qssize_t size = src->bytes_per_line * src->height; - for (qssize_t i = 0; i < size; ++i) { + qsizetype size = src->bytes_per_line * src->height; + for (qsizetype i = 0; i < size; ++i) { dest->data[i] = translate[src->data[i]]; } } |