mirror of
https://invent.kde.org/frameworks/kimageformats.git
synced 2026-02-17 22:43:02 -05:00
DDS: improved read/write support
The following changes have been made: - Improved writing speed by using scanLine() instead of pixel() - Optimized memory usage on writing by using ScanlineConverter class - Added native write support for RGBA32FPx4, RGBA16FPx4, RGB8, Grayscale8 and Indexed8 uncompressed formats - Grayscale DDS without alpha are loaded in a Grayscale8 image - Fixed warnings about wrong PITCH reported by GIMP on DDSs saved by this plugin - Initial support for loading DX10 formats (R16F, RG16F, RGBA16F, RGBPreMulA16F, R32F, RG32F, RGBA32F, RGBPreMulA32F) - Fixed alignment issues and A8P8 format support of the attached images* Tested using GIMP and [NVIDIA Texture Tools](https://developer.nvidia.com/texture-tools-exporter) plugin for Photoshop. (*) The following images (taken from [here](https://github.com/walbourn/directxtexmedia)) cannot be added to read tests due to license issue: [test8_DWORD.dds](/uploads/449b5a0d886aaf6764af554fe38e2b09/test8_DWORD.dds) [dx5_logo.dds](/uploads/6f5f27df752890b227ef07e0195435d4/dx5_logo.dds) [test888_DWORD.dds](/uploads/c8bc355c5749cf203d47e0b3073ad419/test888_DWORD.dds)
This commit is contained in:
committed by
Albert Astals Cid
parent
a6f7482957
commit
adc5c7ae9a
@ -2,6 +2,7 @@
|
||||
This file is part of the KDE project
|
||||
SPDX-FileCopyrightText: 2015 The Qt Company Ltd
|
||||
SPDX-FileCopyrightText: 2013 Ivan Komissarov
|
||||
SPDX-FileCopyrightText: 2024 Mirco Miranda
|
||||
|
||||
SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only
|
||||
*/
|
||||
@ -37,6 +38,15 @@ struct DDSPixelFormat
|
||||
quint32 aBitMask;
|
||||
};
|
||||
|
||||
struct DDSHeaderDX10
|
||||
{
|
||||
quint32 dxgiFormat = 0;
|
||||
quint32 resourceDimension = 0;
|
||||
quint32 miscFlag = 0;
|
||||
quint32 arraySize = 0;
|
||||
quint32 miscFlags2 = 0;
|
||||
};
|
||||
|
||||
struct DDSHeader
|
||||
{
|
||||
enum DDSFlags {
|
||||
@ -84,15 +94,7 @@ struct DDSHeader
|
||||
quint32 caps3;
|
||||
quint32 caps4;
|
||||
quint32 reserved2;
|
||||
};
|
||||
|
||||
struct DDSHeaderDX10
|
||||
{
|
||||
quint32 dxgiFormat;
|
||||
quint32 resourceDimension;
|
||||
quint32 miscFlag;
|
||||
quint32 arraySize;
|
||||
quint32 reserved;
|
||||
DDSHeaderDX10 header10;
|
||||
};
|
||||
|
||||
class QDDSHandler : public QImageIOHandler
|
||||
@ -126,7 +128,6 @@ private:
|
||||
|
||||
DDSHeader m_header;
|
||||
int m_format;
|
||||
DDSHeaderDX10 m_header10;
|
||||
int m_currentImage;
|
||||
mutable ScanState m_scanState;
|
||||
};
|
||||
@ -136,8 +137,8 @@ class QDDSPlugin : public QImageIOPlugin
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QImageIOHandlerFactoryInterface" FILE "dds.json")
|
||||
public:
|
||||
Capabilities capabilities(QIODevice *device, const QByteArray &format) const;
|
||||
QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const;
|
||||
Capabilities capabilities(QIODevice *device, const QByteArray &format) const override;
|
||||
QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const override;
|
||||
};
|
||||
|
||||
#endif // QDDSHANDLER_H
|
||||
|
||||
Reference in New Issue
Block a user