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-
41-
42-
43QBitmap::~QBitmap()-
44{-
45}-
46QBitmap::operator QVariant() const-
47{-
48 return
never executed: return QVariant(QVariant::Bitmap, this);
QVariant(QVariant::Bitmap, this);
never executed: return QVariant(QVariant::Bitmap, this);
0
49}-
50-
51-
52-
53-
54-
55-
56-
57QBitmap QBitmap::fromImage(const QImage &image, Qt::ImageConversionFlags flags)-
58{-
59 if (image.isNull()
image.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
60 return
never executed: return QBitmap();
QBitmap();
never executed: return QBitmap();
0
61-
62 QImage img = image.convertToFormat(QImage::Format_MonoLSB, flags);-
63-
64-
65-
66 const QRgb c0 = QColor(Qt::black).rgb();-
67 const QRgb c1 = QColor(Qt::white).rgb();-
68 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
69 img.invertPixels();-
70 img.setColor(0, c1);-
71 img.setColor(1, c0);-
72 }
never executed: end of block
0
73-
74 QScopedPointer<QPlatformPixmap> data(QGuiApplicationPrivate::platformIntegration()->createPlatformPixmap(QPlatformPixmap::BitmapType));-
75-
76 data->fromImage(img, flags | Qt::MonoOnly);-
77 return
never executed: return QPixmap(data.take());
QPixmap(data.take());
never executed: return QPixmap(data.take());
0
78}-
79QBitmap QBitmap::fromData(const QSize &size, const uchar *bits, QImage::Format monoFormat)-
80{-
81 ((!(monoFormat == QImage::Format_Mono || monoFormat == QImage::Format_MonoLSB)) ? qt_assert("monoFormat == QImage::Format_Mono || monoFormat == QImage::Format_MonoLSB",__FILE__,269) : qt_noop());-
82-
83 QImage image(size, monoFormat);-
84 image.setColor(0, QColor(Qt::color0).rgb());-
85 image.setColor(1, QColor(Qt::color1).rgb());-
86-
87-
88-
89 int bytesPerLine = (size.width() + 7) / 8;-
90 for (int y = 0; y < size.height()
y < size.height()Description
TRUEnever evaluated
FALSEnever evaluated
; ++y)
0
91 memcpy(image.scanLine(y), bits + bytesPerLine * y, bytesPerLine);
never executed: memcpy(image.scanLine(y), bits + bytesPerLine * y, bytesPerLine);
0
92 return
never executed: return QBitmap::fromImage(image);
QBitmap::fromImage(image);
never executed: return QBitmap::fromImage(image);
0
93}-
94-
95-
96-
97-
98-
99-
100-
101QBitmap QBitmap::transformed(const QTransform &matrix) const-
102{-
103 QBitmap bm = QPixmap::transformed(matrix);-
104 return
never executed: return bm;
bm;
never executed: return bm;
0
105}-
106QBitmap QBitmap::transformed(const QMatrix &matrix) const-
107{-
108 return
never executed: return transformed(QTransform(matrix));
transformed(QTransform(matrix));
never executed: return transformed(QTransform(matrix));
0
109}-
110-
111-
Switch to Source codePreprocessed file

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