| Line | Source | Count | 
| 1 |  | - | 
| 2 |  | - | 
| 3 |  | - | 
| 4 |  | - | 
| 5 | class CapabilitiesToStateMask | - | 
| 6 | { | - | 
| 7 | public: | - | 
| 8 |     CapabilitiesToStateMask(QBlittable::Capabilities capabilities) | - | 
| 9 |         : m_capabilities(capabilities) | - | 
| 10 |         , fillRectMask(0) | - | 
| 11 |         , drawRectMask(0) | - | 
| 12 |         , drawPixmapMask(0) | - | 
| 13 |         , alphaFillRectMask(0) | - | 
| 14 |         , opacityPixmapMask(0) | - | 
| 15 |         , capabillitiesState(0) | - | 
| 16 |     { | - | 
| 17 |         if (capabilities & QBlittable::SolidRectCapability) | - | 
| 18 |             setFillRectMask(); | - | 
| 19 |         if (capabilities & QBlittable::SourcePixmapCapability) | - | 
| 20 |            setSourcePixmapMask(); | - | 
| 21 |         if (capabilities & QBlittable::SourceOverPixmapCapability) | - | 
| 22 |            setSourceOverPixmapMask(); | - | 
| 23 |         if (capabilities & QBlittable::SourceOverScaledPixmapCapability) | - | 
| 24 |             setSourceOverScaledPixmapMask(); | - | 
| 25 |         if (capabilities & QBlittable::AlphaFillRectCapability) | - | 
| 26 |             setAlphaFillRectMask(); | - | 
| 27 |         if (capabilities & QBlittable::OpacityPixmapCapability) | - | 
| 28 |             setOpacityPixmapMask(); | - | 
| 29 |     } | - | 
| 30 |  | - | 
| 31 |     inline bool canBlitterFillRect() const | - | 
| 32 |     { | - | 
| 33 |         return checkStateAgainstMask(capabillitiesState, fillRectMask); | - | 
| 34 |     } | - | 
| 35 |  | - | 
| 36 |     inline bool canBlitterAlphaFillRect() const | - | 
| 37 |     { | - | 
| 38 |         return checkStateAgainstMask(capabillitiesState, alphaFillRectMask); | - | 
| 39 |     } | - | 
| 40 |  | - | 
| 41 |     inline bool canBlitterDrawRectMask() const | - | 
| 42 |     { | - | 
| 43 |         return checkStateAgainstMask(capabillitiesState, drawRectMask); | - | 
| 44 |     } | - | 
| 45 |  | - | 
| 46 |     bool canBlitterDrawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) const | - | 
| 47 |     { | - | 
| 48 |         if (pm.handle()->classId() != QPlatformPixmap::BlitterClass) | - | 
| 49 |             return false; | - | 
| 50 |         if (checkStateAgainstMask(capabillitiesState, drawPixmapMask)) { | - | 
| 51 |             if (m_capabilities & (QBlittable::SourceOverPixmapCapability | - | 
| 52 |                                   | QBlittable::SourceOverScaledPixmapCapability)) { | - | 
| 53 |                 if (r.size() != sr.size()) | - | 
| 54 |                     return m_capabilities & QBlittable::SourceOverScaledPixmapCapability; | - | 
| 55 |                 else | - | 
| 56 |                     return m_capabilities & QBlittable::SourceOverPixmapCapability; | - | 
| 57 |             } | - | 
| 58 |             if ((m_capabilities & QBlittable::SourcePixmapCapability) && r.size() == sr.size() && !pm.hasAlphaChannel()) | - | 
| 59 |                 return m_capabilities & QBlittable::SourcePixmapCapability; | - | 
| 60 |         } | - | 
| 61 |         return false; | - | 
| 62 |     } | - | 
| 63 |  | - | 
| 64 |     bool canBlitterDrawPixmapOpacity(const QPixmap &pm) const | - | 
| 65 |     { | - | 
| 66 |         if (pm.handle()->classId() != QPlatformPixmap::BlitterClass) | - | 
| 67 |             return false; | - | 
| 68 |  | - | 
| 69 |         return checkStateAgainstMask(capabillitiesState, opacityPixmapMask); | - | 
| 70 |     } | - | 
| 71 |  | - | 
| 72 |     bool canBlitterDrawCachedGlyphs(const QTransform &transform, QFontEngine::GlyphFormat requestedGlyphFormat, bool complexClip) const | - | 
| 73 |     { | - | 
| 74 |         if (transform.type() > QTransform::TxScale) | - | 
| 75 |             return false; | - | 
| 76 |         if (!(m_capabilities & QBlittable::DrawScaledCachedGlyphsCapability)) | - | 
| 77 |             return false; | - | 
| 78 |         if (requestedGlyphFormat == QFontEngine::Format_ARGB && !(m_capabilities & QBlittable::SubPixelGlyphsCapability)) | - | 
| 79 |             return false; | - | 
| 80 |         if (complexClip && !(m_capabilities & QBlittable::ComplexClipCapability)) | - | 
| 81 |             return false; | - | 
| 82 |         return true; | - | 
| 83 |     } | - | 
| 84 |  | - | 
| 85 |     inline void updateState(uint mask, bool on) { | - | 
| 86 |         updateStateBits(&capabillitiesState, mask, on); | - | 
| 87 |     } | - | 
| 88 |  | - | 
| 89 | private: | - | 
| 90 |  | - | 
| 91 |     static inline void updateStateBits(uint *state, uint mask, bool on) | - | 
| 92 |     { | - | 
| 93 |         *state = on ? (*state | mask) : (*state & ~mask); | - | 
| 94 |     } | - | 
| 95 |  | - | 
| 96 |     static inline bool checkStateAgainstMask(uint state, uint mask) | - | 
| 97 |     { | - | 
| 98 |         return !state || (state & mask && !(state & ~mask)); | - | 
| 99 |     } | - | 
| 100 |  | - | 
| 101 |     void setFillRectMask() { | - | 
| 102 |         updateStateBits(&fillRectMask, 0x00000001, false); | - | 
| 103 |         updateStateBits(&fillRectMask, 0x00000002, false); | - | 
| 104 |  | - | 
| 105 |         updateStateBits(&fillRectMask, 0x00000010, false); | - | 
| 106 |         updateStateBits(&fillRectMask, 0x00000020, false); | - | 
| 107 |  | - | 
| 108 |         updateStateBits(&fillRectMask, 0x00000100, true); | - | 
| 109 |  | - | 
| 110 |  | - | 
| 111 |         updateStateBits(&fillRectMask, 0x00001000, true); | - | 
| 112 |         updateStateBits(&fillRectMask, 0x00002000, false); | - | 
| 113 |         updateStateBits(&fillRectMask, 0x00004000, false); | - | 
| 114 |  | - | 
| 115 |         updateStateBits(&fillRectMask, 0x00010000, false); | - | 
| 116 |         updateStateBits(&fillRectMask, 0x00020000, false); | - | 
| 117 |     } | - | 
| 118 |  | - | 
| 119 |     void setAlphaFillRectMask() { | - | 
| 120 |         updateStateBits(&alphaFillRectMask, 0x00000001, false); | - | 
| 121 |         updateStateBits(&alphaFillRectMask, 0x00000002, false); | - | 
| 122 |  | - | 
| 123 |         updateStateBits(&alphaFillRectMask, 0x00000010, false); | - | 
| 124 |         updateStateBits(&alphaFillRectMask, 0x00000020, true); | - | 
| 125 |  | - | 
| 126 |         updateStateBits(&alphaFillRectMask, 0x00000100, true); | - | 
| 127 |  | - | 
| 128 |  | - | 
| 129 |         updateStateBits(&alphaFillRectMask, 0x00001000, true); | - | 
| 130 |         updateStateBits(&alphaFillRectMask, 0x00002000, false); | - | 
| 131 |         updateStateBits(&alphaFillRectMask, 0x00004000, false); | - | 
| 132 |  | - | 
| 133 |         updateStateBits(&alphaFillRectMask, 0x00010000, false); | - | 
| 134 |         updateStateBits(&alphaFillRectMask, 0x00020000, false); | - | 
| 135 |     } | - | 
| 136 |  | - | 
| 137 |     void setSourcePixmapMask() { | - | 
| 138 |         updateStateBits(&drawPixmapMask, 0x00000001, truefalse); | - | 
| 139 |         updateStateBits(&drawPixmapMask, 0x00000002, false); | - | 
| 140 |  | - | 
| 141 |         updateStateBits(&drawPixmapMask, 0x00000010, true); | - | 
| 142 |         updateStateBits(&drawPixmapMask, 0x00000020, false); | - | 
| 143 |  | - | 
| 144 |         updateStateBits(&drawPixmapMask, 0x00000100, true); | - | 
| 145 |  | - | 
| 146 |         updateStateBits(&drawPixmapMask, 0x00001000, true); | - | 
| 147 |         updateStateBits(&drawPixmapMask, 0x00002000, false); | - | 
| 148 |         updateStateBits(&drawPixmapMask, 0x00004000, false); | - | 
| 149 |  | - | 
| 150 |         updateStateBits(&drawPixmapMask, 0x00010000, false); | - | 
| 151 |         updateStateBits(&drawPixmapMask, 0x00020000, false); | - | 
| 152 |     } never executed: end of block  | 0 | 
| 153 |  | - | 
| 154 |     void setSourceOverPixmapMask() { | - | 
| 155 |         setSourcePixmapMask(); | - | 
| 156 |     } | - | 
| 157 |  | - | 
| 158 |     void setSourceOverScaledPixmapMask() { | - | 
| 159 |         setSourceOverPixmapMask(); | - | 
| 160 |         updateStateBits(&drawRectMask&drawPixmapMask, 0x00000001, true); | - | 
| 161 |     } never executed: end of block  | 0 | 
| 162 |  | - | 
| 163 |     void setOpacityPixmapMask() { | - | 
| 164 |         updateStateBits(&opacityPixmapMask, 0x00000001, true); | - | 
| 165 |         updateStateBits(&opacityPixmapMask, 0x00000002, false); | - | 
| 166 |  | - | 
| 167 |         updateStateBits(&opacityPixmapMask, 0x00000010, true); | - | 
| 168 |         updateStateBits(&opacityPixmapMask, 0x00000020, true); | - | 
| 169 |  | - | 
| 170 |         updateStateBits(&opacityPixmapMask, 0x00000100, true); | - | 
| 171 |  | - | 
| 172 |         updateStateBits(&opacityPixmapMask, 0x00001000, true); | - | 
| 173 |         updateStateBits(&opacityPixmapMask, 0x00002000, true); | - | 
| 174 |         updateStateBits(&opacityPixmapMask, 0x00004000, false); | - | 
| 175 |  | - | 
| 176 |         updateStateBits(&opacityPixmapMask, 0x00010000, false); | - | 
| 177 |         updateStateBits(&opacityPixmapMask, 0x00020000, false); | - | 
| 178 |     } | - | 
| 179 |  | - | 
| 180 |     QBlittable::Capabilities m_capabilities; | - | 
| 181 |     uint fillRectMask; | - | 
| 182 |     uint drawRectMask; | - | 
| 183 |     uint drawPixmapMask; | - | 
| 184 |     uint alphaFillRectMask; | - | 
| 185 |     uint opacityPixmapMask; | - | 
| 186 |     uint capabillitiesState; | - | 
| 187 | }; | - | 
| 188 |  | - | 
| 189 | class QBlitterPaintEnginePrivate : public QRasterPaintEnginePrivate | - | 
| 190 | { | - | 
| 191 |     inline QBlitterPaintEngine* q_func() { return static_cast<QBlitterPaintEngine *>(q_ptr); } inline const QBlitterPaintEngine* q_func() const { return static_cast<const QBlitterPaintEngine *>(q_ptr); } friend class QBlitterPaintEngine; | - | 
| 192 | public: | - | 
| 193 |     QBlitterPaintEnginePrivate(QBlittablePlatformPixmap *p) | - | 
| 194 |         : QRasterPaintEnginePrivate() | - | 
| 195 |         , pmData(p) | - | 
| 196 |         , caps(pmData->blittable()->capabilities()) | - | 
| 197 |         , hasXForm(false) | - | 
| 198 |  | - | 
| 199 |     {} | - | 
| 200 |  | - | 
| 201 |     void lock(); | - | 
| 202 |     void unlock(); | - | 
| 203 |     void fillRect(const QRectF &rect, const QColor &color, bool alpha); | - | 
| 204 |     void clipAndDrawPixmap(const QRectF &clip, const QRectF &target, const QPixmap &pm, const QRectF &sr, bool opacity); | - | 
| 205 |  | - | 
| 206 |  | - | 
| 207 |     void updateCompleteState(QPainterState *s); | - | 
| 208 |     void updatePenState(QPainterState *s); | - | 
| 209 |     void updateBrushState(QPainterState *s); | - | 
| 210 |     void updateOpacityState(QPainterState *s); | - | 
| 211 |     void updateCompositionModeState(QPainterState *s); | - | 
| 212 |     void updateRenderHintsState(QPainterState *s); | - | 
| 213 |     void updateTransformState(QPainterState *s); | - | 
| 214 |     void updateClipState(QPainterState *s); | - | 
| 215 |  | - | 
| 216 |     QBlittablePlatformPixmap *pmData; | - | 
| 217 |     CapabilitiesToStateMask caps; | - | 
| 218 |     uint hasXForm; | - | 
| 219 | }; | - | 
| 220 |  | - | 
| 221 |  | - | 
| 222 | inline void QBlitterPaintEnginePrivate::lock() | - | 
| 223 | { | - | 
| 224 |     if (!pmData->blittable()->isLocked()) | - | 
| 225 |         rasterBuffer->prepare(pmData->buffer()); | - | 
| 226 | } | - | 
| 227 |  | - | 
| 228 | inline void QBlitterPaintEnginePrivate::unlock() | - | 
| 229 | { | - | 
| 230 |     pmData->blittable()->unlock(); | - | 
| 231 | } | - | 
| 232 |  | - | 
| 233 |  | - | 
| 234 | void QBlitterPaintEnginePrivate::updateCompleteState(QPainterState *s) | - | 
| 235 | { | - | 
| 236 |     updatePenState(s); | - | 
| 237 |     updateBrushState(s); | - | 
| 238 |     updateOpacityState(s); | - | 
| 239 |     updateCompositionModeState(s); | - | 
| 240 |     updateRenderHintsState(s); | - | 
| 241 |     updateTransformState(s); | - | 
| 242 |     updateClipState(s); | - | 
| 243 | } | - | 
| 244 |  | - | 
| 245 | void QBlitterPaintEnginePrivate::updatePenState(QPainterState *s) | - | 
| 246 | { | - | 
| 247 |     caps.updateState(0x00000100, qpen_style(s->pen) != Qt::NoPen); | - | 
| 248 | } | - | 
| 249 |  | - | 
| 250 | void QBlitterPaintEnginePrivate::updateBrushState(QPainterState *s) | - | 
| 251 | { | - | 
| 252 |     Qt::BrushStyle style = qbrush_style(s->brush); | - | 
| 253 |  | - | 
| 254 |     caps.updateState(0x00000010, style > Qt::SolidPattern); | - | 
| 255 |     caps.updateState(0x00000020, | - | 
| 256 |                         qbrush_color(s->brush).alpha() < 255); | - | 
| 257 | } | - | 
| 258 |  | - | 
| 259 | void QBlitterPaintEnginePrivate::updateOpacityState(QPainterState *s) | - | 
| 260 | { | - | 
| 261 |     bool translucent = s->opacity < 1; | - | 
| 262 |     caps.updateState(0x00002000, translucent); | - | 
| 263 | } | - | 
| 264 |  | - | 
| 265 | void QBlitterPaintEnginePrivate::updateCompositionModeState(QPainterState *s) | - | 
| 266 | { | - | 
| 267 |     bool nonTrivial = s->composition_mode != QPainter::CompositionMode_SourceOver | - | 
| 268 |                       && s->composition_mode != QPainter::CompositionMode_Source; | - | 
| 269 |  | - | 
| 270 |     caps.updateState(0x00004000, nonTrivial); | - | 
| 271 | } | - | 
| 272 |  | - | 
| 273 | void QBlitterPaintEnginePrivate::updateRenderHintsState(QPainterState *s) | - | 
| 274 | { | - | 
| 275 |     bool aa = s->renderHints & QPainter::Antialiasing; | - | 
| 276 |     caps.updateState(0x00001000, aa); | - | 
| 277 | } | - | 
| 278 |  | - | 
| 279 | void QBlitterPaintEnginePrivate::updateTransformState(QPainterState *s) | - | 
| 280 | { | - | 
| 281 |     QTransform::TransformationType type = s->matrix.type(); | - | 
| 282 |  | - | 
| 283 |  | - | 
| 284 |  | - | 
| 285 |  | - | 
| 286 |     caps.updateState(0x00000002, (type > QTransform::TxScale) || | - | 
| 287 |         ((type == QTransform::TxScale) && ((s->matrix.m11() < 0.0) || (s->matrix.m22() < 0.0)))); | - | 
| 288 |     caps.updateState(0x00000001, type > QTransform::TxTranslate); | - | 
| 289 |  | - | 
| 290 |     hasXForm = type >= QTransform::TxTranslate; | - | 
| 291 | } | - | 
| 292 |  | - | 
| 293 | void QBlitterPaintEnginePrivate::updateClipState(QPainterState *) | - | 
| 294 | { | - | 
| 295 |     const QClipData *clipData = clip(); | - | 
| 296 |     bool complexClip = clipData && !(clipData->hasRectClip || clipData->hasRegionClip); | - | 
| 297 |     caps.updateState(0x00020000, complexClip); | - | 
| 298 | } | - | 
| 299 |  | - | 
| 300 | void QBlitterPaintEnginePrivate::fillRect(const QRectF &rect, const QColor &color, bool alpha) | - | 
| 301 | { | - | 
| 302 |     QBlitterPaintEngine * const q = q_func(); | - | 
| 303 |     pmData->unmarkRasterOverlay(rect); | - | 
| 304 |     QRectF targetRect = rect; | - | 
| 305 |     if (hasXForm) | - | 
| 306 |         targetRect = q->state()->matrix.mapRect(rect); | - | 
| 307 |     const QClipData *clipData = clip(); | - | 
| 308 |     if (clipData) { | - | 
| 309 |         if (clipData->hasRectClip) { | - | 
| 310 |             unlock(); | - | 
| 311 |             if (alpha) | - | 
| 312 |                 pmData->blittable()->alphaFillRect(targetRect & clipData->clipRect, color, q->state()->compositionMode()); | - | 
| 313 |             else | - | 
| 314 |                 pmData->blittable()->fillRect(targetRect & clipData->clipRect, color); | - | 
| 315 |         } else if (clipData->hasRegionClip) { | - | 
| 316 |             QVector<QRect> rects = clipData->clipRegion.rects(); | - | 
| 317 |             for (int i = 0; i < rects.size(); ++i) { | - | 
| 318 |                 QRect intersectRect = rects.at(i).intersected(targetRect.toRect()); | - | 
| 319 |                 if (!intersectRect.isEmpty()) { | - | 
| 320 |                     unlock(); | - | 
| 321 |                     if (alpha) | - | 
| 322 |                         pmData->blittable()->alphaFillRect(intersectRect, color, q->state()->compositionMode()); | - | 
| 323 |                     else | - | 
| 324 |                         pmData->blittable()->fillRect(intersectRect, color); | - | 
| 325 |                 } | - | 
| 326 |             } | - | 
| 327 |         } | - | 
| 328 |     } else { | - | 
| 329 |         if (targetRect.x() >= 0 && targetRect.y() >= 0 | - | 
| 330 |             && targetRect.width() <= q->paintDevice()->width() | - | 
| 331 |             && targetRect.height() <= q->paintDevice()->height()) { | - | 
| 332 |             unlock(); | - | 
| 333 |             if (alpha) | - | 
| 334 |                 pmData->blittable()->alphaFillRect(targetRect, color, q->state()->compositionMode()); | - | 
| 335 |             else | - | 
| 336 |                 pmData->blittable()->fillRect(targetRect, color); | - | 
| 337 |         } else { | - | 
| 338 |             QRectF deviceRect(0, 0, q->paintDevice()->width(), q->paintDevice()->height()); | - | 
| 339 |             unlock(); | - | 
| 340 |             if (alpha) | - | 
| 341 |                 pmData->blittable()->alphaFillRect(deviceRect & targetRect, color, q->state()->compositionMode()); | - | 
| 342 |             else | - | 
| 343 |                 pmData->blittable()->fillRect(deviceRect & targetRect, color); | - | 
| 344 |         } | - | 
| 345 |     } | - | 
| 346 | } | - | 
| 347 |  | - | 
| 348 | void QBlitterPaintEnginePrivate::clipAndDrawPixmap(const QRectF &clip, | - | 
| 349 |                                                    const QRectF &target, | - | 
| 350 |                                                    const QPixmap &pm, | - | 
| 351 |                                                    const QRectF &sr, | - | 
| 352 |                                                    bool opacity) | - | 
| 353 | { | - | 
| 354 |     QBlitterPaintEngine * const q = q_func(); | - | 
| 355 |     QRectF intersectedRect = clip.intersected(target); | - | 
| 356 |     if (intersectedRect.isEmpty()) | - | 
| 357 |         return; | - | 
| 358 |     QRectF source = sr; | - | 
| 359 |     if (intersectedRect.size() != target.size()) { | - | 
| 360 |         if (sr.size() == target.size()) { | - | 
| 361 |  | - | 
| 362 |             qreal deltaTop = target.top() - intersectedRect.top(); | - | 
| 363 |             qreal deltaLeft = target.left() - intersectedRect.left(); | - | 
| 364 |             qreal deltaBottom = target.bottom() - intersectedRect.bottom(); | - | 
| 365 |             qreal deltaRight = target.right() - intersectedRect.right(); | - | 
| 366 |             source.adjust(-deltaLeft, -deltaTop, -deltaRight, -deltaBottom); | - | 
| 367 |         } else { | - | 
| 368 |  | - | 
| 369 |             qreal hFactor = sr.size().width() / target.size().width(); | - | 
| 370 |             qreal vFactor = sr.size().height() / target.size().height(); | - | 
| 371 |             qreal deltaTop = (target.top() - intersectedRect.top()) * vFactor; | - | 
| 372 |             qreal deltaLeft = (target.left() - intersectedRect.left()) * hFactor; | - | 
| 373 |             qreal deltaBottom = (target.bottom() - intersectedRect.bottom()) * vFactor; | - | 
| 374 |             qreal deltaRight = (target.right() - intersectedRect.right()) * hFactor; | - | 
| 375 |             source.adjust(-deltaLeft, -deltaTop, -deltaRight, -deltaBottom); | - | 
| 376 |         } | - | 
| 377 |     } | - | 
| 378 |     pmData->unmarkRasterOverlay(intersectedRect); | - | 
| 379 |     if (opacity) | - | 
| 380 |         pmData->blittable()->drawPixmapOpacity(intersectedRect, pm, source, q->state()->compositionMode(), q->state()->opacity); | - | 
| 381 |     else | - | 
| 382 |         pmData->blittable()->drawPixmap(intersectedRect, pm, source); | - | 
| 383 | } | - | 
| 384 |  | - | 
| 385 | QBlitterPaintEngine::QBlitterPaintEngine(QBlittablePlatformPixmap *p) | - | 
| 386 |     : QRasterPaintEngine(*(new QBlitterPaintEnginePrivate(p)), p->buffer()) | - | 
| 387 | {} | - | 
| 388 |  | - | 
| 389 |  | - | 
| 390 | void QBlitterPaintEngine::penChanged() | - | 
| 391 | { | - | 
| 392 |     QBlitterPaintEnginePrivate * const d = d_func(); | - | 
| 393 |  | - | 
| 394 |     QRasterPaintEngine::penChanged(); | - | 
| 395 |     d->updatePenState(state()); | - | 
| 396 | } | - | 
| 397 |  | - | 
| 398 | void QBlitterPaintEngine::brushChanged() | - | 
| 399 | { | - | 
| 400 |     QBlitterPaintEnginePrivate * const d = d_func(); | - | 
| 401 |  | - | 
| 402 |     QRasterPaintEngine::brushChanged(); | - | 
| 403 |     d->updateBrushState(state()); | - | 
| 404 | } | - | 
| 405 |  | - | 
| 406 | void QBlitterPaintEngine::opacityChanged() | - | 
| 407 | { | - | 
| 408 |     QBlitterPaintEnginePrivate * const d = d_func(); | - | 
| 409 |  | - | 
| 410 |     QRasterPaintEngine::opacityChanged(); | - | 
| 411 |     d->updateOpacityState(state()); | - | 
| 412 | } | - | 
| 413 |  | - | 
| 414 | void QBlitterPaintEngine::compositionModeChanged() | - | 
| 415 | { | - | 
| 416 |     QBlitterPaintEnginePrivate * const d = d_func(); | - | 
| 417 |  | - | 
| 418 |     QRasterPaintEngine::compositionModeChanged(); | - | 
| 419 |     d->updateCompositionModeState(state()); | - | 
| 420 | } | - | 
| 421 |  | - | 
| 422 | void QBlitterPaintEngine::renderHintsChanged() | - | 
| 423 | { | - | 
| 424 |     QBlitterPaintEnginePrivate * const d = d_func(); | - | 
| 425 |  | - | 
| 426 |     QRasterPaintEngine::renderHintsChanged(); | - | 
| 427 |     d->updateRenderHintsState(state()); | - | 
| 428 | } | - | 
| 429 |  | - | 
| 430 | void QBlitterPaintEngine::transformChanged() | - | 
| 431 | { | - | 
| 432 |     QBlitterPaintEnginePrivate * const d = d_func(); | - | 
| 433 |  | - | 
| 434 |     QRasterPaintEngine::transformChanged(); | - | 
| 435 |     d->updateTransformState(state()); | - | 
| 436 | } | - | 
| 437 |  | - | 
| 438 | void QBlitterPaintEngine::clipEnabledChanged() | - | 
| 439 | { | - | 
| 440 |     QBlitterPaintEnginePrivate * const d = d_func(); | - | 
| 441 |     QRasterPaintEngine::clipEnabledChanged(); | - | 
| 442 |     d->updateClipState(state()); | - | 
| 443 | } | - | 
| 444 |  | - | 
| 445 | bool QBlitterPaintEngine::begin(QPaintDevice *pdev) | - | 
| 446 | { | - | 
| 447 |     QBlitterPaintEnginePrivate * const d = d_func(); | - | 
| 448 |     bool ok = QRasterPaintEngine::begin(pdev); | - | 
| 449 |  | - | 
| 450 |  | - | 
| 451 |  | - | 
| 452 |     d->pdev = pdev; | - | 
| 453 |     return ok; | - | 
| 454 | } | - | 
| 455 |  | - | 
| 456 | bool QBlitterPaintEngine::end() | - | 
| 457 | { | - | 
| 458 |  | - | 
| 459 |  | - | 
| 460 |  | - | 
| 461 |  | - | 
| 462 |  | - | 
| 463 |     return QRasterPaintEngine::end(); | - | 
| 464 | } | - | 
| 465 |  | - | 
| 466 | void QBlitterPaintEngine::setState(QPainterState *s) | - | 
| 467 | { | - | 
| 468 |     QBlitterPaintEnginePrivate * const d = d_func(); | - | 
| 469 |  | - | 
| 470 |     QRasterPaintEngine::setState(s); | - | 
| 471 |     d->updateCompleteState(s); | - | 
| 472 | } | - | 
| 473 |  | - | 
| 474 |  | - | 
| 475 | void QBlitterPaintEngine::fill(const QVectorPath &path, const QBrush &brush) | - | 
| 476 | { | - | 
| 477 |     QBlitterPaintEnginePrivate * const d = d_func(); | - | 
| 478 |     if (path.shape() == QVectorPath::RectangleHint) { | - | 
| 479 |         QRectF rect(((const QPointF *) path.points())[0], ((const QPointF *) path.points())[2]); | - | 
| 480 |         fillRect(rect, brush); | - | 
| 481 |     } else { | - | 
| 482 |         d->lock(); | - | 
| 483 |         d->pmData->markRasterOverlay(path); | - | 
| 484 |         QRasterPaintEngine::fill(path, brush); | - | 
| 485 |     } | - | 
| 486 | } | - | 
| 487 |  | - | 
| 488 | void QBlitterPaintEngine::fillRect(const QRectF &rect, const QColor &color) | - | 
| 489 | { | - | 
| 490 |     QBlitterPaintEnginePrivate * const d = d_func(); | - | 
| 491 |     if (d->caps.canBlitterAlphaFillRect()) { | - | 
| 492 |         d->fillRect(rect, color, true); | - | 
| 493 |     } else if (d->caps.canBlitterFillRect() && color.alpha() == 0xff) { | - | 
| 494 |         d->fillRect(rect, color, false); | - | 
| 495 |     } else { | - | 
| 496 |         d->lock(); | - | 
| 497 |         d->pmData->markRasterOverlay(rect); | - | 
| 498 |         QRasterPaintEngine::fillRect(rect, color); | - | 
| 499 |     } | - | 
| 500 | } | - | 
| 501 |  | - | 
| 502 | void QBlitterPaintEngine::fillRect(const QRectF &rect, const QBrush &brush) | - | 
| 503 | { | - | 
| 504 |     if (rect.size().isEmpty()) | - | 
| 505 |         return; | - | 
| 506 |  | - | 
| 507 |     QBlitterPaintEnginePrivate * const d = d_func(); | - | 
| 508 |  | - | 
| 509 |     if (qbrush_style(brush) == Qt::SolidPattern | - | 
| 510 |         && d->caps.canBlitterAlphaFillRect()) { | - | 
| 511 |         d->fillRect(rect, qbrush_color(brush), true); | - | 
| 512 |     } else if (qbrush_style(brush) == Qt::SolidPattern | - | 
| 513 |         && qbrush_color(brush).alpha() == 0xff | - | 
| 514 |         && d->caps.canBlitterFillRect()) { | - | 
| 515 |         d->fillRect(rect, qbrush_color(brush), false); | - | 
| 516 |     } else if ((brush.style() == Qt::TexturePattern) && | - | 
| 517 |                (brush.transform().type() <= QTransform::TxTranslate) && | - | 
| 518 |                 ((d->caps.canBlitterDrawPixmapOpacity(brush.texture())) || | - | 
| 519 |                  (d->caps.canBlitterDrawPixmap(rect, brush.texture(), rect)))) { | - | 
| 520 |         bool rectIsFilled = false; | - | 
| 521 |         QRectF transformedRect = state()->matrix.mapRect(rect); | - | 
| 522 |         qreal x = transformedRect.x(); | - | 
| 523 |         qreal y = transformedRect.y(); | - | 
| 524 |         QPixmap pm = brush.texture(); | - | 
| 525 |         d->unlock(); | - | 
| 526 |         int srcX = int(rect.x() - state()->brushOrigin.x() - brush.transform().dx()) % pm.width(); | - | 
| 527 |         if (srcX < 0) | - | 
| 528 |             srcX = pm.width() + srcX; | - | 
| 529 |         const int startX = srcX; | - | 
| 530 |         int srcY = int(rect.y() - state()->brushOrigin.y() - brush.transform().dy()) % pm.height(); | - | 
| 531 |         if (srcY < 0) | - | 
| 532 |             srcY = pm.height() + srcY; | - | 
| 533 |         while (!rectIsFilled) { | - | 
| 534 |             qreal blitWidth = (pm.width() ) - srcX; | - | 
| 535 |             qreal blitHeight = (pm.height() ) - srcY; | - | 
| 536 |             if (x + blitWidth > transformedRect.right()) | - | 
| 537 |                 blitWidth = transformedRect.right() -x; | - | 
| 538 |             if (y + blitHeight > transformedRect.bottom()) | - | 
| 539 |                 blitHeight = transformedRect.bottom() - y; | - | 
| 540 |             const QClipData *clipData = d->clip(); | - | 
| 541 |             if (clipData->hasRectClip) { | - | 
| 542 |                 QRect targetRect = QRect(x, y, blitWidth, blitHeight).intersected(clipData->clipRect); | - | 
| 543 |                 if (targetRect.isValid()) { | - | 
| 544 |                     int tmpSrcX = srcX + (targetRect.x() - x); | - | 
| 545 |                     int tmpSrcY = srcY + (targetRect.y() - y); | - | 
| 546 |                     QRect srcRect(tmpSrcX, tmpSrcY, targetRect.width(), targetRect.height()); | - | 
| 547 |                     d->pmData->blittable()->drawPixmap(targetRect, pm, srcRect); | - | 
| 548 |                 } | - | 
| 549 |             } else if (clipData->hasRegionClip) { | - | 
| 550 |                 QRect unclippedTargetRect(x, y, blitWidth, blitHeight); | - | 
| 551 |                 const QVector<QRect> intersectedRects = clipData->clipRegion.intersected(unclippedTargetRect).rects(); | - | 
| 552 |                 const int intersectedSize = intersectedRects.size(); | - | 
| 553 |                 for (int i = 0; i < intersectedSize; ++i) { | - | 
| 554 |                     const QRect &targetRect = intersectedRects.at(i); | - | 
| 555 |                     if (!targetRect.isValid() || targetRect.isEmpty()) | - | 
| 556 |                         continue; | - | 
| 557 |                     int tmpSrcX = srcX + (targetRect.x() - x); | - | 
| 558 |                     int tmpSrcY = srcY + (targetRect.y() - y); | - | 
| 559 |                     QRect srcRect(tmpSrcX, tmpSrcY, targetRect.width(), targetRect.height()); | - | 
| 560 |                     d->pmData->blittable()->drawPixmap(targetRect, pm, srcRect); | - | 
| 561 |                 } | - | 
| 562 |             } | - | 
| 563 |             x+=blitWidth; | - | 
| 564 |             if (qFuzzyCompare(x, transformedRect.right())) { | - | 
| 565 |                 x = transformedRect.x(); | - | 
| 566 |                 srcX = startX; | - | 
| 567 |                 srcY = 0; | - | 
| 568 |                 y += blitHeight; | - | 
| 569 |                 if (qFuzzyCompare(y, transformedRect.bottom())) | - | 
| 570 |                     rectIsFilled = true; | - | 
| 571 |             } else | - | 
| 572 |                 srcX = 0; | - | 
| 573 |         } | - | 
| 574 |     } else { | - | 
| 575 |         d->lock(); | - | 
| 576 |         d->pmData->markRasterOverlay(rect); | - | 
| 577 |         QRasterPaintEngine::fillRect(rect, brush); | - | 
| 578 |     } | - | 
| 579 |  | - | 
| 580 | } | - | 
| 581 |  | - | 
| 582 | void QBlitterPaintEngine::drawRects(const QRect *rects, int rectCount) | - | 
| 583 | { | - | 
| 584 |     QBlitterPaintEnginePrivate * const d = d_func(); | - | 
| 585 |     if (d->caps.canBlitterDrawRectMask()) { | - | 
| 586 |         for (int i=0; i<rectCount; ++i) | - | 
| 587 |             d->fillRect(rects[i], qbrush_color(state()->brush), false); | - | 
| 588 |     } else { | - | 
| 589 |         d->pmData->markRasterOverlay(rects, rectCount); | - | 
| 590 |         QRasterPaintEngine::drawRects(rects, rectCount); | - | 
| 591 |     } | - | 
| 592 | } | - | 
| 593 |  | - | 
| 594 | void QBlitterPaintEngine::drawRects(const QRectF *rects, int rectCount) | - | 
| 595 | { | - | 
| 596 |     QBlitterPaintEnginePrivate * const d = d_func(); | - | 
| 597 |     if (d->caps.canBlitterDrawRectMask()) { | - | 
| 598 |         for (int i = 0; i < rectCount; ++i) | - | 
| 599 |             d->fillRect(rects[i], qbrush_color(state()->brush), false); | - | 
| 600 |     } else { | - | 
| 601 |         d->pmData->markRasterOverlay(rects, rectCount); | - | 
| 602 |         QRasterPaintEngine::drawRects(rects, rectCount); | - | 
| 603 |     } | - | 
| 604 | } | - | 
| 605 |  | - | 
| 606 | void QBlitterPaintEngine::drawPixmap(const QPointF &pos, const QPixmap &pm) | - | 
| 607 | { | - | 
| 608 |     drawPixmap(QRectF(pos, pm.size()), pm, pm.rect()); | - | 
| 609 | } | - | 
| 610 |  | - | 
| 611 | void QBlitterPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) | - | 
| 612 | { | - | 
| 613 |     QBlitterPaintEnginePrivate * const d = d_func(); | - | 
| 614 |     bool canDrawOpacity; | - | 
| 615 |  | - | 
| 616 |     canDrawOpacity = d->caps.canBlitterDrawPixmapOpacity(pm); | - | 
| 617 |     if (canDrawOpacity || (d->caps.canBlitterDrawPixmap(r, pm, sr))) { | - | 
| 618 |  | - | 
| 619 |         d->unlock(); | - | 
| 620 |         QRectF targetRect = r; | - | 
| 621 |         if (d->hasXForm) | - | 
| 622 |             targetRect = state()->matrix.mapRect(r); | - | 
| 623 |         const QClipData *clipData = d->clip(); | - | 
| 624 |         if (clipData) { | - | 
| 625 |             if (clipData->hasRectClip) { | - | 
| 626 |                 d->clipAndDrawPixmap(clipData->clipRect, targetRect, pm, sr, canDrawOpacity); | - | 
| 627 |             } else if (clipData->hasRegionClip) { | - | 
| 628 |                 QVector<QRect>rects = clipData->clipRegion.rects(); | - | 
| 629 |                 for (int i = 0; i<rects.size(); ++i) | - | 
| 630 |                     d->clipAndDrawPixmap(rects.at(i), targetRect, pm, sr, canDrawOpacity); | - | 
| 631 |             } | - | 
| 632 |         } else { | - | 
| 633 |             QRectF deviceRect(0, 0, paintDevice()->width(), paintDevice()->height()); | - | 
| 634 |             d->clipAndDrawPixmap(deviceRect, targetRect, pm, sr, canDrawOpacity); | - | 
| 635 |         } | - | 
| 636 |     }else { | - | 
| 637 |         d->lock(); | - | 
| 638 |         d->pmData->markRasterOverlay(r); | - | 
| 639 |         QRasterPaintEngine::drawPixmap(r, pm, sr); | - | 
| 640 |     } | - | 
| 641 | } | - | 
| 642 |  | - | 
| 643 |  | - | 
| 644 | void QBlitterPaintEngine::drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode) | - | 
| 645 | { | - | 
| 646 |     QBlitterPaintEnginePrivate * const d = d_func(); | - | 
| 647 |     d->lock(); | - | 
| 648 |     d->pmData->markRasterOverlay(points, pointCount); | - | 
| 649 |     QRasterPaintEngine::drawPolygon(points, pointCount, mode); | - | 
| 650 | } | - | 
| 651 |  | - | 
| 652 | void QBlitterPaintEngine::drawPolygon(const QPoint *points, int pointCount, PolygonDrawMode mode) | - | 
| 653 | { | - | 
| 654 |     QBlitterPaintEnginePrivate * const d = d_func(); | - | 
| 655 |     d->lock(); | - | 
| 656 |     d->pmData->markRasterOverlay(points, pointCount); | - | 
| 657 |     QRasterPaintEngine::drawPolygon(points, pointCount, mode); | - | 
| 658 | } | - | 
| 659 |  | - | 
| 660 | void QBlitterPaintEngine::fillPath(const QPainterPath &path, QSpanData *fillData) | - | 
| 661 | { | - | 
| 662 |     QBlitterPaintEnginePrivate * const d = d_func(); | - | 
| 663 |     d->lock(); | - | 
| 664 |     d->pmData->markRasterOverlay(path); | - | 
| 665 |     QRasterPaintEngine::fillPath(path, fillData); | - | 
| 666 | } | - | 
| 667 |  | - | 
| 668 | void QBlitterPaintEngine::fillPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode) | - | 
| 669 | { | - | 
| 670 |     QBlitterPaintEnginePrivate * const d = d_func(); | - | 
| 671 |     d->lock(); | - | 
| 672 |     d->pmData->markRasterOverlay(points, pointCount); | - | 
| 673 |     QRasterPaintEngine::fillPolygon(points, pointCount, mode); | - | 
| 674 | } | - | 
| 675 |  | - | 
| 676 | void QBlitterPaintEngine::drawEllipse(const QRectF &r) | - | 
| 677 | { | - | 
| 678 |     QBlitterPaintEnginePrivate * const d = d_func(); | - | 
| 679 |     d->lock(); | - | 
| 680 |     d->pmData->markRasterOverlay(r); | - | 
| 681 |     QRasterPaintEngine::drawEllipse(r); | - | 
| 682 | } | - | 
| 683 |  | - | 
| 684 | void QBlitterPaintEngine::drawImage(const QPointF &pos, const QImage &image) | - | 
| 685 | { | - | 
| 686 |     drawImage(QRectF(pos, image.size()), image, image.rect()); | - | 
| 687 | } | - | 
| 688 |  | - | 
| 689 | void QBlitterPaintEngine::drawImage(const QRectF &r, const QImage &pm, const QRectF &sr, | - | 
| 690 |                                     Qt::ImageConversionFlags flags) | - | 
| 691 | { | - | 
| 692 |     QBlitterPaintEnginePrivate * const d = d_func(); | - | 
| 693 |     d->lock(); | - | 
| 694 |     d->pmData->markRasterOverlay(r); | - | 
| 695 |     QRasterPaintEngine::drawImage(r, pm, sr, flags); | - | 
| 696 | } | - | 
| 697 |  | - | 
| 698 | void QBlitterPaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pm, const QPointF &sr) | - | 
| 699 | { | - | 
| 700 |     QBlitterPaintEnginePrivate * const d = d_func(); | - | 
| 701 |     d->lock(); | - | 
| 702 |     d->pmData->markRasterOverlay(r); | - | 
| 703 |     QRasterPaintEngine::drawTiledPixmap(r, pm, sr); | - | 
| 704 | } | - | 
| 705 |  | - | 
| 706 | void QBlitterPaintEngine::drawTextItem(const QPointF &pos, const QTextItem &ti) | - | 
| 707 | { | - | 
| 708 |     QBlitterPaintEnginePrivate * const d = d_func(); | - | 
| 709 |     d->lock(); | - | 
| 710 |     d->pmData->markRasterOverlay(pos, ti); | - | 
| 711 |     QRasterPaintEngine::drawTextItem(pos, ti); | - | 
| 712 | } | - | 
| 713 |  | - | 
| 714 | void QBlitterPaintEngine::drawPoints(const QPointF *points, int pointCount) | - | 
| 715 | { | - | 
| 716 |     QBlitterPaintEnginePrivate * const d = d_func(); | - | 
| 717 |     d->lock(); | - | 
| 718 |     d->pmData->markRasterOverlay(points, pointCount); | - | 
| 719 |     QRasterPaintEngine::drawPoints(points, pointCount); | - | 
| 720 | } | - | 
| 721 |  | - | 
| 722 | void QBlitterPaintEngine::drawPoints(const QPoint *points, int pointCount) | - | 
| 723 | { | - | 
| 724 |     QBlitterPaintEnginePrivate * const d = d_func(); | - | 
| 725 |     d->lock(); | - | 
| 726 |     d->pmData->markRasterOverlay(points, pointCount); | - | 
| 727 |     QRasterPaintEngine::drawPoints(points, pointCount); | - | 
| 728 | } | - | 
| 729 |  | - | 
| 730 | void QBlitterPaintEngine::stroke(const QVectorPath &path, const QPen &pen) | - | 
| 731 | { | - | 
| 732 |     QBlitterPaintEnginePrivate * const d = d_func(); | - | 
| 733 |     d->lock(); | - | 
| 734 |     d->pmData->markRasterOverlay(path); | - | 
| 735 |     QRasterPaintEngine::stroke(path, pen); | - | 
| 736 | } | - | 
| 737 |  | - | 
| 738 | void QBlitterPaintEngine::drawStaticTextItem(QStaticTextItem *sti) | - | 
| 739 | { | - | 
| 740 |     QBlitterPaintEnginePrivate * const d = d_func(); | - | 
| 741 |     d->lock(); | - | 
| 742 |     QRasterPaintEngine::drawStaticTextItem(sti); | - | 
| 743 |  | - | 
| 744 |  | - | 
| 745 |  | - | 
| 746 |  | - | 
| 747 |  | - | 
| 748 | } | - | 
| 749 |  | - | 
| 750 | bool QBlitterPaintEngine::drawCachedGlyphs(int numGlyphs, const glyph_t *glyphs, const QFixedPoint *positions, QFontEngine *fontEngine) | - | 
| 751 | { | - | 
| 752 |     QBlitterPaintEnginePrivate * const d = d_func(); | - | 
| 753 |     QFontEngine::GlyphFormat glyphFormat = d->glyphCacheFormat; | - | 
| 754 |     if (fontEngine->glyphFormat != QFontEngine::Format_None) | - | 
| 755 |         glyphFormat = fontEngine->glyphFormat; | - | 
| 756 |  | - | 
| 757 |     const QClipData *clipData = d->clip(); | - | 
| 758 |     const bool complexClip = clipData && !clipData->hasRectClip; | - | 
| 759 |  | - | 
| 760 |     const QPainterState *s = state(); | - | 
| 761 |     if (d->caps.canBlitterDrawCachedGlyphs(s->transform(), glyphFormat, complexClip)) { | - | 
| 762 |         d->unlock(); | - | 
| 763 |         const bool result = d->pmData->blittable()->drawCachedGlyphs(s, glyphFormat, numGlyphs, glyphs, positions, fontEngine); | - | 
| 764 |  | - | 
| 765 |         d->lock(); | - | 
| 766 |         return result; | - | 
| 767 |     } else { | - | 
| 768 |         return QRasterPaintEngine::drawCachedGlyphs(numGlyphs, glyphs, positions, fontEngine); | - | 
| 769 |     } | - | 
| 770 | } | - | 
| 771 |  | - | 
| 772 |  | - | 
 |  |  |