summaryrefslogtreecommitdiffstats
path: root/src/gui/image/qpnghandler.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fix PNGs saved from QImage transform of 8-bit imagesAllan Sandfeld Jensen2017-04-191-1/+1
| | | | | | | | | | | Fixes two separate errors. QImage::transform was incorrectly adding colors to the color-table of the returned image when the converted image would not be indexed, and qpnghandler was looking at non-empty color- table instead of color format. Task-number: QTBUG-43708 Change-Id: Ife14b6428ca65ac7d3a0b36a89a73e56d64586b4 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* QtGui: port the last remaining Q_FOREACH loops and add QT_NO_FOREACHMarc Mutz2017-02-201-1/+1
| | | | | | | | | Port the last two remaining Q_FOREACH users in QtGui to C++11 range-for and mark the library as Q_FOREACH -free, using QT_NO_FOREACH. Change-Id: Ie6c5eea0af4227af6ef3dc0b4da2cf62e09d8b52 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* PNG image handler: Avoid "invalid distance too far back" errorEirik Aavitsland2017-01-311-0/+6
| | | | | | | | | | | | | | | For certain slightly miscoded png images, newer versions of libpng will trigger the mentioned zlib error and fail to read the image. This miscoding has until now been safely ignored by all png implementations, so such images exist in the wild, and users expect them to work. Since the cost of the workaround is only a missed opportunity of a tiny saving in memory usage during decoding, enable it. Task-number: QTBUG-58171 Change-Id: I820a9faef6d5b7af79c04404ebdceb48a096f29a Reviewed-by: André Klitzing <aklitzing@gmail.com> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Factor out qt_getImageText() and qt_getImageTextFromDescription()Anton Kudryavtsev2016-07-141-18/+3
| | | | | | | ... and re-use them in QImageReader, QJpegHandler, QPngHandler. Change-Id: Iec89e47205f3c420e1e7eb4a2d3c1fbfe887fd8c Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Merge remote-tracking branch 'origin/5.7' into devLiang Qi2016-06-131-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: config_help.txt configure mkspecs/features/uikit/sdk.prf src/corelib/global/qhooks.cpp src/corelib/io/qfilesystemwatcher.cpp src/corelib/io/qlockfile_unix.cpp src/corelib/tools/qalgorithms.h src/gui/kernel/qwindowsysteminterface.h src/gui/text/qtextdocument_p.cpp src/network/access/access.pri src/network/access/qnetworkaccessmanager.cpp src/network/access/qnetworkreplynsurlconnectionimpl.mm src/src.pro src/testlib/qtestcase.cpp src/widgets/kernel/qwidgetbackingstore_p.h src/widgets/styles/qwindowscestyle.cpp src/widgets/styles/qwindowsmobilestyle.cpp tests/auto/corelib/io/qdiriterator/qdiriterator.pro tests/auto/corelib/io/qfileinfo/qfileinfo.pro tests/auto/gui/kernel/qwindow/BLACKLIST tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp tools/configure/configureapp.cpp Change-Id: Ibf7fb9c8cf263a810ade82f821345d0725c57c67
| * QtGui: use QStringRef to optimize memory allocationAnton Kudryavtsev2016-06-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | Replace substring functions that return QString with corresponding functions that return QStringRef where it's possible. Create QString from QStringRef only where necessary. Change-Id: Id83c60cc7568b20ef008b51c582cfdf466a47e35 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | QtGui: Remove Windows CE.Friedemann Kleint2016-03-301-20/+8
|/ | | | | | | | | Remove #ifdef sections for Q_OS_WINCE and wince .pro file clauses in library, and tests. Task-number: QTBUG-51673 Change-Id: I55f61845c3b54027c467a5c59c122e7d16955358 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Updated license headersJani Heikkinen2016-01-151-14/+20
| | | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: I046ec3e47b1876cd7b4b0353a576b352e3a946d9 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Get rid of QT_USE_BUNDLED_LIBPNGKonstantin Ritt2015-11-231-5/+0
| | | | | | | | | In fact, this is an extra info no one ever cares about. We already have properly configured INCLUDEPATH to look for png.h. Change-Id: I27fec4d474570683c6c371dff34472a7c650fe65 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Export gamma setting and metadata in QImageReaderAllan Sandfeld Jensen2015-06-221-9/+13
| | | | | | | | | | | | The PNG image plugin has the capability of applying gamma correction to read PNGs, but doesn't do so by default, and we export no way of accessing this through the qimagereader API. This patch adds the ability to read the PNG file gamma, and overriding decoded gamma to get gamma correction. Change-Id: Iaf9eaac0827516db6bc02247c58026270cd1f610 Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
* Merge remote-tracking branch 'origin/5.4' into 5.5Liang Qi2015-06-011-7/+0
|\ | | | | | | | | | | | | | | Conflicts: qmake/generators/mac/pbuilder_pbx.cpp src/corelib/global/qglobal.h Change-Id: I2c0f7544bf194f2d0f59218fd583c822901487b0
| * Do not modify decoder when determining image-formatAllan Sandfeld Jensen2015-05-211-7/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We should not configure the decoder when just determining the image- format. Doing so can cause all versions of libpng to print a warning, and some versions to fail to decode. The code appears to be a leftover from when the image-format logic was copied out of the introduction of the decoding method, where the proper settings are still applied. Task-number: QTBUG-46233 Change-Id: I6619728804f040ae6c9d637c7298a8586e22499e Reviewed-by: Andy Shaw <andy.shaw@theqtcompany.com> Reviewed-by: aavit <eirik.aavitsland@theqtcompany.com>
* | QtGui: Fix const correctness in old style castsThiago Macieira2015-03-121-4/+4
| | | | | | | | | | | | | | Found with GCC's -Wcast-qual. Change-Id: Ia0aac2f09e9245339951ffff13c946844bc31eb8 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
* | Update copyright headersJani Heikkinen2015-02-111-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Outdated header.LGPL removed (use header.LGPL21 instead) Old header.LGPL3 renamed to header.LGPL3-COMM to match actual licensing combination. New header.LGPL-COMM taken in the use file which were using old header.LGPL3 (src/plugins/platforms/android/extract.cpp) Added new header.LGPL3 containing Commercial + LGPLv3 + GPLv2 license combination Change-Id: I6f49b819a8a20cc4f88b794a8f6726d975e8ffbe Reviewed-by: Matti Paaso <matti.paaso@theqtcompany.com>
* | Remove Q_C_CALLBACKSThiago Macieira2015-01-171-10/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This is useless. The C++ language does require callbacks passed to C functions to also be extern "C". That's what this macro was doing. But #ifdef'ing for the macro only made the code uglier. Just let the extern "C" be there for all compilers. PS: C++ classes can't be extern "C"... Change-Id: Ic5d393bfd36e48a193fcffff13b9c9b3923443dd Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | Merge remote-tracking branch 'origin/5.4' into devOswald Buddenhagen2014-09-291-19/+11
|\| | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/tools/qbytearray.cpp src/gui/image/qimage.cpp src/gui/image/qppmhandler.cpp src/gui/kernel/qguiapplication.cpp src/gui/painting/qpaintengine_raster.cpp Change-Id: I7c1a8e7ebdfd7f7ae767fdb932823498a7660765
| * Update license headers and add new license filesMatti Paaso2014-09-241-19/+11
| | | | | | | | | | | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 - Removed LICENSE.GPL Change-Id: Iec3406e3eb3f133be549092015cefe33d259a3f2 Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
* | Add Grayscale8 and Alpha8 formats to QImage and drawingAllan Sandfeld Jensen2014-09-171-0/+14
|/ | | | | | | | | | | | Extend the QImage format with two 8-bit grayscale and alpha formats. These formats have the advantage over Indexed8 that they have simpler conversion and can be rendered to by the raster engine. [ChangeLog][QtGui][QImage] Added support grayscale and alpha 8-bit formats which can also be rendered to. Change-Id: I4343c80a92a3dda196aa38d0c3ea251b094fc274 Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
* PNG: properly handle 1bpp greyscale images with alphaGiuseppe D'Angelo2013-09-181-0/+9
| | | | | | | | | | | | | PNG allows 1bpp greyscale images (PNG_COLOR_TYPE_GRAY) to have an alpha key; so even in this case we need to inquiry if the image has a transparency, and if so modify the color table of the monochrome image accordingly. Task-number: QTBUG-33503 Change-Id: Iab07c8f95ac8865269c48816e222645cdcb6bbc1 Reviewed-by: Nicolas Arnaud-Cormos <nicolas@kdab.com> Reviewed-by: aavit <eirik.aavitsland@digia.com>
* Add missing initialization before requesting png data for scaled readSamuel Gaist2013-09-181-7/+8
| | | | | | | | | | Initialize all values read to sensible default in case reading them fails in read_image_scaled. It has already been done for a normal image read Task-number: QTBUG-32674 Change-Id: I19dccad7ef342f1b1bba6b513c04d3661d128a54 Reviewed-by: aavit <eirik.aavitsland@digia.com>
* Initialize variables to fix valgrind warning in pnghandler.Friedemann Kleint2013-08-301-8/+8
| | | | | | | | | Conditional jump or move depends on uninitialised value(s) ==7986== at 0x5B838E8: QPngHandlerPrivate::readPngImage(QImage*) (qpnghandler.cpp:617) Change-Id: Ie739ca1665ce600426e2816a6229145d814125cb Reviewed-by: aavit <eirik.aavitsland@digia.com>
* Add offset reading support in pnghandlerSamuel Gaist2013-08-071-1/+17
| | | | | | | | | This patch adds the offset reading that matches the offset writing in writeImage Task-number: QTBUG-32674 Change-Id: I264ba41163e59638d7219e0a8913f9d455830883 Reviewed-by: aavit <eirik.aavitsland@digia.com>
* Update copyright year in Digia's license headersSergio Ahumada2013-01-181-1/+1
| | | | | Change-Id: Ic804938fc352291d011800d21e549c10acac66fb Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Save grayscale palleted images to grayscale pngSergey Borovkov2012-11-091-4/+7
| | | | | | | | | | While Qt does not support grayscale images explicitly it makes sense to save palleted images to grayscale png when possible for better compression and compatibility as opening and saving grayscale images now converts them to palleted Change-Id: Iab7c5a5a9d24b9352f5a7bafe04824a97d2463d9 Reviewed-by: aavit <eirik.aavitsland@digia.com>
* Remove unnecessary call to png_set_sBit when writing png filesSergey Borovkov2012-10-261-7/+0
| | | | | | | | | | | According to libpng documentation - PNG files reduce possible bit depths to 1, 2, 4, 8, and 16. If data is of another bit depth, it's possible to write an sBIT chunk into the file so that decoders can recover the original data if desired. Since we hardcode depth to 8 there is no need to call png_set_sBit Change-Id: I8e3941675019b920051775128ff4cf2bf1ca7c4a Reviewed-by: aavit <eirik.aavitsland@digia.com>
* Change copyrights from Nokia to DigiaIikka Eklund2012-09-221-24/+24
| | | | | | | | Change copyrights and license headers from Nokia to Digia Change-Id: If1cc974286d29fd01ec6c19dd4719a67f4c3f00e Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* Doc: Fix misc. documentation errorsaavit2012-08-301-9/+1
| | | | | Change-Id: I9481ed452922ed5ecd159a8f60d7fbcb3683cec1 Reviewed-by: Kim M. Kalland <kim.kalland@nokia.com>
* Fix -Wclobbered warningsMarc Mutz2012-08-181-2/+2
| | | | | | | | | | | | | | | | | GCC warns: warning: argument 'x' might be clobbered by 'longjmp' or 'vfork' [-Wclobbered] Apparently, the real fix would be annotating the functions correctly with noreturn and returns_twice attributes, but there's also workarounds for these, at least in the png case, so adding volatile was the easier way out here. Needed a cast to lose the volatile again, passing the argument to qMin(). Change-Id: Id820cf9b65752359f3b8f268172ba71bc9a76784 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Get rid of some deprecation warningsLars Knoll2012-04-281-3/+3
| | | | | Change-Id: I05e6f9479789652cc1536cb5bced2bc8fa664c84 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Implement inline downscaling in png reader, to save memoryaavit2012-04-271-60/+153
| | | | | | | | | Instead of allocating and reading the entire image and then scaling it down, this code reads only one line at a time and scales it on the fly. Change-Id: I61fde307146c11dcd90ca617cc2e7f85dd3b66c4 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* get rid of QT_NO_IMAGE_TEXT switcherKonstantin Ritt2012-04-251-13/+2
| | | | | Change-Id: Ie72f907ffb959f629af6a414959348a992c4c941 Reviewed-by: aavit <qt_aavit@ovi.com>
* Deprecate qMemCopy/qMemSet in favour of their stdlib equivilents.Robin Burchell2012-04-111-2/+2
| | | | | | | | | | | | | | | | | | Just like qMalloc/qRealloc/qFree, there is absolutely no reason to wrap these functions just to avoid an include, except to pay for it with worse runtime performance. On OS X, on byte sizes from 50 up to 1000, calling memset directly is 28-15% faster(!) than adding an additional call to qMemSet. The advantage on sizes above that is unmeasurable. For qMemCopy, the benefits are a little more modest: 16-7%. Change-Id: I98aa92bb765aea0448e3f20af42a039b369af0b3 Reviewed-by: Giuseppe D'Angelo <dangelog@gmail.com> Reviewed-by: John Brooks <john.brooks@dereferenced.net> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Remove "All rights reserved" line from license headers.Jason McDonald2012-01-301-1/+1
| | | | | | | | | | As in the past, to avoid rewriting various autotests that contain line-number information, an extra blank line has been inserted at the end of the license text to ensure that this commit does not change the total number of lines in the license header. Change-Id: I311e001373776812699d6efc045b5f742890c689 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Update contact information in license headers.Jason McDonald2012-01-231-1/+1
| | | | | | | Replace Nokia contact email address with Qt Project website. Change-Id: I431bbbf76d7c27d8b502f87947675c116994c415 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Update copyright year in license headers.Jason McDonald2012-01-051-1/+1
| | | | | Change-Id: I02f2c620296fcd91d4967d58767ea33fc4e1e7dc Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Fix build with Clang for libpng versions 1.4.0 to 1.5.2Tor Arne Vestbø2011-08-311-0/+23
| | | | | | | | | | | | | | | | | | | | | Versions 1.4.0 to 1.5.2 of libpng declare png_longjmp_ptr to have a noreturn attribute if PNG_PEDANTIC_WARNINGS_SUPPORTED is enabled, but most declarations of longjmp in the wild do not add this attribute. This causes problems when the png_jmpbuf macro expands to calling png_set_longjmp_fn with a mismatched longjmp, as compilers such as Clang will treat this as an error. To work around this we override the png_jmpbuf macro to cast longjmp to a png_longjmp_ptr. See also http://llvm.org/bugs/show_bug.cgi?id=10338 Reviewed-by: Simon Hausmann <simon.hausmann@nokia.com> Reviewed-by: Marius Storm-Olsen <marius.storm-olsen@nokia.com> Change-Id: I197cfa12af76410310e409bc0fce7d4332ee66a6 Reviewed-on: http://codereview.qt.nokia.com/3929 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
* Update licenseheader text in source files for qtbase Qt moduleJyri Tahtela2011-05-241-17/+17
| | | | | | | Updated version of LGPL and FDL licenseheaders. Apply release phase licenseheaders for all source files. Reviewed-by: Trust Me
* Initial import from the monolithic Qt.Qt by Nokia2011-04-271-0/+991
This is the beginning of revision history for this module. If you want to look at revision history older than this, please refer to the Qt Git wiki for how to use Git history grafting. At the time of writing, this wiki is located here: http://qt.gitorious.org/qt/pages/GitIntroductionWithQt If you have already performed the grafting and you don't see any history beyond this commit, try running "git log" with the "--follow" argument. Branched from the monolithic repo, Qt master branch, at commit 896db169ea224deb96c59ce8af800d019de63f12