From f88cf324a0bef2db4419c867ab97cb0741d366d1 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Mon, 16 Mar 2015 12:52:23 +0100 Subject: Correct mask of A2B10G10R10 Green mask is missing an F. Change-Id: I7387ef01ee414abc1a48efec71d71f46922c1bed Reviewed-by: Oswald Buddenhagen Reviewed-by: Frederik Gladhorn --- src/plugins/imageformats/dds/qddshandler.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/imageformats/dds/qddshandler.cpp b/src/plugins/imageformats/dds/qddshandler.cpp index 26aa160..2fb6162 100644 --- a/src/plugins/imageformats/dds/qddshandler.cpp +++ b/src/plugins/imageformats/dds/qddshandler.cpp @@ -101,7 +101,7 @@ struct FormatInfo static const FormatInfo formatInfos[] = { { FormatA8R8G8B8, DDSPixelFormat::FlagRGBA, 32, 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000 }, { FormatX8R8G8B8, DDSPixelFormat::FlagRGB, 32, 0x00ff0000, 0x0000ff00, 0x000000ff, 0x00000000 }, - { FormatA2B10G10R10, DDSPixelFormat::FlagRGBA, 32, 0x000003ff, 0x0000fc00, 0x3ff00000, 0xc0000000 }, + { FormatA2B10G10R10, DDSPixelFormat::FlagRGBA, 32, 0x000003ff, 0x000ffc00, 0x3ff00000, 0xc0000000 }, { FormatA8B8G8R8, DDSPixelFormat::FlagRGBA, 32, 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000 }, { FormatX8B8G8R8, DDSPixelFormat::FlagRGB, 32, 0x000000ff, 0x0000ff00, 0x00ff0000, 0x00000000 }, { FormatG16R16, DDSPixelFormat::FlagRGBA, 32, 0x0000ffff, 0xffff0000, 0x00000000, 0x00000000 }, -- cgit v1.2.3 From f65a4c931b0b849c6118a872948e9eb74dc4e011 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Mon, 16 Mar 2015 14:08:31 +0100 Subject: Replace malloc'ed tables with QVarLengthArray Basic cleanup using proper Qt classes instead of malloc. Change-Id: I532b47aac7cfe15a5963371224288bec08135f25 Reviewed-by: Thiago Macieira --- src/plugins/imageformats/tiff/qtiffhandler.cpp | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/src/plugins/imageformats/tiff/qtiffhandler.cpp b/src/plugins/imageformats/tiff/qtiffhandler.cpp index 675e6c3..9697f45 100644 --- a/src/plugins/imageformats/tiff/qtiffhandler.cpp +++ b/src/plugins/imageformats/tiff/qtiffhandler.cpp @@ -494,20 +494,13 @@ bool QTiffHandler::write(const QImage &image) } //// write the color table // allocate the color tables - uint16 *redTable = static_cast(malloc(256 * sizeof(uint16))); - uint16 *greenTable = static_cast(malloc(256 * sizeof(uint16))); - uint16 *blueTable = static_cast(malloc(256 * sizeof(uint16))); - if (!redTable || !greenTable || !blueTable) { - free(redTable); - free(greenTable); - free(blueTable); - TIFFClose(tiff); - return false; - } - - // set the color table const int tableSize = colorTable.size(); Q_ASSERT(tableSize <= 256); + QVarLengthArray redTable(tableSize); + QVarLengthArray greenTable(tableSize); + QVarLengthArray blueTable(tableSize); + + // set the color table for (int i = 0; i Date: Sat, 20 Sep 2014 17:23:37 +0300 Subject: DDS: fix image format check Replace duplicated bBitMask check by the intended gBitMask check. Change-Id: I6d1780a4112e88484de661f07a15f2121602b86c Reviewed-by: Oswald Buddenhagen Reviewed-by: Allan Sandfeld Jensen --- src/plugins/imageformats/dds/qddshandler.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/imageformats/dds/qddshandler.cpp b/src/plugins/imageformats/dds/qddshandler.cpp index 2fb6162..6ec2804 100644 --- a/src/plugins/imageformats/dds/qddshandler.cpp +++ b/src/plugins/imageformats/dds/qddshandler.cpp @@ -323,7 +323,7 @@ static Format getFormat(const DDSHeader &dds) if ((format.flags & info.flags) == info.flags && format.rgbBitCount == info.bitCount && format.rBitMask == info.rBitMask && - format.bBitMask == info.bBitMask && + format.gBitMask == info.gBitMask && format.bBitMask == info.bBitMask && format.aBitMask == info.aBitMask) { return info.format; -- cgit v1.2.3