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