Debian Codegraph @

src/plugins/imageformats/mng/qmnghandler.cpp

raw symbols ◀ ▶ SCIP
1 Debian patch touch this file
  • reject broken MNG images
    Origin
    upstream: https://codereview.qt-project.org/c/qt/qtbase/+/303313 For backport to Qt 5.15, add these checks directly to qtimageformats, not qtbase.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2016 The Qt Company Ltd.
4 ** Contact: https://www.qt.io/licensing/
5 **
6 ** This file is part of the MNG plugins in the Qt ImageFormats module.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and The Qt Company. For licensing terms
14 ** and conditions see https://www.qt.io/terms-conditions. For further
15 ** information use the contact form at https://www.qt.io/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 3 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL3 included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 3 requirements
23 ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24 **
25 ** GNU General Public License Usage
26 ** Alternatively, this file may be used under the terms of the GNU
27 ** General Public License version 2.0 or (at your option) the GNU General
28 ** Public license version 3 or any later version approved by the KDE Free
29 ** Qt Foundation. The licenses are as published by the Free Software
30 ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31 ** included in the packaging of this file. Please review the following
32 ** information to ensure the GNU General Public License requirements will
33 ** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34 ** https://www.gnu.org/licenses/gpl-3.0.html.
35 **
36 ** $QT_END_LICENSE$
37 **
38 ****************************************************************************/
39
40 #include "qmnghandler_p.h"cxx . . $ `<file>/src/plugins/imageformats/mng/qmnghandler_p.h`/
41
42 #include "qimage.h"
43 #include "qvariant.h"
44 #include "qcolor.h"
•45 #include <private/qimage_p.h>
46
47 #define MNG_USE_SOcxx . . $ `src/plugins/imageformats/mng/qmnghandler.cpp:47:9`!
48 #include <libmng.h>
49
50 QT_BEGIN_NAMESPACEcxx . . $ `<external>/15045578679651060896/qglobal.h:148:10`!
51
52 class QMngHandlerPrivatecxx . . $ QMngHandlerPrivate#
53 {
54 Q_DECLARE_PUBLICcxx . . $ `<external>/15045578679651060896/qglobal.h:1172:9`!(QMngHandler)
55 public:
56 bool haveReadNonecxx . . $ QMngHandlerPrivate#haveReadNone.;
57 bool haveReadAllcxx . . $ QMngHandlerPrivate#haveReadAll.;
58 mng_handlecxx . . $ mng_handle# hMNGcxx . . $ QMngHandlerPrivate#hMNG.;
59 QImagecxx . . $ QImage# imagecxx . . $ QMngHandlerPrivate#image.;
60 int elapsedcxx . . $ QMngHandlerPrivate#elapsed.;
61 int nextDelaycxx . . $ QMngHandlerPrivate#nextDelay.;
62 int iterCountcxx . . $ QMngHandlerPrivate#iterCount.;
63 int frameIndexcxx . . $ QMngHandlerPrivate#frameIndex.;
64 int nextIndexcxx . . $ QMngHandlerPrivate#nextIndex.;
65 int frameCountcxx . . $ QMngHandlerPrivate#frameCount.;
66 mng_uint32cxx . . $ mng_uint32# iStylecxx . . $ QMngHandlerPrivate#iStyle.;
67 mng_boolcxx . . $ mng_bool# readDatacxx . . $ QMngHandlerPrivate#readData(f05fe62a59995980).(mng_ptrcxx . . $ mng_ptr# pBuf, mng_uint32cxx . . $ mng_uint32# iSize, mng_uint32pcxx . . $ mng_uint32p# pRead);
68 mng_boolcxx . . $ mng_bool# writeDatacxx . . $ QMngHandlerPrivate#writeData(f05fe62a59995980).(mng_ptrcxx . . $ mng_ptr# pBuf, mng_uint32cxx . . $ mng_uint32# iSize, mng_uint32pcxx . . $ mng_uint32p# pWritten);
69 mng_boolcxx . . $ mng_bool# processHeadercxx . . $ QMngHandlerPrivate#processHeader(a3b7deb7bc8463f1).(mng_uint32cxx . . $ mng_uint32# iWidth, mng_uint32cxx . . $ mng_uint32# iHeight);
70 QMngHandlerPrivatecxx . . $ QMngHandlerPrivate#QMngHandlerPrivate(7658cef341330e2c).(QMngHandlercxx . . $ QMngHandler# *q_ptr);
71 ~cxx . . $ QMngHandlerPrivate#`~QMngHandlerPrivate`(ced63f7c635d850d).QMngHandlerPrivatecxx . . $ QMngHandlerPrivate#();
72 bool getNextImagecxx . . $ QMngHandlerPrivate#getNextImage(5a6f164356166ee6).(QImagecxx . . $ QImage# *result);
73 bool writeImagecxx . . $ QMngHandlerPrivate#writeImage(73afe20316494619).(const QImagecxx . . $ QImage# &image);
74 int currentImageNumbercxx . . $ QMngHandlerPrivate#currentImageNumber(455f465bc33b4cdf).() const;
75 int imageCountcxx . . $ QMngHandlerPrivate#imageCount(455f465bc33b4cdf).() const;
76 bool jumpToImagecxx . . $ QMngHandlerPrivate#jumpToImage(83c267b20bac841a).(int imageNumber);
77 bool jumpToNextImagecxx . . $ QMngHandlerPrivate#jumpToNextImage(c9857a73d68e59ba).();
78 int nextImageDelaycxx . . $ QMngHandlerPrivate#nextImageDelay(455f465bc33b4cdf).() const;
79 bool setBackgroundColorcxx . . $ QMngHandlerPrivate#setBackgroundColor(bf1edffcd5557ab5).(const QColorcxx . . $ QColor# &color);
80 QColorcxx . . $ QColor# backgroundColorcxx . . $ QMngHandlerPrivate#backgroundColor(6d62b116d5d1b12f).() const;
81 QMngHandlercxx . . $ QMngHandler# *q_ptrcxx . . $ QMngHandlerPrivate#q_ptr.;
82 };
83
84 static mng_boolcxx . . $ mng_bool# myerrorcxx . . $ myerror(29be037ec3b07604).(mng_handlecxx . . $ mng_handle# /*hMNG*/,
85 mng_int32cxx . . $ mng_int32# iErrorcode,
86 mng_int8cxx . . $ mng_int8# /*iSeverity*/,
87 mng_chunkidcxx . . $ mng_chunkid# iChunkname,
88 mng_uint32cxx . . $ mng_uint32# /*iChunkseq*/,
89 mng_int32cxx . . $ mng_int32# iExtra1,
90 mng_int32cxx . . $ mng_int32# iExtra2,
91 mng_pcharcxx . . $ mng_pchar# zErrortext)
92 {
93 qWarningcxx . . $ `<external>/10450329605257866924/qlogging.h:166:9`!("MNG error %d: %s; chunk %c%c%c%c; subcode %d:%d",
94 iErrorcode,zErrortext,
95 (iChunkname>>24)&0xff,
96 (iChunkname>>16)&0xff,
97 (iChunkname>>8)&0xff,
98 (iChunkname>>0)&0xff,
99 iExtra1,iExtra2);
100 return MNG_TRUEcxx . . $ `<external>/4655996512791487556/libmng_types.h:345:9`!;
101 }
102
103 static mng_ptrcxx . . $ mng_ptr# myalloccxx . . $ myalloc(bfcfa4d6b7f7ef64).(mng_size_tcxx . . $ mng_size_t# iSize)
104 {
105 return (mng_ptrcxx . . $ mng_ptr#)calloc(1, iSize);
106 }
107
108 static void myfreecxx . . $ myfree(5500c4293b1bbef0).(mng_ptrcxx . . $ mng_ptr# pPtr, mng_size_tcxx . . $ mng_size_t# /*iSize*/)
109 {
110 free(pPtr);
111 }
112
113 static mng_boolcxx . . $ mng_bool# myopenstreamcxx . . $ myopenstream(c27092c9b5aee7e1).(mng_handlecxx . . $ mng_handle#)
114 {
115 return MNG_TRUEcxx . . $ `<external>/4655996512791487556/libmng_types.h:345:9`!;
116 }
117
118 static mng_boolcxx . . $ mng_bool# myclosestreamcxx . . $ myclosestream(c27092c9b5aee7e1).(mng_handlecxx . . $ mng_handle# hMNG)
119 {
120 QMngHandlerPrivatecxx . . $ QMngHandlerPrivate# *pMydata = reinterpret_cast<QMngHandlerPrivatecxx . . $ QMngHandlerPrivate# *>(mng_get_userdata(hMNG));
121 pMydata->haveReadAllcxx . . $ QMngHandlerPrivate#haveReadAll. = true;
122 return MNG_TRUEcxx . . $ `<external>/4655996512791487556/libmng_types.h:345:9`!;
123 }
124
125 static mng_boolcxx . . $ mng_bool# myreaddatacxx . . $ myreaddata(3a43d26bffb5916c).(mng_handlecxx . . $ mng_handle# hMNG,
126 mng_ptrcxx . . $ mng_ptr# pBuf,
127 mng_uint32cxx . . $ mng_uint32# iSize,
128 mng_uint32pcxx . . $ mng_uint32p# pRead)
129 {
130 QMngHandlerPrivatecxx . . $ QMngHandlerPrivate# *pMydata = reinterpret_cast<QMngHandlerPrivatecxx . . $ QMngHandlerPrivate# *>(mng_get_userdata(hMNG));
131 return pMydata->readDatacxx . . $ QMngHandlerPrivate#readData(f05fe62a59995980).(pBuf, iSize, pRead);
132 }
133
134 static mng_boolcxx . . $ mng_bool# mywritedatacxx . . $ mywritedata(3a43d26bffb5916c).(mng_handlecxx . . $ mng_handle# hMNG,
135 mng_ptrcxx . . $ mng_ptr# pBuf,
136 mng_uint32cxx . . $ mng_uint32# iSize,
137 mng_uint32pcxx . . $ mng_uint32p# pWritten)
138 {
139 QMngHandlerPrivatecxx . . $ QMngHandlerPrivate# *pMydata = reinterpret_cast<QMngHandlerPrivatecxx . . $ QMngHandlerPrivate# *>(mng_get_userdata(hMNG));
140 return pMydata->writeDatacxx . . $ QMngHandlerPrivate#writeData(f05fe62a59995980).(pBuf, iSize, pWritten);
141 }
142
143 static mng_boolcxx . . $ mng_bool# myprocessheadercxx . . $ myprocessheader(c6f937e7375becfb).(mng_handlecxx . . $ mng_handle# hMNG,
144 mng_uint32cxx . . $ mng_uint32# iWidth,
145 mng_uint32cxx . . $ mng_uint32# iHeight)
146 {
147 QMngHandlerPrivatecxx . . $ QMngHandlerPrivate# *pMydata = reinterpret_cast<QMngHandlerPrivatecxx . . $ QMngHandlerPrivate# *>(mng_get_userdata(hMNG));
148 return pMydata->processHeadercxx . . $ QMngHandlerPrivate#processHeader(a3b7deb7bc8463f1).(iWidth, iHeight);
149 }
150
151 static mng_ptrcxx . . $ mng_ptr# mygetcanvaslinecxx . . $ mygetcanvasline(f829683bd01ccf96).(mng_handlecxx . . $ mng_handle# hMNG,
152 mng_uint32cxx . . $ mng_uint32# iLinenr)
153 {
154 QMngHandlerPrivatecxx . . $ QMngHandlerPrivate# *pMydata = reinterpret_cast<QMngHandlerPrivatecxx . . $ QMngHandlerPrivate# *>(mng_get_userdata(hMNG));
155 return (mng_ptrcxx . . $ mng_ptr#)pMydata->imagecxx . . $ QMngHandlerPrivate#image..scanLinecxx . . $ QImage#scanLine(f18dc31a6ecbac56).(iLinenr);
156 }
157
158 static mng_boolcxx . . $ mng_bool# myrefreshcxx . . $ myrefresh(de12f3d4b9439e36).(mng_handlecxx . . $ mng_handle# /*hMNG*/,
159 mng_uint32cxx . . $ mng_uint32# /*iX*/,
160 mng_uint32cxx . . $ mng_uint32# /*iY*/,
161 mng_uint32cxx . . $ mng_uint32# /*iWidth*/,
162 mng_uint32cxx . . $ mng_uint32# /*iHeight*/)
163 {
164 return MNG_TRUEcxx . . $ `<external>/4655996512791487556/libmng_types.h:345:9`!;
165 }
166
167 static mng_uint32cxx . . $ mng_uint32# mygettickcountcxx . . $ mygettickcount(9091b7ae611eef44).(mng_handlecxx . . $ mng_handle# hMNG)
168 {
169 QMngHandlerPrivatecxx . . $ QMngHandlerPrivate# *pMydata = reinterpret_cast<QMngHandlerPrivatecxx . . $ QMngHandlerPrivate# *>(mng_get_userdata(hMNG));
170 return pMydata->elapsedcxx . . $ QMngHandlerPrivate#elapsed.++;
171 }
172
173 static mng_boolcxx . . $ mng_bool# mysettimercxx . . $ mysettimer(47f7dba9bbdfdffc).(mng_handlecxx . . $ mng_handle# hMNG,
174 mng_uint32cxx . . $ mng_uint32# iMsecs)
175 {
176 QMngHandlerPrivatecxx . . $ QMngHandlerPrivate# *pMydata = reinterpret_cast<QMngHandlerPrivatecxx . . $ QMngHandlerPrivate# *>(mng_get_userdata(hMNG));
177 pMydata->elapsedcxx . . $ QMngHandlerPrivate#elapsed. += iMsecs;
178 pMydata->nextDelaycxx . . $ QMngHandlerPrivate#nextDelay. = iMsecs;
179 return MNG_TRUEcxx . . $ `<external>/4655996512791487556/libmng_types.h:345:9`!;
180 }
181
182 static mng_boolcxx . . $ mng_bool# myprocesstermcxx . . $ myprocessterm(d5ae8a96b8aefa3d).(mng_handlecxx . . $ mng_handle# hMNG,
183 mng_uint8cxx . . $ mng_uint8# iTermaction,
184 mng_uint8cxx . . $ mng_uint8# /*iIteraction*/,
185 mng_uint32cxx . . $ mng_uint32# /*iDelay*/,
186 mng_uint32cxx . . $ mng_uint32# iItermax)
187 {
188 QMngHandlerPrivatecxx . . $ QMngHandlerPrivate# *pMydata = reinterpret_cast<QMngHandlerPrivatecxx . . $ QMngHandlerPrivate# *>(mng_get_userdata(hMNG));
189 if (iTermaction == 3)
190 pMydata->iterCountcxx . . $ QMngHandlerPrivate#iterCount. = iItermax;
191 return MNG_TRUEcxx . . $ `<external>/4655996512791487556/libmng_types.h:345:9`!;
192 }
193
194 static mng_boolcxx . . $ mng_bool# mytracecxx . . $ mytrace(793b0dcda24dfc40).(mng_handlecxx . . $ mng_handle#,
195 mng_int32cxx . . $ mng_int32# iFuncnr,
196 mng_int32cxx . . $ mng_int32# iFuncseq,
197 mng_pcharcxx . . $ mng_pchar# zFuncname)
198 {
199 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("mng trace: iFuncnr: %d iFuncseq: %d zFuncname: %s", iFuncnr, iFuncseq, zFuncname);
200 return MNG_TRUEcxx . . $ `<external>/4655996512791487556/libmng_types.h:345:9`!;
201 }
202
203 QMngHandlerPrivatecxx . . $ QMngHandlerPrivate#::QMngHandlerPrivatecxx . . $ QMngHandlerPrivate#QMngHandlerPrivate(7658cef341330e2c).(QMngHandlercxx . . $ QMngHandler# *q_ptr)
204 : haveReadNonecxx . . $ QMngHandlerPrivate#haveReadNone.(true), haveReadAllcxx . . $ QMngHandlerPrivate#haveReadAll.(false), elapsedcxx . . $ QMngHandlerPrivate#elapsed.(0), nextDelaycxx . . $ QMngHandlerPrivate#nextDelay.(0), iterCountcxx . . $ QMngHandlerPrivate#iterCount.(1),
205 frameIndexcxx . . $ QMngHandlerPrivate#frameIndex.(-1), nextIndexcxx . . $ QMngHandlerPrivate#nextIndex.(0), frameCountcxx . . $ QMngHandlerPrivate#frameCount.(0), q_ptrcxx . . $ QMngHandlerPrivate#q_ptr.(q_ptr)
206 {
207 iStylecxx . . $ QMngHandlerPrivate#iStyle. = (QSysInfocxx . . $ QSysInfo#::ByteOrdercxx . . $ QSysInfo#ByteOrder. == QSysInfocxx . . $ QSysInfo#::LittleEndiancxx . . $ QSysInfo#LittleEndian.) ? MNG_CANVAS_BGRA8cxx . . $ `<external>/7372437134815882689/libmng.h:2522:9`! : MNG_CANVAS_ARGB8cxx . . $ `<external>/7372437134815882689/libmng.h:2517:9`!;
208 // Initialize libmng
209 hMNGcxx . . $ QMngHandlerPrivate#hMNG. = mng_initialize((mng_ptrcxx . . $ mng_ptr#)this, myalloccxx . . $ myalloc(bfcfa4d6b7f7ef64)., myfreecxx . . $ myfree(5500c4293b1bbef0)., mytracecxx . . $ mytrace(793b0dcda24dfc40).);
210 if (hMNGcxx . . $ QMngHandlerPrivate#hMNG.) {
211 // Set callback functions
212 mng_setcb_errorproc(hMNGcxx . . $ QMngHandlerPrivate#hMNG., myerrorcxx . . $ myerror(29be037ec3b07604).);
213 mng_setcb_openstream(hMNGcxx . . $ QMngHandlerPrivate#hMNG., myopenstreamcxx . . $ myopenstream(c27092c9b5aee7e1).);
214 mng_setcb_closestream(hMNGcxx . . $ QMngHandlerPrivate#hMNG., myclosestreamcxx . . $ myclosestream(c27092c9b5aee7e1).);
215 mng_setcb_readdata(hMNGcxx . . $ QMngHandlerPrivate#hMNG., myreaddatacxx . . $ myreaddata(3a43d26bffb5916c).);
216 mng_setcb_writedata(hMNGcxx . . $ QMngHandlerPrivate#hMNG., mywritedatacxx . . $ mywritedata(3a43d26bffb5916c).);
217 mng_setcb_processheader(hMNGcxx . . $ QMngHandlerPrivate#hMNG., myprocessheadercxx . . $ myprocessheader(c6f937e7375becfb).);
218 mng_setcb_getcanvasline(hMNGcxx . . $ QMngHandlerPrivate#hMNG., mygetcanvaslinecxx . . $ mygetcanvasline(f829683bd01ccf96).);
219 mng_setcb_refresh(hMNGcxx . . $ QMngHandlerPrivate#hMNG., myrefreshcxx . . $ myrefresh(de12f3d4b9439e36).);
220 mng_setcb_gettickcount(hMNGcxx . . $ QMngHandlerPrivate#hMNG., mygettickcountcxx . . $ mygettickcount(9091b7ae611eef44).);
221 mng_setcb_settimer(hMNGcxx . . $ QMngHandlerPrivate#hMNG., mysettimercxx . . $ mysettimer(47f7dba9bbdfdffc).);
222 mng_setcb_processterm(hMNGcxx . . $ QMngHandlerPrivate#hMNG., myprocesstermcxx . . $ myprocessterm(d5ae8a96b8aefa3d).);
223 mng_set_doprogressive(hMNGcxx . . $ QMngHandlerPrivate#hMNG., MNG_FALSEcxx . . $ `<external>/4655996512791487556/libmng_types.h:344:9`!);
224 mng_set_suspensionmode(hMNGcxx . . $ QMngHandlerPrivate#hMNG., MNG_TRUEcxx . . $ `<external>/4655996512791487556/libmng_types.h:345:9`!);
225 }
226 }
227
228 QMngHandlerPrivatecxx . . $ QMngHandlerPrivate#::~cxx . . $ QMngHandlerPrivate#`~QMngHandlerPrivate`(ced63f7c635d850d).QMngHandlerPrivatecxx . . $ QMngHandlerPrivate#()
229 {
230 mng_cleanup(&hMNGcxx . . $ QMngHandlerPrivate#hMNG.);
231 }
232
233 mng_boolcxx . . $ mng_bool# QMngHandlerPrivatecxx . . $ QMngHandlerPrivate#::readDatacxx . . $ QMngHandlerPrivate#readData(f05fe62a59995980).(mng_ptrcxx . . $ mng_ptr# pBuf, mng_uint32cxx . . $ mng_uint32# iSize, mng_uint32pcxx . . $ mng_uint32p# pRead)
234 {
235 Q_Qcxx . . $ `<external>/15045578679651060896/qglobal.h:1178:9`!(QMngHandler);
236 *pRead = q->devicecxx . . $ QImageIOHandler#device(84cdc49e7936af4f).()->readcxx . . $ QIODevice#read(2e638bc8ed65be6c).((char *)pBuf, iSize);
237 return (*pRead > 0) ? MNG_TRUEcxx . . $ `<external>/4655996512791487556/libmng_types.h:345:9`! : MNG_FALSEcxx . . $ `<external>/4655996512791487556/libmng_types.h:344:9`!;
238 }
239
240 mng_boolcxx . . $ mng_bool# QMngHandlerPrivatecxx . . $ QMngHandlerPrivate#::writeDatacxx . . $ QMngHandlerPrivate#writeData(f05fe62a59995980).(mng_ptrcxx . . $ mng_ptr# pBuf, mng_uint32cxx . . $ mng_uint32# iSize, mng_uint32pcxx . . $ mng_uint32p# pWritten)
241 {
242 Q_Qcxx . . $ `<external>/15045578679651060896/qglobal.h:1178:9`!(QMngHandler);
243 *pWritten = q->devicecxx . . $ QImageIOHandler#device(84cdc49e7936af4f).()->writecxx . . $ QIODevice#write(93d4069f65218ea4).((char *)pBuf, iSize);
244 return MNG_TRUEcxx . . $ `<external>/4655996512791487556/libmng_types.h:345:9`!;
245 }
246
247 mng_boolcxx . . $ mng_bool# QMngHandlerPrivatecxx . . $ QMngHandlerPrivate#::processHeadercxx . . $ QMngHandlerPrivate#processHeader(a3b7deb7bc8463f1).(mng_uint32cxx . . $ mng_uint32# iWidth, mng_uint32cxx . . $ mng_uint32# iHeight)
248 {
249 if (mng_set_canvasstyle(hMNGcxx . . $ QMngHandlerPrivate#hMNG., iStylecxx . . $ QMngHandlerPrivate#iStyle.) != MNG_NOERRORcxx . . $ `<external>/7372437134815882689/libmng.h:2400:9`!)
250 return MNG_FALSEcxx . . $ `<external>/4655996512791487556/libmng_types.h:344:9`!;
•251 QImageDatacxx . . $ QImageData#::ImageSizeParameterscxx . . $ QImageData#ImageSizeParameters# szp =
252 QImageDatacxx . . $ QImageData#::calculateImageParameterscxx . . $ QImageData#calculateImageParameters(9e82515468da52c5).(iWidth, iHeight, 32);
253 if (!szp.isValidcxx . . $ QImageData#ImageSizeParameters#isValid(50ce9a9e25b4a850).())
254 return MNG_FALSEcxx . . $ `<external>/4655996512791487556/libmng_types.h:344:9`!;
255 // 256 MB is enough for an 8K 64bpp image
256 if (szp.totalSizecxx . . $ QImageData#ImageSizeParameters#totalSize. > 256 << 20) {
257 qWarningcxx . . $ `<external>/10450329605257866924/qlogging.h:166:9`!("QMngHandler: Rejecting image as it exceeds the current "
258 "allocation limit of 256 megabytes");
259 return MNG_FALSEcxx . . $ `<external>/4655996512791487556/libmng_types.h:344:9`!;
260 }
261 imagecxx . . $ QMngHandlerPrivate#image. =cxx . . $ QImage#`operator=`(e6308d6f8c10e1d2). QImagecxx . . $ QImage#QImage(bf9e47a5364bf007).(iWidth, iHeight, QImagecxx . . $ QImage#::Format_ARGB32cxx . . $ QImage#Format_ARGB32.);
262 imagecxx . . $ QMngHandlerPrivate#image..fillcxx . . $ QImage#fill(cb2f890c2fdad230).(0);
263 return MNG_TRUEcxx . . $ `<external>/4655996512791487556/libmng_types.h:345:9`!;
264 }
265
266 bool QMngHandlerPrivatecxx . . $ QMngHandlerPrivate#::getNextImagecxx . . $ QMngHandlerPrivate#getNextImage(5a6f164356166ee6).(QImagecxx . . $ QImage# *result)
267 {
268 mng_retcodecxx . . $ mng_retcode# ret;
269 const bool savedHaveReadAll = haveReadAllcxx . . $ QMngHandlerPrivate#haveReadAll.;
270 if (haveReadNonecxx . . $ QMngHandlerPrivate#haveReadNone.) {
271 haveReadNonecxx . . $ QMngHandlerPrivate#haveReadNone. = false;
272 ret = mng_readdisplay(hMNGcxx . . $ QMngHandlerPrivate#hMNG.);
273 } else {
274 ret = mng_display_resume(hMNGcxx . . $ QMngHandlerPrivate#hMNG.);
275 }
276 if ((MNG_NOERRORcxx . . $ `<external>/7372437134815882689/libmng.h:2400:9`! == ret) || (MNG_NEEDTIMERWAITcxx . . $ `<external>/7372437134815882689/libmng.h:2416:9`! == ret)) {
277 *result =cxx . . $ QImage#`operator=`(acb38987752f17f1). imagecxx . . $ QMngHandlerPrivate#image.;
278
279 // QTBUG-28894 -- libmng produces an extra frame at the end
280 // of the animation on the first loop only.
281 if (nextDelaycxx . . $ QMngHandlerPrivate#nextDelay. == 1 && (!savedHaveReadAll && haveReadAllcxx . . $ QMngHandlerPrivate#haveReadAll.)) {
282 ret = mng_display_resume(hMNGcxx . . $ QMngHandlerPrivate#hMNG.);
283 }
284
285 frameIndexcxx . . $ QMngHandlerPrivate#frameIndex. = nextIndexcxx . . $ QMngHandlerPrivate#nextIndex.++;
286 if (haveReadAllcxx . . $ QMngHandlerPrivate#haveReadAll. && (frameCountcxx . . $ QMngHandlerPrivate#frameCount. == 0))
287 frameCountcxx . . $ QMngHandlerPrivate#frameCount. = nextIndexcxx . . $ QMngHandlerPrivate#nextIndex.;
288 return true;
289 }
290 return false;
291 }
292
293 bool QMngHandlerPrivatecxx . . $ QMngHandlerPrivate#::writeImagecxx . . $ QMngHandlerPrivate#writeImage(73afe20316494619).(const QImagecxx . . $ QImage# &image)
294 {
295 mng_reset(hMNGcxx . . $ QMngHandlerPrivate#hMNG.);
296 if (mng_create(hMNGcxx . . $ QMngHandlerPrivate#hMNG.) != MNG_NOERRORcxx . . $ `<external>/7372437134815882689/libmng.h:2400:9`!)
297 return false;
298
299 this->imagecxx . . $ QMngHandlerPrivate#image. =cxx . . $ QImage#`operator=`(e6308d6f8c10e1d2). image.convertToFormatcxx . . $ QImage#convertToFormat(2da09223ee5c8d93).(QImagecxx . . $ QImage#::Format_ARGB32cxx . . $ QImage#Format_ARGB32.);
300 int w = image.widthcxx . . $ QImage#width(455f465bc33b4cdf).();
301 int h = image.heightcxx . . $ QImage#height(455f465bc33b4cdf).();
302
303 if (
304 // width, height, ticks, layercount, framecount, playtime, simplicity
305 (mng_putchunk_mhdr(hMNGcxx . . $ QMngHandlerPrivate#hMNG., w, h, 1000, 0, 0, 0, 7) == MNG_NOERRORcxx . . $ `<external>/7372437134815882689/libmng.h:2400:9`!) &&
306 // termination_action, action_after_iterations, delay, iteration_max
307 (mng_putchunk_term(hMNGcxx . . $ QMngHandlerPrivate#hMNG., 3, 0, 1, 0x7FFFFFFF) == MNG_NOERRORcxx . . $ `<external>/7372437134815882689/libmng.h:2400:9`!) &&
308 // width, height, bitdepth, colortype, compression, filter, interlace
309 (mng_putchunk_ihdr(hMNGcxx . . $ QMngHandlerPrivate#hMNG., w, h, 8, 6, 0, 0, 0) == MNG_NOERRORcxx . . $ `<external>/7372437134815882689/libmng.h:2400:9`!) &&
310 // width, height, colortype, bitdepth, compression, filter, interlace, canvasstyle, getcanvasline
311 (mng_putimgdata_ihdr(hMNGcxx . . $ QMngHandlerPrivate#hMNG., w, h, 6, 8, 0, 0, 0, iStylecxx . . $ QMngHandlerPrivate#iStyle., mygetcanvaslinecxx . . $ mygetcanvasline(f829683bd01ccf96).) == MNG_NOERRORcxx . . $ `<external>/7372437134815882689/libmng.h:2400:9`!) &&
312 (mng_putchunk_iend(hMNGcxx . . $ QMngHandlerPrivate#hMNG.) == MNG_NOERRORcxx . . $ `<external>/7372437134815882689/libmng.h:2400:9`!) &&
313 (mng_putchunk_mend(hMNGcxx . . $ QMngHandlerPrivate#hMNG.) == MNG_NOERRORcxx . . $ `<external>/7372437134815882689/libmng.h:2400:9`!) &&
314 (mng_write(hMNGcxx . . $ QMngHandlerPrivate#hMNG.) == MNG_NOERRORcxx . . $ `<external>/7372437134815882689/libmng.h:2400:9`!)
315 )
316 return true;
317 return false;
318 }
319
320 int QMngHandlerPrivatecxx . . $ QMngHandlerPrivate#::currentImageNumbercxx . . $ QMngHandlerPrivate#currentImageNumber(455f465bc33b4cdf).() const
321 {
322 // return mng_get_currentframe(hMNG) % imageCount(); not implemented, apparently
323 return frameIndexcxx . . $ QMngHandlerPrivate#frameIndex.;
324 }
325
326 int QMngHandlerPrivatecxx . . $ QMngHandlerPrivate#::imageCountcxx . . $ QMngHandlerPrivate#imageCount(455f465bc33b4cdf).() const
327 {
328 // return mng_get_totalframes(hMNG); not implemented, apparently
329 if (haveReadAllcxx . . $ QMngHandlerPrivate#haveReadAll.)
330 return frameCountcxx . . $ QMngHandlerPrivate#frameCount.;
331 return 0; // Don't know
332 }
333
334 bool QMngHandlerPrivatecxx . . $ QMngHandlerPrivate#::jumpToImagecxx . . $ QMngHandlerPrivate#jumpToImage(83c267b20bac841a).(int imageNumber)
335 {
336 if (imageNumber == nextIndexcxx . . $ QMngHandlerPrivate#nextIndex.)
337 return true;
338
339 if ((imageNumber == 0) && haveReadAllcxx . . $ QMngHandlerPrivate#haveReadAll. && (nextIndexcxx . . $ QMngHandlerPrivate#nextIndex. == frameCountcxx . . $ QMngHandlerPrivate#frameCount.)) {
340 // Loop!
341 nextIndexcxx . . $ QMngHandlerPrivate#nextIndex. = 0;
342 return true;
343 }
344 if (mng_display_freeze(hMNGcxx . . $ QMngHandlerPrivate#hMNG.) == MNG_NOERRORcxx . . $ `<external>/7372437134815882689/libmng.h:2400:9`!) {
345 if (mng_display_goframe(hMNGcxx . . $ QMngHandlerPrivate#hMNG., imageNumber) == MNG_NOERRORcxx . . $ `<external>/7372437134815882689/libmng.h:2400:9`!) {
346 nextIndexcxx . . $ QMngHandlerPrivate#nextIndex. = imageNumber;
347 return true;
348 }
349 }
350 return false;
351 }
352
353 bool QMngHandlerPrivatecxx . . $ QMngHandlerPrivate#::jumpToNextImagecxx . . $ QMngHandlerPrivate#jumpToNextImage(c9857a73d68e59ba).()
354 {
355 const int numImages = imageCountcxx . . $ QMngHandlerPrivate#imageCount(455f465bc33b4cdf).();
356 return numImages > 1 && jumpToImagecxx . . $ QMngHandlerPrivate#jumpToImage(83c267b20bac841a).((currentImageNumbercxx . . $ QMngHandlerPrivate#currentImageNumber(455f465bc33b4cdf).() + 1) % numImages);
357 }
358
359 int QMngHandlerPrivatecxx . . $ QMngHandlerPrivate#::nextImageDelaycxx . . $ QMngHandlerPrivate#nextImageDelay(455f465bc33b4cdf).() const
360 {
361 return nextDelaycxx . . $ QMngHandlerPrivate#nextDelay.;
362 }
363
364 bool QMngHandlerPrivatecxx . . $ QMngHandlerPrivate#::setBackgroundColorcxx . . $ QMngHandlerPrivate#setBackgroundColor(bf1edffcd5557ab5).(const QColorcxx . . $ QColor# &color)
365 {
366 mng_uint16cxx . . $ mng_uint16# iRed = (mng_uint16cxx . . $ mng_uint16#)(color.redcxx . . $ QColor#red(ea6fe5115c70a13f).() << 8);
367 mng_uint16cxx . . $ mng_uint16# iBlue = (mng_uint16cxx . . $ mng_uint16#)(color.bluecxx . . $ QColor#blue(ea6fe5115c70a13f).() << 8);
368 mng_uint16cxx . . $ mng_uint16# iGreen = (mng_uint16cxx . . $ mng_uint16#)(color.greencxx . . $ QColor#green(ea6fe5115c70a13f).() << 8);
369 return (mng_set_bgcolor(hMNGcxx . . $ QMngHandlerPrivate#hMNG., iRed, iBlue, iGreen) == MNG_NOERRORcxx . . $ `<external>/7372437134815882689/libmng.h:2400:9`!);
370 }
371
372 QColorcxx . . $ QColor# QMngHandlerPrivatecxx . . $ QMngHandlerPrivate#::backgroundColorcxx . . $ QMngHandlerPrivate#backgroundColor(6d62b116d5d1b12f).() const
373 {
374 mng_uint16cxx . . $ mng_uint16# iRed;
375 mng_uint16cxx . . $ mng_uint16# iBlue;
376 mng_uint16cxx . . $ mng_uint16# iGreen;
377 if (mng_get_bgcolor(hMNGcxx . . $ QMngHandlerPrivate#hMNG., &iRed, &iBlue, &iGreen) == MNG_NOERRORcxx . . $ `<external>/7372437134815882689/libmng.h:2400:9`!)
378 return QColorcxx . . $ QColor#QColor(2261ffe5112eab06).((iRed >> 8) & 0xFF, (iGreen >> 8) & 0xFF, (iBlue >> 8) & 0xFF);
379 return QColorcxx . . $ QColor#QColor(ced63f7c635d850d).();
380 }
381
382 QMngHandlercxx . . $ QMngHandler#::QMngHandlercxx . . $ QMngHandler#QMngHandler(49f6e7a06ebc5aa8).()
383 : d_ptrcxx . . $ QMngHandler#d_ptr.(new QMngHandlerPrivatecxx . . $ QMngHandlerPrivate#QMngHandlerPrivate(7658cef341330e2c).(this))
384 {
385 }
386
387 QMngHandlercxx . . $ QMngHandler#::~cxx . . $ QMngHandler#`~QMngHandler`(ced63f7c635d850d).QMngHandlercxx . . $ QMngHandler#()
388 {
389 }
390
391 /*! \reimp */
392 bool QMngHandlercxx . . $ QMngHandler#::canReadcxx . . $ QMngHandler#canRead(50ce9a9e25b4a850).() const
393 {
394 Q_Dcxx . . $ `<external>/15045578679651060896/qglobal.h:1177:9`!(const QMngHandler);
395 if ((!d->haveReadNonecxx . . $ QMngHandlerPrivate#haveReadNone.
396 && (!d->haveReadAllcxx . . $ QMngHandlerPrivate#haveReadAll. || (d->haveReadAllcxx . . $ QMngHandlerPrivate#haveReadAll. && (d->nextIndexcxx . . $ QMngHandlerPrivate#nextIndex. < d->frameCountcxx . . $ QMngHandlerPrivate#frameCount.))))
397 || canReadcxx . . $ QMngHandler#canRead(33ee36428ee918e7).(devicecxx . . $ QImageIOHandler#device(84cdc49e7936af4f).()))
398 {
399 setFormatcxx . . $ QImageIOHandler#setFormat(7c8dc563d715d744).("mng"cxx . . $ QByteArray#QByteArray(34d26762b42c433a).);
400 return true;
401 }
402 return false;
403 }
404
405 /*! \internal */
406 bool QMngHandlercxx . . $ QMngHandler#::canReadcxx . . $ QMngHandler#canRead(33ee36428ee918e7).(QIODevicecxx . . $ QIODevice# *device)
407 {
408 if (!device) {
409 qWarningcxx . . $ `<external>/10450329605257866924/qlogging.h:166:9`!("QMngHandler::canRead() called with no device");
410 return false;
411 }
412
413 return device->peekcxx . . $ QIODevice#peek(1117a85f2fd4e5c8).(8) ==cxx . . $ `operator==`(968ef35b31345279). "\x8A\x4D\x4E\x47\x0D\x0A\x1A\x0A";
414 }
415
416 /*! \reimp */
417 bool QMngHandlercxx . . $ QMngHandler#::readcxx . . $ QMngHandler#read(5a6f164356166ee6).(QImagecxx . . $ QImage# *image)
418 {
419 Q_Dcxx . . $ `<external>/15045578679651060896/qglobal.h:1177:9`!(QMngHandler);
420 return canReadcxx . . $ QMngHandler#canRead(50ce9a9e25b4a850).() ? d->getNextImagecxx . . $ QMngHandlerPrivate#getNextImage(5a6f164356166ee6).(image) : false;
421 }
422
423 /*! \reimp */
424 bool QMngHandlercxx . . $ QMngHandler#::writecxx . . $ QMngHandler#write(73afe20316494619).(const QImagecxx . . $ QImage# &image)
425 {
426 Q_Dcxx . . $ `<external>/15045578679651060896/qglobal.h:1177:9`!(QMngHandler);
427 return d->writeImagecxx . . $ QMngHandlerPrivate#writeImage(73afe20316494619).(image);
428 }
429
430 /*! \reimp */
431 int QMngHandlercxx . . $ QMngHandler#::currentImageNumbercxx . . $ QMngHandler#currentImageNumber(455f465bc33b4cdf).() const
432 {
433 Q_Dcxx . . $ `<external>/15045578679651060896/qglobal.h:1177:9`!(const QMngHandler);
434 return d->currentImageNumbercxx . . $ QMngHandlerPrivate#currentImageNumber(455f465bc33b4cdf).();
435 }
436
437 /*! \reimp */
438 int QMngHandlercxx . . $ QMngHandler#::imageCountcxx . . $ QMngHandler#imageCount(455f465bc33b4cdf).() const
439 {
440 Q_Dcxx . . $ `<external>/15045578679651060896/qglobal.h:1177:9`!(const QMngHandler);
441 return d->imageCountcxx . . $ QMngHandlerPrivate#imageCount(455f465bc33b4cdf).();
442 }
443
444 /*! \reimp */
445 bool QMngHandlercxx . . $ QMngHandler#::jumpToImagecxx . . $ QMngHandler#jumpToImage(83c267b20bac841a).(int imageNumber)
446 {
447 Q_Dcxx . . $ `<external>/15045578679651060896/qglobal.h:1177:9`!(QMngHandler);
448 return d->jumpToImagecxx . . $ QMngHandlerPrivate#jumpToImage(83c267b20bac841a).(imageNumber);
449 }
450
451 /*! \reimp */
452 bool QMngHandlercxx . . $ QMngHandler#::jumpToNextImagecxx . . $ QMngHandler#jumpToNextImage(c9857a73d68e59ba).()
453 {
454 Q_Dcxx . . $ `<external>/15045578679651060896/qglobal.h:1177:9`!(QMngHandler);
455 return d->jumpToNextImagecxx . . $ QMngHandlerPrivate#jumpToNextImage(c9857a73d68e59ba).();
456 }
457
458 /*! \reimp */
459 int QMngHandlercxx . . $ QMngHandler#::loopCountcxx . . $ QMngHandler#loopCount(455f465bc33b4cdf).() const
460 {
461 Q_Dcxx . . $ `<external>/15045578679651060896/qglobal.h:1177:9`!(const QMngHandler);
462 if (d->iterCountcxx . . $ QMngHandlerPrivate#iterCount. == 0x7FFFFFFF)
463 return -1; // infinite loop
464 return d->iterCountcxx . . $ QMngHandlerPrivate#iterCount.-1;
465 }
466
467 /*! \reimp */
468 int QMngHandlercxx . . $ QMngHandler#::nextImageDelaycxx . . $ QMngHandler#nextImageDelay(455f465bc33b4cdf).() const
469 {
470 Q_Dcxx . . $ `<external>/15045578679651060896/qglobal.h:1177:9`!(const QMngHandler);
471 return d->nextImageDelaycxx . . $ QMngHandlerPrivate#nextImageDelay(455f465bc33b4cdf).();
472 }
473
474 /*! \reimp */
475 QVariantcxx . . $ QVariant# QMngHandlercxx . . $ QMngHandler#::optioncxx . . $ QMngHandler#option(5e4f138555277744).(ImageOptioncxx . . $ QImageIOHandler#ImageOption# option) const
476 {
477 Q_Dcxx . . $ `<external>/15045578679651060896/qglobal.h:1177:9`!(const QMngHandler);
478 if (option == QImageIOHandlercxx . . $ QImageIOHandler#::Animationcxx . . $ QImageIOHandler#Animation.)
479 return truecxx . . $ QVariant#QVariant(b45ddcbc8423892c).;
480 else if (option == QImageIOHandlercxx . . $ QImageIOHandler#::BackgroundColorcxx . . $ QImageIOHandler#BackgroundColor.)
481 return d->backgroundColorcxx . . $ QMngHandlerPrivate#backgroundColor(6d62b116d5d1b12f).();
482 return QVariantcxx . . $ QVariant#QVariant(ced63f7c635d850d).();
483 }
484
485 /*! \reimp */
486 void QMngHandlercxx . . $ QMngHandler#::setOptioncxx . . $ QMngHandler#setOption(eb42a208eb11d98f).(ImageOptioncxx . . $ QImageIOHandler#ImageOption# option, const QVariantcxx . . $ QVariant# & value)
487 {
488 Q_Dcxx . . $ `<external>/15045578679651060896/qglobal.h:1177:9`!(QMngHandler);
489 if (option == QImageIOHandlercxx . . $ QImageIOHandler#::BackgroundColorcxx . . $ QImageIOHandler#BackgroundColor.)
490 d->setBackgroundColorcxx . . $ QMngHandlerPrivate#setBackgroundColor(bf1edffcd5557ab5).(qvariant_castcxx . . $ qvariant_cast(c08a979ef106920f).<QColorcxx . . $ QColor#>(value));
491 }
492
493 /*! \reimp */
494 bool QMngHandlercxx . . $ QMngHandler#::supportsOptioncxx . . $ QMngHandler#supportsOption(55c593ff6d26ae20).(ImageOptioncxx . . $ QImageIOHandler#ImageOption# option) const
495 {
496 if (option == QImageIOHandlercxx . . $ QImageIOHandler#::Animationcxx . . $ QImageIOHandler#Animation.)
497 return true;
498 else if (option == QImageIOHandlercxx . . $ QImageIOHandler#::BackgroundColorcxx . . $ QImageIOHandler#BackgroundColor.)
499 return true;
500 return false;
501 }
502
503 QT_END_NAMESPACEcxx . . $ `<external>/15045578679651060896/qglobal.h:149:10`!