From 509d6770d90074f34a95c0b9c75149f0d531f03e Mon Sep 17 00:00:00 2001 From: aavit Date: Tue, 12 Aug 2014 10:25:16 +0200 Subject: Let QImage::mirrored() retain dots-per-meter settings Task-number: QTBUG-40582 Change-Id: Iffeba44fa6d1f34331bb69ff9aabce88efe279a7 Reviewed-by: Laszlo Agocs Reviewed-by: Gunnar Sletta --- src/gui/image/qimage.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/gui/image/qimage.cpp') diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 273c1c922e..3c25aa848d 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -2836,6 +2836,8 @@ QImage QImage::mirrored_helper(bool horizontal, bool vertical) const result.d->colortable = d->colortable; result.d->has_alpha_clut = d->has_alpha_clut; result.d->devicePixelRatio = d->devicePixelRatio; + result.d->dpmx = d->dpmx; + result.d->dpmy = d->dpmy; do_mirror(result.d, d, horizontal, vertical); -- cgit v1.2.3 From 1394962ceb9250979cb230046d13a42deacf996b Mon Sep 17 00:00:00 2001 From: Maks Naumov Date: Wed, 17 Sep 2014 20:51:14 +0300 Subject: Remove pointless check in QImageData::create() "height <= 0" already verified above. Change-Id: Ia2ab90a4cd5533f7b5101686876c2c2cc3e275ac Reviewed-by: Thiago Macieira --- src/gui/image/qimage.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'src/gui/image/qimage.cpp') diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 5de686c1ea..32c81e39fa 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -797,7 +797,6 @@ QImageData *QImageData::create(uchar *data, int width, int height, int bpl, QIm || INT_MAX/sizeof(uchar *) < uint(height) || INT_MAX/uint(depth) < uint(width) || bpl <= 0 - || height <= 0 || bpl < min_bytes_per_line || INT_MAX/uint(bpl) < uint(height)) return d; // invalid parameter(s) -- cgit v1.2.3 From 91b7d53154b84e41c8ec2aa04ce4777cdd138720 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Fri, 19 Sep 2014 16:06:21 +0200 Subject: Fix QPixelFormat values The two mono formats are actually indexed and may have both color and alpha values in the color-table, and Format_ARGB4444_Premultiplied and Format_ARGB6666_Premultiplied both have the alpha value in the end. Change-Id: I7f1efb2213710f5eb628d71356f9c8ed75b50f4d Reviewed-by: Gunnar Sletta --- src/gui/image/qimage.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/gui/image/qimage.cpp') diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 32c81e39fa..d2c3c41812 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -4662,7 +4662,7 @@ static Q_CONSTEXPR QPixelFormat pixelformats[] = { //QImage::Format_Invalid: QPixelFormat(), //QImage::Format_Mono: - QPixelFormat(QPixelFormat::Grayscale, + QPixelFormat(QPixelFormat::Indexed, /*RED*/ 1, /*GREEN*/ 0, /*BLUE*/ 0, @@ -4675,7 +4675,7 @@ static Q_CONSTEXPR QPixelFormat pixelformats[] = { /*INTERPRETATION*/ QPixelFormat::UnsignedByte, /*BYTE ORDER*/ QPixelFormat::CurrentSystemEndian), //QImage::Format_MonoLSB: - QPixelFormat(QPixelFormat::Grayscale, + QPixelFormat(QPixelFormat::Indexed, /*RED*/ 1, /*GREEN*/ 0, /*BLUE*/ 0, @@ -4787,7 +4787,7 @@ static Q_CONSTEXPR QPixelFormat pixelformats[] = { /*FIFTH*/ 0, /*ALPHA*/ 6, /*ALPHA USAGE*/ QPixelFormat::UsesAlpha, - /*ALPHA POSITION*/ QPixelFormat::AtBeginning, + /*ALPHA POSITION*/ QPixelFormat::AtEnd, /*PREMULTIPLIED*/ QPixelFormat::Premultiplied, /*INTERPRETATION*/ QPixelFormat::UnsignedInteger, /*BYTE ORDER*/ QPixelFormat::CurrentSystemEndian), @@ -4852,7 +4852,7 @@ static Q_CONSTEXPR QPixelFormat pixelformats[] = { /*FIFTH*/ 0, /*ALPHA*/ 4, /*ALPHA USAGE*/ QPixelFormat::UsesAlpha, - /*ALPHA POSITION*/ QPixelFormat::AtBeginning, + /*ALPHA POSITION*/ QPixelFormat::AtEnd, /*PREMULTIPLIED*/ QPixelFormat::Premultiplied, /*INTERPRETATION*/ QPixelFormat::UnsignedShort, /*BYTE ORDER*/ QPixelFormat::CurrentSystemEndian), -- cgit v1.2.3 From 974c2108352d1136835a615d3b56b827d6ef99dd Mon Sep 17 00:00:00 2001 From: Matti Paaso Date: Thu, 21 Aug 2014 16:51:22 +0300 Subject: Update license headers and add new license files - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 - Removed LICENSE.GPL Change-Id: Iec3406e3eb3f133be549092015cefe33d259a3f2 Reviewed-by: Iikka Eklund --- src/gui/image/qimage.cpp | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) (limited to 'src/gui/image/qimage.cpp') diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 50dcc9eca2..df4bedc3cd 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -5,36 +5,28 @@ ** ** This file is part of the QtGui module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** rights. These rights are described in the Digia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ -- cgit v1.2.3 From 8165a9c74b309a00c894504a5b6f26e696743c10 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Fri, 19 Sep 2014 16:11:10 +0200 Subject: Clean up QImage::Format switches Changes some switches on QImage::Format that needed to be updated whenever a new image format was added. Two were changed to matching formats supported by BMP and PPM instead of what they don't support, and two were changed to now use QPixelFormat values. Change-Id: I5a14f1d7b7cc0451c68e4d6ab2361a5bd8dc8915 Reviewed-by: Gunnar Sletta --- src/gui/image/qimage.cpp | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) (limited to 'src/gui/image/qimage.cpp') diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index df4bedc3cd..4e10b4cb4b 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -4151,22 +4151,16 @@ QImage QImage::alphaChannel() const */ bool QImage::hasAlphaChannel() const { - return d && (d->format == Format_ARGB32_Premultiplied - || d->format == Format_ARGB32 - || d->format == Format_ARGB8565_Premultiplied - || d->format == Format_ARGB8555_Premultiplied - || d->format == Format_ARGB6666_Premultiplied - || d->format == Format_ARGB4444_Premultiplied - || d->format == Format_RGBA8888 - || d->format == Format_RGBA8888_Premultiplied - || d->format == Format_A2BGR30_Premultiplied - || d->format == Format_A2RGB30_Premultiplied - || (d->has_alpha_clut && (d->format == Format_Indexed8 - || d->format == Format_Mono - || d->format == Format_MonoLSB))); + if (!d) + return false; + const QPixelFormat format = pixelFormat(); + if (format.alphaUsage() == QPixelFormat::UsesAlpha) + return true; + if (format.colorModel() == QPixelFormat::Indexed) + return d->has_alpha_clut; + return false; } - /*! \since 4.7 Returns the number of bit planes in the image. -- cgit v1.2.3