| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/gui/image/qpixmap.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||||||||
| 2 | - | |||||||||||||||||||||||||
| 3 | - | |||||||||||||||||||||||||
| 4 | - | |||||||||||||||||||||||||
| 5 | - | |||||||||||||||||||||||||
| 6 | - | |||||||||||||||||||||||||
| 7 | - | |||||||||||||||||||||||||
| 8 | static bool qt_pixmap_thread_test() | - | ||||||||||||||||||||||||
| 9 | { | - | ||||||||||||||||||||||||
| 10 | if (__builtin_expect(!!(!QCoreApplication::instance()), false)
| 0 | ||||||||||||||||||||||||
| 11 | QMessageLogger(__FILE__, 74, __PRETTY_FUNCTION__).fatal("QPixmap: Must construct a QGuiApplication before a QPixmap"); | - | ||||||||||||||||||||||||
| 12 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||
| 13 | } | - | ||||||||||||||||||||||||
| 14 | - | |||||||||||||||||||||||||
| 15 | if ((static_cast<
| 0 | ||||||||||||||||||||||||
| 16 | bool fail = false; | - | ||||||||||||||||||||||||
| 17 | if (!QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::ThreadedPixmaps)
| 0 | ||||||||||||||||||||||||
| 18 | printf("Lighthouse plugin does not support threaded pixmaps!\n"); | - | ||||||||||||||||||||||||
| 19 | fail = true; | - | ||||||||||||||||||||||||
| 20 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 21 | if (fail
| 0 | ||||||||||||||||||||||||
| 22 | QMessageLogger(__FILE__, 85, __PRETTY_FUNCTION__).warning("QPixmap: It is not safe to use pixmaps outside the GUI thread"); | - | ||||||||||||||||||||||||
| 23 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||
| 24 | } | - | ||||||||||||||||||||||||
| 25 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 26 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||
| 27 | } | - | ||||||||||||||||||||||||
| 28 | - | |||||||||||||||||||||||||
| 29 | void QPixmap::doInit(int w, int h, int type) | - | ||||||||||||||||||||||||
| 30 | { | - | ||||||||||||||||||||||||
| 31 | if ((w > 0
| 0 | ||||||||||||||||||||||||
| 32 | data = QPlatformPixmap::create(w, h, (QPlatformPixmap::PixelType) type); never executed: data = QPlatformPixmap::create(w, h, (QPlatformPixmap::PixelType) type); | 0 | ||||||||||||||||||||||||
| 33 | else | - | ||||||||||||||||||||||||
| 34 | data = 0; never executed: data = 0; | 0 | ||||||||||||||||||||||||
| 35 | } | - | ||||||||||||||||||||||||
| 36 | - | |||||||||||||||||||||||||
| 37 | - | |||||||||||||||||||||||||
| 38 | - | |||||||||||||||||||||||||
| 39 | - | |||||||||||||||||||||||||
| 40 | - | |||||||||||||||||||||||||
| 41 | - | |||||||||||||||||||||||||
| 42 | - | |||||||||||||||||||||||||
| 43 | QPixmap::QPixmap() | - | ||||||||||||||||||||||||
| 44 | : QPaintDevice() | - | ||||||||||||||||||||||||
| 45 | { | - | ||||||||||||||||||||||||
| 46 | (void) qt_pixmap_thread_test(); | - | ||||||||||||||||||||||||
| 47 | doInit(0, 0, QPlatformPixmap::PixmapType); | - | ||||||||||||||||||||||||
| 48 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 49 | QPixmap::QPixmap(int w, int h) | - | ||||||||||||||||||||||||
| 50 | : QPaintDevice() | - | ||||||||||||||||||||||||
| 51 | { | - | ||||||||||||||||||||||||
| 52 | if (!qt_pixmap_thread_test()
| 0 | ||||||||||||||||||||||||
| 53 | doInit(0, 0, QPlatformPixmap::PixmapType); never executed: doInit(0, 0, QPlatformPixmap::PixmapType); | 0 | ||||||||||||||||||||||||
| 54 | else | - | ||||||||||||||||||||||||
| 55 | doInit(w, h, QPlatformPixmap::PixmapType); never executed: doInit(w, h, QPlatformPixmap::PixmapType); | 0 | ||||||||||||||||||||||||
| 56 | } | - | ||||||||||||||||||||||||
| 57 | QPixmap::QPixmap(const QSize &size) | - | ||||||||||||||||||||||||
| 58 | : QPaintDevice() | - | ||||||||||||||||||||||||
| 59 | { | - | ||||||||||||||||||||||||
| 60 | if (!qt_pixmap_thread_test()
| 0 | ||||||||||||||||||||||||
| 61 | doInit(0, 0, QPlatformPixmap::PixmapType); never executed: doInit(0, 0, QPlatformPixmap::PixmapType); | 0 | ||||||||||||||||||||||||
| 62 | else | - | ||||||||||||||||||||||||
| 63 | doInit(size.width(), size.height(), QPlatformPixmap::PixmapType); never executed: doInit(size.width(), size.height(), QPlatformPixmap::PixmapType); | 0 | ||||||||||||||||||||||||
| 64 | } | - | ||||||||||||||||||||||||
| 65 | - | |||||||||||||||||||||||||
| 66 | - | |||||||||||||||||||||||||
| 67 | - | |||||||||||||||||||||||||
| 68 | - | |||||||||||||||||||||||||
| 69 | QPixmap::QPixmap(const QSize &s, int type) | - | ||||||||||||||||||||||||
| 70 | { | - | ||||||||||||||||||||||||
| 71 | if (!qt_pixmap_thread_test()
| 0 | ||||||||||||||||||||||||
| 72 | doInit(0, 0, static_cast<QPlatformPixmap::PixelType>(type)); never executed: doInit(0, 0, static_cast<QPlatformPixmap::PixelType>(type)); | 0 | ||||||||||||||||||||||||
| 73 | else | - | ||||||||||||||||||||||||
| 74 | doInit(s.width(), s.height(), static_cast<QPlatformPixmap::PixelType>(type)); never executed: doInit(s.width(), s.height(), static_cast<QPlatformPixmap::PixelType>(type)); | 0 | ||||||||||||||||||||||||
| 75 | } | - | ||||||||||||||||||||||||
| 76 | - | |||||||||||||||||||||||||
| 77 | - | |||||||||||||||||||||||||
| 78 | - | |||||||||||||||||||||||||
| 79 | - | |||||||||||||||||||||||||
| 80 | QPixmap::QPixmap(QPlatformPixmap *d) | - | ||||||||||||||||||||||||
| 81 | : QPaintDevice(), data(d) | - | ||||||||||||||||||||||||
| 82 | { | - | ||||||||||||||||||||||||
| 83 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 84 | QPixmap::QPixmap(const QString& fileName, const char *format, Qt::ImageConversionFlags flags) | - | ||||||||||||||||||||||||
| 85 | : QPaintDevice() | - | ||||||||||||||||||||||||
| 86 | { | - | ||||||||||||||||||||||||
| 87 | doInit(0, 0, QPlatformPixmap::PixmapType); | - | ||||||||||||||||||||||||
| 88 | if (!qt_pixmap_thread_test()
| 0 | ||||||||||||||||||||||||
| 89 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 90 | - | |||||||||||||||||||||||||
| 91 | load(fileName, format, flags); | - | ||||||||||||||||||||||||
| 92 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 93 | - | |||||||||||||||||||||||||
| 94 | - | |||||||||||||||||||||||||
| 95 | - | |||||||||||||||||||||||||
| 96 | - | |||||||||||||||||||||||||
| 97 | - | |||||||||||||||||||||||||
| 98 | - | |||||||||||||||||||||||||
| 99 | - | |||||||||||||||||||||||||
| 100 | QPixmap::QPixmap(const QPixmap &pixmap) | - | ||||||||||||||||||||||||
| 101 | : QPaintDevice() | - | ||||||||||||||||||||||||
| 102 | { | - | ||||||||||||||||||||||||
| 103 | if (!qt_pixmap_thread_test()
| 0 | ||||||||||||||||||||||||
| 104 | doInit(0, 0, QPlatformPixmap::PixmapType); | - | ||||||||||||||||||||||||
| 105 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 106 | } | - | ||||||||||||||||||||||||
| 107 | if (pixmap.paintingActive()
| 0 | ||||||||||||||||||||||||
| 108 | pixmap.copy().swap(*this); | - | ||||||||||||||||||||||||
| 109 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 110 | data = pixmap.data; | - | ||||||||||||||||||||||||
| 111 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 112 | } | - | ||||||||||||||||||||||||
| 113 | QPixmap::QPixmap(const char * const xpm[]) | - | ||||||||||||||||||||||||
| 114 | : QPaintDevice() | - | ||||||||||||||||||||||||
| 115 | { | - | ||||||||||||||||||||||||
| 116 | doInit(0, 0, QPlatformPixmap::PixmapType); | - | ||||||||||||||||||||||||
| 117 | if (!xpm
| 0 | ||||||||||||||||||||||||
| 118 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 119 | - | |||||||||||||||||||||||||
| 120 | QImage image(xpm); | - | ||||||||||||||||||||||||
| 121 | if (!image.isNull()
| 0 | ||||||||||||||||||||||||
| 122 | if (data
| 0 | ||||||||||||||||||||||||
| 123 | * never executed: this = QBitmap::fromImage(image);*this = QBitmap::fromImage(image);never executed: *this = QBitmap::fromImage(image); | 0 | ||||||||||||||||||||||||
| 124 | else | - | ||||||||||||||||||||||||
| 125 | * never executed: this = fromImage(image);*this = fromImage(image);never executed: *this = fromImage(image); | 0 | ||||||||||||||||||||||||
| 126 | } | - | ||||||||||||||||||||||||
| 127 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 128 | - | |||||||||||||||||||||||||
| 129 | - | |||||||||||||||||||||||||
| 130 | - | |||||||||||||||||||||||||
| 131 | - | |||||||||||||||||||||||||
| 132 | - | |||||||||||||||||||||||||
| 133 | - | |||||||||||||||||||||||||
| 134 | - | |||||||||||||||||||||||||
| 135 | QPixmap::~QPixmap() | - | ||||||||||||||||||||||||
| 136 | { | - | ||||||||||||||||||||||||
| 137 | ((!(!data || data->ref.load() >= 1)) ? qt_assert("!data || data->ref.load() >= 1",__FILE__,273) : qt_noop()); | - | ||||||||||||||||||||||||
| 138 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 139 | - | |||||||||||||||||||||||||
| 140 | - | |||||||||||||||||||||||||
| 141 | - | |||||||||||||||||||||||||
| 142 | - | |||||||||||||||||||||||||
| 143 | int QPixmap::devType() const | - | ||||||||||||||||||||||||
| 144 | { | - | ||||||||||||||||||||||||
| 145 | return never executed: QInternal::Pixmap;return QInternal::Pixmap;never executed: return QInternal::Pixmap; | 0 | ||||||||||||||||||||||||
| 146 | } | - | ||||||||||||||||||||||||
| 147 | QPixmap QPixmap::copy(const QRect &rect) const | - | ||||||||||||||||||||||||
| 148 | { | - | ||||||||||||||||||||||||
| 149 | if (isNull()
| 0 | ||||||||||||||||||||||||
| 150 | return never executed: QPixmap();return QPixmap();never executed: return QPixmap(); | 0 | ||||||||||||||||||||||||
| 151 | - | |||||||||||||||||||||||||
| 152 | QRect r(0, 0, width(), height()); | - | ||||||||||||||||||||||||
| 153 | if (!rect.isEmpty()
| 0 | ||||||||||||||||||||||||
| 154 | r = r.intersected(rect); never executed: r = r.intersected(rect); | 0 | ||||||||||||||||||||||||
| 155 | - | |||||||||||||||||||||||||
| 156 | QPlatformPixmap *d = data->createCompatiblePlatformPixmap(); | - | ||||||||||||||||||||||||
| 157 | d->copy(data.data(), r); | - | ||||||||||||||||||||||||
| 158 | return never executed: QPixmap(d);return QPixmap(d);never executed: return QPixmap(d); | 0 | ||||||||||||||||||||||||
| 159 | } | - | ||||||||||||||||||||||||
| 160 | void QPixmap::scroll(int dx, int dy, const QRect &rect, QRegion *exposed) | - | ||||||||||||||||||||||||
| 161 | { | - | ||||||||||||||||||||||||
| 162 | if (isNull()
| 0 | ||||||||||||||||||||||||
| 163 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 164 | QRect dest = rect & this->rect(); | - | ||||||||||||||||||||||||
| 165 | QRect src = dest.translated(-dx, -dy) & dest; | - | ||||||||||||||||||||||||
| 166 | if (src.isEmpty()
| 0 | ||||||||||||||||||||||||
| 167 | if (exposed
| 0 | ||||||||||||||||||||||||
| 168 | * never executed: exposed += dest;*exposed += dest;never executed: *exposed += dest; | 0 | ||||||||||||||||||||||||
| 169 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 170 | } | - | ||||||||||||||||||||||||
| 171 | - | |||||||||||||||||||||||||
| 172 | detach(); | - | ||||||||||||||||||||||||
| 173 | - | |||||||||||||||||||||||||
| 174 | if (!data->scroll(dx, dy, src)
| 0 | ||||||||||||||||||||||||
| 175 | - | |||||||||||||||||||||||||
| 176 | QPixmap pix = *this; | - | ||||||||||||||||||||||||
| 177 | QPainter painter(&pix); | - | ||||||||||||||||||||||||
| 178 | painter.setCompositionMode(QPainter::CompositionMode_Source); | - | ||||||||||||||||||||||||
| 179 | painter.drawPixmap(src.translated(dx, dy), *this, src); | - | ||||||||||||||||||||||||
| 180 | painter.end(); | - | ||||||||||||||||||||||||
| 181 | *this = pix; | - | ||||||||||||||||||||||||
| 182 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 183 | - | |||||||||||||||||||||||||
| 184 | if (exposed
| 0 | ||||||||||||||||||||||||
| 185 | *exposed += dest; | - | ||||||||||||||||||||||||
| 186 | *exposed -= src.translated(dx, dy); | - | ||||||||||||||||||||||||
| 187 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 188 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 189 | QPixmap &QPixmap::operator=(const QPixmap &pixmap) | - | ||||||||||||||||||||||||
| 190 | { | - | ||||||||||||||||||||||||
| 191 | if (paintingActive()
| 0 | ||||||||||||||||||||||||
| 192 | QMessageLogger(__FILE__, 381, __PRETTY_FUNCTION__).warning("QPixmap::operator=: Cannot assign to pixmap during painting"); | - | ||||||||||||||||||||||||
| 193 | return never executed: *this;return *this;never executed: return *this; | 0 | ||||||||||||||||||||||||
| 194 | } | - | ||||||||||||||||||||||||
| 195 | if (pixmap.paintingActive()
| 0 | ||||||||||||||||||||||||
| 196 | pixmap.copy().swap(*this); | - | ||||||||||||||||||||||||
| 197 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 198 | data = pixmap.data; | - | ||||||||||||||||||||||||
| 199 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 200 | return never executed: *this;return *this;never executed: return *this; | 0 | ||||||||||||||||||||||||
| 201 | } | - | ||||||||||||||||||||||||
| 202 | QPixmap::operator QVariant() const | - | ||||||||||||||||||||||||
| 203 | { | - | ||||||||||||||||||||||||
| 204 | return never executed: QVariant(QVariant::Pixmap, this);return QVariant(QVariant::Pixmap, this);never executed: return QVariant(QVariant::Pixmap, this); | 0 | ||||||||||||||||||||||||
| 205 | } | - | ||||||||||||||||||||||||
| 206 | QImage QPixmap::toImage() const | - | ||||||||||||||||||||||||
| 207 | { | - | ||||||||||||||||||||||||
| 208 | if (isNull()
| 0 | ||||||||||||||||||||||||
| 209 | return never executed: QImage();return QImage();never executed: return QImage(); | 0 | ||||||||||||||||||||||||
| 210 | - | |||||||||||||||||||||||||
| 211 | return never executed: data->toImage();return data->toImage();never executed: return data->toImage(); | 0 | ||||||||||||||||||||||||
| 212 | } | - | ||||||||||||||||||||||||
| 213 | QTransform QPixmap::trueMatrix(const QTransform &m, int w, int h) | - | ||||||||||||||||||||||||
| 214 | { | - | ||||||||||||||||||||||||
| 215 | return never executed: QImage::trueMatrix(m, w, h);return QImage::trueMatrix(m, w, h);never executed: return QImage::trueMatrix(m, w, h); | 0 | ||||||||||||||||||||||||
| 216 | } | - | ||||||||||||||||||||||||
| 217 | QMatrix QPixmap::trueMatrix(const QMatrix &m, int w, int h) | - | ||||||||||||||||||||||||
| 218 | { | - | ||||||||||||||||||||||||
| 219 | return never executed: trueMatrix(QTransform(m), w, h).toAffine();return trueMatrix(QTransform(m), w, h).toAffine();never executed: return trueMatrix(QTransform(m), w, h).toAffine(); | 0 | ||||||||||||||||||||||||
| 220 | } | - | ||||||||||||||||||||||||
| 221 | bool QPixmap::isQBitmap() const | - | ||||||||||||||||||||||||
| 222 | { | - | ||||||||||||||||||||||||
| 223 | return never executed: data && data->type == QPlatformPixmap::BitmapType;return data && data->type == QPlatformPixmap::BitmapType;never executed: return data && data->type == QPlatformPixmap::BitmapType; | 0 | ||||||||||||||||||||||||
| 224 | } | - | ||||||||||||||||||||||||
| 225 | bool QPixmap::isNull() const | - | ||||||||||||||||||||||||
| 226 | { | - | ||||||||||||||||||||||||
| 227 | return never executed: !data || data->isNull();return !data || data->isNull();never executed: return !data || data->isNull(); | 0 | ||||||||||||||||||||||||
| 228 | } | - | ||||||||||||||||||||||||
| 229 | int QPixmap::width() const | - | ||||||||||||||||||||||||
| 230 | { | - | ||||||||||||||||||||||||
| 231 | return never executed: data ? data->width() : 0;return data ? data->width() : 0;never executed: return data ? data->width() : 0; | 0 | ||||||||||||||||||||||||
| 232 | } | - | ||||||||||||||||||||||||
| 233 | int QPixmap::height() const | - | ||||||||||||||||||||||||
| 234 | { | - | ||||||||||||||||||||||||
| 235 | return never executed: data ? data->height() : 0;return data ? data->height() : 0;never executed: return data ? data->height() : 0; | 0 | ||||||||||||||||||||||||
| 236 | } | - | ||||||||||||||||||||||||
| 237 | QSize QPixmap::size() const | - | ||||||||||||||||||||||||
| 238 | { | - | ||||||||||||||||||||||||
| 239 | return never executed: data ? QSize(data->width(), data->height()) : QSize(0, 0);return data ? QSize(data->width(), data->height()) : QSize(0, 0);never executed: return data ? QSize(data->width(), data->height()) : QSize(0, 0); | 0 | ||||||||||||||||||||||||
| 240 | } | - | ||||||||||||||||||||||||
| 241 | QRect QPixmap::rect() const | - | ||||||||||||||||||||||||
| 242 | { | - | ||||||||||||||||||||||||
| 243 | return never executed: data ? QRect(0, 0, data->width(), data->height()) : QRect();return data ? QRect(0, 0, data->width(), data->height()) : QRect();never executed: return data ? QRect(0, 0, data->width(), data->height()) : QRect(); | 0 | ||||||||||||||||||||||||
| 244 | } | - | ||||||||||||||||||||||||
| 245 | int QPixmap::depth() const | - | ||||||||||||||||||||||||
| 246 | { | - | ||||||||||||||||||||||||
| 247 | return never executed: data ? data->depth() : 0;return data ? data->depth() : 0;never executed: return data ? data->depth() : 0; | 0 | ||||||||||||||||||||||||
| 248 | } | - | ||||||||||||||||||||||||
| 249 | void QPixmap::setMask(const QBitmap &mask) | - | ||||||||||||||||||||||||
| 250 | { | - | ||||||||||||||||||||||||
| 251 | if (paintingActive()
| 0 | ||||||||||||||||||||||||
| 252 | QMessageLogger(__FILE__, 591, __PRETTY_FUNCTION__).warning("QPixmap::setMask: Cannot set mask while pixmap is being painted on"); | - | ||||||||||||||||||||||||
| 253 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 254 | } | - | ||||||||||||||||||||||||
| 255 | - | |||||||||||||||||||||||||
| 256 | if (!mask.isNull()
| 0 | ||||||||||||||||||||||||
| 257 | QMessageLogger(__FILE__, 596, __PRETTY_FUNCTION__).warning("QPixmap::setMask() mask size differs from pixmap size"); | - | ||||||||||||||||||||||||
| 258 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 259 | } | - | ||||||||||||||||||||||||
| 260 | - | |||||||||||||||||||||||||
| 261 | if (isNull()
| 0 | ||||||||||||||||||||||||
| 262 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 263 | - | |||||||||||||||||||||||||
| 264 | if (static_cast<const
| 0 | ||||||||||||||||||||||||
| 265 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 266 | - | |||||||||||||||||||||||||
| 267 | detach(); | - | ||||||||||||||||||||||||
| 268 | - | |||||||||||||||||||||||||
| 269 | QImage image = data->toImage(); | - | ||||||||||||||||||||||||
| 270 | if (mask.size().isEmpty()
| 0 | ||||||||||||||||||||||||
| 271 | if (image.depth() != 1
| 0 | ||||||||||||||||||||||||
| 272 | image = image.convertToFormat(QImage::Format_RGB32); | - | ||||||||||||||||||||||||
| 273 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 274 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 275 | const int w = image.width(); | - | ||||||||||||||||||||||||
| 276 | const int h = image.height(); | - | ||||||||||||||||||||||||
| 277 | - | |||||||||||||||||||||||||
| 278 | switch (image.depth()) { | - | ||||||||||||||||||||||||
| 279 | case never executed: 1:case 1:never executed: {case 1: | 0 | ||||||||||||||||||||||||
| 280 | const QImage imageMask = mask.toImage().convertToFormat(image.format()); | - | ||||||||||||||||||||||||
| 281 | for (int y = 0; y < h
| 0 | ||||||||||||||||||||||||
| 282 | const uchar *mscan = imageMask.scanLine(y); | - | ||||||||||||||||||||||||
| 283 | uchar *tscan = image.scanLine(y); | - | ||||||||||||||||||||||||
| 284 | int bytesPerLine = image.bytesPerLine(); | - | ||||||||||||||||||||||||
| 285 | for (int i = 0; i < bytesPerLine
| 0 | ||||||||||||||||||||||||
| 286 | tscan[i] &= mscan[i]; never executed: tscan[i] &= mscan[i]; | 0 | ||||||||||||||||||||||||
| 287 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 288 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 289 | } | - | ||||||||||||||||||||||||
| 290 | default never executed: :default:never executed: {default: | 0 | ||||||||||||||||||||||||
| 291 | const QImage imageMask = mask.toImage().convertToFormat(QImage::Format_MonoLSB); | - | ||||||||||||||||||||||||
| 292 | image = image.convertToFormat(QImage::Format_ARGB32_Premultiplied); | - | ||||||||||||||||||||||||
| 293 | for (int y = 0; y < h
| 0 | ||||||||||||||||||||||||
| 294 | const uchar *mscan = imageMask.scanLine(y); | - | ||||||||||||||||||||||||
| 295 | QRgb *tscan = (QRgb *)image.scanLine(y); | - | ||||||||||||||||||||||||
| 296 | for (int x = 0; x < w
| 0 | ||||||||||||||||||||||||
| 297 | if (!(mscan[x>>3] & (1 << (x&7)))
| 0 | ||||||||||||||||||||||||
| 298 | tscan[x] = 0; never executed: tscan[x] = 0; | 0 | ||||||||||||||||||||||||
| 299 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 300 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 301 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 302 | } | - | ||||||||||||||||||||||||
| 303 | } | - | ||||||||||||||||||||||||
| 304 | } | - | ||||||||||||||||||||||||
| 305 | data->fromImage(image, Qt::AutoColor); | - | ||||||||||||||||||||||||
| 306 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 307 | qreal QPixmap::devicePixelRatio() const | - | ||||||||||||||||||||||||
| 308 | { | - | ||||||||||||||||||||||||
| 309 | if (!data
| 0 | ||||||||||||||||||||||||
| 310 | return never executed: qreal(1.0);return qreal(1.0);never executed: return qreal(1.0); | 0 | ||||||||||||||||||||||||
| 311 | return never executed: data->devicePixelRatio();return data->devicePixelRatio();never executed: return data->devicePixelRatio(); | 0 | ||||||||||||||||||||||||
| 312 | } | - | ||||||||||||||||||||||||
| 313 | void QPixmap::setDevicePixelRatio(qreal scaleFactor) | - | ||||||||||||||||||||||||
| 314 | { | - | ||||||||||||||||||||||||
| 315 | if (isNull()
| 0 | ||||||||||||||||||||||||
| 316 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 317 | - | |||||||||||||||||||||||||
| 318 | if (scaleFactor == data->devicePixelRatio()
| 0 | ||||||||||||||||||||||||
| 319 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 320 | - | |||||||||||||||||||||||||
| 321 | detach(); | - | ||||||||||||||||||||||||
| 322 | data->setDevicePixelRatio(scaleFactor); | - | ||||||||||||||||||||||||
| 323 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 324 | QBitmap QPixmap::createHeuristicMask(bool clipTight) const | - | ||||||||||||||||||||||||
| 325 | { | - | ||||||||||||||||||||||||
| 326 | QBitmap m = QBitmap::fromImage(toImage().createHeuristicMask(clipTight)); | - | ||||||||||||||||||||||||
| 327 | return never executed: m;return m;never executed: return m; | 0 | ||||||||||||||||||||||||
| 328 | } | - | ||||||||||||||||||||||||
| 329 | QBitmap QPixmap::createMaskFromColor(const QColor &maskColor, Qt::MaskMode mode) const | - | ||||||||||||||||||||||||
| 330 | { | - | ||||||||||||||||||||||||
| 331 | QImage image = toImage().convertToFormat(QImage::Format_ARGB32); | - | ||||||||||||||||||||||||
| 332 | return never executed: QBitmap::fromImage(image.createMaskFromColor(maskColor.rgba(), mode));return QBitmap::fromImage(image.createMaskFromColor(maskColor.rgba(), mode));never executed: return QBitmap::fromImage(image.createMaskFromColor(maskColor.rgba(), mode)); | 0 | ||||||||||||||||||||||||
| 333 | } | - | ||||||||||||||||||||||||
| 334 | bool QPixmap::load(const QString &fileName, const char *format, Qt::ImageConversionFlags flags) | - | ||||||||||||||||||||||||
| 335 | { | - | ||||||||||||||||||||||||
| 336 | if (!fileName.isEmpty()
| 0 | ||||||||||||||||||||||||
| 337 | - | |||||||||||||||||||||||||
| 338 | QFileInfo info(fileName); | - | ||||||||||||||||||||||||
| 339 | - | |||||||||||||||||||||||||
| 340 | - | |||||||||||||||||||||||||
| 341 | if (info.completeSuffix().isEmpty()
| 0 | ||||||||||||||||||||||||
| 342 | - | |||||||||||||||||||||||||
| 343 | QString key = QLatin1String("qt_pixmap") | - | ||||||||||||||||||||||||
| 344 | % info.absoluteFilePath() | - | ||||||||||||||||||||||||
| 345 | % HexString<uint>(info.lastModified().toTime_t()) | - | ||||||||||||||||||||||||
| 346 | % HexString<quint64>(info.size()) | - | ||||||||||||||||||||||||
| 347 | % HexString<uint>(data ? data->pixelType() : QPlatformPixmap::PixmapType); | - | ||||||||||||||||||||||||
| 348 | - | |||||||||||||||||||||||||
| 349 | if (QPixmapCache::find(key, this)
| 0 | ||||||||||||||||||||||||
| 350 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||
| 351 | - | |||||||||||||||||||||||||
| 352 | data = QPlatformPixmap::create(0, 0, data ? data->pixelType() : QPlatformPixmap::PixmapType); | - | ||||||||||||||||||||||||
| 353 | - | |||||||||||||||||||||||||
| 354 | if (data->fromFile(fileName, format, flags)
| 0 | ||||||||||||||||||||||||
| 355 | QPixmapCache::insert(key, *this); | - | ||||||||||||||||||||||||
| 356 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||
| 357 | } | - | ||||||||||||||||||||||||
| 358 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 359 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 360 | - | |||||||||||||||||||||||||
| 361 | if (!isNull()
| 0 | ||||||||||||||||||||||||
| 362 | if (isQBitmap()
| 0 | ||||||||||||||||||||||||
| 363 | * never executed: this = QBitmap();*this = QBitmap();never executed: *this = QBitmap(); | 0 | ||||||||||||||||||||||||
| 364 | else | - | ||||||||||||||||||||||||
| 365 | data.reset(); never executed: data.reset(); | 0 | ||||||||||||||||||||||||
| 366 | } | - | ||||||||||||||||||||||||
| 367 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||
| 368 | } | - | ||||||||||||||||||||||||
| 369 | bool QPixmap::loadFromData(const uchar *buf, uint len, const char *format, Qt::ImageConversionFlags flags) | - | ||||||||||||||||||||||||
| 370 | { | - | ||||||||||||||||||||||||
| 371 | if (len == 0
| 0 | ||||||||||||||||||||||||
| 372 | data.reset(); | - | ||||||||||||||||||||||||
| 373 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||
| 374 | } | - | ||||||||||||||||||||||||
| 375 | - | |||||||||||||||||||||||||
| 376 | data = QPlatformPixmap::create(0, 0, QPlatformPixmap::PixmapType); | - | ||||||||||||||||||||||||
| 377 | - | |||||||||||||||||||||||||
| 378 | if (data->fromData(buf, len, format, flags)
| 0 | ||||||||||||||||||||||||
| 379 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||
| 380 | - | |||||||||||||||||||||||||
| 381 | data.reset(); | - | ||||||||||||||||||||||||
| 382 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||
| 383 | } | - | ||||||||||||||||||||||||
| 384 | bool QPixmap::save(const QString &fileName, const char *format, int quality) const | - | ||||||||||||||||||||||||
| 385 | { | - | ||||||||||||||||||||||||
| 386 | if (isNull()
| 0 | ||||||||||||||||||||||||
| 387 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||
| 388 | QImageWriter writer(fileName, format); | - | ||||||||||||||||||||||||
| 389 | return never executed: doImageIO(&writer, quality);return doImageIO(&writer, quality);never executed: return doImageIO(&writer, quality); | 0 | ||||||||||||||||||||||||
| 390 | } | - | ||||||||||||||||||||||||
| 391 | bool QPixmap::save(QIODevice* device, const char* format, int quality) const | - | ||||||||||||||||||||||||
| 392 | { | - | ||||||||||||||||||||||||
| 393 | if (isNull()
| 0 | ||||||||||||||||||||||||
| 394 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||
| 395 | QImageWriter writer(device, format); | - | ||||||||||||||||||||||||
| 396 | return never executed: doImageIO(&writer, quality);return doImageIO(&writer, quality);never executed: return doImageIO(&writer, quality); | 0 | ||||||||||||||||||||||||
| 397 | } | - | ||||||||||||||||||||||||
| 398 | - | |||||||||||||||||||||||||
| 399 | - | |||||||||||||||||||||||||
| 400 | - | |||||||||||||||||||||||||
| 401 | bool QPixmap::doImageIO(QImageWriter *writer, int quality) const | - | ||||||||||||||||||||||||
| 402 | { | - | ||||||||||||||||||||||||
| 403 | if (quality > 100
| 0 | ||||||||||||||||||||||||
| 404 | QMessageLogger(__FILE__, 897, __PRETTY_FUNCTION__).warning("QPixmap::save: quality out of range [-1,100]"); never executed: QMessageLogger(__FILE__, 897, __PRETTY_FUNCTION__).warning("QPixmap::save: quality out of range [-1,100]"); | 0 | ||||||||||||||||||||||||
| 405 | if (quality >= 0
| 0 | ||||||||||||||||||||||||
| 406 | writer->setQuality(qMin(quality,100)); never executed: writer->setQuality(qMin(quality,100)); | 0 | ||||||||||||||||||||||||
| 407 | return never executed: writer->write(toImage());return writer->write(toImage());never executed: return writer->write(toImage()); | 0 | ||||||||||||||||||||||||
| 408 | } | - | ||||||||||||||||||||||||
| 409 | void QPixmap::fill(const QPaintDevice *device, const QPoint &p) | - | ||||||||||||||||||||||||
| 410 | { | - | ||||||||||||||||||||||||
| 411 | (void)device; | - | ||||||||||||||||||||||||
| 412 | (void)p; | - | ||||||||||||||||||||||||
| 413 | QMessageLogger(__FILE__, 914, __PRETTY_FUNCTION__).warning("this function is deprecated, ignored"); | - | ||||||||||||||||||||||||
| 414 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 415 | void QPixmap::fill(const QColor &color) | - | ||||||||||||||||||||||||
| 416 | { | - | ||||||||||||||||||||||||
| 417 | if (isNull()
| 0 | ||||||||||||||||||||||||
| 418 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 419 | - | |||||||||||||||||||||||||
| 420 | - | |||||||||||||||||||||||||
| 421 | - | |||||||||||||||||||||||||
| 422 | if (paintingActive()
| 0 | ||||||||||||||||||||||||
| 423 | QMessageLogger(__FILE__, 943, __PRETTY_FUNCTION__).warning("QPixmap::fill: Cannot fill while pixmap is being painted on"); | - | ||||||||||||||||||||||||
| 424 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 425 | } | - | ||||||||||||||||||||||||
| 426 | - | |||||||||||||||||||||||||
| 427 | if (data->ref.load() == 1
| 0 | ||||||||||||||||||||||||
| 428 | - | |||||||||||||||||||||||||
| 429 | - | |||||||||||||||||||||||||
| 430 | detach(); | - | ||||||||||||||||||||||||
| 431 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 432 | - | |||||||||||||||||||||||||
| 433 | - | |||||||||||||||||||||||||
| 434 | QPlatformPixmap *d = data->createCompatiblePlatformPixmap(); | - | ||||||||||||||||||||||||
| 435 | d->resize(data->width(), data->height()); | - | ||||||||||||||||||||||||
| 436 | data = d; | - | ||||||||||||||||||||||||
| 437 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 438 | data->fill(color); | - | ||||||||||||||||||||||||
| 439 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 440 | qint64 QPixmap::cacheKey() const | - | ||||||||||||||||||||||||
| 441 | { | - | ||||||||||||||||||||||||
| 442 | if (isNull()
| 0 | ||||||||||||||||||||||||
| 443 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 444 | - | |||||||||||||||||||||||||
| 445 | ((!(data)) ? qt_assert("data",__FILE__,988) : qt_noop()); | - | ||||||||||||||||||||||||
| 446 | return never executed: data->cacheKey();return data->cacheKey();never executed: return data->cacheKey(); | 0 | ||||||||||||||||||||||||
| 447 | } | - | ||||||||||||||||||||||||
| 448 | QPixmap QPixmap::grabWidget(QObject *widget, const QRect &rectangle) | - | ||||||||||||||||||||||||
| 449 | { | - | ||||||||||||||||||||||||
| 450 | QPixmap pixmap; | - | ||||||||||||||||||||||||
| 451 | QMessageLogger(__FILE__, 1015, __PRETTY_FUNCTION__).warning("QPixmap::grabWidget is deprecated, use QWidget::grab() instead"); | - | ||||||||||||||||||||||||
| 452 | if (!widget
| 0 | ||||||||||||||||||||||||
| 453 | return never executed: pixmap;return pixmap;never executed: return pixmap; | 0 | ||||||||||||||||||||||||
| 454 | QMetaObject::invokeMethod(widget, "grab", Qt::DirectConnection, | - | ||||||||||||||||||||||||
| 455 | QReturnArgument<QPixmap >("QPixmap", pixmap), | - | ||||||||||||||||||||||||
| 456 | QArgument<QRect >("QRect", rectangle)); | - | ||||||||||||||||||||||||
| 457 | return never executed: pixmap;return pixmap;never executed: return pixmap; | 0 | ||||||||||||||||||||||||
| 458 | } | - | ||||||||||||||||||||||||
| 459 | QDataStream &operator<<(QDataStream &stream, const QPixmap &pixmap) | - | ||||||||||||||||||||||||
| 460 | { | - | ||||||||||||||||||||||||
| 461 | return never executed: stream << pixmap.toImage();return stream << pixmap.toImage();never executed: return stream << pixmap.toImage(); | 0 | ||||||||||||||||||||||||
| 462 | } | - | ||||||||||||||||||||||||
| 463 | QDataStream &operator>>(QDataStream &stream, QPixmap &pixmap) | - | ||||||||||||||||||||||||
| 464 | { | - | ||||||||||||||||||||||||
| 465 | QImage image; | - | ||||||||||||||||||||||||
| 466 | stream >> image; | - | ||||||||||||||||||||||||
| 467 | - | |||||||||||||||||||||||||
| 468 | if (image.isNull()
| 0 | ||||||||||||||||||||||||
| 469 | pixmap = QPixmap(); | - | ||||||||||||||||||||||||
| 470 | } never executed: else if (image.depth() == 1end of block
| 0 | ||||||||||||||||||||||||
| 471 | pixmap = QBitmap::fromImage(image); | - | ||||||||||||||||||||||||
| 472 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 473 | pixmap = QPixmap::fromImage(image); | - | ||||||||||||||||||||||||
| 474 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 475 | return never executed: stream;return stream;never executed: return stream; | 0 | ||||||||||||||||||||||||
| 476 | } | - | ||||||||||||||||||||||||
| 477 | - | |||||||||||||||||||||||||
| 478 | - | |||||||||||||||||||||||||
| 479 | - | |||||||||||||||||||||||||
| 480 | - | |||||||||||||||||||||||||
| 481 | - | |||||||||||||||||||||||||
| 482 | - | |||||||||||||||||||||||||
| 483 | - | |||||||||||||||||||||||||
| 484 | bool QPixmap::isDetached() const | - | ||||||||||||||||||||||||
| 485 | { | - | ||||||||||||||||||||||||
| 486 | return never executed: data && data->ref.load() == 1;return data && data->ref.load() == 1;never executed: return data && data->ref.load() == 1; | 0 | ||||||||||||||||||||||||
| 487 | } | - | ||||||||||||||||||||||||
| 488 | bool QPixmap::convertFromImage(const QImage &image, Qt::ImageConversionFlags flags) | - | ||||||||||||||||||||||||
| 489 | { | - | ||||||||||||||||||||||||
| 490 | detach(); | - | ||||||||||||||||||||||||
| 491 | if (image.isNull()
| 0 | ||||||||||||||||||||||||
| 492 | * never executed: this = QPixmap::fromImage(image, flags);*this = QPixmap::fromImage(image, flags);never executed: *this = QPixmap::fromImage(image, flags); | 0 | ||||||||||||||||||||||||
| 493 | else | - | ||||||||||||||||||||||||
| 494 | data->fromImage(image, flags); never executed: data->fromImage(image, flags); | 0 | ||||||||||||||||||||||||
| 495 | return never executed: !isNull();return !isNull();never executed: return !isNull(); | 0 | ||||||||||||||||||||||||
| 496 | } | - | ||||||||||||||||||||||||
| 497 | QPixmap QPixmap::scaled(const QSize& s, Qt::AspectRatioMode aspectMode, Qt::TransformationMode mode) const | - | ||||||||||||||||||||||||
| 498 | { | - | ||||||||||||||||||||||||
| 499 | if (isNull()
| 0 | ||||||||||||||||||||||||
| 500 | QMessageLogger(__FILE__, 1159, __PRETTY_FUNCTION__).warning("QPixmap::scaled: Pixmap is a null pixmap"); | - | ||||||||||||||||||||||||
| 501 | return never executed: QPixmap();return QPixmap();never executed: return QPixmap(); | 0 | ||||||||||||||||||||||||
| 502 | } | - | ||||||||||||||||||||||||
| 503 | if (s.isEmpty()
| 0 | ||||||||||||||||||||||||
| 504 | return never executed: QPixmap();return QPixmap();never executed: return QPixmap(); | 0 | ||||||||||||||||||||||||
| 505 | - | |||||||||||||||||||||||||
| 506 | QSize newSize = size(); | - | ||||||||||||||||||||||||
| 507 | newSize.scale(s, aspectMode); | - | ||||||||||||||||||||||||
| 508 | newSize.rwidth() = qMax(newSize.width(), 1); | - | ||||||||||||||||||||||||
| 509 | newSize.rheight() = qMax(newSize.height(), 1); | - | ||||||||||||||||||||||||
| 510 | if (newSize == size()
| 0 | ||||||||||||||||||||||||
| 511 | return never executed: *this;return *this;never executed: return *this; | 0 | ||||||||||||||||||||||||
| 512 | - | |||||||||||||||||||||||||
| 513 | QTransform wm = QTransform::fromScale((qreal)newSize.width() / width(), | - | ||||||||||||||||||||||||
| 514 | (qreal)newSize.height() / height()); | - | ||||||||||||||||||||||||
| 515 | QPixmap pix = transformed(wm, mode); | - | ||||||||||||||||||||||||
| 516 | return never executed: pix;return pix;never executed: return pix; | 0 | ||||||||||||||||||||||||
| 517 | } | - | ||||||||||||||||||||||||
| 518 | QPixmap QPixmap::scaledToWidth(int w, Qt::TransformationMode mode) const | - | ||||||||||||||||||||||||
| 519 | { | - | ||||||||||||||||||||||||
| 520 | if (isNull()
| 0 | ||||||||||||||||||||||||
| 521 | QMessageLogger(__FILE__, 1195, __PRETTY_FUNCTION__).warning("QPixmap::scaleWidth: Pixmap is a null pixmap"); | - | ||||||||||||||||||||||||
| 522 | return never executed: copy();return copy();never executed: return copy(); | 0 | ||||||||||||||||||||||||
| 523 | } | - | ||||||||||||||||||||||||
| 524 | if (w <= 0
| 0 | ||||||||||||||||||||||||
| 525 | return never executed: QPixmap();return QPixmap();never executed: return QPixmap(); | 0 | ||||||||||||||||||||||||
| 526 | - | |||||||||||||||||||||||||
| 527 | qreal factor = (qreal) w / width(); | - | ||||||||||||||||||||||||
| 528 | QTransform wm = QTransform::fromScale(factor, factor); | - | ||||||||||||||||||||||||
| 529 | return never executed: transformed(wm, mode);return transformed(wm, mode);never executed: return transformed(wm, mode); | 0 | ||||||||||||||||||||||||
| 530 | } | - | ||||||||||||||||||||||||
| 531 | QPixmap QPixmap::scaledToHeight(int h, Qt::TransformationMode mode) const | - | ||||||||||||||||||||||||
| 532 | { | - | ||||||||||||||||||||||||
| 533 | if (isNull()
| 0 | ||||||||||||||||||||||||
| 534 | QMessageLogger(__FILE__, 1223, __PRETTY_FUNCTION__).warning("QPixmap::scaleHeight: Pixmap is a null pixmap"); | - | ||||||||||||||||||||||||
| 535 | return never executed: copy();return copy();never executed: return copy(); | 0 | ||||||||||||||||||||||||
| 536 | } | - | ||||||||||||||||||||||||
| 537 | if (h <= 0
| 0 | ||||||||||||||||||||||||
| 538 | return never executed: QPixmap();return QPixmap();never executed: return QPixmap(); | 0 | ||||||||||||||||||||||||
| 539 | - | |||||||||||||||||||||||||
| 540 | qreal factor = (qreal) h / height(); | - | ||||||||||||||||||||||||
| 541 | QTransform wm = QTransform::fromScale(factor, factor); | - | ||||||||||||||||||||||||
| 542 | return never executed: transformed(wm, mode);return transformed(wm, mode);never executed: return transformed(wm, mode); | 0 | ||||||||||||||||||||||||
| 543 | } | - | ||||||||||||||||||||||||
| 544 | QPixmap QPixmap::transformed(const QTransform &transform, | - | ||||||||||||||||||||||||
| 545 | Qt::TransformationMode mode) const | - | ||||||||||||||||||||||||
| 546 | { | - | ||||||||||||||||||||||||
| 547 | if (isNull()
| 0 | ||||||||||||||||||||||||
| 548 | return never executed: *this;return *this;never executed: return *this; | 0 | ||||||||||||||||||||||||
| 549 | - | |||||||||||||||||||||||||
| 550 | return never executed: data->transformed(transform, mode);return data->transformed(transform, mode);never executed: return data->transformed(transform, mode); | 0 | ||||||||||||||||||||||||
| 551 | } | - | ||||||||||||||||||||||||
| 552 | - | |||||||||||||||||||||||||
| 553 | - | |||||||||||||||||||||||||
| 554 | - | |||||||||||||||||||||||||
| 555 | - | |||||||||||||||||||||||||
| 556 | - | |||||||||||||||||||||||||
| 557 | - | |||||||||||||||||||||||||
| 558 | - | |||||||||||||||||||||||||
| 559 | QPixmap QPixmap::transformed(const QMatrix &matrix, Qt::TransformationMode mode) const | - | ||||||||||||||||||||||||
| 560 | { | - | ||||||||||||||||||||||||
| 561 | return never executed: transformed(QTransform(matrix), mode);return transformed(QTransform(matrix), mode);never executed: return transformed(QTransform(matrix), mode); | 0 | ||||||||||||||||||||||||
| 562 | } | - | ||||||||||||||||||||||||
| 563 | bool QPixmap::hasAlpha() const | - | ||||||||||||||||||||||||
| 564 | { | - | ||||||||||||||||||||||||
| 565 | return never executed: data && data->hasAlphaChannel();return data && data->hasAlphaChannel();never executed: return data && data->hasAlphaChannel(); | 0 | ||||||||||||||||||||||||
| 566 | } | - | ||||||||||||||||||||||||
| 567 | - | |||||||||||||||||||||||||
| 568 | - | |||||||||||||||||||||||||
| 569 | - | |||||||||||||||||||||||||
| 570 | - | |||||||||||||||||||||||||
| 571 | - | |||||||||||||||||||||||||
| 572 | - | |||||||||||||||||||||||||
| 573 | - | |||||||||||||||||||||||||
| 574 | bool QPixmap::hasAlphaChannel() const | - | ||||||||||||||||||||||||
| 575 | { | - | ||||||||||||||||||||||||
| 576 | return never executed: data && data->hasAlphaChannel();return data && data->hasAlphaChannel();never executed: return data && data->hasAlphaChannel(); | 0 | ||||||||||||||||||||||||
| 577 | } | - | ||||||||||||||||||||||||
| 578 | - | |||||||||||||||||||||||||
| 579 | - | |||||||||||||||||||||||||
| 580 | - | |||||||||||||||||||||||||
| 581 | - | |||||||||||||||||||||||||
| 582 | int QPixmap::metric(PaintDeviceMetric metric) const | - | ||||||||||||||||||||||||
| 583 | { | - | ||||||||||||||||||||||||
| 584 | return never executed: data ? data->metric(metric) : 0;return data ? data->metric(metric) : 0;never executed: return data ? data->metric(metric) : 0; | 0 | ||||||||||||||||||||||||
| 585 | } | - | ||||||||||||||||||||||||
| 586 | - | |||||||||||||||||||||||||
| 587 | - | |||||||||||||||||||||||||
| 588 | - | |||||||||||||||||||||||||
| 589 | - | |||||||||||||||||||||||||
| 590 | QPaintEngine *QPixmap::paintEngine() const | - | ||||||||||||||||||||||||
| 591 | { | - | ||||||||||||||||||||||||
| 592 | return never executed: data ? data->paintEngine() : 0;return data ? data->paintEngine() : 0;never executed: return data ? data->paintEngine() : 0; | 0 | ||||||||||||||||||||||||
| 593 | } | - | ||||||||||||||||||||||||
| 594 | QBitmap QPixmap::mask() const | - | ||||||||||||||||||||||||
| 595 | { | - | ||||||||||||||||||||||||
| 596 | if (!data
| 0 | ||||||||||||||||||||||||
| 597 | return never executed: QBitmap();return QBitmap();never executed: return QBitmap(); | 0 | ||||||||||||||||||||||||
| 598 | - | |||||||||||||||||||||||||
| 599 | const QImage img = toImage(); | - | ||||||||||||||||||||||||
| 600 | bool shouldConvert = (img.format() != QImage::Format_ARGB32
| 0 | ||||||||||||||||||||||||
| 601 | const QImage image = (shouldConvert
| 0 | ||||||||||||||||||||||||
| 602 | const int w = image.width(); | - | ||||||||||||||||||||||||
| 603 | const int h = image.height(); | - | ||||||||||||||||||||||||
| 604 | - | |||||||||||||||||||||||||
| 605 | QImage mask(w, h, QImage::Format_MonoLSB); | - | ||||||||||||||||||||||||
| 606 | if (mask.isNull()
| 0 | ||||||||||||||||||||||||
| 607 | return never executed: QBitmap();return QBitmap();never executed: return QBitmap(); | 0 | ||||||||||||||||||||||||
| 608 | - | |||||||||||||||||||||||||
| 609 | mask.setColorCount(2); | - | ||||||||||||||||||||||||
| 610 | mask.setColor(0, QColor(Qt::color0).rgba()); | - | ||||||||||||||||||||||||
| 611 | mask.setColor(1, QColor(Qt::color1).rgba()); | - | ||||||||||||||||||||||||
| 612 | - | |||||||||||||||||||||||||
| 613 | const int bpl = mask.bytesPerLine(); | - | ||||||||||||||||||||||||
| 614 | - | |||||||||||||||||||||||||
| 615 | for (int y = 0; y < h
| 0 | ||||||||||||||||||||||||
| 616 | const QRgb *src = reinterpret_cast<const QRgb*>(image.scanLine(y)); | - | ||||||||||||||||||||||||
| 617 | uchar *dest = mask.scanLine(y); | - | ||||||||||||||||||||||||
| 618 | memset(dest, 0, bpl); | - | ||||||||||||||||||||||||
| 619 | for (int x = 0; x < w
| 0 | ||||||||||||||||||||||||
| 620 | if (qAlpha(*src) > 0
| 0 | ||||||||||||||||||||||||
| 621 | dest[x >> 3] |= (1 << (x & 7)); never executed: dest[x >> 3] |= (1 << (x & 7)); | 0 | ||||||||||||||||||||||||
| 622 | ++src; | - | ||||||||||||||||||||||||
| 623 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 624 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 625 | - | |||||||||||||||||||||||||
| 626 | return never executed: QBitmap::fromImage(mask);return QBitmap::fromImage(mask);never executed: return QBitmap::fromImage(mask); | 0 | ||||||||||||||||||||||||
| 627 | } | - | ||||||||||||||||||||||||
| 628 | int QPixmap::defaultDepth() | - | ||||||||||||||||||||||||
| 629 | { | - | ||||||||||||||||||||||||
| 630 | return never executed: QGuiApplication::primaryScreen()->depth();return QGuiApplication::primaryScreen()->depth();never executed: return QGuiApplication::primaryScreen()->depth(); | 0 | ||||||||||||||||||||||||
| 631 | } | - | ||||||||||||||||||||||||
| 632 | void QPixmap::detach() | - | ||||||||||||||||||||||||
| 633 | { | - | ||||||||||||||||||||||||
| 634 | if (!data
| 0 | ||||||||||||||||||||||||
| 635 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 636 | - | |||||||||||||||||||||||||
| 637 | - | |||||||||||||||||||||||||
| 638 | - | |||||||||||||||||||||||||
| 639 | QPlatformPixmap *pd = handle(); | - | ||||||||||||||||||||||||
| 640 | QPlatformPixmap::ClassId id = pd->classId(); | - | ||||||||||||||||||||||||
| 641 | if (id == QPlatformPixmap::RasterClass
| 0 | ||||||||||||||||||||||||
| 642 | QRasterPlatformPixmap *rasterData = static_cast<QRasterPlatformPixmap*>(pd); | - | ||||||||||||||||||||||||
| 643 | rasterData->image.detach(); | - | ||||||||||||||||||||||||
| 644 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 645 | - | |||||||||||||||||||||||||
| 646 | if (data->is_cached
| 0 | ||||||||||||||||||||||||
| 647 | QImagePixmapCleanupHooks::executePlatformPixmapModificationHooks(data.data()); never executed: QImagePixmapCleanupHooks::executePlatformPixmapModificationHooks(data.data()); | 0 | ||||||||||||||||||||||||
| 648 | - | |||||||||||||||||||||||||
| 649 | if (data->ref.load() != 1
| 0 | ||||||||||||||||||||||||
| 650 | *this = copy(); | - | ||||||||||||||||||||||||
| 651 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 652 | ++data->detach_no; | - | ||||||||||||||||||||||||
| 653 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 654 | QPixmap QPixmap::fromImage(const QImage &image, Qt::ImageConversionFlags flags) | - | ||||||||||||||||||||||||
| 655 | { | - | ||||||||||||||||||||||||
| 656 | if (image.isNull()
| 0 | ||||||||||||||||||||||||
| 657 | return never executed: QPixmap();return QPixmap();never executed: return QPixmap(); | 0 | ||||||||||||||||||||||||
| 658 | - | |||||||||||||||||||||||||
| 659 | QScopedPointer<QPlatformPixmap> data(QGuiApplicationPrivate::platformIntegration()->createPlatformPixmap(QPlatformPixmap::PixmapType)); | - | ||||||||||||||||||||||||
| 660 | data->fromImage(image, flags); | - | ||||||||||||||||||||||||
| 661 | return never executed: QPixmap(data.take());return QPixmap(data.take());never executed: return QPixmap(data.take()); | 0 | ||||||||||||||||||||||||
| 662 | } | - | ||||||||||||||||||||||||
| 663 | QPixmap QPixmap::fromImageInPlace(QImage &image, Qt::ImageConversionFlags flags) | - | ||||||||||||||||||||||||
| 664 | { | - | ||||||||||||||||||||||||
| 665 | if (image.isNull()
| 0 | ||||||||||||||||||||||||
| 666 | return never executed: QPixmap();return QPixmap();never executed: return QPixmap(); | 0 | ||||||||||||||||||||||||
| 667 | - | |||||||||||||||||||||||||
| 668 | QScopedPointer<QPlatformPixmap> data(QGuiApplicationPrivate::platformIntegration()->createPlatformPixmap(QPlatformPixmap::PixmapType)); | - | ||||||||||||||||||||||||
| 669 | data->fromImageInPlace(image, flags); | - | ||||||||||||||||||||||||
| 670 | return never executed: QPixmap(data.take());return QPixmap(data.take());never executed: return QPixmap(data.take()); | 0 | ||||||||||||||||||||||||
| 671 | } | - | ||||||||||||||||||||||||
| 672 | QPixmap QPixmap::fromImageReader(QImageReader *imageReader, Qt::ImageConversionFlags flags) | - | ||||||||||||||||||||||||
| 673 | { | - | ||||||||||||||||||||||||
| 674 | QScopedPointer<QPlatformPixmap> data(QGuiApplicationPrivate::platformIntegration()->createPlatformPixmap(QPlatformPixmap::PixmapType)); | - | ||||||||||||||||||||||||
| 675 | data->fromImageReader(imageReader, flags); | - | ||||||||||||||||||||||||
| 676 | return never executed: QPixmap(data.take());return QPixmap(data.take());never executed: return QPixmap(data.take()); | 0 | ||||||||||||||||||||||||
| 677 | } | - | ||||||||||||||||||||||||
| 678 | QPixmap QPixmap::grabWindow(WId window, int x, int y, int w, int h) | - | ||||||||||||||||||||||||
| 679 | { | - | ||||||||||||||||||||||||
| 680 | QMessageLogger(__FILE__, 1708, __PRETTY_FUNCTION__).warning("this function is deprecated, use QScreen::grabWindow() instead." | - | ||||||||||||||||||||||||
| 681 | " Defaulting to primary screen."); | - | ||||||||||||||||||||||||
| 682 | return never executed: QGuiApplication::primaryScreen()->grabWindow(window, x, y, w, h);return QGuiApplication::primaryScreen()->grabWindow(window, x, y, w, h);never executed: return QGuiApplication::primaryScreen()->grabWindow(window, x, y, w, h); | 0 | ||||||||||||||||||||||||
| 683 | } | - | ||||||||||||||||||||||||
| 684 | - | |||||||||||||||||||||||||
| 685 | - | |||||||||||||||||||||||||
| 686 | - | |||||||||||||||||||||||||
| 687 | - | |||||||||||||||||||||||||
| 688 | QPlatformPixmap* QPixmap::handle() const | - | ||||||||||||||||||||||||
| 689 | { | - | ||||||||||||||||||||||||
| 690 | return never executed: data.data();return data.data();never executed: return data.data(); | 0 | ||||||||||||||||||||||||
| 691 | } | - | ||||||||||||||||||||||||
| 692 | - | |||||||||||||||||||||||||
| 693 | - | |||||||||||||||||||||||||
| 694 | QDebug operator<<(QDebug dbg, const QPixmap &r) | - | ||||||||||||||||||||||||
| 695 | { | - | ||||||||||||||||||||||||
| 696 | QDebugStateSaver saver(dbg); | - | ||||||||||||||||||||||||
| 697 | dbg.resetFormat(); | - | ||||||||||||||||||||||||
| 698 | dbg.nospace(); | - | ||||||||||||||||||||||||
| 699 | dbg << "QPixmap("; | - | ||||||||||||||||||||||||
| 700 | if (r.isNull()
| 0 | ||||||||||||||||||||||||
| 701 | dbg << "null"; | - | ||||||||||||||||||||||||
| 702 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 703 | dbg << r.size() << ",depth=" << r.depth() | - | ||||||||||||||||||||||||
| 704 | << ",devicePixelRatio=" << r.devicePixelRatio() | - | ||||||||||||||||||||||||
| 705 | << ",cacheKey=" << showbase << hex << r.cacheKey() << dec << noshowbase; | - | ||||||||||||||||||||||||
| 706 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 707 | dbg << ')'; | - | ||||||||||||||||||||||||
| 708 | return never executed: dbg;return dbg;never executed: return dbg; | 0 | ||||||||||||||||||||||||
| 709 | } | - | ||||||||||||||||||||||||
| 710 | - | |||||||||||||||||||||||||
| Switch to Source code | Preprocessed file |