summaryrefslogtreecommitdiffstats
path: root/src/gui/image
Commit message (Collapse)AuthorAgeFilesLines
* Improve support for QImages in QDataStream read transactionsEirik Aavitsland2018-10-151-1/+3
| | | | | | | | | | | | | | | | | | | | | | | QImage's operator>>(QDataStream&) did not set an error mode on the stream on read failures. That would break QDataStream transactions. Since the current QImage serialization cannot differentiate between truncated and corrupted data, we set the ReadPastEnd error as expected by the transaction system. Also specify the expected file format on decoding QImage from stream, to avoid all the format handlers' canRead() being invoked. This is necessary since some of them may call ungetChar(), which fails when the stream is in a transaction. Also add testing of this feature to the QDataStram transaction autotest. That required a slight rewrite of the fake sequential QIODevice subclass. The previous implementation had incorrect behavior of peek(), which is required by QImage decoders. Task-number: QTBUG-70875 Change-Id: If3f1ca7186ad1e6ca0e6e8ea81d2b2fbece6ea01 Reviewed-by: Alex Trotsenko <alex1973tr@gmail.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QImageReader: add tracepoints for image loadingGiuseppe D'Angelo2018-10-141-1/+13
| | | | | Change-Id: I5fe25793eeda01a4fa1658091890af23f66b7089 Reviewed-by: Rafael Roquetto <rafael@roquetto.com>
* QImageWriter/QPNGHandler: Quality option should be CompressionRatioAlexandra Cherdantseva2018-10-141-19/+31
| | | | | | | | | | | Wrong option was used to set zlib compression level for png setCompression with negative value uses default compression setCompression with value between 0-100 converts to zlib compression level 0-9 setCompression with positive value overrides Quality option Change-Id: Ic4b048a1e30d6940019c2a00a6c24d0c11e3f821 Reviewed-by: Alexandra Cherdantseva <neluhus.vagus@gmail.com> Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* QPixmap: use rvalue moreAnton Kudryavtsev2018-10-101-3/+2
| | | | | Change-Id: Ifb8c014abf6e02dc782fab2d653e4edfc4972125 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Add missing null checks after detachAllan Sandfeld Jensen2018-10-101-2/+14
| | | | | | | | | A few places we didn't check if detach() succeeded including in reinterpretAsFormat(), where it can be undone. Task-number: QTBUG-70785 Change-Id: Ibcc8e26e2961f6288eb7a045ae1cb28e59213a49 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Add NEON optimized ARGB32 unpremultiply routinesAllan Sandfeld Jensen2018-10-091-2/+15
| | | | | | | | Mirroring similar routines recently added for SSE4.1 Change-Id: Ibb9d10cc34655ce1dc0e97fdff4e4f6a81d47d05 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io> Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* QImageWriter: Fix default compressionratioEirik Aavitsland2018-09-251-1/+1
| | | | | | | | | | | | Before asking a image format handler to save an image, QImageWriter sets the value of all supported options. For options like quality and gamma, the default value is an illegal value (-1 and 0.0 resp.), effectively telling the handler that the application has not requested any particular value. But in the case of compressionratio, the default was 0, a legal value. Fix by changing it to -1. Change-Id: Iad6d4c2dbe269b25863e7d4967aa9ed2a7d1247f Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Merge remote-tracking branch 'origin/5.11' into 5.12Qt Forward Merge Bot2018-09-141-0/+2
|\ | | | | | | Change-Id: Ic4c1a8041dcfd143861c39e0014fbdaaa3fb25c6
| * bmp image handler: check for out of range image sizeEirik Aavitsland2018-09-111-0/+2
| | | | | | | | | | | | | | | | Make the decoder fail early to avoid spending time and memory on attempting to decode a corrupt image file. Change-Id: I874e04f3b43122d73f8e58c7a5bcc4a741b68264 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Fix spelling mistake in qimage.hTor Arne Vestbø2018-09-131-1/+1
| | | | | | | | | | | | Change-Id: I2138318894587cc0b5f03af14a57b2a39509f0da Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* | Fix reading 16bpc grayscale PNGsAllan Sandfeld Jensen2018-09-031-17/+20
| | | | | | | | | | | | | | | | | | They were incorrectly attempted to be read as Indexed8, instead use the RGBA64 formats to read them with full accuracy. Task-number: QTBUG-45858 Change-Id: I14fc3cb0d59fa2fc0e68fd870f3b32352c34161f Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* | Smooth image scaling for 64bit imagesAllan Sandfeld Jensen2018-08-221-1/+13
| | | | | | | | | | | | | | | | Adds support for smooth scaling 64bit images. Task-number: QTBUG-45858 Change-Id: If46030fb8e7d684159f852a3b8266a74e5e6700c Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* | Merge dev into 5.12Oswald Buddenhagen2018-08-211-30/+62
|\ \ | | | | | | | | | Change-Id: I63f632b595f66d2fc93e9aa713500e3799e3df2a
| * | Add direct conversions between RGB30<->RGBA8888Allan Sandfeld Jensen2018-08-151-30/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | Expands the existing conversions for ARGB32<->RGB30 to also handle RGBA8888 to avoid any performance regression of the 16bpc conversion path. Change-Id: I34e519a04276b0e7ff00c6125ba06c889045d2ac Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* | | Allow setting the QIcon fallback themeAlbert Astals Cid2018-08-204-6/+53
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows apps that know their icons are in a given icon theme to set that theme as fallback, so in case the user theme does not include them, the icons can still be found. This solves the problem of missing icons that often happens when running KDE applications on a GNOME desktop. Change-Id: I4e5543d598012352a29ff79dab0357506d986b6d Reviewed-by: Dominik Haumann <dhaumann@kde.org> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* | Implement support for 16bpc image formatsAllan Sandfeld Jensen2018-08-115-118/+759
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds support for 16bit per color image formats in QImage. This makes it possible to read and write 16bpc PNGs, and take full advantage of the 16bpc paint engine. [ChangeLog][QtGui][QImage] QImage now supports 64bit image formats with 16 bits per color channel, compatible with 16bpc PNG or RGBA16 OpenGL formats. Task-number: QTBUG-45858 Change-Id: Icd28bd5868a6efcf65cb5bd56031d42941e04099 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* | Merge remote-tracking branch 'origin/5.11' into devQt Forward Merge Bot2018-08-072-3/+4
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf src/corelib/doc/src/objectmodel/signalsandslots.qdoc src/plugins/platforms/cocoa/qcocoamenuloader.mm src/plugins/platforms/xcb/qxcbconnection.cpp src/plugins/platforms/xcb/qxcbconnection.h src/plugins/platforms/xcb/qxcbconnection_xi2.cpp src/plugins/platforms/xcb/qxcbwindow.cpp tests/auto/gui/image/qimage/tst_qimage.cpp Done-with: Gatis Paeglis <gatis.paeglis@qt.io> Change-Id: I9bd24ee9b00d4f26c8f344ce3970aa6e93935ff5
| * Fix conversion from transparent indexed8 to RGB32Allan Sandfeld Jensen2018-08-031-2/+3
| | | | | | | | | | | | | | | | A typo meant the color-table was not fixed. For safety fallback colors are also made opaque. Change-Id: I3e609882177604910c4343c86f00221a89af9078 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
| * Fix crash in qppmhandler for certain malformed image filesEirik Aavitsland2018-08-031-1/+1
| | | | | | | | | | | | | | | | | | | | The ppm format specifies that the maximum color value field must be less than 65536. The handler did not enforce this, leading to potentional overflow when the value was used in 16 bits context. Task-number: QTBUG-69449 Change-Id: Iea7a7e0f8953ec1ea8571e215687d12a9d77e11c Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Merge branch '5.11' into devEdward Welbourne2018-07-311-1/+1
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: qmake/library/qmakebuiltins.cpp src/plugins/platforms/windows/qwindowstabletsupport.h src/plugins/platforms/xcb/qxcbconnection.cpp src/plugins/platforms/xcb/qxcbconnection.h src/plugins/platforms/xcb/qxcbconnection_xi2.cpp src/plugins/platforms/xcb/qxcbwindow.cpp src/widgets/styles/qstylesheetstyle.cpp tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp Done-With: Gatis Paeglis <gatis.paeglis@qt.io> Change-Id: I000b0eb3cea2a5c7a99b95732bfdd41507cf916e
| * Doc: Remove typo and add line breaks after \internalPaul Wicking2018-07-261-1/+1
| | | | | | | | | | | | | | | | | | In an unrelated change, it seems \internal \obsolete can cause unexpected behavior when generating the documentation. Adding this line break should fix that. Change-Id: I95eceb109faaf89be8f258fba8c31008fdc4ca57 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* | Merge remote-tracking branch 'origin/5.11' into devQt Forward Merge Bot2018-07-171-1/+1
|\| | | | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/platforms/cocoa/qcocoawindow.mm src/plugins/platforms/xcb/qxcbintegration.cpp Conflicts git missed: src/plugins/platforms/qnx/qqnxglcontext.cpp Change-Id: I0582cdc9e66e43efe79038b9c43d4f9572ac88fc
| * Fix: png handler returning Mono QImage with color table < 2 itemsEirik Aavitsland2018-07-161-1/+1
| | | | | | | | | | | | | | | | | | | | A bit depth 1 png image may contain a single color table item. The png handler would in such cases reduce the size of the QImage color table to 1, which could easily lead to crashes later on. Task-number: QTBUG-69256 Change-Id: I01d78977c121bacc44b823231d8f32ca63d8a98c Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* | qpixmap_win.cpp: Silence clang-cl warningsFriedemann Kleint2018-05-161-23/+25
| | | | | | | | | | | | | | | | | | | | | | | | Introduce nullptr, C++ casts, fix deprecation warnings and fix some signedness issues. Amends 2268b6bcdd1b4ddcd78753b81c477f0aa2855261. Task-number: QTBUG-51124 Task-number: QTBUG-63512 Change-Id: If371d3b71658258b7238c7eb0b11ac4a1ae0d1b6 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* | Doc: add explanation of return format of QImage::transformed()Eirik Aavitsland2018-05-111-0/+14
| | | | | | | | | | | | | | | | | | | | QImage::transformed() can sometimes return an image with a different image format than the original. This might be unexpected, so explain it in the doc. Task-number: QTBUG-50087 Change-Id: I165fc7b44439b770b542be52d3108fd70bf0ae99 Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
* | Get rid of argb32->argb32pm routines in qimageAllan Sandfeld Jensen2018-05-075-355/+2
| | | | | | | | | | | | | | | | We already have better optimized versions in drawhelper. Removing these versions is a performance gain. Change-Id: I431c74e440529648d9bc5e22c0e700a72d376934 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* | Merge drawhelper convert-from and storeAllan Sandfeld Jensen2018-05-025-92/+69
| | | | | | | | | | | | | | Avoids using an intermediate buffer on store and simplifies the code. Change-Id: I2dc4e735eb770f90dc99fe0f513b4df3b35ee793 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* | Merge remote-tracking branch 'origin/5.11' into devQt Forward Merge Bot2018-04-151-1/+7
|\| | | | | | | Change-Id: I8c353b4c53e90434453c76691eac39a894d23b49
| * Fix crash if QPixmap::defaultDepth() is called when no QGuiApplicationEirik Aavitsland2018-04-121-1/+7
| | | | | | | | | | | | | | | | | | | | This static method can be called before QGuiApplication is created. At that point there is yet no primary screen, so the implementation needs to guard against dereferencing a nullptr. Task-number: QTBUG-67309 Change-Id: I6b7b9e97b1c3c79bf2f9c6d6247c3b10f39f7a55 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | QPixmapCache: make sure to not overflow cache limitChristian Ehrlicher2018-04-101-8/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The cost for the pixmap cache was calculated in bytes but setCacheLimit() takes the size in kilobytes. This lead to the situation that all values above 2097152 overflowed and disabled the caching completely. Fix it by calculating the cost in kilobytes as it is done in QGLContext. Task-number: QTBUG-45293 Change-Id: Ib8dc2360c8f3201ce0b615a04c38b5ccaa8fc6cf Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io> Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* | QtGui: Add qt_imageToWinHBITMAP(), qt_imageFromWinHBITMAP()Friedemann Kleint2018-04-101-78/+310
| | | | | | | | | | | | | | | | | | | | | | Add functions for converting QImage to HBITMAP and back supporting additional formats of QImage (RGB888, RGB555, Indexed8 and Mono). Add test with roundtrip to tst_qimage similar to tst_QPixmap::toWinHBITMAP(). Task-number: QTBUG-51124 Change-Id: Ib568898e7162686bfa527d828785628eb0b78e21 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* | Merge remote-tracking branch 'origin/5.11' into devQt Forward Merge Bot2018-04-071-4/+8
|\| | | | | | | Change-Id: Idf2bef470663864069bbf7e41af07b534936863a
| * Fix visual artifacts in diffuse image dithering (the default)Eirik Aavitsland2018-04-061-4/+8
| | | | | | | | | | | | | | | | | | | | The distributed error fractions in the Floyd-Steinberg dithering algorithm were not computed precisely. In particular, rounding errors could be accumulated, leading to visual artifacts. Task-number: QTBUG-67425 Change-Id: I77b48c3cab3e66ca161721d14b58fcc4188e74a8 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* | QImage: Add Q_GADGET and make format enumeration a Q_ENUMFriedemann Kleint2018-04-061-0/+2
| | | | | | | | | | | | | | This makes debugging easier. Change-Id: I023fc1220b2a33db85bb8388bcfea433eb810f63 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | Fix documentation of QImage{Reader,Writer}::imageFormatsForMimeType()Friedemann Kleint2018-04-032-2/+2
| | | | | | | | | | | | | | | | | | | | | | Fix a qdoc warning about unknown command \mimeType. Amends 37217c57fa5595e7cdfd7e19f34de22848dfc370. Task-number: QTBUG-49714 Change-Id: I48b38864e502164d9ccf5e2ba75bfd4084344ce0 Reviewed-by: Alexander Volkov <a.volkov@rusbitech.ru> Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* | Remove bit details from QPixelLayoutAllan Sandfeld Jensen2018-04-032-34/+14
| | | | | | | | | | | | | | | | | | They were only used for rgb swap and checking for the presence of an alpha channel. Change-Id: I013aa9035ccf4362fa3d9ecda41723e4ec5a44cb Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* | Merge remote-tracking branch 'origin/5.11' into devQt Forward Merge Bot2018-03-213-5/+36
|\| | | | | | | Change-Id: I35a6555e3885e489f88aa9b4b0142e1017f7a959
| * QPixmap don't assume QPlatformScreen::format is opaqueJohan Klokkhammer Helsing2018-03-193-5/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QRasterPlatformPixmap::systemOpaqueFormat returned QPlatformScreen::format without checking that the format was actually opaque. This caused several QPixmap tests to fail on Wayland because Wayland compositors don't communicate the native format of the screen, just a list of supported pixel formats, so we just return ARGB32_premultiplied in QWaylandScreen::format(). Rename the method systemOpaqueFormat to systemNativeFormat since that's how it's used most of the time. And do a conversion when we actually care whether the format is opaque or not. Task-number: QTBUG-51748 Change-Id: I47dc1c3f185fb802016ca361206d47d02e8d3cf1 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* | Use simple scaling for downscaling less than 2xAllan Sandfeld Jensen2018-03-072-12/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The simple scaling that only samples every input pixel once, can be used with downscaling < 2x as well if we just handle the case where the input can't be in the intermediate buffer. At the same time the handling of the intermediate buffer has been moved out of simple scale helper functions so the code can be shared and the AVX2 optimizations also used for non-argb32pm formats. Change-Id: I98d225ef8d4f2978480d09110c959b556c563b57 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Introduce QImage{Reader,Writer}::imageFormatsForMimeType()Alexander Volkov2018-02-276-2/+71
| | | | | | | | | | | | | | | | | | | | It can be used if, for example, you get an image MIME type from the user, and you want to find the appropriate format for loading or saving this image. Task-number: QTBUG-49714 Change-Id: Iae5a7e9d658d6c3d1cd750a8bbc279f1812f99df Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* | Merge remote-tracking branch 'origin/5.11' into devLiang Qi2018-02-161-1/+7
|\| | | | | | | | | | | | | Conflicts: src/corelib/tools/tools.pri Change-Id: I705630f9cecbf0ce51a22fc6116b8c49611259e9
| * Merge remote-tracking branch 'origin/5.10' into 5.11Liang Qi2018-02-151-1/+7
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/corelib.pro src/corelib/global/qrandom.cpp src/network/access/qhttpnetworkrequest_p.h src/plugins/platforms/cocoa/qcocoamenu.mm src/plugins/platforms/cocoa/qcocoansmenu.mm src/plugins/platforms/cocoa/qcocoawindow.mm src/plugins/platforms/cocoa/qnsview.mm src/plugins/platforms/offscreen/qoffscreenintegration.h src/widgets/kernel/qaction.cpp src/widgets/widgets.pro Done-with: Andy Shaw <andy.shaw@qt.io> Change-Id: Ib01547cf4184023f19858ccf0ce7fb824fed2a8d
| | * Fix a crash when QMovie::speed is set to 0Val Doroshchuk2018-01-241-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | Setting speed to 0 means the current frame will continue to be shown, the finished signal is not emitted, and state remains QMovie::Running. Task-number: QTBUG-65758 Change-Id: I681d902e3211c5899b21043e5177b7c73d5d3fb5 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* | | QtGui: Raise minimum supported MSVC version to 2015Friedemann Kleint2018-02-142-5/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove code for older versions and streamline #ifdefs. Task-number: QTBUG-51673 Change-Id: I841f1880371db79723747fb9686ba466fd66c26f Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* | | Avoid code duplication in QImage{Reader,Writer}Alexander Volkov2018-02-115-201/+299
| | | | | | | | | | | | | | | | | | | | | | | | | | | Extract code related to supportedImageFormats() and supportedMimeTypes() into QImageReaderWriterHelpers namespace. Change-Id: If0f56682072859be1b6f07afd7737431325827fc Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* | | QImage: use rvalue overloads moreAnton Kudryavtsev2018-02-101-6/+3
| | | | | | | | | | | | | | | | | | Change-Id: I4e5e1199d1bf460c58a75fbc06b91ec5a71c49f9 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | QPixmap: use rvalue overloads moreAnton Kudryavtsev2018-02-081-5/+5
| | | | | | | | | | | | | | | Change-Id: Icf19d20bf46f575ba020e308e0822164ed9924cf Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* | | Add overloaded QBitmap::fromImage that takes QImage rvalueAnton Kudryavtsev2018-02-072-17/+36
|/ / | | | | | | | | | | | | | | | | ... and use it. [ChangeLog][QtGui][QBitmap] Add overloaded QBitmap::fromImage that takes QImage rvalue Change-Id: Idb6e6bb1645371996700349714041cc54bb3d005 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* | Merge remote-tracking branch 'origin/5.10' into devLiang Qi2018-01-201-11/+9
|\| | | | | | | | | | | | | Conflicts: tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp Change-Id: If089d5010d15c33b3c1f13912d4386207456c1a9
| * Merge remote-tracking branch 'origin/5.9' into 5.10Tor Arne Vestbø2018-01-161-11/+9
| |\ | | | | | | | | | Change-Id: I896b0cf54f317c4336cc3d3db319a0b89e421728