Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/gui/image/qpixmap_raster.cpp |
Source code | Switch to Preprocessed file |
Line | Source | Count | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | /**************************************************************************** | - | ||||||||||||
2 | ** | - | ||||||||||||
3 | ** Copyright (C) 2015 The Qt Company Ltd. | - | ||||||||||||
4 | ** Contact: http://www.qt.io/licensing/ | - | ||||||||||||
5 | ** | - | ||||||||||||
6 | ** This file is part of the QtGui module of the Qt Toolkit. | - | ||||||||||||
7 | ** | - | ||||||||||||
8 | ** $QT_BEGIN_LICENSE:LGPL21$ | - | ||||||||||||
9 | ** Commercial License Usage | - | ||||||||||||
10 | ** Licensees holding valid commercial Qt licenses may use this file in | - | ||||||||||||
11 | ** accordance with the commercial license agreement provided with the | - | ||||||||||||
12 | ** Software or, alternatively, in accordance with the terms contained in | - | ||||||||||||
13 | ** a written agreement between you and The Qt Company. For licensing terms | - | ||||||||||||
14 | ** and conditions see http://www.qt.io/terms-conditions. For further | - | ||||||||||||
15 | ** information use the contact form at http://www.qt.io/contact-us. | - | ||||||||||||
16 | ** | - | ||||||||||||
17 | ** GNU Lesser General Public License Usage | - | ||||||||||||
18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | - | ||||||||||||
19 | ** General Public License version 2.1 or version 3 as published by the Free | - | ||||||||||||
20 | ** Software Foundation and appearing in the file LICENSE.LGPLv21 and | - | ||||||||||||
21 | ** LICENSE.LGPLv3 included in the packaging of this file. Please review the | - | ||||||||||||
22 | ** following information to ensure the GNU Lesser General Public License | - | ||||||||||||
23 | ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and | - | ||||||||||||
24 | ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | - | ||||||||||||
25 | ** | - | ||||||||||||
26 | ** As a special exception, The Qt Company gives you certain additional | - | ||||||||||||
27 | ** rights. These rights are described in The Qt Company LGPL Exception | - | ||||||||||||
28 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | - | ||||||||||||
29 | ** | - | ||||||||||||
30 | ** $QT_END_LICENSE$ | - | ||||||||||||
31 | ** | - | ||||||||||||
32 | ****************************************************************************/ | - | ||||||||||||
33 | - | |||||||||||||
34 | #include "qpixmap.h" | - | ||||||||||||
35 | - | |||||||||||||
36 | #include <private/qfont_p.h> | - | ||||||||||||
37 | - | |||||||||||||
38 | #include "qpixmap_raster_p.h" | - | ||||||||||||
39 | #include "qnativeimage_p.h" | - | ||||||||||||
40 | #include "qimage_p.h" | - | ||||||||||||
41 | #include "qpaintengine.h" | - | ||||||||||||
42 | - | |||||||||||||
43 | #include "qbitmap.h" | - | ||||||||||||
44 | #include "qimage.h" | - | ||||||||||||
45 | #include <QBuffer> | - | ||||||||||||
46 | #include <QImageReader> | - | ||||||||||||
47 | #include <private/qimage_p.h> | - | ||||||||||||
48 | #include <private/qsimd_p.h> | - | ||||||||||||
49 | #include <private/qdrawhelper_p.h> | - | ||||||||||||
50 | - | |||||||||||||
51 | QT_BEGIN_NAMESPACE | - | ||||||||||||
52 | - | |||||||||||||
53 | QPixmap qt_toRasterPixmap(const QImage &image) | - | ||||||||||||
54 | { | - | ||||||||||||
55 | QPlatformPixmap *data = | - | ||||||||||||
56 | new QRasterPlatformPixmap(image.depth() == 1 | - | ||||||||||||
57 | ? QPlatformPixmap::BitmapType | - | ||||||||||||
58 | : QPlatformPixmap::PixmapType); | - | ||||||||||||
59 | - | |||||||||||||
60 | data->fromImage(image, Qt::AutoColor); | - | ||||||||||||
61 | - | |||||||||||||
62 | return QPixmap(data); never executed: return QPixmap(data); | 0 | ||||||||||||
63 | } | - | ||||||||||||
64 | - | |||||||||||||
65 | QPixmap qt_toRasterPixmap(const QPixmap &pixmap) | - | ||||||||||||
66 | { | - | ||||||||||||
67 | if (pixmap.isNull())
| 0 | ||||||||||||
68 | return QPixmap(); never executed: return QPixmap(); | 0 | ||||||||||||
69 | - | |||||||||||||
70 | if (QPixmap(pixmap).data_ptr()->classId() == QPlatformPixmap::RasterClass)
| 0 | ||||||||||||
71 | return pixmap; never executed: return pixmap; | 0 | ||||||||||||
72 | - | |||||||||||||
73 | return qt_toRasterPixmap(pixmap.toImage()); never executed: return qt_toRasterPixmap(pixmap.toImage()); | 0 | ||||||||||||
74 | } | - | ||||||||||||
75 | - | |||||||||||||
76 | QRasterPlatformPixmap::QRasterPlatformPixmap(PixelType type) | - | ||||||||||||
77 | : QPlatformPixmap(type, RasterClass) | - | ||||||||||||
78 | { | - | ||||||||||||
79 | } never executed: end of block | 0 | ||||||||||||
80 | - | |||||||||||||
81 | QRasterPlatformPixmap::~QRasterPlatformPixmap() | - | ||||||||||||
82 | { | - | ||||||||||||
83 | } | - | ||||||||||||
84 | - | |||||||||||||
85 | QPlatformPixmap *QRasterPlatformPixmap::createCompatiblePlatformPixmap() const | - | ||||||||||||
86 | { | - | ||||||||||||
87 | return new QRasterPlatformPixmap(pixelType()); never executed: return new QRasterPlatformPixmap(pixelType()); | 0 | ||||||||||||
88 | } | - | ||||||||||||
89 | - | |||||||||||||
90 | void QRasterPlatformPixmap::resize(int width, int height) | - | ||||||||||||
91 | { | - | ||||||||||||
92 | QImage::Format format; | - | ||||||||||||
93 | if (pixelType() == BitmapType)
| 0 | ||||||||||||
94 | format = QImage::Format_MonoLSB; never executed: format = QImage::Format_MonoLSB; | 0 | ||||||||||||
95 | else | - | ||||||||||||
96 | format = QNativeImage::systemFormat(); never executed: format = QNativeImage::systemFormat(); | 0 | ||||||||||||
97 | - | |||||||||||||
98 | image = QImage(width, height, format); | - | ||||||||||||
99 | w = width; | - | ||||||||||||
100 | h = height; | - | ||||||||||||
101 | d = image.depth(); | - | ||||||||||||
102 | is_null = (w <= 0 || h <= 0);
| 0 | ||||||||||||
103 | - | |||||||||||||
104 | if (pixelType() == BitmapType && !image.isNull()) {
| 0 | ||||||||||||
105 | image.setColorCount(2); | - | ||||||||||||
106 | image.setColor(0, QColor(Qt::color0).rgba()); | - | ||||||||||||
107 | image.setColor(1, QColor(Qt::color1).rgba()); | - | ||||||||||||
108 | } never executed: end of block | 0 | ||||||||||||
109 | - | |||||||||||||
110 | setSerialNumber(image.cacheKey() >> 32); | - | ||||||||||||
111 | } never executed: end of block | 0 | ||||||||||||
112 | - | |||||||||||||
113 | bool QRasterPlatformPixmap::fromData(const uchar *buffer, uint len, const char *format, | - | ||||||||||||
114 | Qt::ImageConversionFlags flags) | - | ||||||||||||
115 | { | - | ||||||||||||
116 | QByteArray a = QByteArray::fromRawData(reinterpret_cast<const char *>(buffer), len); | - | ||||||||||||
117 | QBuffer b(&a); | - | ||||||||||||
118 | b.open(QIODevice::ReadOnly); | - | ||||||||||||
119 | QImage image = QImageReader(&b, format).read(); | - | ||||||||||||
120 | if (image.isNull())
| 0 | ||||||||||||
121 | return false; never executed: return false; | 0 | ||||||||||||
122 | - | |||||||||||||
123 | createPixmapForImage(image, flags, /* inplace = */true); | - | ||||||||||||
124 | return !isNull(); never executed: return !isNull(); | 0 | ||||||||||||
125 | } | - | ||||||||||||
126 | - | |||||||||||||
127 | void QRasterPlatformPixmap::fromImage(const QImage &sourceImage, | - | ||||||||||||
128 | Qt::ImageConversionFlags flags) | - | ||||||||||||
129 | { | - | ||||||||||||
130 | QImage image = sourceImage; | - | ||||||||||||
131 | createPixmapForImage(image, flags, /* inplace = */false); | - | ||||||||||||
132 | } never executed: end of block | 0 | ||||||||||||
133 | - | |||||||||||||
134 | void QRasterPlatformPixmap::fromImageInPlace(QImage &sourceImage, | - | ||||||||||||
135 | Qt::ImageConversionFlags flags) | - | ||||||||||||
136 | { | - | ||||||||||||
137 | createPixmapForImage(sourceImage, flags, /* inplace = */true); | - | ||||||||||||
138 | } never executed: end of block | 0 | ||||||||||||
139 | - | |||||||||||||
140 | void QRasterPlatformPixmap::fromImageReader(QImageReader *imageReader, | - | ||||||||||||
141 | Qt::ImageConversionFlags flags) | - | ||||||||||||
142 | { | - | ||||||||||||
143 | Q_UNUSED(flags); | - | ||||||||||||
144 | QImage image = imageReader->read(); | - | ||||||||||||
145 | if (image.isNull())
| 0 | ||||||||||||
146 | return; never executed: return; | 0 | ||||||||||||
147 | - | |||||||||||||
148 | createPixmapForImage(image, flags, /* inplace = */true); | - | ||||||||||||
149 | } never executed: end of block | 0 | ||||||||||||
150 | - | |||||||||||||
151 | // from qbackingstore.cpp | - | ||||||||||||
152 | extern void qt_scrollRectInImage(QImage &img, const QRect &rect, const QPoint &offset); | - | ||||||||||||
153 | - | |||||||||||||
154 | void QRasterPlatformPixmap::copy(const QPlatformPixmap *data, const QRect &rect) | - | ||||||||||||
155 | { | - | ||||||||||||
156 | fromImage(data->toImage(rect).copy(), Qt::NoOpaqueDetection); | - | ||||||||||||
157 | } never executed: end of block | 0 | ||||||||||||
158 | - | |||||||||||||
159 | bool QRasterPlatformPixmap::scroll(int dx, int dy, const QRect &rect) | - | ||||||||||||
160 | { | - | ||||||||||||
161 | if (!image.isNull())
| 0 | ||||||||||||
162 | qt_scrollRectInImage(image, rect, QPoint(dx, dy)); never executed: qt_scrollRectInImage(image, rect, QPoint(dx, dy)); | 0 | ||||||||||||
163 | return true; never executed: return true; | 0 | ||||||||||||
164 | } | - | ||||||||||||
165 | - | |||||||||||||
166 | void QRasterPlatformPixmap::fill(const QColor &color) | - | ||||||||||||
167 | { | - | ||||||||||||
168 | uint pixel; | - | ||||||||||||
169 | - | |||||||||||||
170 | if (image.depth() == 1) {
| 0 | ||||||||||||
171 | int gray = qGray(color.rgba()); | - | ||||||||||||
172 | // Pick the best approximate color in the image's colortable. | - | ||||||||||||
173 | if (qAbs(qGray(image.color(0)) - gray) < qAbs(qGray(image.color(1)) - gray))
| 0 | ||||||||||||
174 | pixel = 0; never executed: pixel = 0; | 0 | ||||||||||||
175 | else | - | ||||||||||||
176 | pixel = 1; never executed: pixel = 1; | 0 | ||||||||||||
177 | } else if (image.depth() >= 15) {
| 0 | ||||||||||||
178 | int alpha = color.alpha(); | - | ||||||||||||
179 | if (alpha != 255) {
| 0 | ||||||||||||
180 | if (!image.hasAlphaChannel()) {
| 0 | ||||||||||||
181 | QImage::Format toFormat = qt_alphaVersionForPainting(image.format()); | - | ||||||||||||
182 | if (!image.isNull() && qt_depthForFormat(image.format()) == qt_depthForFormat(toFormat)) {
| 0 | ||||||||||||
183 | image.detach(); | - | ||||||||||||
184 | image.d->format = toFormat; | - | ||||||||||||
185 | } else { never executed: end of block | 0 | ||||||||||||
186 | image = QImage(image.width(), image.height(), toFormat); | - | ||||||||||||
187 | } never executed: end of block | 0 | ||||||||||||
188 | } | - | ||||||||||||
189 | } never executed: end of block | 0 | ||||||||||||
190 | pixel = qPremultiply(color.rgba()); | - | ||||||||||||
191 | const QPixelLayout *layout = &qPixelLayouts[image.format()]; | - | ||||||||||||
192 | layout->convertFromARGB32PM(&pixel, &pixel, 1, layout, 0); | - | ||||||||||||
193 | } else if (image.format() == QImage::Format_Alpha8) { never executed: end of block
| 0 | ||||||||||||
194 | pixel = qAlpha(color.rgba()); | - | ||||||||||||
195 | } else if (image.format() == QImage::Format_Grayscale8) { never executed: end of block
| 0 | ||||||||||||
196 | pixel = qGray(color.rgba()); | - | ||||||||||||
197 | } else never executed: end of block | 0 | ||||||||||||
198 | { | - | ||||||||||||
199 | pixel = 0; | - | ||||||||||||
200 | // ### what about 8 bit indexed? | - | ||||||||||||
201 | } never executed: end of block | 0 | ||||||||||||
202 | - | |||||||||||||
203 | image.fill(pixel); | - | ||||||||||||
204 | } never executed: end of block | 0 | ||||||||||||
205 | - | |||||||||||||
206 | bool QRasterPlatformPixmap::hasAlphaChannel() const | - | ||||||||||||
207 | { | - | ||||||||||||
208 | return image.hasAlphaChannel(); never executed: return image.hasAlphaChannel(); | 0 | ||||||||||||
209 | } | - | ||||||||||||
210 | - | |||||||||||||
211 | QImage QRasterPlatformPixmap::toImage() const | - | ||||||||||||
212 | { | - | ||||||||||||
213 | if (!image.isNull()) {
| 0 | ||||||||||||
214 | QImageData *data = const_cast<QImage &>(image).data_ptr(); | - | ||||||||||||
215 | if (data->paintEngine && data->paintEngine->isActive()
| 0 | ||||||||||||
216 | && data->paintEngine->paintDevice() == &image)
| 0 | ||||||||||||
217 | { | - | ||||||||||||
218 | return image.copy(); never executed: return image.copy(); | 0 | ||||||||||||
219 | } | - | ||||||||||||
220 | } never executed: end of block | 0 | ||||||||||||
221 | - | |||||||||||||
222 | return image; never executed: return image; | 0 | ||||||||||||
223 | } | - | ||||||||||||
224 | - | |||||||||||||
225 | QImage QRasterPlatformPixmap::toImage(const QRect &rect) const | - | ||||||||||||
226 | { | - | ||||||||||||
227 | if (rect.isNull())
| 0 | ||||||||||||
228 | return image; never executed: return image; | 0 | ||||||||||||
229 | - | |||||||||||||
230 | QRect clipped = rect.intersected(QRect(0, 0, w, h)); | - | ||||||||||||
231 | const uint du = uint(d); | - | ||||||||||||
232 | if ((du % 8 == 0) && (((uint(clipped.x()) * du)) % 32 == 0)) {
| 0 | ||||||||||||
233 | QImage newImage(image.scanLine(clipped.y()) + clipped.x() * (du / 8), | - | ||||||||||||
234 | clipped.width(), clipped.height(), | - | ||||||||||||
235 | image.bytesPerLine(), image.format()); | - | ||||||||||||
236 | newImage.setDevicePixelRatio(image.devicePixelRatio()); | - | ||||||||||||
237 | return newImage; never executed: return newImage; | 0 | ||||||||||||
238 | } else { | - | ||||||||||||
239 | return image.copy(clipped); never executed: return image.copy(clipped); | 0 | ||||||||||||
240 | } | - | ||||||||||||
241 | } | - | ||||||||||||
242 | - | |||||||||||||
243 | QPaintEngine* QRasterPlatformPixmap::paintEngine() const | - | ||||||||||||
244 | { | - | ||||||||||||
245 | return image.paintEngine(); never executed: return image.paintEngine(); | 0 | ||||||||||||
246 | } | - | ||||||||||||
247 | - | |||||||||||||
248 | int QRasterPlatformPixmap::metric(QPaintDevice::PaintDeviceMetric metric) const | - | ||||||||||||
249 | { | - | ||||||||||||
250 | QImageData *d = image.d; | - | ||||||||||||
251 | if (!d)
| 0 | ||||||||||||
252 | return 0; never executed: return 0; | 0 | ||||||||||||
253 | - | |||||||||||||
254 | // override the image dpi with the screen dpi when rendering to a pixmap | - | ||||||||||||
255 | switch (metric) { | - | ||||||||||||
256 | case QPaintDevice::PdmWidth: never executed: case QPaintDevice::PdmWidth: | 0 | ||||||||||||
257 | return w; never executed: return w; | 0 | ||||||||||||
258 | case QPaintDevice::PdmHeight: never executed: case QPaintDevice::PdmHeight: | 0 | ||||||||||||
259 | return h; never executed: return h; | 0 | ||||||||||||
260 | case QPaintDevice::PdmWidthMM: never executed: case QPaintDevice::PdmWidthMM: | 0 | ||||||||||||
261 | return qRound(d->width * 25.4 / qt_defaultDpiX()); never executed: return qRound(d->width * 25.4 / qt_defaultDpiX()); | 0 | ||||||||||||
262 | case QPaintDevice::PdmHeightMM: never executed: case QPaintDevice::PdmHeightMM: | 0 | ||||||||||||
263 | return qRound(d->height * 25.4 / qt_defaultDpiY()); never executed: return qRound(d->height * 25.4 / qt_defaultDpiY()); | 0 | ||||||||||||
264 | case QPaintDevice::PdmNumColors: never executed: case QPaintDevice::PdmNumColors: | 0 | ||||||||||||
265 | return d->colortable.size(); never executed: return d->colortable.size(); | 0 | ||||||||||||
266 | case QPaintDevice::PdmDepth: never executed: case QPaintDevice::PdmDepth: | 0 | ||||||||||||
267 | return this->d; never executed: return this->d; | 0 | ||||||||||||
268 | case QPaintDevice::PdmDpiX: never executed: case QPaintDevice::PdmDpiX: | 0 | ||||||||||||
269 | return qt_defaultDpiX(); never executed: return qt_defaultDpiX(); | 0 | ||||||||||||
270 | case QPaintDevice::PdmPhysicalDpiX: never executed: case QPaintDevice::PdmPhysicalDpiX: | 0 | ||||||||||||
271 | return qt_defaultDpiX(); never executed: return qt_defaultDpiX(); | 0 | ||||||||||||
272 | case QPaintDevice::PdmDpiY: never executed: case QPaintDevice::PdmDpiY: | 0 | ||||||||||||
273 | return qt_defaultDpiX(); never executed: return qt_defaultDpiX(); | 0 | ||||||||||||
274 | case QPaintDevice::PdmPhysicalDpiY: never executed: case QPaintDevice::PdmPhysicalDpiY: | 0 | ||||||||||||
275 | return qt_defaultDpiY(); never executed: return qt_defaultDpiY(); | 0 | ||||||||||||
276 | case QPaintDevice::PdmDevicePixelRatio: never executed: case QPaintDevice::PdmDevicePixelRatio: | 0 | ||||||||||||
277 | return image.devicePixelRatio(); never executed: return image.devicePixelRatio(); | 0 | ||||||||||||
278 | case QPaintDevice::PdmDevicePixelRatioScaled: never executed: case QPaintDevice::PdmDevicePixelRatioScaled: | 0 | ||||||||||||
279 | return image.devicePixelRatio() * QPaintDevice::devicePixelRatioFScale(); never executed: return image.devicePixelRatio() * QPaintDevice::devicePixelRatioFScale(); | 0 | ||||||||||||
280 | - | |||||||||||||
281 | default: never executed: default: | 0 | ||||||||||||
282 | qWarning("QRasterPlatformPixmap::metric(): Unhandled metric type %d", metric); | - | ||||||||||||
283 | break; never executed: break; | 0 | ||||||||||||
284 | } | - | ||||||||||||
285 | - | |||||||||||||
286 | return 0; never executed: return 0; | 0 | ||||||||||||
287 | } | - | ||||||||||||
288 | - | |||||||||||||
289 | void QRasterPlatformPixmap::createPixmapForImage(QImage &sourceImage, Qt::ImageConversionFlags flags, bool inPlace) | - | ||||||||||||
290 | { | - | ||||||||||||
291 | QImage::Format format; | - | ||||||||||||
292 | if (flags & Qt::NoFormatConversion)
| 0 | ||||||||||||
293 | format = sourceImage.format(); never executed: format = sourceImage.format(); | 0 | ||||||||||||
294 | else | - | ||||||||||||
295 | if (pixelType() == BitmapType) {
| 0 | ||||||||||||
296 | format = QImage::Format_MonoLSB; | - | ||||||||||||
297 | } else { never executed: end of block | 0 | ||||||||||||
298 | if (sourceImage.depth() == 1) {
| 0 | ||||||||||||
299 | format = sourceImage.hasAlphaChannel()
| 0 | ||||||||||||
300 | ? QImage::Format_ARGB32_Premultiplied | - | ||||||||||||
301 | : QImage::Format_RGB32; | - | ||||||||||||
302 | } else { never executed: end of block | 0 | ||||||||||||
303 | QImage::Format opaqueFormat = QNativeImage::systemFormat(); | - | ||||||||||||
304 | QImage::Format alphaFormat = qt_alphaVersionForPainting(opaqueFormat); | - | ||||||||||||
305 | - | |||||||||||||
306 | if (!sourceImage.hasAlphaChannel()) {
| 0 | ||||||||||||
307 | format = opaqueFormat; | - | ||||||||||||
308 | } else if ((flags & Qt::NoOpaqueDetection) == 0 never executed: end of block
| 0 | ||||||||||||
309 | && !const_cast<QImage &>(sourceImage).data_ptr()->checkForAlphaPixels())
| 0 | ||||||||||||
310 | { | - | ||||||||||||
311 | format = opaqueFormat; | - | ||||||||||||
312 | } else { never executed: end of block | 0 | ||||||||||||
313 | format = alphaFormat; | - | ||||||||||||
314 | } never executed: end of block | 0 | ||||||||||||
315 | } | - | ||||||||||||
316 | } | - | ||||||||||||
317 | - | |||||||||||||
318 | // image has alpha format but is really opaque, so try to do a | - | ||||||||||||
319 | // more efficient conversion | - | ||||||||||||
320 | if (format == QImage::Format_RGB32 && (sourceImage.format() == QImage::Format_ARGB32
| 0 | ||||||||||||
321 | || sourceImage.format() == QImage::Format_ARGB32_Premultiplied))
| 0 | ||||||||||||
322 | { | - | ||||||||||||
323 | inPlace = inPlace && sourceImage.isDetached();
| 0 | ||||||||||||
324 | image = sourceImage; | - | ||||||||||||
325 | if (!inPlace)
| 0 | ||||||||||||
326 | image.detach(); never executed: image.detach(); | 0 | ||||||||||||
327 | if (image.d)
| 0 | ||||||||||||
328 | image.d->format = QImage::Format_RGB32; never executed: image.d->format = QImage::Format_RGB32; | 0 | ||||||||||||
329 | } else if (inPlace && sourceImage.d->convertInPlace(format, flags)) { never executed: end of block
| 0 | ||||||||||||
330 | image = sourceImage; | - | ||||||||||||
331 | } else { never executed: end of block | 0 | ||||||||||||
332 | image = sourceImage.convertToFormat(format); | - | ||||||||||||
333 | } never executed: end of block | 0 | ||||||||||||
334 | - | |||||||||||||
335 | if (image.d) {
| 0 | ||||||||||||
336 | w = image.d->width; | - | ||||||||||||
337 | h = image.d->height; | - | ||||||||||||
338 | d = image.d->depth; | - | ||||||||||||
339 | } else { never executed: end of block | 0 | ||||||||||||
340 | w = h = d = 0; | - | ||||||||||||
341 | } never executed: end of block | 0 | ||||||||||||
342 | is_null = (w <= 0 || h <= 0);
| 0 | ||||||||||||
343 | - | |||||||||||||
344 | if (image.d)
| 0 | ||||||||||||
345 | image.d->devicePixelRatio = sourceImage.devicePixelRatio(); never executed: image.d->devicePixelRatio = sourceImage.devicePixelRatio(); | 0 | ||||||||||||
346 | //ensure the pixmap and the image resulting from toImage() have the same cacheKey(); | - | ||||||||||||
347 | setSerialNumber(image.cacheKey() >> 32); | - | ||||||||||||
348 | if (image.d)
| 0 | ||||||||||||
349 | setDetachNumber(image.d->detach_no); never executed: setDetachNumber(image.d->detach_no); | 0 | ||||||||||||
350 | } never executed: end of block | 0 | ||||||||||||
351 | - | |||||||||||||
352 | QImage* QRasterPlatformPixmap::buffer() | - | ||||||||||||
353 | { | - | ||||||||||||
354 | return ℑ never executed: return ℑ | 0 | ||||||||||||
355 | } | - | ||||||||||||
356 | - | |||||||||||||
357 | qreal QRasterPlatformPixmap::devicePixelRatio() const | - | ||||||||||||
358 | { | - | ||||||||||||
359 | return image.devicePixelRatio(); never executed: return image.devicePixelRatio(); | 0 | ||||||||||||
360 | } | - | ||||||||||||
361 | - | |||||||||||||
362 | void QRasterPlatformPixmap::setDevicePixelRatio(qreal scaleFactor) | - | ||||||||||||
363 | { | - | ||||||||||||
364 | image.setDevicePixelRatio(scaleFactor); | - | ||||||||||||
365 | } never executed: end of block | 0 | ||||||||||||
366 | - | |||||||||||||
367 | QT_END_NAMESPACE | - | ||||||||||||
Source code | Switch to Preprocessed file |