| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/gui/image/qpixmap_raster.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||||||||
| 2 | - | |||||||||||||||||||||||||
| 3 | - | |||||||||||||||||||||||||
| 4 | - | |||||||||||||||||||||||||
| 5 | - | |||||||||||||||||||||||||
| 6 | - | |||||||||||||||||||||||||
| 7 | - | |||||||||||||||||||||||||
| 8 | QPixmap qt_toRasterPixmap(const QImage &image) | - | ||||||||||||||||||||||||
| 9 | { | - | ||||||||||||||||||||||||
| 10 | QPlatformPixmap *data = | - | ||||||||||||||||||||||||
| 11 | new QRasterPlatformPixmap(image.depth() == 1 | - | ||||||||||||||||||||||||
| 12 | ? QPlatformPixmap::BitmapType | - | ||||||||||||||||||||||||
| 13 | : QPlatformPixmap::PixmapType); | - | ||||||||||||||||||||||||
| 14 | - | |||||||||||||||||||||||||
| 15 | data->fromImage(image, Qt::AutoColor); | - | ||||||||||||||||||||||||
| 16 | - | |||||||||||||||||||||||||
| 17 | return never executed: QPixmap(data);return QPixmap(data);never executed: return QPixmap(data); | 0 | ||||||||||||||||||||||||
| 18 | } | - | ||||||||||||||||||||||||
| 19 | - | |||||||||||||||||||||||||
| 20 | QPixmap qt_toRasterPixmap(const QPixmap &pixmap) | - | ||||||||||||||||||||||||
| 21 | { | - | ||||||||||||||||||||||||
| 22 | if (pixmap.isNull()
| 0 | ||||||||||||||||||||||||
| 23 | return never executed: QPixmap();return QPixmap();never executed: return QPixmap(); | 0 | ||||||||||||||||||||||||
| 24 | - | |||||||||||||||||||||||||
| 25 | if (QPixmap(pixmap).data_ptr()->classId() == QPlatformPixmap::RasterClass
| 0 | ||||||||||||||||||||||||
| 26 | return never executed: pixmap;return pixmap;never executed: return pixmap; | 0 | ||||||||||||||||||||||||
| 27 | - | |||||||||||||||||||||||||
| 28 | return never executed: qt_toRasterPixmap(pixmap.toImage());return qt_toRasterPixmap(pixmap.toImage());never executed: return qt_toRasterPixmap(pixmap.toImage()); | 0 | ||||||||||||||||||||||||
| 29 | } | - | ||||||||||||||||||||||||
| 30 | - | |||||||||||||||||||||||||
| 31 | QRasterPlatformPixmap::QRasterPlatformPixmap(PixelType type) | - | ||||||||||||||||||||||||
| 32 | : QPlatformPixmap(type, RasterClass) | - | ||||||||||||||||||||||||
| 33 | { | - | ||||||||||||||||||||||||
| 34 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 35 | - | |||||||||||||||||||||||||
| 36 | QRasterPlatformPixmap::~QRasterPlatformPixmap() | - | ||||||||||||||||||||||||
| 37 | { | - | ||||||||||||||||||||||||
| 38 | } | - | ||||||||||||||||||||||||
| 39 | - | |||||||||||||||||||||||||
| 40 | QPlatformPixmap *QRasterPlatformPixmap::createCompatiblePlatformPixmap() const | - | ||||||||||||||||||||||||
| 41 | { | - | ||||||||||||||||||||||||
| 42 | return never executed: new QRasterPlatformPixmap(pixelType());return new QRasterPlatformPixmap(pixelType());never executed: return new QRasterPlatformPixmap(pixelType()); | 0 | ||||||||||||||||||||||||
| 43 | } | - | ||||||||||||||||||||||||
| 44 | - | |||||||||||||||||||||||||
| 45 | void QRasterPlatformPixmap::resize(int width, int height) | - | ||||||||||||||||||||||||
| 46 | { | - | ||||||||||||||||||||||||
| 47 | QImage::Format format; | - | ||||||||||||||||||||||||
| 48 | if (pixelType() == BitmapType
| 0 | ||||||||||||||||||||||||
| 49 | format = QImage::Format_MonoLSB; never executed: format = QImage::Format_MonoLSB; | 0 | ||||||||||||||||||||||||
| 50 | else | - | ||||||||||||||||||||||||
| 51 | format = QNativeImage::systemFormat(); never executed: format = QNativeImage::systemFormat(); | 0 | ||||||||||||||||||||||||
| 52 | - | |||||||||||||||||||||||||
| 53 | image = QImage(width, height, format); | - | ||||||||||||||||||||||||
| 54 | w = width; | - | ||||||||||||||||||||||||
| 55 | h = height; | - | ||||||||||||||||||||||||
| 56 | d = image.depth(); | - | ||||||||||||||||||||||||
| 57 | is_null = (w <= 0
| 0 | ||||||||||||||||||||||||
| 58 | - | |||||||||||||||||||||||||
| 59 | if (pixelType() == BitmapType
| 0 | ||||||||||||||||||||||||
| 60 | image.setColorCount(2); | - | ||||||||||||||||||||||||
| 61 | image.setColor(0, QColor(Qt::color0).rgba()); | - | ||||||||||||||||||||||||
| 62 | image.setColor(1, QColor(Qt::color1).rgba()); | - | ||||||||||||||||||||||||
| 63 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 64 | - | |||||||||||||||||||||||||
| 65 | setSerialNumber(image.cacheKey() >> 32); | - | ||||||||||||||||||||||||
| 66 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 67 | - | |||||||||||||||||||||||||
| 68 | bool QRasterPlatformPixmap::fromData(const uchar *buffer, uint len, const char *format, | - | ||||||||||||||||||||||||
| 69 | Qt::ImageConversionFlags flags) | - | ||||||||||||||||||||||||
| 70 | { | - | ||||||||||||||||||||||||
| 71 | QByteArray a = QByteArray::fromRawData(reinterpret_cast<const char *>(buffer), len); | - | ||||||||||||||||||||||||
| 72 | QBuffer b(&a); | - | ||||||||||||||||||||||||
| 73 | b.open(QIODevice::ReadOnly); | - | ||||||||||||||||||||||||
| 74 | QImage image = QImageReader(&b, format).read(); | - | ||||||||||||||||||||||||
| 75 | if (image.isNull()
| 0 | ||||||||||||||||||||||||
| 76 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||
| 77 | - | |||||||||||||||||||||||||
| 78 | createPixmapForImage(image, flags, true); | - | ||||||||||||||||||||||||
| 79 | return never executed: !isNull();return !isNull();never executed: return !isNull(); | 0 | ||||||||||||||||||||||||
| 80 | } | - | ||||||||||||||||||||||||
| 81 | - | |||||||||||||||||||||||||
| 82 | void QRasterPlatformPixmap::fromImage(const QImage &sourceImage, | - | ||||||||||||||||||||||||
| 83 | Qt::ImageConversionFlags flags) | - | ||||||||||||||||||||||||
| 84 | { | - | ||||||||||||||||||||||||
| 85 | QImage image = sourceImage; | - | ||||||||||||||||||||||||
| 86 | createPixmapForImage(image, flags, false); | - | ||||||||||||||||||||||||
| 87 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 88 | - | |||||||||||||||||||||||||
| 89 | void QRasterPlatformPixmap::fromImageInPlace(QImage &sourceImage, | - | ||||||||||||||||||||||||
| 90 | Qt::ImageConversionFlags flags) | - | ||||||||||||||||||||||||
| 91 | { | - | ||||||||||||||||||||||||
| 92 | createPixmapForImage(sourceImage, flags, true); | - | ||||||||||||||||||||||||
| 93 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 94 | - | |||||||||||||||||||||||||
| 95 | void QRasterPlatformPixmap::fromImageReader(QImageReader *imageReader, | - | ||||||||||||||||||||||||
| 96 | Qt::ImageConversionFlags flags) | - | ||||||||||||||||||||||||
| 97 | { | - | ||||||||||||||||||||||||
| 98 | (void)flags;; | - | ||||||||||||||||||||||||
| 99 | QImage image = imageReader->read(); | - | ||||||||||||||||||||||||
| 100 | if (image.isNull()
| 0 | ||||||||||||||||||||||||
| 101 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 102 | - | |||||||||||||||||||||||||
| 103 | createPixmapForImage(image, flags, true); | - | ||||||||||||||||||||||||
| 104 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 105 | - | |||||||||||||||||||||||||
| 106 | - | |||||||||||||||||||||||||
| 107 | extern void qt_scrollRectInImage(QImage &img, const QRect &rect, const QPoint &offset); | - | ||||||||||||||||||||||||
| 108 | - | |||||||||||||||||||||||||
| 109 | void QRasterPlatformPixmap::copy(const QPlatformPixmap *data, const QRect &rect) | - | ||||||||||||||||||||||||
| 110 | { | - | ||||||||||||||||||||||||
| 111 | fromImage(data->toImage(rect).copy(), Qt::NoOpaqueDetection); | - | ||||||||||||||||||||||||
| 112 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 113 | - | |||||||||||||||||||||||||
| 114 | bool QRasterPlatformPixmap::scroll(int dx, int dy, const QRect &rect) | - | ||||||||||||||||||||||||
| 115 | { | - | ||||||||||||||||||||||||
| 116 | if (!image.isNull()
| 0 | ||||||||||||||||||||||||
| 117 | qt_scrollRectInImage(image, rect, QPoint(dx, dy)); never executed: qt_scrollRectInImage(image, rect, QPoint(dx, dy)); | 0 | ||||||||||||||||||||||||
| 118 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||
| 119 | } | - | ||||||||||||||||||||||||
| 120 | - | |||||||||||||||||||||||||
| 121 | void QRasterPlatformPixmap::fill(const QColor &color) | - | ||||||||||||||||||||||||
| 122 | { | - | ||||||||||||||||||||||||
| 123 | uint pixel; | - | ||||||||||||||||||||||||
| 124 | - | |||||||||||||||||||||||||
| 125 | if (image.depth() == 1
| 0 | ||||||||||||||||||||||||
| 126 | int gray = qGray(color.rgba()); | - | ||||||||||||||||||||||||
| 127 | - | |||||||||||||||||||||||||
| 128 | if (qAbs(qGray(image.color(0)) - gray) < qAbs(qGray(image.color(1)) - gray)
| 0 | ||||||||||||||||||||||||
| 129 | pixel = 0; never executed: pixel = 0; | 0 | ||||||||||||||||||||||||
| 130 | else | - | ||||||||||||||||||||||||
| 131 | pixel = 1; never executed: pixel = 1; | 0 | ||||||||||||||||||||||||
| 132 | } else if (image.depth() >= 15
| 0 | ||||||||||||||||||||||||
| 133 | int alpha = color.alpha(); | - | ||||||||||||||||||||||||
| 134 | if (alpha != 255
| 0 | ||||||||||||||||||||||||
| 135 | if (!image.hasAlphaChannel()
| 0 | ||||||||||||||||||||||||
| 136 | QImage::Format toFormat = qt_alphaVersionForPainting(image.format()); | - | ||||||||||||||||||||||||
| 137 | if (!image.isNull()
| 0 | ||||||||||||||||||||||||
| 138 | image.detach(); | - | ||||||||||||||||||||||||
| 139 | image.d->format = toFormat; | - | ||||||||||||||||||||||||
| 140 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 141 | image = QImage(image.width(), image.height(), toFormat); | - | ||||||||||||||||||||||||
| 142 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 143 | } | - | ||||||||||||||||||||||||
| 144 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 145 | pixel = qPremultiply(color.rgba()); | - | ||||||||||||||||||||||||
| 146 | const QPixelLayout *layout = &qPixelLayouts[image.format()]; | - | ||||||||||||||||||||||||
| 147 | layout->convertFromARGB32PM(&pixel, &pixel, 1, layout, 0); | - | ||||||||||||||||||||||||
| 148 | } never executed: else if (image.format() == QImage::Format_Alpha8end of block
| 0 | ||||||||||||||||||||||||
| 149 | pixel = qAlpha(color.rgba()); | - | ||||||||||||||||||||||||
| 150 | } never executed: else if (image.format() == QImage::Format_Grayscale8end of block
| 0 | ||||||||||||||||||||||||
| 151 | pixel = qGray(color.rgba()); | - | ||||||||||||||||||||||||
| 152 | } never executed: elseend of block | 0 | ||||||||||||||||||||||||
| 153 | { | - | ||||||||||||||||||||||||
| 154 | pixel = 0; | - | ||||||||||||||||||||||||
| 155 | - | |||||||||||||||||||||||||
| 156 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 157 | - | |||||||||||||||||||||||||
| 158 | image.fill(pixel); | - | ||||||||||||||||||||||||
| 159 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 160 | - | |||||||||||||||||||||||||
| 161 | bool QRasterPlatformPixmap::hasAlphaChannel() const | - | ||||||||||||||||||||||||
| 162 | { | - | ||||||||||||||||||||||||
| 163 | return never executed: image.hasAlphaChannel();return image.hasAlphaChannel();never executed: return image.hasAlphaChannel(); | 0 | ||||||||||||||||||||||||
| 164 | } | - | ||||||||||||||||||||||||
| 165 | - | |||||||||||||||||||||||||
| 166 | QImage QRasterPlatformPixmap::toImage() const | - | ||||||||||||||||||||||||
| 167 | { | - | ||||||||||||||||||||||||
| 168 | if (!image.isNull()
| 0 | ||||||||||||||||||||||||
| 169 | QImageData *data = const_cast<QImage &>(image).data_ptr(); | - | ||||||||||||||||||||||||
| 170 | if (data->paintEngine
| 0 | ||||||||||||||||||||||||
| 171 | && data->paintEngine->paintDevice() == &image
| 0 | ||||||||||||||||||||||||
| 172 | { | - | ||||||||||||||||||||||||
| 173 | return never executed: image.copy();return image.copy();never executed: return image.copy(); | 0 | ||||||||||||||||||||||||
| 174 | } | - | ||||||||||||||||||||||||
| 175 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 176 | - | |||||||||||||||||||||||||
| 177 | return never executed: image;return image;never executed: return image; | 0 | ||||||||||||||||||||||||
| 178 | } | - | ||||||||||||||||||||||||
| 179 | - | |||||||||||||||||||||||||
| 180 | QImage QRasterPlatformPixmap::toImage(const QRect &rect) const | - | ||||||||||||||||||||||||
| 181 | { | - | ||||||||||||||||||||||||
| 182 | if (rect.isNull()
| 0 | ||||||||||||||||||||||||
| 183 | return never executed: image;return image;never executed: return image; | 0 | ||||||||||||||||||||||||
| 184 | - | |||||||||||||||||||||||||
| 185 | QRect clipped = rect.intersected(QRect(0, 0, w, h)); | - | ||||||||||||||||||||||||
| 186 | const uint du = uint(d); | - | ||||||||||||||||||||||||
| 187 | if ((
| 0 | ||||||||||||||||||||||||
| 188 | QImage newImage(image.scanLine(clipped.y()) + clipped.x() * (du / 8), | - | ||||||||||||||||||||||||
| 189 | clipped.width(), clipped.height(), | - | ||||||||||||||||||||||||
| 190 | image.bytesPerLine(), image.format()); | - | ||||||||||||||||||||||||
| 191 | newImage.setDevicePixelRatio(image.devicePixelRatio()); | - | ||||||||||||||||||||||||
| 192 | return never executed: newImage;return newImage;never executed: return newImage; | 0 | ||||||||||||||||||||||||
| 193 | } else { | - | ||||||||||||||||||||||||
| 194 | return never executed: image.copy(clipped);return image.copy(clipped);never executed: return image.copy(clipped); | 0 | ||||||||||||||||||||||||
| 195 | } | - | ||||||||||||||||||||||||
| 196 | } | - | ||||||||||||||||||||||||
| 197 | - | |||||||||||||||||||||||||
| 198 | QPaintEngine* QRasterPlatformPixmap::paintEngine() const | - | ||||||||||||||||||||||||
| 199 | { | - | ||||||||||||||||||||||||
| 200 | return never executed: image.paintEngine();return image.paintEngine();never executed: return image.paintEngine(); | 0 | ||||||||||||||||||||||||
| 201 | } | - | ||||||||||||||||||||||||
| 202 | - | |||||||||||||||||||||||||
| 203 | int QRasterPlatformPixmap::metric(QPaintDevice::PaintDeviceMetric metric) const | - | ||||||||||||||||||||||||
| 204 | { | - | ||||||||||||||||||||||||
| 205 | QImageData *d = image.d; | - | ||||||||||||||||||||||||
| 206 | if (!d
| 0 | ||||||||||||||||||||||||
| 207 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 208 | - | |||||||||||||||||||||||||
| 209 | - | |||||||||||||||||||||||||
| 210 | switch (metric) { | - | ||||||||||||||||||||||||
| 211 | case never executed: QPaintDevice::PdmWidth:case QPaintDevice::PdmWidth:never executed: case QPaintDevice::PdmWidth: | 0 | ||||||||||||||||||||||||
| 212 | return never executed: w;return w;never executed: return w; | 0 | ||||||||||||||||||||||||
| 213 | case never executed: QPaintDevice::PdmHeight:case QPaintDevice::PdmHeight:never executed: case QPaintDevice::PdmHeight: | 0 | ||||||||||||||||||||||||
| 214 | return never executed: h;return h;never executed: return h; | 0 | ||||||||||||||||||||||||
| 215 | case never executed: QPaintDevice::PdmWidthMM:case QPaintDevice::PdmWidthMM:never executed: case QPaintDevice::PdmWidthMM: | 0 | ||||||||||||||||||||||||
| 216 | return never executed: qRound(d->width * 25.4 / qt_defaultDpiX());return qRound(d->width * 25.4 / qt_defaultDpiX());never executed: return qRound(d->width * 25.4 / qt_defaultDpiX()); | 0 | ||||||||||||||||||||||||
| 217 | case never executed: QPaintDevice::PdmHeightMM:case QPaintDevice::PdmHeightMM:never executed: case QPaintDevice::PdmHeightMM: | 0 | ||||||||||||||||||||||||
| 218 | return never executed: qRound(d->height * 25.4 / qt_defaultDpiY());return qRound(d->height * 25.4 / qt_defaultDpiY());never executed: return qRound(d->height * 25.4 / qt_defaultDpiY()); | 0 | ||||||||||||||||||||||||
| 219 | case never executed: QPaintDevice::PdmNumColors:case QPaintDevice::PdmNumColors:never executed: case QPaintDevice::PdmNumColors: | 0 | ||||||||||||||||||||||||
| 220 | return never executed: d->colortable.size();return d->colortable.size();never executed: return d->colortable.size(); | 0 | ||||||||||||||||||||||||
| 221 | case never executed: QPaintDevice::PdmDepth:case QPaintDevice::PdmDepth:never executed: case QPaintDevice::PdmDepth: | 0 | ||||||||||||||||||||||||
| 222 | return never executed: this->d;return this->d;never executed: return this->d; | 0 | ||||||||||||||||||||||||
| 223 | case never executed: QPaintDevice::PdmDpiX:case QPaintDevice::PdmDpiX:never executed: case QPaintDevice::PdmDpiX: | 0 | ||||||||||||||||||||||||
| 224 | return never executed: qt_defaultDpiX();return qt_defaultDpiX();never executed: return qt_defaultDpiX(); | 0 | ||||||||||||||||||||||||
| 225 | case never executed: QPaintDevice::PdmPhysicalDpiX:case QPaintDevice::PdmPhysicalDpiX:never executed: case QPaintDevice::PdmPhysicalDpiX: | 0 | ||||||||||||||||||||||||
| 226 | return never executed: qt_defaultDpiX();return qt_defaultDpiX();never executed: return qt_defaultDpiX(); | 0 | ||||||||||||||||||||||||
| 227 | case never executed: QPaintDevice::PdmDpiY:case QPaintDevice::PdmDpiY:never executed: case QPaintDevice::PdmDpiY: | 0 | ||||||||||||||||||||||||
| 228 | return never executed: qt_defaultDpiX();return qt_defaultDpiX();never executed: return qt_defaultDpiX(); | 0 | ||||||||||||||||||||||||
| 229 | case never executed: QPaintDevice::PdmPhysicalDpiY:case QPaintDevice::PdmPhysicalDpiY:never executed: case QPaintDevice::PdmPhysicalDpiY: | 0 | ||||||||||||||||||||||||
| 230 | return never executed: qt_defaultDpiY();return qt_defaultDpiY();never executed: return qt_defaultDpiY(); | 0 | ||||||||||||||||||||||||
| 231 | case never executed: QPaintDevice::PdmDevicePixelRatio:case QPaintDevice::PdmDevicePixelRatio:never executed: case QPaintDevice::PdmDevicePixelRatio: | 0 | ||||||||||||||||||||||||
| 232 | return never executed: image.devicePixelRatio();return image.devicePixelRatio();never executed: return image.devicePixelRatio(); | 0 | ||||||||||||||||||||||||
| 233 | case never executed: QPaintDevice::PdmDevicePixelRatioScaled:case QPaintDevice::PdmDevicePixelRatioScaled:never executed: case QPaintDevice::PdmDevicePixelRatioScaled: | 0 | ||||||||||||||||||||||||
| 234 | return never executed: image.devicePixelRatio() * QPaintDevice::devicePixelRatioFScale();return image.devicePixelRatio() * QPaintDevice::devicePixelRatioFScale();never executed: return image.devicePixelRatio() * QPaintDevice::devicePixelRatioFScale(); | 0 | ||||||||||||||||||||||||
| 235 | - | |||||||||||||||||||||||||
| 236 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||||||||
| 237 | QMessageLogger(__FILE__, 288, __PRETTY_FUNCTION__).warning("QRasterPlatformPixmap::metric(): Unhandled metric type %d", metric); | - | ||||||||||||||||||||||||
| 238 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 239 | } | - | ||||||||||||||||||||||||
| 240 | - | |||||||||||||||||||||||||
| 241 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 242 | } | - | ||||||||||||||||||||||||
| 243 | - | |||||||||||||||||||||||||
| 244 | void QRasterPlatformPixmap::createPixmapForImage(QImage &sourceImage, Qt::ImageConversionFlags flags, bool inPlace) | - | ||||||||||||||||||||||||
| 245 | { | - | ||||||||||||||||||||||||
| 246 | QImage::Format format; | - | ||||||||||||||||||||||||
| 247 | if (flags & Qt::NoFormatConversion
| 0 | ||||||||||||||||||||||||
| 248 | format = sourceImage.format(); never executed: format = sourceImage.format(); | 0 | ||||||||||||||||||||||||
| 249 | else | - | ||||||||||||||||||||||||
| 250 | if (pixelType() == BitmapType
| 0 | ||||||||||||||||||||||||
| 251 | format = QImage::Format_MonoLSB; | - | ||||||||||||||||||||||||
| 252 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 253 | if (sourceImage.depth() == 1
| 0 | ||||||||||||||||||||||||
| 254 | format = sourceImage.hasAlphaChannel()
| 0 | ||||||||||||||||||||||||
| 255 | ? QImage::Format_ARGB32_Premultiplied | - | ||||||||||||||||||||||||
| 256 | : QImage::Format_RGB32; | - | ||||||||||||||||||||||||
| 257 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 258 | QImage::Format opaqueFormat = QNativeImage::systemFormat(); | - | ||||||||||||||||||||||||
| 259 | QImage::Format alphaFormat = qt_alphaVersionForPainting(opaqueFormat); | - | ||||||||||||||||||||||||
| 260 | - | |||||||||||||||||||||||||
| 261 | if (!sourceImage.hasAlphaChannel()
| 0 | ||||||||||||||||||||||||
| 262 | format = opaqueFormat; | - | ||||||||||||||||||||||||
| 263 | } never executed: else if ((end of block
| 0 | ||||||||||||||||||||||||
| 264 | && !const_cast<QImage &>(sourceImage).data_ptr()->checkForAlphaPixels()
| 0 | ||||||||||||||||||||||||
| 265 | { | - | ||||||||||||||||||||||||
| 266 | format = opaqueFormat; | - | ||||||||||||||||||||||||
| 267 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 268 | format = alphaFormat; | - | ||||||||||||||||||||||||
| 269 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 270 | } | - | ||||||||||||||||||||||||
| 271 | } | - | ||||||||||||||||||||||||
| 272 | - | |||||||||||||||||||||||||
| 273 | - | |||||||||||||||||||||||||
| 274 | - | |||||||||||||||||||||||||
| 275 | if (format == QImage::Format_RGB32
| 0 | ||||||||||||||||||||||||
| 276 | || sourceImage.format() == QImage::Format_ARGB32_Premultiplied
| 0 | ||||||||||||||||||||||||
| 277 | { | - | ||||||||||||||||||||||||
| 278 | inPlace = inPlace
| 0 | ||||||||||||||||||||||||
| 279 | image = sourceImage; | - | ||||||||||||||||||||||||
| 280 | if (!inPlace
| 0 | ||||||||||||||||||||||||
| 281 | image.detach(); never executed: image.detach(); | 0 | ||||||||||||||||||||||||
| 282 | if (image.d
| 0 | ||||||||||||||||||||||||
| 283 | image.d->format = QImage::Format_RGB32; never executed: image.d->format = QImage::Format_RGB32; | 0 | ||||||||||||||||||||||||
| 284 | } never executed: else if (inPlaceend of block
| 0 | ||||||||||||||||||||||||
| 285 | image = sourceImage; | - | ||||||||||||||||||||||||
| 286 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 287 | image = sourceImage.convertToFormat(format); | - | ||||||||||||||||||||||||
| 288 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 289 | - | |||||||||||||||||||||||||
| 290 | if (image.d
| 0 | ||||||||||||||||||||||||
| 291 | w = image.d->width; | - | ||||||||||||||||||||||||
| 292 | h = image.d->height; | - | ||||||||||||||||||||||||
| 293 | d = image.d->depth; | - | ||||||||||||||||||||||||
| 294 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 295 | w = h = d = 0; | - | ||||||||||||||||||||||||
| 296 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 297 | is_null = (w <= 0
| 0 | ||||||||||||||||||||||||
| 298 | - | |||||||||||||||||||||||||
| 299 | if (image.d
| 0 | ||||||||||||||||||||||||
| 300 | image.d->devicePixelRatio = sourceImage.devicePixelRatio(); never executed: image.d->devicePixelRatio = sourceImage.devicePixelRatio(); | 0 | ||||||||||||||||||||||||
| 301 | - | |||||||||||||||||||||||||
| 302 | setSerialNumber(image.cacheKey() >> 32); | - | ||||||||||||||||||||||||
| 303 | if (image.d
| 0 | ||||||||||||||||||||||||
| 304 | setDetachNumber(image.d->detach_no); never executed: setDetachNumber(image.d->detach_no); | 0 | ||||||||||||||||||||||||
| 305 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 306 | - | |||||||||||||||||||||||||
| 307 | QImage* QRasterPlatformPixmap::buffer() | - | ||||||||||||||||||||||||
| 308 | { | - | ||||||||||||||||||||||||
| 309 | return never executed: ℑreturn ℑnever executed: return ℑ | 0 | ||||||||||||||||||||||||
| 310 | } | - | ||||||||||||||||||||||||
| 311 | - | |||||||||||||||||||||||||
| 312 | qreal QRasterPlatformPixmap::devicePixelRatio() const | - | ||||||||||||||||||||||||
| 313 | { | - | ||||||||||||||||||||||||
| 314 | return never executed: image.devicePixelRatio();return image.devicePixelRatio();never executed: return image.devicePixelRatio(); | 0 | ||||||||||||||||||||||||
| 315 | } | - | ||||||||||||||||||||||||
| 316 | - | |||||||||||||||||||||||||
| 317 | void QRasterPlatformPixmap::setDevicePixelRatio(qreal scaleFactor) | - | ||||||||||||||||||||||||
| 318 | { | - | ||||||||||||||||||||||||
| 319 | image.setDevicePixelRatio(scaleFactor); | - | ||||||||||||||||||||||||
| 320 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 321 | - | |||||||||||||||||||||||||
| 322 | - | |||||||||||||||||||||||||
| Switch to Source code | Preprocessed file |