qbitmap.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/gui/image/qbitmap.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3QBitmap::QBitmap()-
4 : QPixmap(QSize(0, 0), QPlatformPixmap::BitmapType)-
5{-
6}
never executed: end of block
0
7QBitmap::QBitmap(int w, int h)-
8 : QPixmap(QSize(w, h), QPlatformPixmap::BitmapType)-
9{-
10}
never executed: end of block
0
11QBitmap::QBitmap(const QSize &size)-
12 : QPixmap(size, QPlatformPixmap::BitmapType)-
13{-
14}
never executed: end of block
0
15QBitmap::QBitmap(const QPixmap &pixmap)-
16{-
17 QBitmap::operator=(pixmap);-
18}
never executed: end of block
0
19QBitmap::QBitmap(const QString& fileName, const char *format)-
20 : QPixmap(QSize(0, 0), QPlatformPixmap::BitmapType)-
21{-
22 load(fileName, format, Qt::MonoOnly);-
23}
never executed: end of block
0
24QBitmap &QBitmap::operator=(const QPixmap &pixmap)-
25{-
26 if (pixmap.isNull()
pixmap.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
27 QBitmap(0, 0).swap(*this);-
28 }
never executed: end of block
else if (pixmap.depth() == 1
pixmap.depth() == 1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
29 QPixmap::operator=(pixmap);-
30 }
never executed: end of block
else {
0
31 QImage image;-
32 image = pixmap.toImage();-
33 *this = fromImage(image);-
34 }
never executed: end of block
0
35 return
never executed: return *this;
*this;
never executed: return *this;
0
36}-
37-
38-
39-
40-
41QBitmap::~QBitmap()-
42{-
43}-
44QBitmap::operator QVariant() const-
45{-
46 return
never executed: return QVariant(QVariant::Bitmap, this);
QVariant(QVariant::Bitmap, this);
never executed: return QVariant(QVariant::Bitmap, this);
0
47}-
48-
49-
50-
51-
52-
53-
54-
55QBitmap QBitmap::fromImage(const QImage &image, Qt::ImageConversionFlags flags)-
56{-
57 if (image.isNull()
image.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
58 return
never executed: return QBitmap();
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(0) == c0Description
TRUEnever evaluated
FALSEnever evaluated
&& img.color(1) == c1
img.color(1) == c1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
67 img.invertPixels();-
68 img.setColor(0, c1);-
69 img.setColor(1, c0);-
70 }
never executed: end of block
0
71-
72 QScopedPointer<QPlatformPixmap> data(QGuiApplicationPrivate::platformIntegration()->createPlatformPixmap(QPlatformPixmap::BitmapType));-
73-
74 data->fromImage(img, flags | Qt::MonoOnly);-
75 return
never executed: return QPixmap(data.take());
QPixmap(data.take());
never executed: return QPixmap(data.take());
0
76}-
77QBitmap QBitmap::fromData(const QSize &size, const uchar *bits, QImage::Format monoFormat)-
78{-
79 ((!(monoFormat == QImage::Format_Mono || monoFormat == QImage::Format_MonoLSB)) ? qt_assert("monoFormat == QImage::Format_Mono || monoFormat == QImage::Format_MonoLSB",__FILE__,259) : 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 < size.height()Description
TRUEnever evaluated
FALSEnever evaluated
; ++y)
0
89 memcpy(image.scanLine(y), bits + bytesPerLine * y, bytesPerLine);
never executed: memcpy(image.scanLine(y), bits + bytesPerLine * y, bytesPerLine);
0
90 return
never executed: return QBitmap::fromImage(image);
QBitmap::fromImage(image);
never executed: return QBitmap::fromImage(image);
0
91}-
92-
93-
94-
95-
96-
97-
98-
99QBitmap QBitmap::transformed(const QTransform &matrix) const-
100{-
101 QBitmap bm = QPixmap::transformed(matrix);-
102 return
never executed: return bm;
bm;
never executed: return bm;
0
103}-
104QBitmap QBitmap::transformed(const QMatrix &matrix) const-
105{-
106 return
never executed: return transformed(QTransform(matrix));
transformed(QTransform(matrix));
never executed: return transformed(QTransform(matrix));
0
107}-
108-
109-
Switch to Source codePreprocessed file

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