| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/gui/image/qbitmap.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||
| 2 | - | |||||||||||||
| 3 | QBitmap::QBitmap() | - | ||||||||||||
| 4 | : QPixmap(QSize(0, 0), QPlatformPixmap::BitmapType) | - | ||||||||||||
| 5 | { | - | ||||||||||||
| 6 | } never executed: end of block | 0 | ||||||||||||
| 7 | QBitmap::QBitmap(int w, int h) | - | ||||||||||||
| 8 | : QPixmap(QSize(w, h), QPlatformPixmap::BitmapType) | - | ||||||||||||
| 9 | { | - | ||||||||||||
| 10 | } never executed: end of block | 0 | ||||||||||||
| 11 | QBitmap::QBitmap(const QSize &size) | - | ||||||||||||
| 12 | : QPixmap(size, QPlatformPixmap::BitmapType) | - | ||||||||||||
| 13 | { | - | ||||||||||||
| 14 | } never executed: end of block | 0 | ||||||||||||
| 15 | QBitmap::QBitmap(const QPixmap &pixmap) | - | ||||||||||||
| 16 | { | - | ||||||||||||
| 17 | QBitmap::operator=(pixmap); | - | ||||||||||||
| 18 | } never executed: end of block | 0 | ||||||||||||
| 19 | QBitmap::QBitmap(const QString& fileName, const char *format) | - | ||||||||||||
| 20 | : QPixmap(QSize(0, 0), QPlatformPixmap::BitmapType) | - | ||||||||||||
| 21 | { | - | ||||||||||||
| 22 | load(fileName, format, Qt::MonoOnly); | - | ||||||||||||
| 23 | } never executed: end of block | 0 | ||||||||||||
| 24 | QBitmap &QBitmap::operator=(const QPixmap &pixmap) | - | ||||||||||||
| 25 | { | - | ||||||||||||
| 26 | if (pixmap.isNull()
| 0 | ||||||||||||
| 27 | QBitmap(0, 0).swap(*this); | - | ||||||||||||
| 28 | } never executed: else if (pixmap.depth() == 1end of block
| 0 | ||||||||||||
| 29 | QPixmap::operator=(pixmap); | - | ||||||||||||
| 30 | } never executed: else {end of block | 0 | ||||||||||||
| 31 | QImage image; | - | ||||||||||||
| 32 | image = pixmap.toImage(); | - | ||||||||||||
| 33 | *this = fromImage(image); | - | ||||||||||||
| 34 | } never executed: end of block | 0 | ||||||||||||
| 35 | return never executed: *this;return *this;never executed: return *this; | 0 | ||||||||||||
| 36 | } | - | ||||||||||||
| 37 | - | |||||||||||||
| 38 | - | |||||||||||||
| 39 | - | |||||||||||||
| 40 | - | |||||||||||||
| 41 | - | |||||||||||||
| 42 | - | |||||||||||||
| 43 | QBitmap::~QBitmap() | - | ||||||||||||
| 44 | { | - | ||||||||||||
| 45 | } | - | ||||||||||||
| 46 | QBitmap::operator QVariant() const | - | ||||||||||||
| 47 | { | - | ||||||||||||
| 48 | return never executed: QVariant(QVariant::Bitmap, this);return QVariant(QVariant::Bitmap, this);never executed: return QVariant(QVariant::Bitmap, this); | 0 | ||||||||||||
| 49 | } | - | ||||||||||||
| 50 | - | |||||||||||||
| 51 | - | |||||||||||||
| 52 | - | |||||||||||||
| 53 | - | |||||||||||||
| 54 | - | |||||||||||||
| 55 | - | |||||||||||||
| 56 | - | |||||||||||||
| 57 | QBitmap QBitmap::fromImage(const QImage &image, Qt::ImageConversionFlags flags) | - | ||||||||||||
| 58 | { | - | ||||||||||||
| 59 | if (image.isNull()
| 0 | ||||||||||||
| 60 | return never executed: QBitmap();return QBitmap();never executed: return QBitmap(); | 0 | ||||||||||||
| 61 | - | |||||||||||||
| 62 | QImage img = image.convertToFormat(QImage::Format_MonoLSB, flags); | - | ||||||||||||
| 63 | - | |||||||||||||
| 64 | - | |||||||||||||
| 65 | - | |||||||||||||
| 66 | const QRgb c0 = QColor(Qt::black).rgb(); | - | ||||||||||||
| 67 | const QRgb c1 = QColor(Qt::white).rgb(); | - | ||||||||||||
| 68 | if (img.color(0) == c0
| 0 | ||||||||||||
| 69 | img.invertPixels(); | - | ||||||||||||
| 70 | img.setColor(0, c1); | - | ||||||||||||
| 71 | img.setColor(1, c0); | - | ||||||||||||
| 72 | } never executed: end of block | 0 | ||||||||||||
| 73 | - | |||||||||||||
| 74 | QScopedPointer<QPlatformPixmap> data(QGuiApplicationPrivate::platformIntegration()->createPlatformPixmap(QPlatformPixmap::BitmapType)); | - | ||||||||||||
| 75 | - | |||||||||||||
| 76 | data->fromImage(img, flags | Qt::MonoOnly); | - | ||||||||||||
| 77 | return never executed: QPixmap(data.take());return QPixmap(data.take());never executed: return QPixmap(data.take()); | 0 | ||||||||||||
| 78 | } | - | ||||||||||||
| 79 | QBitmap QBitmap::fromData(const QSize &size, const uchar *bits, QImage::Format monoFormat) | - | ||||||||||||
| 80 | { | - | ||||||||||||
| 81 | ((!(monoFormat == QImage::Format_Mono || monoFormat == QImage::Format_MonoLSB)) ? qt_assert("monoFormat == QImage::Format_Mono || monoFormat == QImage::Format_MonoLSB",__FILE__,269) : qt_noop()); | - | ||||||||||||
| 82 | - | |||||||||||||
| 83 | QImage image(size, monoFormat); | - | ||||||||||||
| 84 | image.setColor(0, QColor(Qt::color0).rgb()); | - | ||||||||||||
| 85 | image.setColor(1, QColor(Qt::color1).rgb()); | - | ||||||||||||
| 86 | - | |||||||||||||
| 87 | - | |||||||||||||
| 88 | - | |||||||||||||
| 89 | int bytesPerLine = (size.width() + 7) / 8; | - | ||||||||||||
| 90 | for (int y = 0; y < size.height()
| 0 | ||||||||||||
| 91 | memcpy(image.scanLine(y), bits + bytesPerLine * y, bytesPerLine); never executed: memcpy(image.scanLine(y), bits + bytesPerLine * y, bytesPerLine); | 0 | ||||||||||||
| 92 | return never executed: QBitmap::fromImage(image);return QBitmap::fromImage(image);never executed: return QBitmap::fromImage(image); | 0 | ||||||||||||
| 93 | } | - | ||||||||||||
| 94 | - | |||||||||||||
| 95 | - | |||||||||||||
| 96 | - | |||||||||||||
| 97 | - | |||||||||||||
| 98 | - | |||||||||||||
| 99 | - | |||||||||||||
| 100 | - | |||||||||||||
| 101 | QBitmap QBitmap::transformed(const QTransform &matrix) const | - | ||||||||||||
| 102 | { | - | ||||||||||||
| 103 | QBitmap bm = QPixmap::transformed(matrix); | - | ||||||||||||
| 104 | return never executed: bm;return bm;never executed: return bm; | 0 | ||||||||||||
| 105 | } | - | ||||||||||||
| 106 | QBitmap QBitmap::transformed(const QMatrix &matrix) const | - | ||||||||||||
| 107 | { | - | ||||||||||||
| 108 | return never executed: transformed(QTransform(matrix));return transformed(QTransform(matrix));never executed: return transformed(QTransform(matrix)); | 0 | ||||||||||||
| 109 | } | - | ||||||||||||
| 110 | - | |||||||||||||
| 111 | - | |||||||||||||
| Switch to Source code | Preprocessed file |