diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2021-08-04 16:40:24 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2021-08-05 07:35:20 +0200 |
commit | 2658f95d3c3aafe3d3da20bf02d597f70277cd8f (patch) | |
tree | 194c602c4ed1b3d1f473b98b942d6a50aa7967f5 /src | |
parent | ec40e505068c9e75d69f13666aa3f182cf2fc2c4 (diff) |
QXpmHandler: clean up write_xpm_image: scope variables better
... and fix spacing around operators and after flow-control keywords.
Change-Id: Iefaa03074536d13a655c91fb42aef6aa96c2665b
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/image/qxpmhandler.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/gui/image/qxpmhandler.cpp b/src/gui/image/qxpmhandler.cpp index f9247f9ff0..ae3fc8128d 100644 --- a/src/gui/image/qxpmhandler.cpp +++ b/src/gui/image/qxpmhandler.cpp @@ -1128,12 +1128,11 @@ static bool write_xpm_image(const QImage &sourceImage, QIODevice *device, const const int w = image.width(); const int h = image.height(); int ncolors = 0; - int x, y; // build color table - for(y=0; y<h; y++) { + for (int y = 0; y < h; ++y) { const QRgb *yp = reinterpret_cast<const QRgb *>(image.constScanLine(y)); - for(x=0; x<w; x++) { + for (int x = 0; x < w; ++x) { QRgb color = *(yp + x); const auto [it, inserted] = colorMap.try_emplace(color, ncolors); if (inserted) @@ -1168,10 +1167,10 @@ static bool write_xpm_image(const QImage &sourceImage, QIODevice *device, const // write pixels, limit to 4 characters per pixel QByteArray line; - for(y=0; y<h; y++) { + for (int y = 0; y < h; ++y) { line.clear(); const QRgb *yp = reinterpret_cast<const QRgb *>(image.constScanLine(y)); - for(x=0; x<w; x++) { + for (int x = 0; x < w; ++x) { int color = (int)(*(yp + x)); line.append(xpm_color_name(cpp, colorMap[color])); } |