image/qplatformpixmap.cpp

Switch to Source codePreprocessed file
LineSource CodeCoverage
1 -
2 -
3QPlatformPixmap *QPlatformPixmap::create(int w, int h, PixelType type) -
4{ -
5 QPlatformPixmap *data = QGuiApplicationPrivate::platformIntegration()->createPlatformPixmap(static_cast<QPlatformPixmap::PixelType>(type)); -
6 data->resize(w, h); -
7 return data;
executed: return data;
Execution Count:938
938
8} -
9 -
10 -
11QPlatformPixmap::QPlatformPixmap(PixelType pixelType, int objectId) -
12 : w(0), -
13 h(0), -
14 d(0), -
15 is_null(true), -
16 ref(0), -
17 detach_no(0), -
18 type(pixelType), -
19 id(objectId), -
20 ser_no(0), -
21 is_cached(false) -
22{ -
23}
executed: }
Execution Count:5017
5017
24 -
25QPlatformPixmap::~QPlatformPixmap() -
26{ -
27 -
28 -
29 -
30 -
31 -
32 -
33 if (is_cached) {
partially evaluated: is_cached
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4995
0-4995
34 QImagePixmapCleanupHooks::executePlatformPixmapDestructionHooks(this); -
35 is_cached = false; -
36 }
never executed: }
0
37}
executed: }
Execution Count:4995
4995
38 -
39QPlatformPixmap *QPlatformPixmap::createCompatiblePlatformPixmap() const -
40{ -
41 QPlatformPixmap *d = QGuiApplicationPrivate::platformIntegration()->createPlatformPixmap(pixelType()); -
42 return d;
never executed: return d;
0
43} -
44 -
45static QImage makeBitmapCompliantIfNeeded(QPlatformPixmap *d, const QImage &image, Qt::ImageConversionFlags flags) -
46{ -
47 if (d->pixelType() == QPlatformPixmap::BitmapType) {
evaluated: d->pixelType() == QPlatformPixmap::BitmapType
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:121
1-121
48 QImage img = image.convertToFormat(QImage::Format_MonoLSB, flags); -
49 -
50 -
51 -
52 const QRgb c0 = QColor(Qt::black).rgb(); -
53 const QRgb c1 = QColor(Qt::white).rgb(); -
54 if (img.color(0) == c0 && img.color(1) == c1) {
partially evaluated: img.color(0) == c0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
never evaluated: img.color(1) == c1
0-1
55 img.invertPixels(); -
56 img.setColor(0, c1); -
57 img.setColor(1, c0); -
58 }
never executed: }
0
59 return img;
executed: return img;
Execution Count:1
1
60 } -
61 -
62 return image;
executed: return image;
Execution Count:121
121
63} -
64 -
65void QPlatformPixmap::fromImageReader(QImageReader *imageReader, -
66 Qt::ImageConversionFlags flags) -
67{ -
68 const QImage image = imageReader->read(); -
69 fromImage(image, flags); -
70}
never executed: }
0
71 -
72bool QPlatformPixmap::fromFile(const QString &fileName, const char *format, -
73 Qt::ImageConversionFlags flags) -
74{ -
75 QImage image = QImageReader(fileName, format).read(); -
76 if (image.isNull())
evaluated: image.isNull()
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:122
5-122
77 return false;
executed: return false;
Execution Count:5
5
78 fromImage(makeBitmapCompliantIfNeeded(this, image, flags), flags); -
79 return !isNull();
executed: return !isNull();
Execution Count:122
122
80} -
81 -
82bool QPlatformPixmap::fromData(const uchar *buf, uint len, const char *format, Qt::ImageConversionFlags flags) -
83{ -
84 QByteArray a = QByteArray::fromRawData(reinterpret_cast<const char *>(buf), len); -
85 QBuffer b(&a); -
86 b.open(QIODevice::ReadOnly); -
87 QImage image = QImageReader(&b, format).read(); -
88 if (image.isNull())
never evaluated: image.isNull()
0
89 return false;
never executed: return false;
0
90 fromImage(makeBitmapCompliantIfNeeded(this, image, flags), flags); -
91 return !isNull();
never executed: return !isNull();
0
92} -
93 -
94void QPlatformPixmap::copy(const QPlatformPixmap *data, const QRect &rect) -
95{ -
96 fromImage(data->toImage(rect), Qt::NoOpaqueDetection); -
97}
never executed: }
0
98 -
99bool QPlatformPixmap::scroll(int dx, int dy, const QRect &rect) -
100{ -
101 (void)dx;; -
102 (void)dy;; -
103 (void)rect;; -
104 return false;
never executed: return false;
0
105} -
106 -
107QPixmap QPlatformPixmap::transformed(const QTransform &matrix, -
108 Qt::TransformationMode mode) const -
109{ -
110 return QPixmap::fromImage(toImage().transformed(matrix, mode));
executed: return QPixmap::fromImage(toImage().transformed(matrix, mode));
Execution Count:103
103
111} -
112 -
113void QPlatformPixmap::setSerialNumber(int serNo) -
114{ -
115 ser_no = serNo; -
116}
executed: }
Execution Count:5219
5219
117 -
118QImage QPlatformPixmap::toImage(const QRect &rect) const -
119{ -
120 if (rect.contains(QRect(0, 0, w, h)))
never evaluated: rect.contains(QRect(0, 0, w, h))
0
121 return toImage();
never executed: return toImage();
0
122 else -
123 return toImage().copy(rect);
never executed: return toImage().copy(rect);
0
124} -
125 -
126QImage* QPlatformPixmap::buffer() -
127{ -
128 return 0;
never executed: return 0;
0
129} -
130 -
131 -
132 -
133 -
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial