OpenCoverage

qxpmhandler.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/gui/image/qxpmhandler.cpp
Source codeSwitch to Preprocessed file
LineSourceCount
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 QtGui module of the Qt Toolkit.-
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 "private/qxpmhandler_p.h"-
41-
42#ifndef QT_NO_IMAGEFORMAT_XPM-
43-
44#include <private/qcolor_p.h>-
45#include <qimage.h>-
46#include <qmap.h>-
47#include <qtextstream.h>-
48#include <qvariant.h>-
49-
50#include <algorithm>-
51-
52QT_BEGIN_NAMESPACE-
53-
54static quint64 xpmHash(const QString &str)-
55{-
56 unsigned int hashValue = 0;-
57 for (int i = 0; i < str.size(); ++i) {
i < str.size()Description
TRUEnever evaluated
FALSEnever evaluated
0
58 hashValue <<= 8;-
59 hashValue += (unsigned int)str.at(i).unicode();-
60 }
never executed: end of block
0
61 return hashValue;
never executed: return hashValue;
0
62}-
63static quint64 xpmHash(char *str)-
64{-
65 unsigned int hashValue = 0;-
66 while (*str != '\0') {
*str != '\0'Description
TRUEnever evaluated
FALSEnever evaluated
0
67 hashValue <<= 8;-
68 hashValue += (unsigned int)*str;-
69 ++str;-
70 }
never executed: end of block
0
71 return hashValue;
never executed: return hashValue;
0
72}-
73-
74#ifdef QRGB-
75#undef QRGB-
76#endif-
77#define QRGB(r,g,b) (r*65536 + g*256 + b)-
78-
79static const int xpmRgbTblSize = 657;-
80-
81static const struct XPMRGBData {-
82 uint value;-
83 const char name[21];-
84} xpmRgbTbl[] = {-
85 { QRGB(240,248,255), "aliceblue" },-
86 { QRGB(250,235,215), "antiquewhite" },-
87 { QRGB(255,239,219), "antiquewhite1" },-
88 { QRGB(238,223,204), "antiquewhite2" },-
89 { QRGB(205,192,176), "antiquewhite3" },-
90 { QRGB(139,131,120), "antiquewhite4" },-
91 { QRGB(127,255,212), "aquamarine" },-
92 { QRGB(127,255,212), "aquamarine1" },-
93 { QRGB(118,238,198), "aquamarine2" },-
94 { QRGB(102,205,170), "aquamarine3" },-
95 { QRGB( 69,139,116), "aquamarine4" },-
96 { QRGB(240,255,255), "azure" },-
97 { QRGB(240,255,255), "azure1" },-
98 { QRGB(224,238,238), "azure2" },-
99 { QRGB(193,205,205), "azure3" },-
100 { QRGB(131,139,139), "azure4" },-
101 { QRGB(245,245,220), "beige" },-
102 { QRGB(255,228,196), "bisque" },-
103 { QRGB(255,228,196), "bisque1" },-
104 { QRGB(238,213,183), "bisque2" },-
105 { QRGB(205,183,158), "bisque3" },-
106 { QRGB(139,125,107), "bisque4" },-
107 { QRGB( 0, 0, 0), "black" },-
108 { QRGB(255,235,205), "blanchedalmond" },-
109 { QRGB( 0, 0,255), "blue" },-
110 { QRGB( 0, 0,255), "blue1" },-
111 { QRGB( 0, 0,238), "blue2" },-
112 { QRGB( 0, 0,205), "blue3" },-
113 { QRGB( 0, 0,139), "blue4" },-
114 { QRGB(138, 43,226), "blueviolet" },-
115 { QRGB(165, 42, 42), "brown" },-
116 { QRGB(255, 64, 64), "brown1" },-
117 { QRGB(238, 59, 59), "brown2" },-
118 { QRGB(205, 51, 51), "brown3" },-
119 { QRGB(139, 35, 35), "brown4" },-
120 { QRGB(222,184,135), "burlywood" },-
121 { QRGB(255,211,155), "burlywood1" },-
122 { QRGB(238,197,145), "burlywood2" },-
123 { QRGB(205,170,125), "burlywood3" },-
124 { QRGB(139,115, 85), "burlywood4" },-
125 { QRGB( 95,158,160), "cadetblue" },-
126 { QRGB(152,245,255), "cadetblue1" },-
127 { QRGB(142,229,238), "cadetblue2" },-
128 { QRGB(122,197,205), "cadetblue3" },-
129 { QRGB( 83,134,139), "cadetblue4" },-
130 { QRGB(127,255, 0), "chartreuse" },-
131 { QRGB(127,255, 0), "chartreuse1" },-
132 { QRGB(118,238, 0), "chartreuse2" },-
133 { QRGB(102,205, 0), "chartreuse3" },-
134 { QRGB( 69,139, 0), "chartreuse4" },-
135 { QRGB(210,105, 30), "chocolate" },-
136 { QRGB(255,127, 36), "chocolate1" },-
137 { QRGB(238,118, 33), "chocolate2" },-
138 { QRGB(205,102, 29), "chocolate3" },-
139 { QRGB(139, 69, 19), "chocolate4" },-
140 { QRGB(255,127, 80), "coral" },-
141 { QRGB(255,114, 86), "coral1" },-
142 { QRGB(238,106, 80), "coral2" },-
143 { QRGB(205, 91, 69), "coral3" },-
144 { QRGB(139, 62, 47), "coral4" },-
145 { QRGB(100,149,237), "cornflowerblue" },-
146 { QRGB(255,248,220), "cornsilk" },-
147 { QRGB(255,248,220), "cornsilk1" },-
148 { QRGB(238,232,205), "cornsilk2" },-
149 { QRGB(205,200,177), "cornsilk3" },-
150 { QRGB(139,136,120), "cornsilk4" },-
151 { QRGB( 0,255,255), "cyan" },-
152 { QRGB( 0,255,255), "cyan1" },-
153 { QRGB( 0,238,238), "cyan2" },-
154 { QRGB( 0,205,205), "cyan3" },-
155 { QRGB( 0,139,139), "cyan4" },-
156 { QRGB( 0, 0,139), "darkblue" },-
157 { QRGB( 0,139,139), "darkcyan" },-
158 { QRGB(184,134, 11), "darkgoldenrod" },-
159 { QRGB(255,185, 15), "darkgoldenrod1" },-
160 { QRGB(238,173, 14), "darkgoldenrod2" },-
161 { QRGB(205,149, 12), "darkgoldenrod3" },-
162 { QRGB(139,101, 8), "darkgoldenrod4" },-
163 { QRGB(169,169,169), "darkgray" },-
164 { QRGB( 0,100, 0), "darkgreen" },-
165 { QRGB(169,169,169), "darkgrey" },-
166 { QRGB(189,183,107), "darkkhaki" },-
167 { QRGB(139, 0,139), "darkmagenta" },-
168 { QRGB( 85,107, 47), "darkolivegreen" },-
169 { QRGB(202,255,112), "darkolivegreen1" },-
170 { QRGB(188,238,104), "darkolivegreen2" },-
171 { QRGB(162,205, 90), "darkolivegreen3" },-
172 { QRGB(110,139, 61), "darkolivegreen4" },-
173 { QRGB(255,140, 0), "darkorange" },-
174 { QRGB(255,127, 0), "darkorange1" },-
175 { QRGB(238,118, 0), "darkorange2" },-
176 { QRGB(205,102, 0), "darkorange3" },-
177 { QRGB(139, 69, 0), "darkorange4" },-
178 { QRGB(153, 50,204), "darkorchid" },-
179 { QRGB(191, 62,255), "darkorchid1" },-
180 { QRGB(178, 58,238), "darkorchid2" },-
181 { QRGB(154, 50,205), "darkorchid3" },-
182 { QRGB(104, 34,139), "darkorchid4" },-
183 { QRGB(139, 0, 0), "darkred" },-
184 { QRGB(233,150,122), "darksalmon" },-
185 { QRGB(143,188,143), "darkseagreen" },-
186 { QRGB(193,255,193), "darkseagreen1" },-
187 { QRGB(180,238,180), "darkseagreen2" },-
188 { QRGB(155,205,155), "darkseagreen3" },-
189 { QRGB(105,139,105), "darkseagreen4" },-
190 { QRGB( 72, 61,139), "darkslateblue" },-
191 { QRGB( 47, 79, 79), "darkslategray" },-
192 { QRGB(151,255,255), "darkslategray1" },-
193 { QRGB(141,238,238), "darkslategray2" },-
194 { QRGB(121,205,205), "darkslategray3" },-
195 { QRGB( 82,139,139), "darkslategray4" },-
196 { QRGB( 47, 79, 79), "darkslategrey" },-
197 { QRGB( 0,206,209), "darkturquoise" },-
198 { QRGB(148, 0,211), "darkviolet" },-
199 { QRGB(255, 20,147), "deeppink" },-
200 { QRGB(255, 20,147), "deeppink1" },-
201 { QRGB(238, 18,137), "deeppink2" },-
202 { QRGB(205, 16,118), "deeppink3" },-
203 { QRGB(139, 10, 80), "deeppink4" },-
204 { QRGB( 0,191,255), "deepskyblue" },-
205 { QRGB( 0,191,255), "deepskyblue1" },-
206 { QRGB( 0,178,238), "deepskyblue2" },-
207 { QRGB( 0,154,205), "deepskyblue3" },-
208 { QRGB( 0,104,139), "deepskyblue4" },-
209 { QRGB(105,105,105), "dimgray" },-
210 { QRGB(105,105,105), "dimgrey" },-
211 { QRGB( 30,144,255), "dodgerblue" },-
212 { QRGB( 30,144,255), "dodgerblue1" },-
213 { QRGB( 28,134,238), "dodgerblue2" },-
214 { QRGB( 24,116,205), "dodgerblue3" },-
215 { QRGB( 16, 78,139), "dodgerblue4" },-
216 { QRGB(178, 34, 34), "firebrick" },-
217 { QRGB(255, 48, 48), "firebrick1" },-
218 { QRGB(238, 44, 44), "firebrick2" },-
219 { QRGB(205, 38, 38), "firebrick3" },-
220 { QRGB(139, 26, 26), "firebrick4" },-
221 { QRGB(255,250,240), "floralwhite" },-
222 { QRGB( 34,139, 34), "forestgreen" },-
223 { QRGB(220,220,220), "gainsboro" },-
224 { QRGB(248,248,255), "ghostwhite" },-
225 { QRGB(255,215, 0), "gold" },-
226 { QRGB(255,215, 0), "gold1" },-
227 { QRGB(238,201, 0), "gold2" },-
228 { QRGB(205,173, 0), "gold3" },-
229 { QRGB(139,117, 0), "gold4" },-
230 { QRGB(218,165, 32), "goldenrod" },-
231 { QRGB(255,193, 37), "goldenrod1" },-
232 { QRGB(238,180, 34), "goldenrod2" },-
233 { QRGB(205,155, 29), "goldenrod3" },-
234 { QRGB(139,105, 20), "goldenrod4" },-
235 { QRGB(190,190,190), "gray" },-
236 { QRGB( 0, 0, 0), "gray0" },-
237 { QRGB( 3, 3, 3), "gray1" },-
238 { QRGB( 26, 26, 26), "gray10" },-
239 { QRGB(255,255,255), "gray100" },-
240 { QRGB( 28, 28, 28), "gray11" },-
241 { QRGB( 31, 31, 31), "gray12" },-
242 { QRGB( 33, 33, 33), "gray13" },-
243 { QRGB( 36, 36, 36), "gray14" },-
244 { QRGB( 38, 38, 38), "gray15" },-
245 { QRGB( 41, 41, 41), "gray16" },-
246 { QRGB( 43, 43, 43), "gray17" },-
247 { QRGB( 46, 46, 46), "gray18" },-
248 { QRGB( 48, 48, 48), "gray19" },-
249 { QRGB( 5, 5, 5), "gray2" },-
250 { QRGB( 51, 51, 51), "gray20" },-
251 { QRGB( 54, 54, 54), "gray21" },-
252 { QRGB( 56, 56, 56), "gray22" },-
253 { QRGB( 59, 59, 59), "gray23" },-
254 { QRGB( 61, 61, 61), "gray24" },-
255 { QRGB( 64, 64, 64), "gray25" },-
256 { QRGB( 66, 66, 66), "gray26" },-
257 { QRGB( 69, 69, 69), "gray27" },-
258 { QRGB( 71, 71, 71), "gray28" },-
259 { QRGB( 74, 74, 74), "gray29" },-
260 { QRGB( 8, 8, 8), "gray3" },-
261 { QRGB( 77, 77, 77), "gray30" },-
262 { QRGB( 79, 79, 79), "gray31" },-
263 { QRGB( 82, 82, 82), "gray32" },-
264 { QRGB( 84, 84, 84), "gray33" },-
265 { QRGB( 87, 87, 87), "gray34" },-
266 { QRGB( 89, 89, 89), "gray35" },-
267 { QRGB( 92, 92, 92), "gray36" },-
268 { QRGB( 94, 94, 94), "gray37" },-
269 { QRGB( 97, 97, 97), "gray38" },-
270 { QRGB( 99, 99, 99), "gray39" },-
271 { QRGB( 10, 10, 10), "gray4" },-
272 { QRGB(102,102,102), "gray40" },-
273 { QRGB(105,105,105), "gray41" },-
274 { QRGB(107,107,107), "gray42" },-
275 { QRGB(110,110,110), "gray43" },-
276 { QRGB(112,112,112), "gray44" },-
277 { QRGB(115,115,115), "gray45" },-
278 { QRGB(117,117,117), "gray46" },-
279 { QRGB(120,120,120), "gray47" },-
280 { QRGB(122,122,122), "gray48" },-
281 { QRGB(125,125,125), "gray49" },-
282 { QRGB( 13, 13, 13), "gray5" },-
283 { QRGB(127,127,127), "gray50" },-
284 { QRGB(130,130,130), "gray51" },-
285 { QRGB(133,133,133), "gray52" },-
286 { QRGB(135,135,135), "gray53" },-
287 { QRGB(138,138,138), "gray54" },-
288 { QRGB(140,140,140), "gray55" },-
289 { QRGB(143,143,143), "gray56" },-
290 { QRGB(145,145,145), "gray57" },-
291 { QRGB(148,148,148), "gray58" },-
292 { QRGB(150,150,150), "gray59" },-
293 { QRGB( 15, 15, 15), "gray6" },-
294 { QRGB(153,153,153), "gray60" },-
295 { QRGB(156,156,156), "gray61" },-
296 { QRGB(158,158,158), "gray62" },-
297 { QRGB(161,161,161), "gray63" },-
298 { QRGB(163,163,163), "gray64" },-
299 { QRGB(166,166,166), "gray65" },-
300 { QRGB(168,168,168), "gray66" },-
301 { QRGB(171,171,171), "gray67" },-
302 { QRGB(173,173,173), "gray68" },-
303 { QRGB(176,176,176), "gray69" },-
304 { QRGB( 18, 18, 18), "gray7" },-
305 { QRGB(179,179,179), "gray70" },-
306 { QRGB(181,181,181), "gray71" },-
307 { QRGB(184,184,184), "gray72" },-
308 { QRGB(186,186,186), "gray73" },-
309 { QRGB(189,189,189), "gray74" },-
310 { QRGB(191,191,191), "gray75" },-
311 { QRGB(194,194,194), "gray76" },-
312 { QRGB(196,196,196), "gray77" },-
313 { QRGB(199,199,199), "gray78" },-
314 { QRGB(201,201,201), "gray79" },-
315 { QRGB( 20, 20, 20), "gray8" },-
316 { QRGB(204,204,204), "gray80" },-
317 { QRGB(207,207,207), "gray81" },-
318 { QRGB(209,209,209), "gray82" },-
319 { QRGB(212,212,212), "gray83" },-
320 { QRGB(214,214,214), "gray84" },-
321 { QRGB(217,217,217), "gray85" },-
322 { QRGB(219,219,219), "gray86" },-
323 { QRGB(222,222,222), "gray87" },-
324 { QRGB(224,224,224), "gray88" },-
325 { QRGB(227,227,227), "gray89" },-
326 { QRGB( 23, 23, 23), "gray9" },-
327 { QRGB(229,229,229), "gray90" },-
328 { QRGB(232,232,232), "gray91" },-
329 { QRGB(235,235,235), "gray92" },-
330 { QRGB(237,237,237), "gray93" },-
331 { QRGB(240,240,240), "gray94" },-
332 { QRGB(242,242,242), "gray95" },-
333 { QRGB(245,245,245), "gray96" },-
334 { QRGB(247,247,247), "gray97" },-
335 { QRGB(250,250,250), "gray98" },-
336 { QRGB(252,252,252), "gray99" },-
337 { QRGB( 0,255, 0), "green" },-
338 { QRGB( 0,255, 0), "green1" },-
339 { QRGB( 0,238, 0), "green2" },-
340 { QRGB( 0,205, 0), "green3" },-
341 { QRGB( 0,139, 0), "green4" },-
342 { QRGB(173,255, 47), "greenyellow" },-
343 { QRGB(190,190,190), "grey" },-
344 { QRGB( 0, 0, 0), "grey0" },-
345 { QRGB( 3, 3, 3), "grey1" },-
346 { QRGB( 26, 26, 26), "grey10" },-
347 { QRGB(255,255,255), "grey100" },-
348 { QRGB( 28, 28, 28), "grey11" },-
349 { QRGB( 31, 31, 31), "grey12" },-
350 { QRGB( 33, 33, 33), "grey13" },-
351 { QRGB( 36, 36, 36), "grey14" },-
352 { QRGB( 38, 38, 38), "grey15" },-
353 { QRGB( 41, 41, 41), "grey16" },-
354 { QRGB( 43, 43, 43), "grey17" },-
355 { QRGB( 46, 46, 46), "grey18" },-
356 { QRGB( 48, 48, 48), "grey19" },-
357 { QRGB( 5, 5, 5), "grey2" },-
358 { QRGB( 51, 51, 51), "grey20" },-
359 { QRGB( 54, 54, 54), "grey21" },-
360 { QRGB( 56, 56, 56), "grey22" },-
361 { QRGB( 59, 59, 59), "grey23" },-
362 { QRGB( 61, 61, 61), "grey24" },-
363 { QRGB( 64, 64, 64), "grey25" },-
364 { QRGB( 66, 66, 66), "grey26" },-
365 { QRGB( 69, 69, 69), "grey27" },-
366 { QRGB( 71, 71, 71), "grey28" },-
367 { QRGB( 74, 74, 74), "grey29" },-
368 { QRGB( 8, 8, 8), "grey3" },-
369 { QRGB( 77, 77, 77), "grey30" },-
370 { QRGB( 79, 79, 79), "grey31" },-
371 { QRGB( 82, 82, 82), "grey32" },-
372 { QRGB( 84, 84, 84), "grey33" },-
373 { QRGB( 87, 87, 87), "grey34" },-
374 { QRGB( 89, 89, 89), "grey35" },-
375 { QRGB( 92, 92, 92), "grey36" },-
376 { QRGB( 94, 94, 94), "grey37" },-
377 { QRGB( 97, 97, 97), "grey38" },-
378 { QRGB( 99, 99, 99), "grey39" },-
379 { QRGB( 10, 10, 10), "grey4" },-
380 { QRGB(102,102,102), "grey40" },-
381 { QRGB(105,105,105), "grey41" },-
382 { QRGB(107,107,107), "grey42" },-
383 { QRGB(110,110,110), "grey43" },-
384 { QRGB(112,112,112), "grey44" },-
385 { QRGB(115,115,115), "grey45" },-
386 { QRGB(117,117,117), "grey46" },-
387 { QRGB(120,120,120), "grey47" },-
388 { QRGB(122,122,122), "grey48" },-
389 { QRGB(125,125,125), "grey49" },-
390 { QRGB( 13, 13, 13), "grey5" },-
391 { QRGB(127,127,127), "grey50" },-
392 { QRGB(130,130,130), "grey51" },-
393 { QRGB(133,133,133), "grey52" },-
394 { QRGB(135,135,135), "grey53" },-
395 { QRGB(138,138,138), "grey54" },-
396 { QRGB(140,140,140), "grey55" },-
397 { QRGB(143,143,143), "grey56" },-
398 { QRGB(145,145,145), "grey57" },-
399 { QRGB(148,148,148), "grey58" },-
400 { QRGB(150,150,150), "grey59" },-
401 { QRGB( 15, 15, 15), "grey6" },-
402 { QRGB(153,153,153), "grey60" },-
403 { QRGB(156,156,156), "grey61" },-
404 { QRGB(158,158,158), "grey62" },-
405 { QRGB(161,161,161), "grey63" },-
406 { QRGB(163,163,163), "grey64" },-
407 { QRGB(166,166,166), "grey65" },-
408 { QRGB(168,168,168), "grey66" },-
409 { QRGB(171,171,171), "grey67" },-
410 { QRGB(173,173,173), "grey68" },-
411 { QRGB(176,176,176), "grey69" },-
412 { QRGB( 18, 18, 18), "grey7" },-
413 { QRGB(179,179,179), "grey70" },-
414 { QRGB(181,181,181), "grey71" },-
415 { QRGB(184,184,184), "grey72" },-
416 { QRGB(186,186,186), "grey73" },-
417 { QRGB(189,189,189), "grey74" },-
418 { QRGB(191,191,191), "grey75" },-
419 { QRGB(194,194,194), "grey76" },-
420 { QRGB(196,196,196), "grey77" },-
421 { QRGB(199,199,199), "grey78" },-
422 { QRGB(201,201,201), "grey79" },-
423 { QRGB( 20, 20, 20), "grey8" },-
424 { QRGB(204,204,204), "grey80" },-
425 { QRGB(207,207,207), "grey81" },-
426 { QRGB(209,209,209), "grey82" },-
427 { QRGB(212,212,212), "grey83" },-
428 { QRGB(214,214,214), "grey84" },-
429 { QRGB(217,217,217), "grey85" },-
430 { QRGB(219,219,219), "grey86" },-
431 { QRGB(222,222,222), "grey87" },-
432 { QRGB(224,224,224), "grey88" },-
433 { QRGB(227,227,227), "grey89" },-
434 { QRGB( 23, 23, 23), "grey9" },-
435 { QRGB(229,229,229), "grey90" },-
436 { QRGB(232,232,232), "grey91" },-
437 { QRGB(235,235,235), "grey92" },-
438 { QRGB(237,237,237), "grey93" },-
439 { QRGB(240,240,240), "grey94" },-
440 { QRGB(242,242,242), "grey95" },-
441 { QRGB(245,245,245), "grey96" },-
442 { QRGB(247,247,247), "grey97" },-
443 { QRGB(250,250,250), "grey98" },-
444 { QRGB(252,252,252), "grey99" },-
445 { QRGB(240,255,240), "honeydew" },-
446 { QRGB(240,255,240), "honeydew1" },-
447 { QRGB(224,238,224), "honeydew2" },-
448 { QRGB(193,205,193), "honeydew3" },-
449 { QRGB(131,139,131), "honeydew4" },-
450 { QRGB(255,105,180), "hotpink" },-
451 { QRGB(255,110,180), "hotpink1" },-
452 { QRGB(238,106,167), "hotpink2" },-
453 { QRGB(205, 96,144), "hotpink3" },-
454 { QRGB(139, 58, 98), "hotpink4" },-
455 { QRGB(205, 92, 92), "indianred" },-
456 { QRGB(255,106,106), "indianred1" },-
457 { QRGB(238, 99, 99), "indianred2" },-
458 { QRGB(205, 85, 85), "indianred3" },-
459 { QRGB(139, 58, 58), "indianred4" },-
460 { QRGB(255,255,240), "ivory" },-
461 { QRGB(255,255,240), "ivory1" },-
462 { QRGB(238,238,224), "ivory2" },-
463 { QRGB(205,205,193), "ivory3" },-
464 { QRGB(139,139,131), "ivory4" },-
465 { QRGB(240,230,140), "khaki" },-
466 { QRGB(255,246,143), "khaki1" },-
467 { QRGB(238,230,133), "khaki2" },-
468 { QRGB(205,198,115), "khaki3" },-
469 { QRGB(139,134, 78), "khaki4" },-
470 { QRGB(230,230,250), "lavender" },-
471 { QRGB(255,240,245), "lavenderblush" },-
472 { QRGB(255,240,245), "lavenderblush1" },-
473 { QRGB(238,224,229), "lavenderblush2" },-
474 { QRGB(205,193,197), "lavenderblush3" },-
475 { QRGB(139,131,134), "lavenderblush4" },-
476 { QRGB(124,252, 0), "lawngreen" },-
477 { QRGB(255,250,205), "lemonchiffon" },-
478 { QRGB(255,250,205), "lemonchiffon1" },-
479 { QRGB(238,233,191), "lemonchiffon2" },-
480 { QRGB(205,201,165), "lemonchiffon3" },-
481 { QRGB(139,137,112), "lemonchiffon4" },-
482 { QRGB(173,216,230), "lightblue" },-
483 { QRGB(191,239,255), "lightblue1" },-
484 { QRGB(178,223,238), "lightblue2" },-
485 { QRGB(154,192,205), "lightblue3" },-
486 { QRGB(104,131,139), "lightblue4" },-
487 { QRGB(240,128,128), "lightcoral" },-
488 { QRGB(224,255,255), "lightcyan" },-
489 { QRGB(224,255,255), "lightcyan1" },-
490 { QRGB(209,238,238), "lightcyan2" },-
491 { QRGB(180,205,205), "lightcyan3" },-
492 { QRGB(122,139,139), "lightcyan4" },-
493 { QRGB(238,221,130), "lightgoldenrod" },-
494 { QRGB(255,236,139), "lightgoldenrod1" },-
495 { QRGB(238,220,130), "lightgoldenrod2" },-
496 { QRGB(205,190,112), "lightgoldenrod3" },-
497 { QRGB(139,129, 76), "lightgoldenrod4" },-
498 { QRGB(250,250,210), "lightgoldenrodyellow" },-
499 { QRGB(211,211,211), "lightgray" },-
500 { QRGB(144,238,144), "lightgreen" },-
501 { QRGB(211,211,211), "lightgrey" },-
502 { QRGB(255,182,193), "lightpink" },-
503 { QRGB(255,174,185), "lightpink1" },-
504 { QRGB(238,162,173), "lightpink2" },-
505 { QRGB(205,140,149), "lightpink3" },-
506 { QRGB(139, 95,101), "lightpink4" },-
507 { QRGB(255,160,122), "lightsalmon" },-
508 { QRGB(255,160,122), "lightsalmon1" },-
509 { QRGB(238,149,114), "lightsalmon2" },-
510 { QRGB(205,129, 98), "lightsalmon3" },-
511 { QRGB(139, 87, 66), "lightsalmon4" },-
512 { QRGB( 32,178,170), "lightseagreen" },-
513 { QRGB(135,206,250), "lightskyblue" },-
514 { QRGB(176,226,255), "lightskyblue1" },-
515 { QRGB(164,211,238), "lightskyblue2" },-
516 { QRGB(141,182,205), "lightskyblue3" },-
517 { QRGB( 96,123,139), "lightskyblue4" },-
518 { QRGB(132,112,255), "lightslateblue" },-
519 { QRGB(119,136,153), "lightslategray" },-
520 { QRGB(119,136,153), "lightslategrey" },-
521 { QRGB(176,196,222), "lightsteelblue" },-
522 { QRGB(202,225,255), "lightsteelblue1" },-
523 { QRGB(188,210,238), "lightsteelblue2" },-
524 { QRGB(162,181,205), "lightsteelblue3" },-
525 { QRGB(110,123,139), "lightsteelblue4" },-
526 { QRGB(255,255,224), "lightyellow" },-
527 { QRGB(255,255,224), "lightyellow1" },-
528 { QRGB(238,238,209), "lightyellow2" },-
529 { QRGB(205,205,180), "lightyellow3" },-
530 { QRGB(139,139,122), "lightyellow4" },-
531 { QRGB( 50,205, 50), "limegreen" },-
532 { QRGB(250,240,230), "linen" },-
533 { QRGB(255, 0,255), "magenta" },-
534 { QRGB(255, 0,255), "magenta1" },-
535 { QRGB(238, 0,238), "magenta2" },-
536 { QRGB(205, 0,205), "magenta3" },-
537 { QRGB(139, 0,139), "magenta4" },-
538 { QRGB(176, 48, 96), "maroon" },-
539 { QRGB(255, 52,179), "maroon1" },-
540 { QRGB(238, 48,167), "maroon2" },-
541 { QRGB(205, 41,144), "maroon3" },-
542 { QRGB(139, 28, 98), "maroon4" },-
543 { QRGB(102,205,170), "mediumaquamarine" },-
544 { QRGB( 0, 0,205), "mediumblue" },-
545 { QRGB(186, 85,211), "mediumorchid" },-
546 { QRGB(224,102,255), "mediumorchid1" },-
547 { QRGB(209, 95,238), "mediumorchid2" },-
548 { QRGB(180, 82,205), "mediumorchid3" },-
549 { QRGB(122, 55,139), "mediumorchid4" },-
550 { QRGB(147,112,219), "mediumpurple" },-
551 { QRGB(171,130,255), "mediumpurple1" },-
552 { QRGB(159,121,238), "mediumpurple2" },-
553 { QRGB(137,104,205), "mediumpurple3" },-
554 { QRGB( 93, 71,139), "mediumpurple4" },-
555 { QRGB( 60,179,113), "mediumseagreen" },-
556 { QRGB(123,104,238), "mediumslateblue" },-
557 { QRGB( 0,250,154), "mediumspringgreen" },-
558 { QRGB( 72,209,204), "mediumturquoise" },-
559 { QRGB(199, 21,133), "mediumvioletred" },-
560 { QRGB( 25, 25,112), "midnightblue" },-
561 { QRGB(245,255,250), "mintcream" },-
562 { QRGB(255,228,225), "mistyrose" },-
563 { QRGB(255,228,225), "mistyrose1" },-
564 { QRGB(238,213,210), "mistyrose2" },-
565 { QRGB(205,183,181), "mistyrose3" },-
566 { QRGB(139,125,123), "mistyrose4" },-
567 { QRGB(255,228,181), "moccasin" },-
568 { QRGB(255,222,173), "navajowhite" },-
569 { QRGB(255,222,173), "navajowhite1" },-
570 { QRGB(238,207,161), "navajowhite2" },-
571 { QRGB(205,179,139), "navajowhite3" },-
572 { QRGB(139,121, 94), "navajowhite4" },-
573 { QRGB( 0, 0,128), "navy" },-
574 { QRGB( 0, 0,128), "navyblue" },-
575 { QRGB(253,245,230), "oldlace" },-
576 { QRGB(107,142, 35), "olivedrab" },-
577 { QRGB(192,255, 62), "olivedrab1" },-
578 { QRGB(179,238, 58), "olivedrab2" },-
579 { QRGB(154,205, 50), "olivedrab3" },-
580 { QRGB(105,139, 34), "olivedrab4" },-
581 { QRGB(255,165, 0), "orange" },-
582 { QRGB(255,165, 0), "orange1" },-
583 { QRGB(238,154, 0), "orange2" },-
584 { QRGB(205,133, 0), "orange3" },-
585 { QRGB(139, 90, 0), "orange4" },-
586 { QRGB(255, 69, 0), "orangered" },-
587 { QRGB(255, 69, 0), "orangered1" },-
588 { QRGB(238, 64, 0), "orangered2" },-
589 { QRGB(205, 55, 0), "orangered3" },-
590 { QRGB(139, 37, 0), "orangered4" },-
591 { QRGB(218,112,214), "orchid" },-
592 { QRGB(255,131,250), "orchid1" },-
593 { QRGB(238,122,233), "orchid2" },-
594 { QRGB(205,105,201), "orchid3" },-
595 { QRGB(139, 71,137), "orchid4" },-
596 { QRGB(238,232,170), "palegoldenrod" },-
597 { QRGB(152,251,152), "palegreen" },-
598 { QRGB(154,255,154), "palegreen1" },-
599 { QRGB(144,238,144), "palegreen2" },-
600 { QRGB(124,205,124), "palegreen3" },-
601 { QRGB( 84,139, 84), "palegreen4" },-
602 { QRGB(175,238,238), "paleturquoise" },-
603 { QRGB(187,255,255), "paleturquoise1" },-
604 { QRGB(174,238,238), "paleturquoise2" },-
605 { QRGB(150,205,205), "paleturquoise3" },-
606 { QRGB(102,139,139), "paleturquoise4" },-
607 { QRGB(219,112,147), "palevioletred" },-
608 { QRGB(255,130,171), "palevioletred1" },-
609 { QRGB(238,121,159), "palevioletred2" },-
610 { QRGB(205,104,137), "palevioletred3" },-
611 { QRGB(139, 71, 93), "palevioletred4" },-
612 { QRGB(255,239,213), "papayawhip" },-
613 { QRGB(255,218,185), "peachpuff" },-
614 { QRGB(255,218,185), "peachpuff1" },-
615 { QRGB(238,203,173), "peachpuff2" },-
616 { QRGB(205,175,149), "peachpuff3" },-
617 { QRGB(139,119,101), "peachpuff4" },-
618 { QRGB(205,133, 63), "peru" },-
619 { QRGB(255,192,203), "pink" },-
620 { QRGB(255,181,197), "pink1" },-
621 { QRGB(238,169,184), "pink2" },-
622 { QRGB(205,145,158), "pink3" },-
623 { QRGB(139, 99,108), "pink4" },-
624 { QRGB(221,160,221), "plum" },-
625 { QRGB(255,187,255), "plum1" },-
626 { QRGB(238,174,238), "plum2" },-
627 { QRGB(205,150,205), "plum3" },-
628 { QRGB(139,102,139), "plum4" },-
629 { QRGB(176,224,230), "powderblue" },-
630 { QRGB(160, 32,240), "purple" },-
631 { QRGB(155, 48,255), "purple1" },-
632 { QRGB(145, 44,238), "purple2" },-
633 { QRGB(125, 38,205), "purple3" },-
634 { QRGB( 85, 26,139), "purple4" },-
635 { QRGB(255, 0, 0), "red" },-
636 { QRGB(255, 0, 0), "red1" },-
637 { QRGB(238, 0, 0), "red2" },-
638 { QRGB(205, 0, 0), "red3" },-
639 { QRGB(139, 0, 0), "red4" },-
640 { QRGB(188,143,143), "rosybrown" },-
641 { QRGB(255,193,193), "rosybrown1" },-
642 { QRGB(238,180,180), "rosybrown2" },-
643 { QRGB(205,155,155), "rosybrown3" },-
644 { QRGB(139,105,105), "rosybrown4" },-
645 { QRGB( 65,105,225), "royalblue" },-
646 { QRGB( 72,118,255), "royalblue1" },-
647 { QRGB( 67,110,238), "royalblue2" },-
648 { QRGB( 58, 95,205), "royalblue3" },-
649 { QRGB( 39, 64,139), "royalblue4" },-
650 { QRGB(139, 69, 19), "saddlebrown" },-
651 { QRGB(250,128,114), "salmon" },-
652 { QRGB(255,140,105), "salmon1" },-
653 { QRGB(238,130, 98), "salmon2" },-
654 { QRGB(205,112, 84), "salmon3" },-
655 { QRGB(139, 76, 57), "salmon4" },-
656 { QRGB(244,164, 96), "sandybrown" },-
657 { QRGB( 46,139, 87), "seagreen" },-
658 { QRGB( 84,255,159), "seagreen1" },-
659 { QRGB( 78,238,148), "seagreen2" },-
660 { QRGB( 67,205,128), "seagreen3" },-
661 { QRGB( 46,139, 87), "seagreen4" },-
662 { QRGB(255,245,238), "seashell" },-
663 { QRGB(255,245,238), "seashell1" },-
664 { QRGB(238,229,222), "seashell2" },-
665 { QRGB(205,197,191), "seashell3" },-
666 { QRGB(139,134,130), "seashell4" },-
667 { QRGB(160, 82, 45), "sienna" },-
668 { QRGB(255,130, 71), "sienna1" },-
669 { QRGB(238,121, 66), "sienna2" },-
670 { QRGB(205,104, 57), "sienna3" },-
671 { QRGB(139, 71, 38), "sienna4" },-
672 { QRGB(135,206,235), "skyblue" },-
673 { QRGB(135,206,255), "skyblue1" },-
674 { QRGB(126,192,238), "skyblue2" },-
675 { QRGB(108,166,205), "skyblue3" },-
676 { QRGB( 74,112,139), "skyblue4" },-
677 { QRGB(106, 90,205), "slateblue" },-
678 { QRGB(131,111,255), "slateblue1" },-
679 { QRGB(122,103,238), "slateblue2" },-
680 { QRGB(105, 89,205), "slateblue3" },-
681 { QRGB( 71, 60,139), "slateblue4" },-
682 { QRGB(112,128,144), "slategray" },-
683 { QRGB(198,226,255), "slategray1" },-
684 { QRGB(185,211,238), "slategray2" },-
685 { QRGB(159,182,205), "slategray3" },-
686 { QRGB(108,123,139), "slategray4" },-
687 { QRGB(112,128,144), "slategrey" },-
688 { QRGB(255,250,250), "snow" },-
689 { QRGB(255,250,250), "snow1" },-
690 { QRGB(238,233,233), "snow2" },-
691 { QRGB(205,201,201), "snow3" },-
692 { QRGB(139,137,137), "snow4" },-
693 { QRGB( 0,255,127), "springgreen" },-
694 { QRGB( 0,255,127), "springgreen1" },-
695 { QRGB( 0,238,118), "springgreen2" },-
696 { QRGB( 0,205,102), "springgreen3" },-
697 { QRGB( 0,139, 69), "springgreen4" },-
698 { QRGB( 70,130,180), "steelblue" },-
699 { QRGB( 99,184,255), "steelblue1" },-
700 { QRGB( 92,172,238), "steelblue2" },-
701 { QRGB( 79,148,205), "steelblue3" },-
702 { QRGB( 54,100,139), "steelblue4" },-
703 { QRGB(210,180,140), "tan" },-
704 { QRGB(255,165, 79), "tan1" },-
705 { QRGB(238,154, 73), "tan2" },-
706 { QRGB(205,133, 63), "tan3" },-
707 { QRGB(139, 90, 43), "tan4" },-
708 { QRGB(216,191,216), "thistle" },-
709 { QRGB(255,225,255), "thistle1" },-
710 { QRGB(238,210,238), "thistle2" },-
711 { QRGB(205,181,205), "thistle3" },-
712 { QRGB(139,123,139), "thistle4" },-
713 { QRGB(255, 99, 71), "tomato" },-
714 { QRGB(255, 99, 71), "tomato1" },-
715 { QRGB(238, 92, 66), "tomato2" },-
716 { QRGB(205, 79, 57), "tomato3" },-
717 { QRGB(139, 54, 38), "tomato4" },-
718 { QRGB( 64,224,208), "turquoise" },-
719 { QRGB( 0,245,255), "turquoise1" },-
720 { QRGB( 0,229,238), "turquoise2" },-
721 { QRGB( 0,197,205), "turquoise3" },-
722 { QRGB( 0,134,139), "turquoise4" },-
723 { QRGB(238,130,238), "violet" },-
724 { QRGB(208, 32,144), "violetred" },-
725 { QRGB(255, 62,150), "violetred1" },-
726 { QRGB(238, 58,140), "violetred2" },-
727 { QRGB(205, 50,120), "violetred3" },-
728 { QRGB(139, 34, 82), "violetred4" },-
729 { QRGB(245,222,179), "wheat" },-
730 { QRGB(255,231,186), "wheat1" },-
731 { QRGB(238,216,174), "wheat2" },-
732 { QRGB(205,186,150), "wheat3" },-
733 { QRGB(139,126,102), "wheat4" },-
734 { QRGB(255,255,255), "white" },-
735 { QRGB(245,245,245), "whitesmoke" },-
736 { QRGB(255,255, 0), "yellow" },-
737 { QRGB(255,255, 0), "yellow1" },-
738 { QRGB(238,238, 0), "yellow2" },-
739 { QRGB(205,205, 0), "yellow3" },-
740 { QRGB(139,139, 0), "yellow4" },-
741 { QRGB(154,205, 50), "yellowgreen" } };-
742-
743#if defined(Q_CC_MSVC) && _MSC_VER < 1600-
744inline bool operator<(const XPMRGBData &data1, const XPMRGBData &data2)-
745{ return qstrcmp(data1.name, data2.name) < 0; }-
746#endif-
747-
748inline bool operator<(const char *name, const XPMRGBData &data)-
749{
never executed: return qstrcmp(name, data.name) < 0;
return qstrcmp(name, data.name) < 0; }
never executed: return qstrcmp(name, data.name) < 0;
0
750inline bool operator<(const XPMRGBData &data, const char *name)-
751{
never executed: return qstrcmp(data.name, name) < 0;
return qstrcmp(data.name, name) < 0; }
never executed: return qstrcmp(data.name, name) < 0;
0
752-
753static inline bool qt_get_named_xpm_rgb(const char *name_no_space, QRgb *rgb)-
754{-
755 const XPMRGBData *r = std::lower_bound(xpmRgbTbl, xpmRgbTbl + xpmRgbTblSize, name_no_space);-
756 if ((r != xpmRgbTbl + xpmRgbTblSize) && !(name_no_space < *r)) {
(r != xpmRgbTb...xpmRgbTblSize)Description
TRUEnever evaluated
FALSEnever evaluated
!(name_no_space < *r)Description
TRUEnever evaluated
FALSEnever evaluated
0
757 *rgb = r->value;-
758 return true;
never executed: return true;
0
759 } else {-
760 return false;
never executed: return false;
0
761 }-
762}-
763-
764/*****************************************************************************-
765 Misc. utility functions-
766 *****************************************************************************/-
767static QString fbname(const QString &fileName) // get file basename (sort of)-
768{-
769 QString s = fileName;-
770 if (!s.isEmpty()) {
!s.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
771 int i;-
772 if ((i = s.lastIndexOf(QLatin1Char('/'))) >= 0)
(i = s.lastInd...ar('/'))) >= 0Description
TRUEnever evaluated
FALSEnever evaluated
0
773 s = s.mid(i);
never executed: s = s.mid(i);
0
774 if ((i = s.lastIndexOf(QLatin1Char('\\'))) >= 0)
(i = s.lastInd...r('\\'))) >= 0Description
TRUEnever evaluated
FALSEnever evaluated
0
775 s = s.mid(i);
never executed: s = s.mid(i);
0
776 QRegExp r(QLatin1String("[a-zA-Z][a-zA-Z0-9_]*"));-
777 int p = r.indexIn(s);-
778 if (p == -1)
p == -1Description
TRUEnever evaluated
FALSEnever evaluated
0
779 s.clear();
never executed: s.clear();
0
780 else-
781 s = s.mid(p, r.matchedLength());
never executed: s = s.mid(p, r.matchedLength());
0
782 }-
783 if (s.isEmpty())
s.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
784 s = QString::fromLatin1("dummy");
never executed: s = QString::fromLatin1("dummy");
0
785 return s;
never executed: return s;
0
786}-
787-
788// Skip until ", read until the next ", return the rest in *buf-
789// Returns false on error, true on success-
790-
791static bool read_xpm_string(QByteArray &buf, QIODevice *d, const char * const *source, int &index,-
792 QByteArray &state)-
793{-
794 if (source) {
sourceDescription
TRUEnever evaluated
FALSEnever evaluated
0
795 buf = source[index++];-
796 return true;
never executed: return true;
0
797 }-
798-
799 buf = "";-
800 bool gotQuote = false;-
801 int offset = 0;-
802 forever {-
803 if (offset == state.size() || state.isEmpty()) {
offset == state.size()Description
TRUEnever evaluated
FALSEnever evaluated
state.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
804 char buf[2048];-
805 qint64 bytesRead = d->read(buf, sizeof(buf));-
806 if (bytesRead <= 0)
bytesRead <= 0Description
TRUEnever evaluated
FALSEnever evaluated
0
807 return false;
never executed: return false;
0
808 state = QByteArray(buf, int(bytesRead));-
809 offset = 0;-
810 }
never executed: end of block
0
811-
812 if (!gotQuote) {
!gotQuoteDescription
TRUEnever evaluated
FALSEnever evaluated
0
813 if (state.at(offset++) == '"')
state.at(offset++) == '"'Description
TRUEnever evaluated
FALSEnever evaluated
0
814 gotQuote = true;
never executed: gotQuote = true;
0
815 } else {
never executed: end of block
0
816 char c = state.at(offset++);-
817 if (c == '"')
c == '"'Description
TRUEnever evaluated
FALSEnever evaluated
0
818 break;
never executed: break;
0
819 buf += c;-
820 }
never executed: end of block
0
821 }-
822 state.remove(0, offset);-
823 return true;
never executed: return true;
0
824}-
825-
826// Tests if the given prefix can be the start of an XPM color specification-
827-
828static bool is_xpm_color_spec_prefix(const QByteArray& prefix)-
829{-
830 return prefix == "c" ||
never executed: return prefix == "c" || prefix == "g" || prefix == "g4" || prefix == "m" || prefix == "s";
0
831 prefix == "g" ||
never executed: return prefix == "c" || prefix == "g" || prefix == "g4" || prefix == "m" || prefix == "s";
0
832 prefix == "g4" ||
never executed: return prefix == "c" || prefix == "g" || prefix == "g4" || prefix == "m" || prefix == "s";
0
833 prefix == "m" ||
never executed: return prefix == "c" || prefix == "g" || prefix == "g4" || prefix == "m" || prefix == "s";
0
834 prefix == "s";
never executed: return prefix == "c" || prefix == "g" || prefix == "g4" || prefix == "m" || prefix == "s";
0
835}-
836-
837// Reads XPM header.-
838-
839static bool read_xpm_header(-
840 QIODevice *device, const char * const * source, int& index, QByteArray &state,-
841 int *cpp, int *ncols, int *w, int *h)-
842{-
843 QByteArray buf(200, 0);-
844-
845 if (!read_xpm_string(buf, device, source, index, state))
!read_xpm_stri... index, state)Description
TRUEnever evaluated
FALSEnever evaluated
0
846 return false;
never executed: return false;
0
847-
848#if defined(_MSC_VER) && _MSC_VER >= 1400 && !defined(Q_OS_WINCE)-
849 if (sscanf_s(buf, "%d %d %d %d", w, h, ncols, cpp) < 4)-
850#else-
851 if (sscanf(buf, "%d %d %d %d", w, h, ncols, cpp) < 4)
sscanf(buf, "%...cols, cpp) < 4Description
TRUEnever evaluated
FALSEnever evaluated
0
852#endif-
853 return false; // < 4 numbers parsed
never executed: return false;
0
854-
855 return true;
never executed: return true;
0
856}-
857-
858// Reads XPM body (color information & pixels).-
859-
860static bool read_xpm_body(-
861 QIODevice *device, const char * const * source, int& index, QByteArray& state,-
862 int cpp, int ncols, int w, int h, QImage& image)-
863{-
864 QByteArray buf(200, 0);-
865 int i;-
866-
867 if (cpp < 0 || cpp > 15)
cpp < 0Description
TRUEnever evaluated
FALSEnever evaluated
cpp > 15Description
TRUEnever evaluated
FALSEnever evaluated
0
868 return false;
never executed: return false;
0
869-
870 // For > 256 colors, we delay creation of the image until-
871 // after we have read the color specifications, so that we can-
872 // create it in correct format (Format_RGB32 vs Format_ARGB32,-
873 // depending on absence or presence of "c none", respectively)-
874 if (ncols <= 256) {
ncols <= 256Description
TRUEnever evaluated
FALSEnever evaluated
0
875 if (image.size() != QSize(w, h) || image.format() != QImage::Format_Indexed8) {
image.size() != QSize(w, h)Description
TRUEnever evaluated
FALSEnever evaluated
image.format()...ormat_Indexed8Description
TRUEnever evaluated
FALSEnever evaluated
0
876 image = QImage(w, h, QImage::Format_Indexed8);-
877 if (image.isNull())
image.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
0
878 return false;
never executed: return false;
0
879 }
never executed: end of block
0
880 image.setColorCount(ncols);-
881 }
never executed: end of block
0
882-
883 QMap<quint64, int> colorMap;-
884 int currentColor;-
885 bool hasTransparency = false;-
886-
887 for(currentColor=0; currentColor < ncols; ++currentColor) {
currentColor < ncolsDescription
TRUEnever evaluated
FALSEnever evaluated
0
888 if (!read_xpm_string(buf, device, source, index, state)) {
!read_xpm_stri... index, state)Description
TRUEnever evaluated
FALSEnever evaluated
0
889 qWarning("QImage: XPM color specification missing");-
890 return false;
never executed: return false;
0
891 }-
892 QByteArray index;-
893 index = buf.left(cpp);-
894 buf = buf.mid(cpp).simplified().trimmed().toLower();-
895 QList<QByteArray> tokens = buf.split(' ');-
896 i = tokens.indexOf("c");-
897 if (i < 0)
i < 0Description
TRUEnever evaluated
FALSEnever evaluated
0
898 i = tokens.indexOf("g");
never executed: i = tokens.indexOf("g");
0
899 if (i < 0)
i < 0Description
TRUEnever evaluated
FALSEnever evaluated
0
900 i = tokens.indexOf("g4");
never executed: i = tokens.indexOf("g4");
0
901 if (i < 0)
i < 0Description
TRUEnever evaluated
FALSEnever evaluated
0
902 i = tokens.indexOf("m");
never executed: i = tokens.indexOf("m");
0
903 if (i < 0) {
i < 0Description
TRUEnever evaluated
FALSEnever evaluated
0
904 qWarning("QImage: XPM color specification is missing: %s", buf.constData());-
905 return false; // no c/g/g4/m specification at all
never executed: return false;
0
906 }-
907 QByteArray color;-
908 while ((++i < tokens.size()) && !is_xpm_color_spec_prefix(tokens.at(i))) {
(++i < tokens.size())Description
TRUEnever evaluated
FALSEnever evaluated
!is_xpm_color_...(tokens.at(i))Description
TRUEnever evaluated
FALSEnever evaluated
0
909 color.append(tokens.at(i));-
910 }
never executed: end of block
0
911 if (color.isEmpty()) {
color.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
912 qWarning("QImage: XPM color value is missing from specification: %s", buf.constData());-
913 return false; // no color value
never executed: return false;
0
914 }-
915 buf = color;-
916 if (buf == "none") {
buf == "none"Description
TRUEnever evaluated
FALSEnever evaluated
0
917 hasTransparency = true;-
918 int transparentColor = currentColor;-
919 if (ncols <= 256) {
ncols <= 256Description
TRUEnever evaluated
FALSEnever evaluated
0
920 image.setColor(transparentColor, 0);-
921 colorMap.insert(xpmHash(QLatin1String(index.constData())), transparentColor);-
922 } else {
never executed: end of block
0
923 colorMap.insert(xpmHash(QLatin1String(index.constData())), 0);-
924 }
never executed: end of block
0
925 } else {-
926 QRgb c_rgb;-
927 if (((buf.length()-1) % 3) && (buf[0] == '#')) {
((buf.length()-1) % 3)Description
TRUEnever evaluated
FALSEnever evaluated
(buf[0] == '#')Description
TRUEnever evaluated
FALSEnever evaluated
0
928 buf.truncate(((buf.length()-1) / 4 * 3) + 1); // remove alpha channel left by imagemagick-
929 }
never executed: end of block
0
930 if (buf[0] == '#') {
buf[0] == '#'Description
TRUEnever evaluated
FALSEnever evaluated
0
931 qt_get_hex_rgb(buf, &c_rgb);-
932 } else {
never executed: end of block
0
933 qt_get_named_xpm_rgb(buf, &c_rgb);-
934 }
never executed: end of block
0
935 if (ncols <= 256) {
ncols <= 256Description
TRUEnever evaluated
FALSEnever evaluated
0
936 image.setColor(currentColor, 0xff000000 | c_rgb);-
937 colorMap.insert(xpmHash(QLatin1String(index.constData())), currentColor);-
938 } else {
never executed: end of block
0
939 colorMap.insert(xpmHash(QLatin1String(index.constData())), 0xff000000 | c_rgb);-
940 }
never executed: end of block
0
941 }-
942 }-
943-
944 if (ncols > 256) {
ncols > 256Description
TRUEnever evaluated
FALSEnever evaluated
0
945 // Now we can create 32-bit image of appropriate format-
946 QImage::Format format = hasTransparency ?
hasTransparencyDescription
TRUEnever evaluated
FALSEnever evaluated
0
947 QImage::Format_ARGB32 : QImage::Format_RGB32;-
948 if (image.size() != QSize(w, h) || image.format() != format) {
image.size() != QSize(w, h)Description
TRUEnever evaluated
FALSEnever evaluated
image.format() != formatDescription
TRUEnever evaluated
FALSEnever evaluated
0
949 image = QImage(w, h, format);-
950 if (image.isNull())
image.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
0
951 return false;
never executed: return false;
0
952 }
never executed: end of block
0
953 }
never executed: end of block
0
954-
955 // Read pixels-
956 for(int y=0; y<h; y++) {
y<hDescription
TRUEnever evaluated
FALSEnever evaluated
0
957 if (!read_xpm_string(buf, device, source, index, state)) {
!read_xpm_stri... index, state)Description
TRUEnever evaluated
FALSEnever evaluated
0
958 qWarning("QImage: XPM pixels missing on image line %d", y);-
959 return false;
never executed: return false;
0
960 }-
961 if (image.depth() == 8) {
image.depth() == 8Description
TRUEnever evaluated
FALSEnever evaluated
0
962 uchar *p = image.scanLine(y);-
963 uchar *d = (uchar *)buf.data();-
964 uchar *end = d + buf.length();-
965 int x;-
966 if (cpp == 1) {
cpp == 1Description
TRUEnever evaluated
FALSEnever evaluated
0
967 char b[2];-
968 b[1] = '\0';-
969 for (x=0; x<w && d<end; x++) {
x<wDescription
TRUEnever evaluated
FALSEnever evaluated
d<endDescription
TRUEnever evaluated
FALSEnever evaluated
0
970 b[0] = *d++;-
971 *p++ = (uchar)colorMap[xpmHash(b)];-
972 }
never executed: end of block
0
973 } else {
never executed: end of block
0
974 char b[16];-
975 b[cpp] = '\0';-
976 for (x=0; x<w && d<end; x++) {
x<wDescription
TRUEnever evaluated
FALSEnever evaluated
d<endDescription
TRUEnever evaluated
FALSEnever evaluated
0
977 memcpy(b, (char *)d, cpp);-
978 *p++ = (uchar)colorMap[xpmHash(b)];-
979 d += cpp;-
980 }
never executed: end of block
0
981 }
never executed: end of block
0
982 // avoid uninitialized memory for malformed xpms-
983 if (x < w) {
x < wDescription
TRUEnever evaluated
FALSEnever evaluated
0
984 qWarning("QImage: XPM pixels missing on image line %d (possibly a C++ trigraph).", y);-
985 memset(p, 0, w - x);-
986 }
never executed: end of block
0
987 } else {
never executed: end of block
0
988 QRgb *p = (QRgb*)image.scanLine(y);-
989 uchar *d = (uchar *)buf.data();-
990 uchar *end = d + buf.length();-
991 int x;-
992 char b[16];-
993 b[cpp] = '\0';-
994 for (x=0; x<w && d<end; x++) {
x<wDescription
TRUEnever evaluated
FALSEnever evaluated
d<endDescription
TRUEnever evaluated
FALSEnever evaluated
0
995 memcpy(b, (char *)d, cpp);-
996 *p++ = (QRgb)colorMap[xpmHash(b)];-
997 d += cpp;-
998 }
never executed: end of block
0
999 // avoid uninitialized memory for malformed xpms-
1000 if (x < w) {
x < wDescription
TRUEnever evaluated
FALSEnever evaluated
0
1001 qWarning("QImage: XPM pixels missing on image line %d (possibly a C++ trigraph).", y);-
1002 memset(p, 0, (w - x)*4);-
1003 }
never executed: end of block
0
1004 }
never executed: end of block
0
1005 }-
1006-
1007 if (device) {
deviceDescription
TRUEnever evaluated
FALSEnever evaluated
0
1008 // Rewind unused characters, and skip to the end of the XPM struct.-
1009 for (int i = state.size() - 1; i >= 0; --i)
i >= 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1010 device->ungetChar(state[i]);
never executed: device->ungetChar(state[i]);
0
1011 char c;-
1012 while (device->getChar(&c) && c != ';') {}
never executed: end of block
device->getChar(&c)Description
TRUEnever evaluated
FALSEnever evaluated
c != ';'Description
TRUEnever evaluated
FALSEnever evaluated
0
1013 while (device->getChar(&c) && c != '\n') {}
never executed: end of block
device->getChar(&c)Description
TRUEnever evaluated
FALSEnever evaluated
c != '\n'Description
TRUEnever evaluated
FALSEnever evaluated
0
1014 }
never executed: end of block
0
1015 return true;
never executed: return true;
0
1016}-
1017-
1018//-
1019// INTERNAL-
1020//-
1021// Reads an .xpm from either the QImageIO or from the QString *.-
1022// One of the two HAS to be 0, the other one is used.-
1023//-
1024-
1025bool qt_read_xpm_image_or_array(QIODevice *device, const char * const * source, QImage &image)-
1026{-
1027 if (!source)
!sourceDescription
TRUEnever evaluated
FALSEnever evaluated
0
1028 return true;
never executed: return true;
0
1029-
1030 QByteArray buf(200, 0);-
1031 QByteArray state;-
1032-
1033 int cpp, ncols, w, h, index = 0;-
1034-
1035 if (device) {
deviceDescription
TRUEnever evaluated
FALSEnever evaluated
0
1036 // "/* XPM */"-
1037 int readBytes;-
1038 if ((readBytes = device->readLine(buf.data(), buf.size())) < 0)
(readBytes = d...f.size())) < 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1039 return false;
never executed: return false;
0
1040-
1041 if (buf.indexOf("/* XPM") != 0) {
buf.indexOf("/* XPM") != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1042 while (readBytes > 0) {
readBytes > 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1043 device->ungetChar(buf.at(readBytes - 1));-
1044 --readBytes;-
1045 }
never executed: end of block
0
1046 return false;
never executed: return false;
0
1047 }// bad magic-
1048 }
never executed: end of block
0
1049-
1050 if (!read_xpm_header(device, source, index, state, &cpp, &ncols, &w, &h))
!read_xpm_head...ncols, &w, &h)Description
TRUEnever evaluated
FALSEnever evaluated
0
1051 return false;
never executed: return false;
0
1052-
1053 return read_xpm_body(device, source, index, state, cpp, ncols, w, h, image);
never executed: return read_xpm_body(device, source, index, state, cpp, ncols, w, h, image);
0
1054}-
1055-
1056static const char* xpm_color_name(int cpp, int index)-
1057{-
1058 static char returnable[5];-
1059 static const char code[] = ".#abcdefghijklmnopqrstuvwxyzABCD"-
1060 "EFGHIJKLMNOPQRSTUVWXYZ0123456789";-
1061 // cpp is limited to 4 and index is limited to 64^cpp-
1062 if (cpp > 1) {
cpp > 1Description
TRUEnever evaluated
FALSEnever evaluated
0
1063 if (cpp > 2) {
cpp > 2Description
TRUEnever evaluated
FALSEnever evaluated
0
1064 if (cpp > 3) {
cpp > 3Description
TRUEnever evaluated
FALSEnever evaluated
0
1065 returnable[3] = code[index % 64];-
1066 index /= 64;-
1067 } else
never executed: end of block
0
1068 returnable[3] = '\0';
never executed: returnable[3] = '\0';
0
1069 returnable[2] = code[index % 64];-
1070 index /= 64;-
1071 } else
never executed: end of block
0
1072 returnable[2] = '\0';
never executed: returnable[2] = '\0';
0
1073 // the following 4 lines are a joke!-
1074 if (index == 0)
index == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1075 index = 64*44+21;
never executed: index = 64*44+21;
0
1076 else if (index == 64*44+21)
index == 64*44+21Description
TRUEnever evaluated
FALSEnever evaluated
0
1077 index = 0;
never executed: index = 0;
0
1078 returnable[1] = code[index % 64];-
1079 index /= 64;-
1080 } else
never executed: end of block
0
1081 returnable[1] = '\0';
never executed: returnable[1] = '\0';
0
1082 returnable[0] = code[index];-
1083-
1084 return returnable;
never executed: return returnable;
0
1085}-
1086-
1087-
1088// write XPM image data-
1089static bool write_xpm_image(const QImage &sourceImage, QIODevice *device, const QString &fileName)-
1090{-
1091 if (!device->isWritable())
!device->isWritable()Description
TRUEnever evaluated
FALSEnever evaluated
0
1092 return false;
never executed: return false;
0
1093-
1094 QImage image;-
1095 if (sourceImage.format() != QImage::Format_RGB32 && sourceImage.format() != QImage::Format_ARGB32 && sourceImage.format() != QImage::Format_ARGB32_Premultiplied)
sourceImage.fo...::Format_RGB32Description
TRUEnever evaluated
FALSEnever evaluated
sourceImage.fo...:Format_ARGB32Description
TRUEnever evaluated
FALSEnever evaluated
sourceImage.fo..._PremultipliedDescription
TRUEnever evaluated
FALSEnever evaluated
0
1096 image = sourceImage.convertToFormat(QImage::Format_RGB32);
never executed: image = sourceImage.convertToFormat(QImage::Format_RGB32);
0
1097 else-
1098 image = sourceImage;
never executed: image = sourceImage;
0
1099-
1100 QMap<QRgb, int> colorMap;-
1101-
1102 int w = image.width(), h = image.height(), ncolors = 0;-
1103 int x, y;-
1104-
1105 // build color table-
1106 for(y=0; y<h; y++) {
y<hDescription
TRUEnever evaluated
FALSEnever evaluated
0
1107 const QRgb *yp = reinterpret_cast<const QRgb *>(image.constScanLine(y));-
1108 for(x=0; x<w; x++) {
x<wDescription
TRUEnever evaluated
FALSEnever evaluated
0
1109 QRgb color = *(yp + x);-
1110 if (!colorMap.contains(color))
!colorMap.contains(color)Description
TRUEnever evaluated
FALSEnever evaluated
0
1111 colorMap.insert(color, ncolors++);
never executed: colorMap.insert(color, ncolors++);
0
1112 }
never executed: end of block
0
1113 }
never executed: end of block
0
1114-
1115 // number of 64-bit characters per pixel needed to encode all colors-
1116 int cpp = 1;-
1117 for (int k = 64; ncolors > k; k *= 64) {
ncolors > kDescription
TRUEnever evaluated
FALSEnever evaluated
0
1118 ++cpp;-
1119 // limit to 4 characters per pixel-
1120 // 64^4 colors is enough for a 4096x4096 image-
1121 if (cpp > 4)
cpp > 4Description
TRUEnever evaluated
FALSEnever evaluated
0
1122 break;
never executed: break;
0
1123 }
never executed: end of block
0
1124-
1125 QString line;-
1126-
1127 // write header-
1128 QTextStream s(device);-
1129 s << "/* XPM */" << endl-
1130 << "static char *" << fbname(fileName) << "[]={" << endl-
1131 << '\"' << w << ' ' << h << ' ' << ncolors << ' ' << cpp << '\"';-
1132-
1133 // write palette-
1134 QMap<QRgb, int>::Iterator c = colorMap.begin();-
1135 while (c != colorMap.end()) {
c != colorMap.end()Description
TRUEnever evaluated
FALSEnever evaluated
0
1136 QRgb color = c.key();-
1137 if (image.format() != QImage::Format_RGB32 && !qAlpha(color))
image.format()...::Format_RGB32Description
TRUEnever evaluated
FALSEnever evaluated
!qAlpha(color)Description
TRUEnever evaluated
FALSEnever evaluated
0
1138 line = QString::asprintf("\"%s c None\"",
never executed: line = QString::asprintf("\"%s c None\"", xpm_color_name(cpp, *c));
0
1139 xpm_color_name(cpp, *c));
never executed: line = QString::asprintf("\"%s c None\"", xpm_color_name(cpp, *c));
0
1140 else-
1141 line = QString::asprintf("\"%s c #%02x%02x%02x\"",
never executed: line = QString::asprintf("\"%s c #%02x%02x%02x\"", xpm_color_name(cpp, *c), qRed(color), qGreen(color), qBlue(color));
0
1142 xpm_color_name(cpp, *c),
never executed: line = QString::asprintf("\"%s c #%02x%02x%02x\"", xpm_color_name(cpp, *c), qRed(color), qGreen(color), qBlue(color));
0
1143 qRed(color),
never executed: line = QString::asprintf("\"%s c #%02x%02x%02x\"", xpm_color_name(cpp, *c), qRed(color), qGreen(color), qBlue(color));
0
1144 qGreen(color),
never executed: line = QString::asprintf("\"%s c #%02x%02x%02x\"", xpm_color_name(cpp, *c), qRed(color), qGreen(color), qBlue(color));
0
1145 qBlue(color));
never executed: line = QString::asprintf("\"%s c #%02x%02x%02x\"", xpm_color_name(cpp, *c), qRed(color), qGreen(color), qBlue(color));
0
1146 ++c;-
1147 s << ',' << endl << line;-
1148 }
never executed: end of block
0
1149-
1150 // write pixels, limit to 4 characters per pixel-
1151 line.truncate(cpp*w);-
1152 for(y=0; y<h; y++) {
y<hDescription
TRUEnever evaluated
FALSEnever evaluated
0
1153 const QRgb *yp = reinterpret_cast<const QRgb *>(image.constScanLine(y));-
1154 int cc = 0;-
1155 for(x=0; x<w; x++) {
x<wDescription
TRUEnever evaluated
FALSEnever evaluated
0
1156 int color = (int)(*(yp + x));-
1157 const QByteArray chars(xpm_color_name(cpp, colorMap[color]));-
1158 line[cc++] = QLatin1Char(chars[0]);-
1159 if (cpp > 1) {
cpp > 1Description
TRUEnever evaluated
FALSEnever evaluated
0
1160 line[cc++] = QLatin1Char(chars[1]);-
1161 if (cpp > 2) {
cpp > 2Description
TRUEnever evaluated
FALSEnever evaluated
0
1162 line[cc++] = QLatin1Char(chars[2]);-
1163 if (cpp > 3) {
cpp > 3Description
TRUEnever evaluated
FALSEnever evaluated
0
1164 line[cc++] = QLatin1Char(chars[3]);-
1165 }
never executed: end of block
0
1166 }
never executed: end of block
0
1167 }
never executed: end of block
0
1168 }
never executed: end of block
0
1169 s << ',' << endl << '\"' << line << '\"';-
1170 }
never executed: end of block
0
1171 s << "};" << endl;-
1172 return (s.status() == QTextStream::Ok);
never executed: return (s.status() == QTextStream::Ok);
0
1173}-
1174-
1175QXpmHandler::QXpmHandler()-
1176 : state(Ready), index(0)-
1177{-
1178}
never executed: end of block
0
1179-
1180bool QXpmHandler::readHeader()-
1181{-
1182 state = Error;-
1183 if (!read_xpm_header(device(), 0, index, buffer, &cpp, &ncols, &width, &height))
!read_xpm_head...idth, &height)Description
TRUEnever evaluated
FALSEnever evaluated
0
1184 return false;
never executed: return false;
0
1185 state = ReadHeader;-
1186 return true;
never executed: return true;
0
1187}-
1188-
1189bool QXpmHandler::readImage(QImage *image)-
1190{-
1191 if (state == Error)
state == ErrorDescription
TRUEnever evaluated
FALSEnever evaluated
0
1192 return false;
never executed: return false;
0
1193-
1194 if (state == Ready && !readHeader()) {
state == ReadyDescription
TRUEnever evaluated
FALSEnever evaluated
!readHeader()Description
TRUEnever evaluated
FALSEnever evaluated
0
1195 state = Error;-
1196 return false;
never executed: return false;
0
1197 }-
1198-
1199 if (!read_xpm_body(device(), 0, index, buffer, cpp, ncols, width, height, *image)) {
!read_xpm_body...eight, *image)Description
TRUEnever evaluated
FALSEnever evaluated
0
1200 state = Error;-
1201 return false;
never executed: return false;
0
1202 }-
1203-
1204 state = Ready;-
1205 return true;
never executed: return true;
0
1206}-
1207-
1208bool QXpmHandler::canRead() const-
1209{-
1210 if (state == Ready && !canRead(device()))
state == ReadyDescription
TRUEnever evaluated
FALSEnever evaluated
!canRead(device())Description
TRUEnever evaluated
FALSEnever evaluated
0
1211 return false;
never executed: return false;
0
1212-
1213 if (state != Error) {
state != ErrorDescription
TRUEnever evaluated
FALSEnever evaluated
0
1214 setFormat("xpm");-
1215 return true;
never executed: return true;
0
1216 }-
1217-
1218 return false;
never executed: return false;
0
1219}-
1220-
1221bool QXpmHandler::canRead(QIODevice *device)-
1222{-
1223 if (!device) {
!deviceDescription
TRUEnever evaluated
FALSEnever evaluated
0
1224 qWarning("QXpmHandler::canRead() called with no device");-
1225 return false;
never executed: return false;
0
1226 }-
1227-
1228 char head[6];-
1229 if (device->peek(head, sizeof(head)) != sizeof(head))
device->peek(h...= sizeof(head)Description
TRUEnever evaluated
FALSEnever evaluated
0
1230 return false;
never executed: return false;
0
1231-
1232 return qstrncmp(head, "/* XPM", 6) == 0;
never executed: return qstrncmp(head, "/* XPM", 6) == 0;
0
1233}-
1234-
1235bool QXpmHandler::read(QImage *image)-
1236{-
1237 if (!canRead())
!canRead()Description
TRUEnever evaluated
FALSEnever evaluated
0
1238 return false;
never executed: return false;
0
1239 return readImage(image);
never executed: return readImage(image);
0
1240}-
1241-
1242bool QXpmHandler::write(const QImage &image)-
1243{-
1244 return write_xpm_image(image, device(), fileName);
never executed: return write_xpm_image(image, device(), fileName);
0
1245}-
1246-
1247bool QXpmHandler::supportsOption(ImageOption option) const-
1248{-
1249 return option == Name
never executed: return option == Name || option == Size || option == ImageFormat;
0
1250 || option == Size
never executed: return option == Name || option == Size || option == ImageFormat;
0
1251 || option == ImageFormat;
never executed: return option == Name || option == Size || option == ImageFormat;
0
1252}-
1253-
1254QVariant QXpmHandler::option(ImageOption option) const-
1255{-
1256 if (option == Name) {
option == NameDescription
TRUEnever evaluated
FALSEnever evaluated
0
1257 return fileName;
never executed: return fileName;
0
1258 } else if (option == Size) {
option == SizeDescription
TRUEnever evaluated
FALSEnever evaluated
0
1259 if (state == Error)
state == ErrorDescription
TRUEnever evaluated
FALSEnever evaluated
0
1260 return QVariant();
never executed: return QVariant();
0
1261 if (state == Ready && !const_cast<QXpmHandler*>(this)->readHeader())
state == ReadyDescription
TRUEnever evaluated
FALSEnever evaluated
!const_cast<QX...->readHeader()Description
TRUEnever evaluated
FALSEnever evaluated
0
1262 return QVariant();
never executed: return QVariant();
0
1263 return QSize(width, height);
never executed: return QSize(width, height);
0
1264 } else if (option == ImageFormat) {
option == ImageFormatDescription
TRUEnever evaluated
FALSEnever evaluated
0
1265 if (state == Error)
state == ErrorDescription
TRUEnever evaluated
FALSEnever evaluated
0
1266 return QVariant();
never executed: return QVariant();
0
1267 if (state == Ready && !const_cast<QXpmHandler*>(this)->readHeader())
state == ReadyDescription
TRUEnever evaluated
FALSEnever evaluated
!const_cast<QX...->readHeader()Description
TRUEnever evaluated
FALSEnever evaluated
0
1268 return QVariant();
never executed: return QVariant();
0
1269 // If we have more than 256 colors in the table, we need to-
1270 // figure out, if it contains transparency. That means reading-
1271 // the whole color table, which is too much work work pre-checking-
1272 // the image format-
1273 if (ncols <= 256)
ncols <= 256Description
TRUEnever evaluated
FALSEnever evaluated
0
1274 return QImage::Format_Indexed8;
never executed: return QImage::Format_Indexed8;
0
1275 else-
1276 return QImage::Format_Invalid;
never executed: return QImage::Format_Invalid;
0
1277 }-
1278-
1279 return QVariant();
never executed: return QVariant();
0
1280}-
1281-
1282void QXpmHandler::setOption(ImageOption option, const QVariant &value)-
1283{-
1284 if (option == Name)
option == NameDescription
TRUEnever evaluated
FALSEnever evaluated
0
1285 fileName = value.toString();
never executed: fileName = value.toString();
0
1286}
never executed: end of block
0
1287-
1288QByteArray QXpmHandler::name() const-
1289{-
1290 return "xpm";
never executed: return "xpm";
0
1291}-
1292-
1293QT_END_NAMESPACE-
1294-
1295#endif // QT_NO_IMAGEFORMAT_XPM-
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9