qgraphicseffect.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/widgets/effects/qgraphicseffect.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7QGraphicsEffectPrivate::~QGraphicsEffectPrivate()-
8{-
9}-
10QGraphicsEffectSource::QGraphicsEffectSource(QGraphicsEffectSourcePrivate &dd, QObject *parent)-
11 : QObject(dd, parent)-
12{}
never executed: end of block
0
13-
14-
15-
16-
17QGraphicsEffectSource::~QGraphicsEffectSource()-
18{}-
19-
20-
21-
22-
23-
24-
25QRectF QGraphicsEffectSource::boundingRect(Qt::CoordinateSystem system) const-
26{-
27 return
never executed: return d_func()->boundingRect(system);
d_func()->boundingRect(system);
never executed: return d_func()->boundingRect(system);
0
28}-
29QRectF QGraphicsEffect::sourceBoundingRect(Qt::CoordinateSystem system) const-
30{-
31 const QGraphicsEffectPrivate * const d = d_func();-
32 if (d->source
d->sourceDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
33 return
never executed: return d->source->boundingRect(system);
d->source->boundingRect(system);
never executed: return d->source->boundingRect(system);
0
34 return
never executed: return QRectF();
QRectF();
never executed: return QRectF();
0
35}-
36-
37-
38-
39-
40-
41-
42-
43const QGraphicsItem *QGraphicsEffectSource::graphicsItem() const-
44{-
45 return
never executed: return d_func()->graphicsItem();
d_func()->graphicsItem();
never executed: return d_func()->graphicsItem();
0
46}-
47-
48-
49-
50-
51-
52-
53-
54const QWidget *QGraphicsEffectSource::widget() const-
55{-
56 return
never executed: return d_func()->widget();
d_func()->widget();
never executed: return d_func()->widget();
0
57}-
58-
59-
60-
61-
62-
63-
64-
65const QStyleOption *QGraphicsEffectSource::styleOption() const-
66{-
67 return
never executed: return d_func()->styleOption();
d_func()->styleOption();
never executed: return d_func()->styleOption();
0
68}-
69void QGraphicsEffectSource::draw(QPainter *painter)-
70{-
71 const QGraphicsEffectSourcePrivate * const d = d_func();-
72-
73 QPixmap pm;-
74 if (QPixmapCache::find(d->m_cacheKey, &pm)
QPixmapCache::...cacheKey, &pm)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
75 QTransform restoreTransform;-
76 if (d->m_cachedSystem == Qt::DeviceCoordinates
d->m_cachedSys...iceCoordinatesDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
77 restoreTransform = painter->worldTransform();-
78 painter->setWorldTransform(QTransform());-
79 }
never executed: end of block
0
80-
81 painter->drawPixmap(d->m_cachedOffset, pm);-
82-
83 if (d->m_cachedSystem == Qt::DeviceCoordinates
d->m_cachedSys...iceCoordinatesDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
84 painter->setWorldTransform(restoreTransform);
never executed: painter->setWorldTransform(restoreTransform);
0
85 }
never executed: end of block
else {
0
86 d_func()->draw(painter);-
87 }
never executed: end of block
0
88}-
89void QGraphicsEffect::drawSource(QPainter *painter)-
90{-
91 const QGraphicsEffectPrivate * const d = d_func();-
92 if (d->source
d->sourceDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
93 d->source->draw(painter);
never executed: d->source->draw(painter);
0
94}
never executed: end of block
0
95void QGraphicsEffectSource::update()-
96{-
97 d_func()->update();-
98}
never executed: end of block
0
99bool QGraphicsEffectSource::isPixmap() const-
100{-
101 return
never executed: return d_func()->isPixmap();
d_func()->isPixmap();
never executed: return d_func()->isPixmap();
0
102}-
103bool QGraphicsEffect::sourceIsPixmap() const-
104{-
105 return
never executed: return source() ? source()->isPixmap() : false;
source() ? source()->isPixmap() : false;
never executed: return source() ? source()->isPixmap() : false;
0
106}-
107QPixmap QGraphicsEffectSource::pixmap(Qt::CoordinateSystem system, QPoint *offset, QGraphicsEffect::PixmapPadMode mode) const-
108{-
109 const QGraphicsEffectSourcePrivate * const d = d_func();-
110-
111-
112 const QGraphicsItem *item = graphicsItem();-
113 if (system == Qt::LogicalCoordinates
system == Qt::...calCoordinatesDescription
TRUEnever evaluated
FALSEnever evaluated
&& mode == QGraphicsEffect::NoPad
mode == QGraphicsEffect::NoPadDescription
TRUEnever evaluated
FALSEnever evaluated
&& item
itemDescription
TRUEnever evaluated
FALSEnever evaluated
&& isPixmap()
isPixmap()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
114 const QGraphicsPixmapItem *pixmapItem = static_cast<const QGraphicsPixmapItem *>(item);-
115 if (offset
offsetDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
116 *
never executed: *offset = pixmapItem->offset().toPoint();
offset = pixmapItem->offset().toPoint();
never executed: *offset = pixmapItem->offset().toPoint();
0
117 return
never executed: return pixmapItem->pixmap();
pixmapItem->pixmap();
never executed: return pixmapItem->pixmap();
0
118 }-
119-
120 if (__builtin_expect(!!(system == Qt::DeviceCoordinates && item && !static_cast<const QGraphicsItemEffectSourcePrivate *>(d_func())->info), false)
__builtin_expe...>info), false)Description
TRUEnever evaluated
FALSEnever evaluated
0
121 ) {-
122 QMessageLogger(__FILE__, 327, __PRETTY_FUNCTION__).warning("QGraphicsEffectSource::pixmap: Not yet implemented, lacking device context");-
123 return
never executed: return QPixmap();
QPixmap();
never executed: return QPixmap();
0
124 }-
125-
126 QPixmap pm;-
127 if (item
itemDescription
TRUEnever evaluated
FALSEnever evaluated
&& d->m_cachedSystem == system
d->m_cachedSystem == systemDescription
TRUEnever evaluated
FALSEnever evaluated
&& d->m_cachedMode == mode
d->m_cachedMode == modeDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
128 QPixmapCache::find(d->m_cacheKey, &pm);
never executed: QPixmapCache::find(d->m_cacheKey, &pm);
0
129-
130 if (pm.isNull()
pm.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
131 pm = d->pixmap(system, &d->m_cachedOffset, mode);-
132 d->m_cachedSystem = system;-
133 d->m_cachedMode = mode;-
134-
135 d->invalidateCache();-
136 d->m_cacheKey = QPixmapCache::insert(pm);-
137 }
never executed: end of block
0
138-
139 if (offset
offsetDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
140 *
never executed: *offset = d->m_cachedOffset;
offset = d->m_cachedOffset;
never executed: *offset = d->m_cachedOffset;
0
141-
142 return
never executed: return pm;
pm;
never executed: return pm;
0
143}-
144QPixmap QGraphicsEffect::sourcePixmap(Qt::CoordinateSystem system, QPoint *offset, QGraphicsEffect::PixmapPadMode mode) const-
145{-
146 const QGraphicsEffectPrivate * const d = d_func();-
147 if (d->source
d->sourceDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
148 return
never executed: return d->source->pixmap(system, offset, mode);
d->source->pixmap(system, offset, mode);
never executed: return d->source->pixmap(system, offset, mode);
0
149 return
never executed: return QPixmap();
QPixmap();
never executed: return QPixmap();
0
150}-
151-
152QGraphicsEffectSourcePrivate::~QGraphicsEffectSourcePrivate()-
153{-
154 invalidateCache();-
155}
never executed: end of block
0
156-
157void QGraphicsEffectSourcePrivate::setCachedOffset(const QPoint &offset)-
158{-
159 m_cachedOffset = offset;-
160}
never executed: end of block
0
161-
162void QGraphicsEffectSourcePrivate::invalidateCache(InvalidateReason reason) const-
163{-
164 if (m_cachedMode != QGraphicsEffect::PadToEffectiveBoundingRect
m_cachedMode !...veBoundingRectDescription
TRUEnever evaluated
FALSEnever evaluated
0
165 && (reason == EffectRectChanged
reason == EffectRectChangedDescription
TRUEnever evaluated
FALSEnever evaluated
0
166 || (reason == TransformChanged
reason == TransformChangedDescription
TRUEnever evaluated
FALSEnever evaluated
&& m_cachedSystem == Qt::LogicalCoordinates
m_cachedSystem...calCoordinatesDescription
TRUEnever evaluated
FALSEnever evaluated
))) {
0
167 return;
never executed: return;
0
168 }-
169-
170 QPixmapCache::remove(m_cacheKey);-
171}
never executed: end of block
0
172-
173-
174-
175-
176-
177QGraphicsEffect::QGraphicsEffect(QObject *parent)-
178 : QObject(*new QGraphicsEffectPrivate, parent)-
179{-
180}
never executed: end of block
0
181-
182-
183-
184-
185QGraphicsEffect::QGraphicsEffect(QGraphicsEffectPrivate &dd, QObject *parent)-
186 : QObject(dd, parent)-
187{-
188}
never executed: end of block
0
189-
190-
191-
192-
193QGraphicsEffect::~QGraphicsEffect()-
194{-
195 QGraphicsEffectPrivate * const d = d_func();-
196 d->setGraphicsEffectSource(0);-
197}
never executed: end of block
0
198QRectF QGraphicsEffect::boundingRect() const-
199{-
200 const QGraphicsEffectPrivate * const d = d_func();-
201 if (d->source
d->sourceDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
202 return
never executed: return boundingRectFor(d->source->boundingRect());
boundingRectFor(d->source->boundingRect());
never executed: return boundingRectFor(d->source->boundingRect());
0
203 return
never executed: return QRectF();
QRectF();
never executed: return QRectF();
0
204}-
205QRectF QGraphicsEffect::boundingRectFor(const QRectF &rect) const-
206{-
207 return
never executed: return rect;
rect;
never executed: return rect;
0
208}-
209bool QGraphicsEffect::isEnabled() const-
210{-
211 const QGraphicsEffectPrivate * const d = d_func();-
212 return
never executed: return d->isEnabled;
d->isEnabled;
never executed: return d->isEnabled;
0
213}-
214-
215void QGraphicsEffect::setEnabled(bool enable)-
216{-
217 QGraphicsEffectPrivate * const d = d_func();-
218 if (d->isEnabled == enable
d->isEnabled == enableDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
219 return;
never executed: return;
0
220-
221 d->isEnabled = enable;-
222 if (d->source
d->sourceDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
223 d->source->d_func()->effectBoundingRectChanged();-
224 d->source->d_func()->invalidateCache();-
225 }
never executed: end of block
0
226 enabledChanged(enable);-
227}
never executed: end of block
0
228void QGraphicsEffect::update()-
229{-
230 QGraphicsEffectPrivate * const d = d_func();-
231 if (d->source
d->sourceDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
232 d->source->update();
never executed: d->source->update();
0
233}
never executed: end of block
0
234QGraphicsEffectSource *QGraphicsEffect::source() const-
235{-
236 const QGraphicsEffectPrivate * const d = d_func();-
237 return
never executed: return d->source;
d->source;
never executed: return d->source;
0
238}-
239void QGraphicsEffect::updateBoundingRect()-
240{-
241 QGraphicsEffectPrivate * const d = d_func();-
242 if (d->source
d->sourceDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
243 d->source->d_func()->effectBoundingRectChanged();-
244 d->source->d_func()->invalidateCache(QGraphicsEffectSourcePrivate::EffectRectChanged);-
245 }
never executed: end of block
0
246}
never executed: end of block
0
247void QGraphicsEffect::sourceChanged(ChangeFlags flags)-
248{-
249 (void)flags;;-
250}
never executed: end of block
0
251QGraphicsColorizeEffect::QGraphicsColorizeEffect(QObject *parent)-
252 : QGraphicsEffect(*new QGraphicsColorizeEffectPrivate, parent)-
253{-
254}
never executed: end of block
0
255-
256-
257-
258-
259QGraphicsColorizeEffect::~QGraphicsColorizeEffect()-
260{-
261}-
262-
263-
264-
265-
266-
267-
268-
269QColor QGraphicsColorizeEffect::color() const-
270{-
271 const QGraphicsColorizeEffectPrivate * const d = d_func();-
272 return
never executed: return d->filter->color();
d->filter->color();
never executed: return d->filter->color();
0
273}-
274-
275void QGraphicsColorizeEffect::setColor(const QColor &color)-
276{-
277 QGraphicsColorizeEffectPrivate * const d = d_func();-
278 if (d->filter->color() == color
d->filter->color() == colorDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
279 return;
never executed: return;
0
280-
281 d->filter->setColor(color);-
282 update();-
283 colorChanged(color);-
284}
never executed: end of block
0
285qreal QGraphicsColorizeEffect::strength() const-
286{-
287 const QGraphicsColorizeEffectPrivate * const d = d_func();-
288 return
never executed: return d->filter->strength();
d->filter->strength();
never executed: return d->filter->strength();
0
289}-
290-
291void QGraphicsColorizeEffect::setStrength(qreal strength)-
292{-
293 QGraphicsColorizeEffectPrivate * const d = d_func();-
294 if (qFuzzyCompare(d->filter->strength(), strength)
qFuzzyCompare(...h(), strength)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
295 return;
never executed: return;
0
296-
297 d->filter->setStrength(strength);-
298 d->opaque = !qFuzzyIsNull(strength);-
299 update();-
300 strengthChanged(strength);-
301}
never executed: end of block
0
302void QGraphicsColorizeEffect::draw(QPainter *painter)-
303{-
304 QGraphicsColorizeEffectPrivate * const d = d_func();-
305-
306 if (!d->opaque
!d->opaqueDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
307 drawSource(painter);-
308 return;
never executed: return;
0
309 }-
310-
311 QPoint offset;-
312 if (sourceIsPixmap()
sourceIsPixmap()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
313-
314 const QPixmap pixmap = sourcePixmap(Qt::LogicalCoordinates, &offset, NoPad);-
315 if (!pixmap.isNull()
!pixmap.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
316 d->filter->draw(painter, offset, pixmap);
never executed: d->filter->draw(painter, offset, pixmap);
0
317-
318 return;
never executed: return;
0
319 }-
320-
321-
322 const QPixmap pixmap = sourcePixmap(Qt::DeviceCoordinates, &offset);-
323 if (pixmap.isNull()
pixmap.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
324 return;
never executed: return;
0
325-
326 QTransform restoreTransform = painter->worldTransform();-
327 painter->setWorldTransform(QTransform());-
328 d->filter->draw(painter, offset, pixmap);-
329 painter->setWorldTransform(restoreTransform);-
330}
never executed: end of block
0
331QGraphicsBlurEffect::QGraphicsBlurEffect(QObject *parent)-
332 : QGraphicsEffect(*new QGraphicsBlurEffectPrivate, parent)-
333{-
334 QGraphicsBlurEffectPrivate * const d = d_func();-
335 d->filter->setBlurHints(QGraphicsBlurEffect::PerformanceHint);-
336}
never executed: end of block
0
337-
338-
339-
340-
341QGraphicsBlurEffect::~QGraphicsBlurEffect()-
342{-
343}-
344qreal QGraphicsBlurEffect::blurRadius() const-
345{-
346 const QGraphicsBlurEffectPrivate * const d = d_func();-
347 return
never executed: return d->filter->radius();
d->filter->radius();
never executed: return d->filter->radius();
0
348}-
349-
350void QGraphicsBlurEffect::setBlurRadius(qreal radius)-
351{-
352 QGraphicsBlurEffectPrivate * const d = d_func();-
353 if (qFuzzyCompare(d->filter->radius(), radius)
qFuzzyCompare(...ius(), radius)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
354 return;
never executed: return;
0
355-
356 d->filter->setRadius(radius);-
357 updateBoundingRect();-
358 blurRadiusChanged(radius);-
359}
never executed: end of block
0
360QGraphicsBlurEffect::BlurHints QGraphicsBlurEffect::blurHints() const-
361{-
362 const QGraphicsBlurEffectPrivate * const d = d_func();-
363 return
never executed: return d->filter->blurHints();
d->filter->blurHints();
never executed: return d->filter->blurHints();
0
364}-
365-
366void QGraphicsBlurEffect::setBlurHints(QGraphicsBlurEffect::BlurHints hints)-
367{-
368 QGraphicsBlurEffectPrivate * const d = d_func();-
369 if (d->filter->blurHints() == hints
d->filter->blu...nts() == hintsDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
370 return;
never executed: return;
0
371-
372 d->filter->setBlurHints(hints);-
373 blurHintsChanged(hints);-
374}
never executed: end of block
0
375QRectF QGraphicsBlurEffect::boundingRectFor(const QRectF &rect) const-
376{-
377 const QGraphicsBlurEffectPrivate * const d = d_func();-
378 return
never executed: return d->filter->boundingRectFor(rect);
d->filter->boundingRectFor(rect);
never executed: return d->filter->boundingRectFor(rect);
0
379}-
380-
381-
382-
383-
384void QGraphicsBlurEffect::draw(QPainter *painter)-
385{-
386 QGraphicsBlurEffectPrivate * const d = d_func();-
387 if (d->filter->radius() < 1
d->filter->radius() < 1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
388 drawSource(painter);-
389 return;
never executed: return;
0
390 }-
391-
392 PixmapPadMode mode = PadToEffectiveBoundingRect;-
393-
394 QPoint offset;-
395 QPixmap pixmap = sourcePixmap(Qt::LogicalCoordinates, &offset, mode);-
396 if (pixmap.isNull()
pixmap.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
397 return;
never executed: return;
0
398-
399 d->filter->draw(painter, offset, pixmap);-
400}
never executed: end of block
0
401QGraphicsDropShadowEffect::QGraphicsDropShadowEffect(QObject *parent)-
402 : QGraphicsEffect(*new QGraphicsDropShadowEffectPrivate, parent)-
403{-
404}
never executed: end of block
0
405-
406-
407-
408-
409QGraphicsDropShadowEffect::~QGraphicsDropShadowEffect()-
410{-
411}-
412QPointF QGraphicsDropShadowEffect::offset() const-
413{-
414 const QGraphicsDropShadowEffectPrivate * const d = d_func();-
415 return
never executed: return d->filter->offset();
d->filter->offset();
never executed: return d->filter->offset();
0
416}-
417-
418void QGraphicsDropShadowEffect::setOffset(const QPointF &offset)-
419{-
420 QGraphicsDropShadowEffectPrivate * const d = d_func();-
421 if (d->filter->offset() == offset
d->filter->offset() == offsetDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
422 return;
never executed: return;
0
423-
424 d->filter->setOffset(offset);-
425 updateBoundingRect();-
426 offsetChanged(offset);-
427}
never executed: end of block
0
428qreal QGraphicsDropShadowEffect::blurRadius() const-
429{-
430 const QGraphicsDropShadowEffectPrivate * const d = d_func();-
431 return
never executed: return d->filter->blurRadius();
d->filter->blurRadius();
never executed: return d->filter->blurRadius();
0
432}-
433-
434void QGraphicsDropShadowEffect::setBlurRadius(qreal blurRadius)-
435{-
436 QGraphicsDropShadowEffectPrivate * const d = d_func();-
437 if (qFuzzyCompare(d->filter->blurRadius(), blurRadius)
qFuzzyCompare(...), blurRadius)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
438 return;
never executed: return;
0
439-
440 d->filter->setBlurRadius(blurRadius);-
441 updateBoundingRect();-
442 blurRadiusChanged(blurRadius);-
443}
never executed: end of block
0
444QColor QGraphicsDropShadowEffect::color() const-
445{-
446 const QGraphicsDropShadowEffectPrivate * const d = d_func();-
447 return
never executed: return d->filter->color();
d->filter->color();
never executed: return d->filter->color();
0
448}-
449-
450void QGraphicsDropShadowEffect::setColor(const QColor &color)-
451{-
452 QGraphicsDropShadowEffectPrivate * const d = d_func();-
453 if (d->filter->color() == color
d->filter->color() == colorDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
454 return;
never executed: return;
0
455-
456 d->filter->setColor(color);-
457 update();-
458 colorChanged(color);-
459}
never executed: end of block
0
460QRectF QGraphicsDropShadowEffect::boundingRectFor(const QRectF &rect) const-
461{-
462 const QGraphicsDropShadowEffectPrivate * const d = d_func();-
463 return
never executed: return d->filter->boundingRectFor(rect);
d->filter->boundingRectFor(rect);
never executed: return d->filter->boundingRectFor(rect);
0
464}-
465-
466-
467-
468-
469void QGraphicsDropShadowEffect::draw(QPainter *painter)-
470{-
471 QGraphicsDropShadowEffectPrivate * const d = d_func();-
472 if (d->filter->blurRadius() <= 0
d->filter->blurRadius() <= 0Description
TRUEnever evaluated
FALSEnever evaluated
&& d->filter->offset().isNull()
d->filter->offset().isNull()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
473 drawSource(painter);-
474 return;
never executed: return;
0
475 }-
476-
477 PixmapPadMode mode = PadToEffectiveBoundingRect;-
478-
479-
480 QPoint offset;-
481 const QPixmap pixmap = sourcePixmap(Qt::DeviceCoordinates, &offset, mode);-
482 if (pixmap.isNull()
pixmap.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
483 return;
never executed: return;
0
484-
485 QTransform restoreTransform = painter->worldTransform();-
486 painter->setWorldTransform(QTransform());-
487 d->filter->draw(painter, offset, pixmap);-
488 painter->setWorldTransform(restoreTransform);-
489}
never executed: end of block
0
490QGraphicsOpacityEffect::QGraphicsOpacityEffect(QObject *parent)-
491 : QGraphicsEffect(*new QGraphicsOpacityEffectPrivate, parent)-
492{-
493}
never executed: end of block
0
494-
495-
496-
497-
498QGraphicsOpacityEffect::~QGraphicsOpacityEffect()-
499{-
500}-
501qreal QGraphicsOpacityEffect::opacity() const-
502{-
503 const QGraphicsOpacityEffectPrivate * const d = d_func();-
504 return
never executed: return d->opacity;
d->opacity;
never executed: return d->opacity;
0
505}-
506-
507void QGraphicsOpacityEffect::setOpacity(qreal opacity)-
508{-
509 QGraphicsOpacityEffectPrivate * const d = d_func();-
510 opacity = qBound(qreal(0.0), opacity, qreal(1.0));-
511-
512 if (qFuzzyCompare(d->opacity, opacity)
qFuzzyCompare(...city, opacity)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
513 return;
never executed: return;
0
514-
515 d->opacity = opacity;-
516 if ((
(d->isFullyTra...l(d->opacity))Description
TRUEnever evaluated
FALSEnever evaluated
d->isFullyTransparent = qFuzzyIsNull(d->opacity))
(d->isFullyTra...l(d->opacity))Description
TRUEnever evaluated
FALSEnever evaluated
)
0
517 d->isFullyOpaque = 0;
never executed: d->isFullyOpaque = 0;
0
518 else-
519 d->isFullyOpaque = qFuzzyIsNull(d->opacity - 1);
never executed: d->isFullyOpaque = qFuzzyIsNull(d->opacity - 1);
0
520 update();-
521 opacityChanged(opacity);-
522}
never executed: end of block
0
523QBrush QGraphicsOpacityEffect::opacityMask() const-
524{-
525 const QGraphicsOpacityEffectPrivate * const d = d_func();-
526 return
never executed: return d->opacityMask;
d->opacityMask;
never executed: return d->opacityMask;
0
527}-
528-
529void QGraphicsOpacityEffect::setOpacityMask(const QBrush &mask)-
530{-
531 QGraphicsOpacityEffectPrivate * const d = d_func();-
532 if (d->opacityMask == mask
d->opacityMask == maskDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
533 return;
never executed: return;
0
534-
535 d->opacityMask = mask;-
536 d->hasOpacityMask = (mask.style() != Qt::NoBrush);-
537 update();-
538-
539 opacityMaskChanged(mask);-
540}
never executed: end of block
0
541void QGraphicsOpacityEffect::draw(QPainter *painter)-
542{-
543 QGraphicsOpacityEffectPrivate * const d = d_func();-
544-
545-
546 if (d->isFullyTransparent
d->isFullyTransparentDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
547 return;
never executed: return;
0
548-
549-
550 if (d->isFullyOpaque
d->isFullyOpaqueDescription
TRUEnever evaluated
FALSEnever evaluated
&& !d->hasOpacityMask
!d->hasOpacityMaskDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
551 drawSource(painter);-
552 return;
never executed: return;
0
553 }-
554-
555 QPoint offset;-
556 Qt::CoordinateSystem system = sourceIsPixmap()
sourceIsPixmap()Description
TRUEnever evaluated
FALSEnever evaluated
? Qt::LogicalCoordinates : Qt::DeviceCoordinates;
0
557 QPixmap pixmap = sourcePixmap(system, &offset, QGraphicsEffect::NoPad);-
558 if (pixmap.isNull()
pixmap.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
559 return;
never executed: return;
0
560-
561 painter->save();-
562 painter->setOpacity(d->opacity);-
563-
564 if (d->hasOpacityMask
d->hasOpacityMaskDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
565 QPainter pixmapPainter(&pixmap);-
566 pixmapPainter.setRenderHints(painter->renderHints());-
567 pixmapPainter.setCompositionMode(QPainter::CompositionMode_DestinationIn);-
568 if (system == Qt::DeviceCoordinates
system == Qt::...iceCoordinatesDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
569 QTransform worldTransform = painter->worldTransform();-
570 worldTransform *= QTransform::fromTranslate(-offset.x(), -offset.y());-
571 pixmapPainter.setWorldTransform(worldTransform);-
572 pixmapPainter.fillRect(sourceBoundingRect(), d->opacityMask);-
573 }
never executed: end of block
else {
0
574 pixmapPainter.translate(-offset);-
575 pixmapPainter.fillRect(pixmap.rect(), d->opacityMask);-
576 }
never executed: end of block
0
577 }-
578-
579 if (system == Qt::DeviceCoordinates
system == Qt::...iceCoordinatesDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
580 painter->setWorldTransform(QTransform());
never executed: painter->setWorldTransform(QTransform());
0
581-
582 painter->drawPixmap(offset, pixmap);-
583 painter->restore();-
584}
never executed: end of block
0
585-
586-
587-
588-
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9