image/qbitmap.cpp

Switch to Source codePreprocessed file
LineSource CodeCoverage
1 -
2 -
3QBitmap::QBitmap() -
4 : QPixmap(QSize(0, 0), QPlatformPixmap::BitmapType) -
5{ -
6}
executed: }
Execution Count:112
112
7QBitmap::QBitmap(int w, int h) -
8 : QPixmap(QSize(w, h), QPlatformPixmap::BitmapType) -
9{ -
10}
executed: }
Execution Count:13
13
11QBitmap::QBitmap(const QSize &size) -
12 : QPixmap(size, QPlatformPixmap::BitmapType) -
13{ -
14}
executed: }
Execution Count:4
4
15QBitmap::QBitmap(const QPixmap &pixmap) -
16{ -
17 QBitmap::operator=(pixmap); -
18}
executed: }
Execution Count:167
167
19QBitmap::QBitmap(const QString& fileName, const char *format) -
20 : QPixmap(QSize(0, 0), QPlatformPixmap::BitmapType) -
21{ -
22 load(fileName, format, Qt::MonoOnly); -
23}
executed: }
Execution Count:1
1
24QBitmap &QBitmap::operator=(const QPixmap &pixmap) -
25{ -
26 if (pixmap.isNull()) {
partially evaluated: pixmap.isNull()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:168
0-168
27 QBitmap(0, 0).swap(*this); -
28 } else if (pixmap.depth() == 1) {
evaluated: pixmap.depth() == 1
TRUEFALSE
yes
Evaluation Count:155
yes
Evaluation Count:13
never executed: }
0-155
29 QPixmap::operator=(pixmap); -
30 } else {
executed: }
Execution Count:155
155
31 QImage image; -
32 image = pixmap.toImage(); -
33 *this = fromImage(image); -
34 }
executed: }
Execution Count:13
13
35 return *this;
executed: return *this;
Execution Count:168
168
36} -
37 -
38 -
39 -
40 -
41QBitmap::~QBitmap() -
42{ -
43} -
44QBitmap::operator QVariant() const -
45{ -
46 return QVariant(QVariant::Bitmap, this);
executed: return QVariant(QVariant::Bitmap, this);
Execution Count:2
2
47} -
48 -
49 -
50 -
51 -
52 -
53 -
54 -
55QBitmap QBitmap::fromImage(const QImage &image, Qt::ImageConversionFlags flags) -
56{ -
57 if (image.isNull())
partially evaluated: image.isNull()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:155
0-155
58 return QBitmap();
never executed: return QBitmap();
0
59 -
60 QImage img = image.convertToFormat(QImage::Format_MonoLSB, flags); -
61 -
62 -
63 -
64 const QRgb c0 = QColor(Qt::black).rgb(); -
65 const QRgb c1 = QColor(Qt::white).rgb(); -
66 if (img.color(0) == c0 && img.color(1) == c1) {
evaluated: img.color(0) == c0
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:153
partially evaluated: img.color(1) == c1
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-153
67 img.invertPixels(); -
68 img.setColor(0, c1); -
69 img.setColor(1, c0); -
70 }
executed: }
Execution Count:2
2
71 -
72 QScopedPointer<QPlatformPixmap> data(QGuiApplicationPrivate::platformIntegration()->createPlatformPixmap(QPlatformPixmap::BitmapType)); -
73 -
74 data->fromImage(img, flags | Qt::MonoOnly); -
75 return QPixmap(data.take());
executed: return QPixmap(data.take());
Execution Count:155
155
76} -
77QBitmap QBitmap::fromData(const QSize &size, const uchar *bits, QImage::Format monoFormat) -
78{ -
79 qt_noop(); -
80 -
81 QImage image(size, monoFormat); -
82 image.setColor(0, QColor(Qt::color0).rgb()); -
83 image.setColor(1, QColor(Qt::color1).rgb()); -
84 -
85 -
86 -
87 int bytesPerLine = (size.width() + 7) / 8; -
88 for (int y = 0; y < size.height(); ++y)
evaluated: y < size.height()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:1
1-2
89 memcpy(image.scanLine(y), bits + bytesPerLine * y, bytesPerLine);
executed: memcpy(image.scanLine(y), bits + bytesPerLine * y, bytesPerLine);
Execution Count:2
2
90 return QBitmap::fromImage(image);
executed: return QBitmap::fromImage(image);
Execution Count:1
1
91} -
92 -
93 -
94 -
95 -
96 -
97 -
98 -
99QBitmap QBitmap::transformed(const QTransform &matrix) const -
100{ -
101 QBitmap bm = QPixmap::transformed(matrix); -
102 return bm;
never executed: return bm;
0
103} -
104QBitmap QBitmap::transformed(const QMatrix &matrix) const -
105{ -
106 return transformed(QTransform(matrix));
never executed: return transformed(QTransform(matrix));
0
107} -
108 -
109 -
110 -
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial