Line | Source Code | Coverage |
---|
1 | | - |
2 | | - |
3 | | - |
4 | | - |
5 | | - |
6 | | - |
7 | | - |
8 | static int global_ser_no = 0; | - |
9 | | - |
10 | QBlittablePlatformPixmap::QBlittablePlatformPixmap() | - |
11 | : QPlatformPixmap(QPlatformPixmap::PixmapType,BlitterClass) | - |
12 | , m_alpha(false) | - |
13 | | - |
14 | | - |
15 | | - |
16 | { | - |
17 | setSerialNumber(++global_ser_no); | - |
18 | } | 0 |
19 | | - |
20 | QBlittablePlatformPixmap::~QBlittablePlatformPixmap() | - |
21 | { | - |
22 | | - |
23 | | - |
24 | | - |
25 | | - |
26 | } | - |
27 | | - |
28 | QBlittable *QBlittablePlatformPixmap::blittable() const | - |
29 | { | - |
30 | if (!m_blittable) { never evaluated: !m_blittable | 0 |
31 | QBlittablePlatformPixmap *that = const_cast<QBlittablePlatformPixmap *>(this); | - |
32 | that->m_blittable.reset(this->createBlittable(QSize(w, h), m_alpha)); | - |
33 | } | 0 |
34 | | - |
35 | return m_blittable.data(); never executed: return m_blittable.data(); | 0 |
36 | } | - |
37 | | - |
38 | void QBlittablePlatformPixmap::setBlittable(QBlittable *blittable) | - |
39 | { | - |
40 | resize(blittable->size().width(),blittable->size().height()); | - |
41 | m_blittable.reset(blittable); | - |
42 | } | 0 |
43 | | - |
44 | void QBlittablePlatformPixmap::resize(int width, int height) | - |
45 | { | - |
46 | m_blittable.reset(0); | - |
47 | m_engine.reset(0); | - |
48 | d = QGuiApplication::primaryScreen()->depth(); | - |
49 | w = width; | - |
50 | h = height; | - |
51 | is_null = (w <= 0 || h <= 0); | 0 |
52 | setSerialNumber(++global_ser_no); | - |
53 | } | 0 |
54 | | - |
55 | int QBlittablePlatformPixmap::metric(QPaintDevice::PaintDeviceMetric metric) const | - |
56 | { | - |
57 | switch (metric) { | - |
58 | case QPaintDevice::PdmWidth: | - |
59 | return w; never executed: return w; | 0 |
60 | case QPaintDevice::PdmHeight: | - |
61 | return h; never executed: return h; | 0 |
62 | case QPaintDevice::PdmWidthMM: | - |
63 | return qRound(w * 25.4 / qt_defaultDpiX()); never executed: return qRound(w * 25.4 / qt_defaultDpiX()); | 0 |
64 | case QPaintDevice::PdmHeightMM: | - |
65 | return qRound(h * 25.4 / qt_defaultDpiY()); never executed: return qRound(h * 25.4 / qt_defaultDpiY()); | 0 |
66 | case QPaintDevice::PdmDepth: | - |
67 | return 32; never executed: return 32; | 0 |
68 | case QPaintDevice::PdmDpiX: | - |
69 | case QPaintDevice::PdmPhysicalDpiX: | - |
70 | return qt_defaultDpiX(); never executed: return qt_defaultDpiX(); | 0 |
71 | case QPaintDevice::PdmDpiY: | - |
72 | case QPaintDevice::PdmPhysicalDpiY: | - |
73 | return qt_defaultDpiY(); never executed: return qt_defaultDpiY(); | 0 |
74 | default: | - |
75 | QMessageLogger("image/qpixmap_blitter.cpp", 124, __PRETTY_FUNCTION__).warning("QRasterPlatformPixmap::metric(): Unhandled metric type %d", metric); | - |
76 | break; | 0 |
77 | } | - |
78 | | - |
79 | return 0; never executed: return 0; | 0 |
80 | } | - |
81 | | - |
82 | void QBlittablePlatformPixmap::fill(const QColor &color) | - |
83 | { | - |
84 | if (blittable()->capabilities() & QBlittable::AlphaFillRectCapability) { never evaluated: blittable()->capabilities() & QBlittable::AlphaFillRectCapability | 0 |
85 | blittable()->unlock(); | - |
86 | blittable()->alphaFillRect(QRectF(0,0,w,h),color,QPainter::CompositionMode_Source); | - |
87 | } else if (color.alpha() == 255 && blittable()->capabilities() & QBlittable::SolidRectCapability) { never evaluated: color.alpha() == 255 never evaluated: blittable()->capabilities() & QBlittable::SolidRectCapability | 0 |
88 | blittable()->unlock(); | - |
89 | blittable()->fillRect(QRectF(0,0,w,h),color); | - |
90 | } else { | 0 |
91 | | - |
92 | | - |
93 | | - |
94 | if (color.alpha() != 255 && !hasAlphaChannel()) { never evaluated: color.alpha() != 255 never evaluated: !hasAlphaChannel() | 0 |
95 | m_blittable.reset(0); | - |
96 | m_engine.reset(0); | - |
97 | m_alpha = true; | - |
98 | } | 0 |
99 | | - |
100 | uint pixel = PREMUL(color.rgba()); | - |
101 | const QPixelLayout *layout = &qPixelLayouts[blittable()->lock()->format()]; | - |
102 | qt_noop(); | - |
103 | layout->convertFromARGB32PM(&pixel, &pixel, 1, layout, 0); | - |
104 | | - |
105 | | - |
106 | blittable()->lock()->fill(pixel); | - |
107 | } | 0 |
108 | | - |
109 | } | - |
110 | | - |
111 | QImage *QBlittablePlatformPixmap::buffer() | - |
112 | { | - |
113 | return blittable()->lock(); never executed: return blittable()->lock(); | 0 |
114 | } | - |
115 | | - |
116 | QImage QBlittablePlatformPixmap::toImage() const | - |
117 | { | - |
118 | return blittable()->lock()->copy(); never executed: return blittable()->lock()->copy(); | 0 |
119 | } | - |
120 | | - |
121 | bool QBlittablePlatformPixmap::hasAlphaChannel() const | - |
122 | { | - |
123 | return blittable()->lock()->hasAlphaChannel(); never executed: return blittable()->lock()->hasAlphaChannel(); | 0 |
124 | } | - |
125 | | - |
126 | void QBlittablePlatformPixmap::fromImage(const QImage &image, | - |
127 | Qt::ImageConversionFlags flags) | - |
128 | { | - |
129 | m_alpha = image.hasAlphaChannel(); | - |
130 | resize(image.width(),image.height()); | - |
131 | markRasterOverlay(QRect(0,0,w,h)); | - |
132 | QImage *thisImg = buffer(); | - |
133 | | - |
134 | QImage correctFormatPic = image; | - |
135 | if (correctFormatPic.format() != thisImg->format()) never evaluated: correctFormatPic.format() != thisImg->format() | 0 |
136 | correctFormatPic = correctFormatPic.convertToFormat(thisImg->format(), flags); never executed: correctFormatPic = correctFormatPic.convertToFormat(thisImg->format(), flags); | 0 |
137 | | - |
138 | uchar *mem = thisImg->bits(); | - |
139 | const uchar *bits = correctFormatPic.bits(); | - |
140 | int bytesCopied = 0; | - |
141 | while (bytesCopied < correctFormatPic.byteCount()) { never evaluated: bytesCopied < correctFormatPic.byteCount() | 0 |
142 | memcpy(mem,bits,correctFormatPic.bytesPerLine()); | - |
143 | mem += thisImg->bytesPerLine(); | - |
144 | bits += correctFormatPic.bytesPerLine(); | - |
145 | bytesCopied+=correctFormatPic.bytesPerLine(); | - |
146 | } | 0 |
147 | } | 0 |
148 | | - |
149 | qreal QBlittablePlatformPixmap::devicePixelRatio() const | - |
150 | { | - |
151 | return m_devicePixelRatio; never executed: return m_devicePixelRatio; | 0 |
152 | } | - |
153 | | - |
154 | void QBlittablePlatformPixmap::setDevicePixelRatio(qreal scaleFactor) | - |
155 | { | - |
156 | m_devicePixelRatio = scaleFactor; | - |
157 | } | 0 |
158 | | - |
159 | QPaintEngine *QBlittablePlatformPixmap::paintEngine() const | - |
160 | { | - |
161 | if (!m_engine) { never evaluated: !m_engine | 0 |
162 | QBlittablePlatformPixmap *that = const_cast<QBlittablePlatformPixmap *>(this); | - |
163 | that->m_engine.reset(new QBlitterPaintEngine(that)); | - |
164 | } | 0 |
165 | return m_engine.data(); never executed: return m_engine.data(); | 0 |
166 | } | - |
167 | | - |
168 | | - |
| | |