qplatformpixmap.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/gui/image/qplatformpixmap.cpp
Switch to Source codePreprocessed file
LineSourceCount
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
never executed: return data;
data;
never executed: return data;
0
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}
never executed: end of block
0
24-
25QPlatformPixmap::~QPlatformPixmap()-
26{-
27-
28-
29-
30-
31-
32-
33 if (is_cached
is_cachedDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
34 QImagePixmapCleanupHooks::executePlatformPixmapDestructionHooks(this);-
35 is_cached = false;-
36 }
never executed: end of block
0
37}
never executed: end of block
0
38-
39QPlatformPixmap *QPlatformPixmap::createCompatiblePlatformPixmap() const-
40{-
41 QPlatformPixmap *d = QGuiApplicationPrivate::platformIntegration()->createPlatformPixmap(pixelType());-
42 return
never executed: return d;
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
d->pixelType()...ap::BitmapTypeDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
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(0) == c0Description
TRUEnever evaluated
FALSEnever evaluated
&& img.color(1) == c1
img.color(1) == c1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
55 img.invertPixels();-
56 img.setColor(0, c1);-
57 img.setColor(1, c0);-
58 }
never executed: end of block
0
59 return
never executed: return img;
img;
never executed: return img;
0
60 }-
61-
62 return
never executed: return image;
image;
never executed: return image;
0
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: end of block
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()
image.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
77 return
never executed: return false;
false;
never executed: return false;
0
78 fromImage(makeBitmapCompliantIfNeeded(this, image, flags), flags);-
79 return
never executed: return !isNull();
!isNull();
never executed: return !isNull();
0
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()
image.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
89 return
never executed: return false;
false;
never executed: return false;
0
90 fromImage(makeBitmapCompliantIfNeeded(this, image, flags), flags);-
91 return
never executed: return !isNull();
!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: end of block
0
98-
99bool QPlatformPixmap::scroll(int dx, int dy, const QRect &rect)-
100{-
101 (void)dx;;-
102 (void)dy;;-
103 (void)rect;;-
104 return
never executed: return false;
false;
never executed: return false;
0
105}-
106-
107QPixmap QPlatformPixmap::transformed(const QTransform &matrix,-
108 Qt::TransformationMode mode) const-
109{-
110 return
never executed: return QPixmap::fromImage(toImage().transformed(matrix, mode));
QPixmap::fromImage(toImage().transformed(matrix, mode));
never executed: return QPixmap::fromImage(toImage().transformed(matrix, mode));
0
111}-
112-
113void QPlatformPixmap::setSerialNumber(int serNo)-
114{-
115 ser_no = serNo;-
116}
never executed: end of block
0
117-
118void QPlatformPixmap::setDetachNumber(int detNo)-
119{-
120 detach_no = detNo;-
121}
never executed: end of block
0
122-
123QImage QPlatformPixmap::toImage(const QRect &rect) const-
124{-
125 if (rect.contains(QRect(0, 0, w, h))
rect.contains(...t(0, 0, w, h))Description
TRUEnever evaluated
FALSEnever evaluated
)
0
126 return
never executed: return toImage();
toImage();
never executed: return toImage();
0
127 else-
128 return
never executed: return toImage().copy(rect);
toImage().copy(rect);
never executed: return toImage().copy(rect);
0
129}-
130-
131QImage* QPlatformPixmap::buffer()-
132{-
133 return
never executed: return 0;
0;
never executed: return 0;
0
134}-
135-
136-
137-
Switch to Source codePreprocessed file

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