summaryrefslogtreecommitdiffstats
path: root/src/gui/image
Commit message (Collapse)AuthorAgeFilesLines
* Add -Wshorten-64-to-32 to headerscleanTor Arne Vestbø2022-07-211-1/+1
| | | | | | | | Fix existing warnings by casting to the appropriate type. Change-Id: Ic44d2a71e1a2e508199dbb46bea7a19e183ec42c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Purge Q_DUMMY_COMPARISON_OPERATOR usagesFabian Kosmale2022-07-212-3/+0
| | | | | | | | It is a noop on all our supported compilers. Task-number: QTBUG-105098 Change-Id: Ic59d4c86d96ea29a5513d778ddd35df8c7a6877a Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Doc: Remove Qt-5 only part in qimageiohandler.cppKai Köhne2022-07-201-5/+0
| | | | | Change-Id: Ie9c3633be3acca158499a5be8f344331df82b528 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* QIcon: remove icon from cache if the cached engine fails to loadLu YaNing2022-07-071-4/+8
| | | | | | | | | | | | | | | | | An icon that is not null by the time it is inserted in the cache can become null, depending on the QIconEngine implementation. For example, when an application with a shortcut exists on the desktop, uninstall the application, and then install the application again, the acquisition of the application icon will fail. The reason is that after installing the application for the second time, the qtIconCache will not be updated when the icon is acquired. Done-with: Volker Hilsheimer <volker.hilsheimer@qt.io> Pick-to: 5.15 6.2 6.3 6.4 Change-Id: I6dc8cf435815b92da270d74fe992843336af23e2 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Trace QImage::Format as int in QImageData::create()Shawn Rutledge2022-06-141-1/+1
| | | | | | | | | | Traces can contain only a few types; for now, enums have to be converted to int. Amends 6d323c0b221a3b127d80e338a42306cc34bc4d40 Task-number: QTBUG-102862 Change-Id: If129d03b13e723350bac987c6e35d471aa6c17e2 Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io> Reviewed-by: Rafael Roquetto <rafael.roquetto@qt.io>
* Fix misuses of 0.9999 constantAllan Sandfeld Jensen2022-06-021-7/+2
| | | | | | | | | Replace it with floor and round. It appears the old behavior was to work around combining ceil with inaccurate FP, but it doesn't appear this hacky ceil is needed. Change-Id: I5c16ec0fa4916e17198a733c46937fde53f2ddb5 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Do metadata detach simpler than full detachAllan Sandfeld Jensen2022-06-012-14/+38
| | | | | | | | | Avoid a full data detach when only metadata changes. This paradigm was already used one place, and made generic. Fixes: QTBUG-81674 Change-Id: I605253babc6ad9fc130e19e8cef3812690933ac5 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Add painter render hint for brush pattern transformationEirik Aavitsland2022-05-311-0/+2
| | | | | | | | | | | | | | [ChangeLog][QtGui][QPainter] In Qt 5, the predefined brush patterns would always be transformed along with the object being painted. In Qt 6.0 onwards, they would or would not, depending on the SmoothPixmapTransformation render hint. Instead of this somewhat surprising behavior, make the default be untransformed (i.e. cosmetic), which makes sense when it comes to dpr scaling. For the cases where one wants scaling, a new render hint is introduced to enable that: NonCosmeticPatternBrushes. Change-Id: I2208c7a28af9056d7ab97a529b66bf2d502c3c4f Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Expand QColorTransformAllan Sandfeld Jensen2022-05-263-8/+47
| | | | | | | | | | Add comparison operators and an isIdentity() method to detect (1-1) transforms. [ChangeLog][QtGui] Added QColorTransform::isIdentity() method. Added QImage::colorTransformed() transitive method. Change-Id: I5fbcd14e75f2179e43e94e8c5f42cd0a5600790b Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Use SPDX license identifiersLucie Gérard2022-05-1664-2434/+130
| | | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Correctly read and write CF_DIB bmp dataViktor Arvidsson2022-05-161-22/+38
| | | | | | | | | | | | | | | | | | | | When decoding CF_DIB data through the bmp handler we have to do some assumptions on where the pixel data starts since there's no file header to get the offset value from. We have to do this because theres some optional data after the info header that needs to be skipped over in some cases. These optional color mask values are now also written when putting a CF_DIB into the clipboard for maximum compatibility with other apps on Windows. This fixes the issue where pasted dibs would be offset by 3 pixels on Windows. Fixes: QTBUG-100351 Pick-to: 6.2 6.3 Change-Id: Icafaf82e0aa3476794b671c638455402a0d5206f Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Add floating point color space conversionsAllan Sandfeld Jensen2022-05-141-9/+23
| | | | | | | | | | This allows color space conversions that produces values outside the 0.0->1.0 range, which is one of the intended functions of the floating point image formats. Change-Id: I63b37b0f6934d4382edafb4709486c785a637c67 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Replace remaining uses of deprecated _qs with _sSona Kurazyan2022-05-021-1/+2
| | | | | | Task-number: QTBUG-101408 Change-Id: I1fda67c07e948af5017f0b99b67f8c20d7052033 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QtGui: includemocsMarc Mutz2022-04-293-0/+6
| | | | | | | | | | | Including moc files directly into their classes' TU tends to improve codegen and enables extended compiler warnings, e.g. about unused private functions or fields. Pick-to: 6.3 6.2 5.15 Task-number: QTBUG-102886 Change-Id: I1945741794c25679a9d94c0d68c8642e2c823502 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QtGui: replace remaining uses of QLatin1String with QLatin1StringViewSona Kurazyan2022-04-282-6/+6
| | | | | | Task-number: QTBUG-98434 Change-Id: I98c27030c783f968cbf38dc966ce486dc366b302 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QtGui: use _L1 for for creating Latin-1 string literalsSona Kurazyan2022-04-289-58/+67
| | | | | | Task-number: QTBUG-98434 Change-Id: Idcb71c1d27125333a53b6bdd3e1af0d4c66617fa Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QtGui: stop using QLatin1Char constructor for creating char literalsSona Kurazyan2022-04-136-14/+14
| | | | | | | | | Required for porting away from QLatin1Char/QLatin1String in scope of QTBUG-98434. Change-Id: I308d86cefcbfd126929b68f9a853d420840c965f Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QImageReader::read(): fetch filename onceShawn Rutledge2022-04-121-5/+3
| | | | | | | | | | | | The code in the Q_TRACE_ENABLED case was doing the same sort of qobject_cast that is done in the fileName() accessor; so it's both a code deduplication and an optimization to get the filename into a local variable once, and use it both for tracing and for the @Nx suffix check below. Task-number: QTBUG-100578 Change-Id: Id7bde4ddbab38e20694c09cc7b412fec091672de Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Detach for colortransforms of indexed formatsAllan Sandfeld Jensen2022-04-061-3/+5
| | | | | | | | | | We were triggering detach during the transform, but the short-cut for indexed formats wasn't triggering that. Instead make the detach explicit and avoid it during the loop. Pick-to: 6.3 6.2 5.15 Change-Id: I0f12b7f93841342a0770ce3d3c78f26ad19d8dac Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Short live Q_CONSTINIT!Marc Mutz2022-03-261-1/+1
| | | | | | | | | | | | | | | | | | It expands to the first available of - constinit (C++20) - [[clang::require_constant_initialization]] (Clang) - __constinit (GCC >= 10) Use it around the code (on and near static QBasicAtomic; this patch makes no attempt to find all statics in qtbase). [ChangeLog][QtCore][QtGlobal] Added macro Q_CONSTINIT. Fixes: QTBUG-100484 Change-Id: I11e0363a7acb3464476859d12ec7f94319d82be7 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* QtGui: compile-optimize inline swap functionsMarc Mutz2022-03-194-4/+4
| | | | | | | | | | | | | | | | | | Instead of using the overly-generic qSwap() monster, use - qt_ptr_swap() for swapping raw pointers - member-swap for swapping smart pointers - std::swap() for swapping scalars In QtCore, this has proven to give a nice reduction in compile time for Qt users, cf. b1b0c2970e480ef460a61f37fa430dc443390358. Pick-to: 6.3 6.2 Task-number: QTBUG-97601 Change-Id: I987ff95e8751a22a4f283655d8225dd16de21178 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QImage::operator==: Also compare the image colorspaceAlbert Astals Cid2022-03-181-1/+1
| | | | | | Pick-to: 6.3 6.2 Change-Id: I4cb86d32492876791fe852f8c3123b7d4a69a5bd Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Remove disappeared QIconEngine::IconNameHook from QIconChunLin Wang2022-03-141-3/+2
| | | | | | | | | | QIconEngine::IconNameHook disappeared,see commit fce84f76f04957e51f1d92129236733d9bf7d08a Fixes: QTBUG-98755 Pick-to: 6.2 6.3 Change-Id: Id0600b5682de4bfeaae9ca4e975d454d7ee158ff Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Fix deprecated uses of QScopedPointerMårten Nordheim2022-03-083-10/+16
| | | | | | | | | By changing it to unique_ptr. Pick-to: 6.2 6.3 Change-Id: I91abb69445b537d4c95983ae735341882352b29d Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QColor: port string-parsing from out parameters to optional<>Marc Mutz2022-03-081-9/+6
| | | | | | | | | Makes for easier reading of code, and allows qt_get_hex_rgb(), which is called from different TUs, to be marked as PURE. Change-Id: Ie7d4e5a164ca1daf521e18ff47f17885bc1443c1 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* QBitmap::fromPixmap: document \sinceGiuseppe D'Angelo2022-03-041-0/+2
| | | | | | Change-Id: Ia8b4e20dc98e3b184b6e2ba9844907f813dbc1ab Pick-to: 6.2 6.3 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QBitmap: de-inline dtorMarc Mutz2022-02-152-0/+7
| | | | | | | | | | | | | The destructor of this polymorphic class was incorrectly marked for removal in Qt 6, and, unfortunately, that was carried out. Now it delivers one of the most-duplicated vtables across all of Qt (at least four duplicates), and we can never add anything to it until Qt 7 (because existing code de-virtualized it as a no-op). Task-number: QTBUG-45582 Pick-to: 6.3 Change-Id: I85bd3b13dca9f1fc8cb62ca079a1168a33f71323 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QImageReader: Check for existing handler in initHandlerRobert Löhning2022-02-021-3/+6
| | | | | | | | | Some calling code did this beforehand, other didn't. Now, the function itself checks for an existing handler before doing anything else. Change-Id: I8fc43fb8788c9dfe825b15ffa2fa69ee43915cd6 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Doc: Remove mentioning of Fowler bookKai Köhne2022-01-171-1/+1
| | | | | | | | | It is out of print since years, and probably quite dated by now (released 1997). Pick-to: 6.3 Change-Id: I1653eb404713c15d70b8a15858e8c7d12b2e71cb Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
* Draw extended RGB solid colorsAllan Sandfeld Jensen2022-01-121-0/+25
| | | | | | | Pass extended RGB colors through the paint engine. Change-Id: I2e212cd4c76aaa65439746352c0da2b9db4a506d Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* QImageReader: check allocation limit for minimum 32 bppEirik Aavitsland2021-11-222-2/+13
| | | | | | | | | | | | | | | | | Also, as a driveby, add an environment variable so the limit can be changed at runtime. [ChangeLog][QtGui][QImageReader] When checking allocation limit during image reading, the memory requirements are now calculated for a minimum of 32 bits per pixel, since Qt will typically convert an image to that depth when it is used in GUI. This means that the effective allocation limit is significantly smaller when reading 1 bpp and 8 bpp images. Pick-to: 6.2 6.2.2 Change-Id: If1b204d413973b0975eea531e29c260fdcec931d Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Increment reference count when restoring referenceAllan Sandfeld Jensen2021-11-181-0/+1
| | | | | | | | | | Otherwise the count will be wrong after an out of memory failure in reinterpretAsFormat. Pick-to: 6.2 5.15 Fixes: QTBUG-98377 Change-Id: Ice51d47a6db9277126a5c7337e14aaf5ddee3a10 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Reject truncated and corrupt ascii pnm imagesEirik Aavitsland2021-11-161-22/+27
| | | | | | | | | In contrast to the binary decoder code, the ascii decoder would not abort and fail on premature end of file. Pick-to: 6.2 6.2.2 5.15 5.12 5.12.12 Change-Id: If27bce0afa8d1de6c4dbeb2bc0e623c1dcc2f1e0 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Tidy up QPixmapCache to prevent potential segfaultVolker Hilsheimer2021-11-051-23/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Following reports of segfaults in long-running programs leading to QPixmapCache corruption, clean up some code smells: * check pointers before dereferencing We did this in some places, and a default constructed or moved-from key could have a nullptr KeyData, so check everywhere. * don't trunctate qsizetype to int Still plenty of int APIs left, but no need for ints in internal code. * don't underflow maxCost to -1 if totalCost was 0 * use ranged-for to iterate over list of keys * guard any public function that might create the cache with the thread- test This avoids that the cache ends up living in the wrong thread. * don't use reinterpret_cast when static_cast is enough (which is always from void*) Since the crash is not reproducible so far, and the reports indicate that it can only be observed when the program has run for a long time, there is no test case included. However, this removes some code smells that might be responsible for data corruption. Pick-to: 6.2 Task-number: QTBUG-97903 Task-number: QTBUG-91445 Task-number: QTCREATORBUG-26473 Change-Id: Ibdd8963d7dd44caab1468ecc6f81ace761719c69 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* QFactoryLoader: continue the port from JSON to CBORThiago Macieira2021-10-201-6/+5
| | | | | | | | | | | | | | This continues the effort from the previous commit, by not passing through the JSON conversion at all, and simply using CBOR directly. The port in qtbase is complete, but in order to support the conversion in other modules without introducing breakages, there's a temporary class used for converting to QPluginParsedMetaData from QJsonObject. It'll be removed once all other modules have finished converting. Change-Id: I2de1b4dfacd443148279fffd16a3ed4ddaf34afc Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* When filling a pixmap after an assignment ensure the set DPR is not lostAndy Shaw2021-10-151-0/+1
| | | | | | Pick-to: 6.2 5.15 Change-Id: I649547ea277f9d074e6638e4b7b1206d3d3d976b Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* gui: Fix typos in documentationJonas Kvinge2021-10-123-4/+4
| | | | | | Pick-to: 5.15 6.2 Change-Id: I533f5a55cd0cd60a76990b552d7dab51a301ac1c Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* gui: Fix typos in source code commentsJonas Kvinge2021-10-126-8/+8
| | | | | | Pick-to: 5.15 6.2 Change-Id: Ie53e5542a8f93856470982939ecd8ec90b323d69 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Preserve QImage metadata when converting format with color tableEirik Aavitsland2021-09-281-1/+1
| | | | | | | | | | Unlike the other conversion functions, convertWithPalette() did not call copyMetadata(). Fixes: QTBUG-96926 Pick-to: 6.2 5.15 Change-Id: I2b171cec16bc5a90d33e80d6fe178c650ed3fe36 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* QIconLoader: code tidiesGiuseppe D'Angelo2021-09-182-43/+32
| | | | | | | | | | | | | | | | | | Turn QThemeIconEntries into an owning container (std::vector of unique_ptr), so that code using QThemeIconInfo doesn't have to manage ownership (and forget to do so, and cause bugs like QTBUG-93050). The fallout is mostly on isEmpty() vs empty(); as drive-by fixes: * use auto; * use make_unique (no raw news); * turn a few indexed loops into range-based ones; * streamline an if-else-if chain; * turn a !(a == b) condition into a != b. Change-Id: Ie3ac9de57c80ed3184ec0d15c847f81306ef48ca Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* qt_pixmap_thread_test(): Simplify logic, merge warningsSze Howe Koh2021-09-061-12/+6
| | | | | | Pick-to: 6.2 Change-Id: I0c413c14d124bafbd6b2bd94d7a128e19ed83ade Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* QPixmap: Fix crash if created without gui app in secondary threadSze Howe Koh2021-09-041-1/+1
| | | | | | | | | | | | | The thread checking in in_pixmap_thread_test() is only safe, and only makes sense, if we have a QGuiApplication. If we only have QCoreApplication, only null QPixmaps may be created anyway, so threading makes no difference. Fixes: QTBUG-95358 Pick-to: 6.2 Change-Id: I93c983a3d6c271b0a19dfd0384862fc151459029 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Sze Howe Koh <szehowe.koh@gmail.com>
* When clearing QPixmapCache, stop its flushing timerEirik Aavitsland2021-09-011-0/+5
| | | | | | | | | | | | | | No need for timer event to reduce cache size when it is already empty. May also avoid the "Timers cannot be stopped from another thread" warning at exit, if the global cache object is then deleted by another thread. Fixes: QTBUG-96101 Pick-to: 6.2 5.15 Change-Id: Id1aeecfbb43a25a887ebd5cc7242749a74290bb0 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Fix warning about loop variable creating a copyTor Arne Vestbø2021-08-241-1/+1
| | | | | | | | | | | qxpmhandler.cpp:1162:21: warning: loop variable '[color, index]' of type 'const std::__1::pair<const unsigned int, int>' creates a copy from type 'const std::__1::pair<const unsigned int, int>' [-Wrange-loop-analysis] for (const auto [color, index] : colorMap) ^ Change-Id: Ifabf1c569efdcd929859227d860f4598250ba5bd Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* qpnghandler: Only assume we're past the input size if it returns a sizeAlbert Astals Cid2021-08-191-1/+1
| | | | | | | | | | Size 0 is a "valid" answer for QIODevice implementations so we need to make sure that we only enter the "try to workaround broken files" if we know there is a size, otherwise the first read of length 4 that libpng does breaks everything. Change-Id: I1e396abd206ff90edae4372726f1d82d5d41ccf3 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Remove unused internal flag in QImageEirik Aavitsland2021-08-132-9/+3
| | | | | | | | | | The "locked" flag was only added for a particular use in the Freetype font engine in 070d9c00c488a5ee6811f04170cf488ead79bf80,but that usage was refactored away long ago in afb326f07109da0035112e6f56e683e37b8a5d72. Pick-to: 6.2 Change-Id: I7347c91f49ba59041f6ff35bd5a6b537d6c704d4 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* QXpmHandler: clean up write_xpm_image: cut out the QBA middle-manMarc Mutz2021-08-061-4/+3
| | | | | | | | | | | | Instead of appending to a QByteArray and then streaming that one, just stream the components of a line directly. QTextStream's op<<(const char*) is not subject to QT_NO_CAST_FROM_ASCII, etc., so can be used unconditionally. Change-Id: Idd97a75a1b5b939de7176d40880a2f328d01927d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QXpmHandler: actually limit characters-per-pixel to fourMarc Mutz2021-08-061-2/+5
| | | | | | | | | | | | | | | | | | | The following code assumed, and all comments indicated, that the cpp variable was limited to a max of 4. Yet, as coded, cpp could be five, in which case the XPM would be corrupt, as the header suggested five characters-per-pixel while the data was formatted in only four. Add a warning and error out when we encounter this situation. [ChangeLog][QtGui][QImage] Instead of writing a corrupt file, rejects to write XPM files with more than 64^4 colors (more than four characters per pixel) now. Pick-to: 6.2 6.1 5.15 5.12 Change-Id: I458873cf7d179ab2e2dacd4c17dc837d640591a9 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QXpmHandler: clean up write_xpm_image: use conventional pointer arithmeticMarc Mutz2021-08-051-6/+3
| | | | | | | | | | | | | | ... instead of *(array + index). Also fix a pointless cast from QRgb to int which the next line implicitly undoes (because colorMap has QRgb as key, not int) and get rid of the local variables that facilitated said fallacy in the first place. Change-Id: I71a92822ee2404646f6fb5533e40252f38e6b21f Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* QXpmHandler: clean up write_xpm_image: scope variables betterMarc Mutz2021-08-051-5/+4
| | | | | | | ... and fix spacing around operators and after flow-control keywords. Change-Id: Iefaa03074536d13a655c91fb42aef6aa96c2665b Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>