| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/items/qquickshadereffectsource.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||
| 2 | - | |||||||||||||||||||
| 3 | - | |||||||||||||||||||
| 4 | - | |||||||||||||||||||
| 5 | - | |||||||||||||||||||
| 6 | - | |||||||||||||||||||
| 7 | class QQuickShaderEffectSourceTextureProvider : public QSGTextureProvider | - | ||||||||||||||||||
| 8 | { | - | ||||||||||||||||||
| 9 | public: | - | ||||||||||||||||||
| 10 | #pragma GCC diagnostic push | - | ||||||||||||||||||
| 11 | - | |||||||||||||||||||
| 12 | #pragma GCC diagnostic ignored "-Wsuggest-override" | - | ||||||||||||||||||
| 13 | static const QMetaObject staticMetaObject; virtual const QMetaObject *metaObject() const; virtual void *qt_metacast(const char *); virtual int qt_metacall(QMetaObject::Call, int, void **); static inline QString tr(const char *s, const char *c = nullptr, int n = -1) { return staticMetaObject.tr(s, c, n); } __attribute__ ((__deprecated__)) static inline QString trUtf8(const char *s, const char *c = nullptr, int n = -1) { return staticMetaObject.tr(s, c, n); } private: | - | ||||||||||||||||||
| 14 | #pragma GCC diagnostic ignored "-Wattributes" | - | ||||||||||||||||||
| 15 | __attribute__((visibility("hidden"))) static void qt_static_metacall(QObject *, QMetaObject::Call, int, void **); | - | ||||||||||||||||||
| 16 | #pragma GCC diagnostic pop | - | ||||||||||||||||||
| 17 | struct QPrivateSignal {}; | - | ||||||||||||||||||
| 18 | public: | - | ||||||||||||||||||
| 19 | QQuickShaderEffectSourceTextureProvider() | - | ||||||||||||||||||
| 20 | : sourceTexture(nullptr) | - | ||||||||||||||||||
| 21 | , mipmapFiltering(QSGTexture::None) | - | ||||||||||||||||||
| 22 | , filtering(QSGTexture::Nearest) | - | ||||||||||||||||||
| 23 | , horizontalWrap(QSGTexture::ClampToEdge) | - | ||||||||||||||||||
| 24 | , verticalWrap(QSGTexture::ClampToEdge) | - | ||||||||||||||||||
| 25 | { | - | ||||||||||||||||||
| 26 | } executed 57 times by 3 tests: end of blockExecuted by:
| 57 | ||||||||||||||||||
| 27 | - | |||||||||||||||||||
| 28 | QSGTexture *texture() const override { | - | ||||||||||||||||||
| 29 | sourceTexture->setMipmapFiltering(mipmapFiltering); | - | ||||||||||||||||||
| 30 | sourceTexture->setFiltering(filtering); | - | ||||||||||||||||||
| 31 | sourceTexture->setHorizontalWrapMode(horizontalWrap); | - | ||||||||||||||||||
| 32 | sourceTexture->setVerticalWrapMode(verticalWrap); | - | ||||||||||||||||||
| 33 | return executed 598 times by 3 tests: sourceTexture;return sourceTexture;Executed by:
executed 598 times by 3 tests: return sourceTexture;Executed by:
| 598 | ||||||||||||||||||
| 34 | } | - | ||||||||||||||||||
| 35 | - | |||||||||||||||||||
| 36 | QSGLayer *sourceTexture; | - | ||||||||||||||||||
| 37 | - | |||||||||||||||||||
| 38 | QSGTexture::Filtering mipmapFiltering; | - | ||||||||||||||||||
| 39 | QSGTexture::Filtering filtering; | - | ||||||||||||||||||
| 40 | QSGTexture::WrapMode horizontalWrap; | - | ||||||||||||||||||
| 41 | QSGTexture::WrapMode verticalWrap; | - | ||||||||||||||||||
| 42 | }; | - | ||||||||||||||||||
| 43 | - | |||||||||||||||||||
| 44 | class QQuickShaderEffectSourceCleanup : public QRunnable | - | ||||||||||||||||||
| 45 | { | - | ||||||||||||||||||
| 46 | public: | - | ||||||||||||||||||
| 47 | QQuickShaderEffectSourceCleanup(QSGLayer *t, QQuickShaderEffectSourceTextureProvider *p) | - | ||||||||||||||||||
| 48 | : texture(t) | - | ||||||||||||||||||
| 49 | , provider(p) | - | ||||||||||||||||||
| 50 | {} executed 93 times by 4 tests: end of blockExecuted by:
| 93 | ||||||||||||||||||
| 51 | void run() override { | - | ||||||||||||||||||
| 52 | delete texture; | - | ||||||||||||||||||
| 53 | delete provider; | - | ||||||||||||||||||
| 54 | } executed 93 times by 4 tests: end of blockExecuted by:
| 93 | ||||||||||||||||||
| 55 | QSGLayer *texture; | - | ||||||||||||||||||
| 56 | QQuickShaderEffectSourceTextureProvider *provider; | - | ||||||||||||||||||
| 57 | }; | - | ||||||||||||||||||
| 58 | QQuickShaderEffectSource::QQuickShaderEffectSource(QQuickItem *parent) | - | ||||||||||||||||||
| 59 | : QQuickItem(parent) | - | ||||||||||||||||||
| 60 | , m_provider(nullptr) | - | ||||||||||||||||||
| 61 | , m_texture(nullptr) | - | ||||||||||||||||||
| 62 | , m_wrapMode(ClampToEdge) | - | ||||||||||||||||||
| 63 | , m_sourceItem(nullptr) | - | ||||||||||||||||||
| 64 | , m_textureSize(0, 0) | - | ||||||||||||||||||
| 65 | , m_format(RGBA) | - | ||||||||||||||||||
| 66 | , m_samples(0) | - | ||||||||||||||||||
| 67 | , m_live(true) | - | ||||||||||||||||||
| 68 | , m_hideSource(false) | - | ||||||||||||||||||
| 69 | , m_mipmap(false) | - | ||||||||||||||||||
| 70 | , m_recursive(false) | - | ||||||||||||||||||
| 71 | , m_grab(true) | - | ||||||||||||||||||
| 72 | , m_textureMirroring(MirrorVertically) | - | ||||||||||||||||||
| 73 | { | - | ||||||||||||||||||
| 74 | setFlag(ItemHasContents); | - | ||||||||||||||||||
| 75 | } executed 108 times by 4 tests: end of blockExecuted by:
| 108 | ||||||||||||||||||
| 76 | - | |||||||||||||||||||
| 77 | QQuickShaderEffectSource::~QQuickShaderEffectSource() | - | ||||||||||||||||||
| 78 | { | - | ||||||||||||||||||
| 79 | if (window()
| 2-106 | ||||||||||||||||||
| 80 | window()->scheduleRenderJob(new QQuickShaderEffectSourceCleanup(m_texture, m_provider), | - | ||||||||||||||||||
| 81 | QQuickWindow::AfterSynchronizingStage); | - | ||||||||||||||||||
| 82 | } executed 2 times by 1 test: else {end of blockExecuted by:
| 2 | ||||||||||||||||||
| 83 | - | |||||||||||||||||||
| 84 | - | |||||||||||||||||||
| 85 | ((!m_texture) ? static_cast<void>(0) : qt_assert("!m_texture", __FILE__, 211)); | - | ||||||||||||||||||
| 86 | ((!m_provider) ? static_cast<void>(0) : qt_assert("!m_provider", __FILE__, 212)); | - | ||||||||||||||||||
| 87 | } executed 106 times by 4 tests: end of blockExecuted by:
| 106 | ||||||||||||||||||
| 88 | - | |||||||||||||||||||
| 89 | if (m_sourceItem
| 10-98 | ||||||||||||||||||
| 90 | QQuickItemPrivate *sd = QQuickItemPrivate::get(m_sourceItem); | - | ||||||||||||||||||
| 91 | sd->removeItemChangeListener(this, QQuickItemPrivate::Geometry); | - | ||||||||||||||||||
| 92 | sd->derefFromEffectItem(m_hideSource); | - | ||||||||||||||||||
| 93 | if (window()
| 2-96 | ||||||||||||||||||
| 94 | sd->derefWindow(); executed 2 times by 1 test: sd->derefWindow();Executed by:
| 2 | ||||||||||||||||||
| 95 | } executed 98 times by 4 tests: end of blockExecuted by:
| 98 | ||||||||||||||||||
| 96 | } executed 108 times by 4 tests: end of blockExecuted by:
| 108 | ||||||||||||||||||
| 97 | - | |||||||||||||||||||
| 98 | void QQuickShaderEffectSource::ensureTexture() | - | ||||||||||||||||||
| 99 | { | - | ||||||||||||||||||
| 100 | if (m_texture
| 101-139 | ||||||||||||||||||
| 101 | return; executed 139 times by 4 tests: return;Executed by:
| 139 | ||||||||||||||||||
| 102 | - | |||||||||||||||||||
| 103 | ((QQuickItemPrivate::get(this)->window && QQuickItemPrivate::get(this)->sceneGraphRenderContext() && QThread::currentThread() == QQuickItemPrivate::get(this)->sceneGraphRenderContext()->thread()) ? static_cast<void>(0) : qt_assert_x("QQuickShaderEffectSource::ensureTexture", "Cannot be used outside the rendering thread", | - | ||||||||||||||||||
| 104 | - | |||||||||||||||||||
| 105 | - | |||||||||||||||||||
| 106 | - | |||||||||||||||||||
| 107 | __FILE__ | - | ||||||||||||||||||
| 108 | , | - | ||||||||||||||||||
| 109 | - | |||||||||||||||||||
| 110 | - | |||||||||||||||||||
| 111 | - | |||||||||||||||||||
| 112 | 233 | - | ||||||||||||||||||
| 113 | )) | - | ||||||||||||||||||
| 114 | - | |||||||||||||||||||
| 115 | - | |||||||||||||||||||
| 116 | - | |||||||||||||||||||
| 117 | ; | - | ||||||||||||||||||
| 118 | - | |||||||||||||||||||
| 119 | QSGRenderContext *rc = QQuickItemPrivate::get(this)->sceneGraphRenderContext(); | - | ||||||||||||||||||
| 120 | m_texture = rc->sceneGraphContext()->createLayer(rc); | - | ||||||||||||||||||
| 121 | connect(QQuickItemPrivate::get(this)->window, qFlagLocation("2""sceneGraphInvalidated()" "\0" __FILE__ ":" "237"), m_texture, qFlagLocation("1""invalidated()" "\0" __FILE__ ":" "237"), Qt::DirectConnection); | - | ||||||||||||||||||
| 122 | connect(m_texture, qFlagLocation("2""updateRequested()" "\0" __FILE__ ":" "238"), this, qFlagLocation("1""update()" "\0" __FILE__ ":" "238")); | - | ||||||||||||||||||
| 123 | connect(m_texture, qFlagLocation("2""scheduledUpdateCompleted()" "\0" __FILE__ ":" "239"), this, qFlagLocation("2""scheduledUpdateCompleted()" "\0" __FILE__ ":" "239")); | - | ||||||||||||||||||
| 124 | } executed 101 times by 4 tests: end of blockExecuted by:
| 101 | ||||||||||||||||||
| 125 | - | |||||||||||||||||||
| 126 | static void get_wrap_mode(QQuickShaderEffectSource::WrapMode mode, QSGTexture::WrapMode *hWrap, QSGTexture::WrapMode *vWrap); | - | ||||||||||||||||||
| 127 | - | |||||||||||||||||||
| 128 | QSGTextureProvider *QQuickShaderEffectSource::textureProvider() const | - | ||||||||||||||||||
| 129 | { | - | ||||||||||||||||||
| 130 | const QQuickItemPrivate *d = QQuickItemPrivate::get(this); | - | ||||||||||||||||||
| 131 | if (!d->window
| 0-58 | ||||||||||||||||||
| 132 | QMessageLogger(__FILE__, 248, __PRETTY_FUNCTION__).warning("QQuickShaderEffectSource::textureProvider: can only be queried on the rendering thread of an exposed window"); | - | ||||||||||||||||||
| 133 | return never executed: nullptr;return nullptr;never executed: return nullptr; | 0 | ||||||||||||||||||
| 134 | } | - | ||||||||||||||||||
| 135 | - | |||||||||||||||||||
| 136 | if (!m_provider
| 1-57 | ||||||||||||||||||
| 137 | const_cast<QQuickShaderEffectSource *>(this)->m_provider = new QQuickShaderEffectSourceTextureProvider(); | - | ||||||||||||||||||
| 138 | const_cast<QQuickShaderEffectSource *>(this)->ensureTexture(); | - | ||||||||||||||||||
| 139 | connect(m_texture, qFlagLocation("2""updateRequested()" "\0" __FILE__ ":" "255"), m_provider, qFlagLocation("2""textureChanged()" "\0" __FILE__ ":" "255")); | - | ||||||||||||||||||
| 140 | - | |||||||||||||||||||
| 141 | get_wrap_mode(m_wrapMode, &m_provider->horizontalWrap, &m_provider->verticalWrap); | - | ||||||||||||||||||
| 142 | m_provider->mipmapFiltering = mipmap()
| 0-57 | ||||||||||||||||||
| 143 | m_provider->filtering = smooth()
| 19-38 | ||||||||||||||||||
| 144 | m_provider->sourceTexture = m_texture; | - | ||||||||||||||||||
| 145 | } executed 57 times by 3 tests: end of blockExecuted by:
| 57 | ||||||||||||||||||
| 146 | return executed 58 times by 3 tests: m_provider;return m_provider;Executed by:
executed 58 times by 3 tests: return m_provider;Executed by:
| 58 | ||||||||||||||||||
| 147 | } | - | ||||||||||||||||||
| 148 | QQuickShaderEffectSource::WrapMode QQuickShaderEffectSource::wrapMode() const | - | ||||||||||||||||||
| 149 | { | - | ||||||||||||||||||
| 150 | return never executed: m_wrapMode;return m_wrapMode;never executed: return m_wrapMode; | 0 | ||||||||||||||||||
| 151 | } | - | ||||||||||||||||||
| 152 | - | |||||||||||||||||||
| 153 | void QQuickShaderEffectSource::setWrapMode(WrapMode mode) | - | ||||||||||||||||||
| 154 | { | - | ||||||||||||||||||
| 155 | if (mode == m_wrapMode
| 0-82 | ||||||||||||||||||
| 156 | return; executed 82 times by 2 tests: return;Executed by:
| 82 | ||||||||||||||||||
| 157 | m_wrapMode = mode; | - | ||||||||||||||||||
| 158 | update(); | - | ||||||||||||||||||
| 159 | wrapModeChanged(); | - | ||||||||||||||||||
| 160 | } never executed: end of block | 0 | ||||||||||||||||||
| 161 | QQuickItem *QQuickShaderEffectSource::sourceItem() const | - | ||||||||||||||||||
| 162 | { | - | ||||||||||||||||||
| 163 | return executed 183 times by 4 tests: m_sourceItem;return m_sourceItem;Executed by:
executed 183 times by 4 tests: return m_sourceItem;Executed by:
| 183 | ||||||||||||||||||
| 164 | } | - | ||||||||||||||||||
| 165 | - | |||||||||||||||||||
| 166 | void QQuickShaderEffectSource::itemGeometryChanged(QQuickItem *item, QQuickGeometryChange change, const QRectF &) | - | ||||||||||||||||||
| 167 | { | - | ||||||||||||||||||
| 168 | ((item == m_sourceItem) ? static_cast<void>(0) : qt_assert("item == m_sourceItem", __FILE__, 314)); | - | ||||||||||||||||||
| 169 | (void)item;; | - | ||||||||||||||||||
| 170 | if (change.sizeChange()
| 8-24 | ||||||||||||||||||
| 171 | update(); executed 24 times by 3 tests: update();Executed by:
| 24 | ||||||||||||||||||
| 172 | } executed 32 times by 3 tests: end of blockExecuted by:
| 32 | ||||||||||||||||||
| 173 | - | |||||||||||||||||||
| 174 | void QQuickShaderEffectSource::setSourceItem(QQuickItem *item) | - | ||||||||||||||||||
| 175 | { | - | ||||||||||||||||||
| 176 | if (item == m_sourceItem
| 0-108 | ||||||||||||||||||
| 177 | return; never executed: return; | 0 | ||||||||||||||||||
| 178 | if (m_sourceItem
| 0-108 | ||||||||||||||||||
| 179 | QQuickItemPrivate *d = QQuickItemPrivate::get(m_sourceItem); | - | ||||||||||||||||||
| 180 | d->derefFromEffectItem(m_hideSource); | - | ||||||||||||||||||
| 181 | d->removeItemChangeListener(this, QQuickItemPrivate::Geometry); | - | ||||||||||||||||||
| 182 | disconnect(m_sourceItem, qFlagLocation("2""destroyed(QObject*)" "\0" __FILE__ ":" "328"), this, qFlagLocation("1""sourceItemDestroyed(QObject*)" "\0" __FILE__ ":" "328")); | - | ||||||||||||||||||
| 183 | if (window()
| 0 | ||||||||||||||||||
| 184 | d->derefWindow(); never executed: d->derefWindow(); | 0 | ||||||||||||||||||
| 185 | } never executed: end of block | 0 | ||||||||||||||||||
| 186 | - | |||||||||||||||||||
| 187 | m_sourceItem = item; | - | ||||||||||||||||||
| 188 | - | |||||||||||||||||||
| 189 | if (m_sourceItem
| 0-108 | ||||||||||||||||||
| 190 | if (window() == m_sourceItem->window()
| 0-108 | ||||||||||||||||||
| 191 | || (window() == nullptr
| 0 | ||||||||||||||||||
| 192 | || (m_sourceItem->window() == nullptr
| 0 | ||||||||||||||||||
| 193 | QQuickItemPrivate *d = QQuickItemPrivate::get(item); | - | ||||||||||||||||||
| 194 | - | |||||||||||||||||||
| 195 | - | |||||||||||||||||||
| 196 | - | |||||||||||||||||||
| 197 | - | |||||||||||||||||||
| 198 | if (window()
| 22-86 | ||||||||||||||||||
| 199 | d->refWindow(window()); executed 22 times by 2 tests: d->refWindow(window());Executed by:
| 22 | ||||||||||||||||||
| 200 | else if (m_sourceItem->window()
| 0-86 | ||||||||||||||||||
| 201 | d->refWindow(m_sourceItem->window()); never executed: d->refWindow(m_sourceItem->window()); | 0 | ||||||||||||||||||
| 202 | d->refFromEffectItem(m_hideSource); | - | ||||||||||||||||||
| 203 | d->addItemChangeListener(this, QQuickItemPrivate::Geometry); | - | ||||||||||||||||||
| 204 | connect(m_sourceItem, qFlagLocation("2""destroyed(QObject*)" "\0" __FILE__ ":" "350"), this, qFlagLocation("1""sourceItemDestroyed(QObject*)" "\0" __FILE__ ":" "350")); | - | ||||||||||||||||||
| 205 | } executed 108 times by 4 tests: else {end of blockExecuted by:
| 108 | ||||||||||||||||||
| 206 | QMessageLogger(__FILE__, 352, __PRETTY_FUNCTION__).warning("ShaderEffectSource: sourceItem and ShaderEffectSource must both be children of the same window."); | - | ||||||||||||||||||
| 207 | m_sourceItem = nullptr; | - | ||||||||||||||||||
| 208 | } never executed: end of block | 0 | ||||||||||||||||||
| 209 | } | - | ||||||||||||||||||
| 210 | update(); | - | ||||||||||||||||||
| 211 | sourceItemChanged(); | - | ||||||||||||||||||
| 212 | } executed 108 times by 4 tests: end of blockExecuted by:
| 108 | ||||||||||||||||||
| 213 | - | |||||||||||||||||||
| 214 | void QQuickShaderEffectSource::sourceItemDestroyed(QObject *item) | - | ||||||||||||||||||
| 215 | { | - | ||||||||||||||||||
| 216 | ((item == m_sourceItem) ? static_cast<void>(0) : qt_assert("item == m_sourceItem", __FILE__, 362)); | - | ||||||||||||||||||
| 217 | (void)item;; | - | ||||||||||||||||||
| 218 | m_sourceItem = nullptr; | - | ||||||||||||||||||
| 219 | update(); | - | ||||||||||||||||||
| 220 | sourceItemChanged(); | - | ||||||||||||||||||
| 221 | } executed 10 times by 2 tests: end of blockExecuted by:
| 10 | ||||||||||||||||||
| 222 | QRectF QQuickShaderEffectSource::sourceRect() const | - | ||||||||||||||||||
| 223 | { | - | ||||||||||||||||||
| 224 | return never executed: m_sourceRect;return m_sourceRect;never executed: return m_sourceRect; | 0 | ||||||||||||||||||
| 225 | } | - | ||||||||||||||||||
| 226 | - | |||||||||||||||||||
| 227 | void QQuickShaderEffectSource::setSourceRect(const QRectF &rect) | - | ||||||||||||||||||
| 228 | { | - | ||||||||||||||||||
| 229 | if (rect == m_sourceRect
| 2-80 | ||||||||||||||||||
| 230 | return; executed 80 times by 2 tests: return;Executed by:
| 80 | ||||||||||||||||||
| 231 | m_sourceRect = rect; | - | ||||||||||||||||||
| 232 | update(); | - | ||||||||||||||||||
| 233 | sourceRectChanged(); | - | ||||||||||||||||||
| 234 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||
| 235 | QSize QQuickShaderEffectSource::textureSize() const | - | ||||||||||||||||||
| 236 | { | - | ||||||||||||||||||
| 237 | return never executed: m_textureSize;return m_textureSize;never executed: return m_textureSize; | 0 | ||||||||||||||||||
| 238 | } | - | ||||||||||||||||||
| 239 | - | |||||||||||||||||||
| 240 | void QQuickShaderEffectSource::setTextureSize(const QSize &size) | - | ||||||||||||||||||
| 241 | { | - | ||||||||||||||||||
| 242 | if (size == m_textureSize
| 0-82 | ||||||||||||||||||
| 243 | return; never executed: return; | 0 | ||||||||||||||||||
| 244 | m_textureSize = size; | - | ||||||||||||||||||
| 245 | update(); | - | ||||||||||||||||||
| 246 | textureSizeChanged(); | - | ||||||||||||||||||
| 247 | } executed 82 times by 2 tests: end of blockExecuted by:
| 82 | ||||||||||||||||||
| 248 | QQuickShaderEffectSource::Format QQuickShaderEffectSource::format() const | - | ||||||||||||||||||
| 249 | { | - | ||||||||||||||||||
| 250 | return never executed: m_format;return m_format;never executed: return m_format; | 0 | ||||||||||||||||||
| 251 | } | - | ||||||||||||||||||
| 252 | - | |||||||||||||||||||
| 253 | void QQuickShaderEffectSource::setFormat(QQuickShaderEffectSource::Format format) | - | ||||||||||||||||||
| 254 | { | - | ||||||||||||||||||
| 255 | if (format == m_format
| 0-82 | ||||||||||||||||||
| 256 | return; executed 82 times by 2 tests: return;Executed by:
| 82 | ||||||||||||||||||
| 257 | m_format = format; | - | ||||||||||||||||||
| 258 | update(); | - | ||||||||||||||||||
| 259 | formatChanged(); | - | ||||||||||||||||||
| 260 | } never executed: end of block | 0 | ||||||||||||||||||
| 261 | bool QQuickShaderEffectSource::live() const | - | ||||||||||||||||||
| 262 | { | - | ||||||||||||||||||
| 263 | return never executed: m_live;return m_live;never executed: return m_live; | 0 | ||||||||||||||||||
| 264 | } | - | ||||||||||||||||||
| 265 | - | |||||||||||||||||||
| 266 | void QQuickShaderEffectSource::setLive(bool live) | - | ||||||||||||||||||
| 267 | { | - | ||||||||||||||||||
| 268 | if (live == m_live
| 0 | ||||||||||||||||||
| 269 | return; never executed: return; | 0 | ||||||||||||||||||
| 270 | m_live = live; | - | ||||||||||||||||||
| 271 | update(); | - | ||||||||||||||||||
| 272 | liveChanged(); | - | ||||||||||||||||||
| 273 | } never executed: end of block | 0 | ||||||||||||||||||
| 274 | bool QQuickShaderEffectSource::hideSource() const | - | ||||||||||||||||||
| 275 | { | - | ||||||||||||||||||
| 276 | return never executed: m_hideSource;return m_hideSource;never executed: return m_hideSource; | 0 | ||||||||||||||||||
| 277 | } | - | ||||||||||||||||||
| 278 | - | |||||||||||||||||||
| 279 | void QQuickShaderEffectSource::setHideSource(bool hide) | - | ||||||||||||||||||
| 280 | { | - | ||||||||||||||||||
| 281 | if (hide == m_hideSource
| 0-96 | ||||||||||||||||||
| 282 | return; never executed: return; | 0 | ||||||||||||||||||
| 283 | if (m_sourceItem
| 6-90 | ||||||||||||||||||
| 284 | QQuickItemPrivate::get(m_sourceItem)->refFromEffectItem(hide); | - | ||||||||||||||||||
| 285 | QQuickItemPrivate::get(m_sourceItem)->derefFromEffectItem(m_hideSource); | - | ||||||||||||||||||
| 286 | } executed 90 times by 4 tests: end of blockExecuted by:
| 90 | ||||||||||||||||||
| 287 | m_hideSource = hide; | - | ||||||||||||||||||
| 288 | update(); | - | ||||||||||||||||||
| 289 | hideSourceChanged(); | - | ||||||||||||||||||
| 290 | } executed 96 times by 4 tests: end of blockExecuted by:
| 96 | ||||||||||||||||||
| 291 | bool QQuickShaderEffectSource::mipmap() const | - | ||||||||||||||||||
| 292 | { | - | ||||||||||||||||||
| 293 | return executed 57 times by 3 tests: m_mipmap;return m_mipmap;Executed by:
executed 57 times by 3 tests: return m_mipmap;Executed by:
| 57 | ||||||||||||||||||
| 294 | } | - | ||||||||||||||||||
| 295 | - | |||||||||||||||||||
| 296 | void QQuickShaderEffectSource::setMipmap(bool enabled) | - | ||||||||||||||||||
| 297 | { | - | ||||||||||||||||||
| 298 | if (enabled == m_mipmap
| 2-80 | ||||||||||||||||||
| 299 | return; executed 80 times by 2 tests: return;Executed by:
| 80 | ||||||||||||||||||
| 300 | m_mipmap = enabled; | - | ||||||||||||||||||
| 301 | update(); | - | ||||||||||||||||||
| 302 | mipmapChanged(); | - | ||||||||||||||||||
| 303 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||
| 304 | bool QQuickShaderEffectSource::recursive() const | - | ||||||||||||||||||
| 305 | { | - | ||||||||||||||||||
| 306 | return never executed: m_recursive;return m_recursive;never executed: return m_recursive; | 0 | ||||||||||||||||||
| 307 | } | - | ||||||||||||||||||
| 308 | - | |||||||||||||||||||
| 309 | void QQuickShaderEffectSource::setRecursive(bool enabled) | - | ||||||||||||||||||
| 310 | { | - | ||||||||||||||||||
| 311 | if (enabled == m_recursive
| 0 | ||||||||||||||||||
| 312 | return; never executed: return; | 0 | ||||||||||||||||||
| 313 | m_recursive = enabled; | - | ||||||||||||||||||
| 314 | recursiveChanged(); | - | ||||||||||||||||||
| 315 | } never executed: end of block | 0 | ||||||||||||||||||
| 316 | QQuickShaderEffectSource::TextureMirroring QQuickShaderEffectSource::textureMirroring() const | - | ||||||||||||||||||
| 317 | { | - | ||||||||||||||||||
| 318 | return never executed: QQuickShaderEffectSource::TextureMirroring(m_textureMirroring);return QQuickShaderEffectSource::TextureMirroring(m_textureMirroring);never executed: return QQuickShaderEffectSource::TextureMirroring(m_textureMirroring); | 0 | ||||||||||||||||||
| 319 | } | - | ||||||||||||||||||
| 320 | - | |||||||||||||||||||
| 321 | void QQuickShaderEffectSource::setTextureMirroring(TextureMirroring mirroring) | - | ||||||||||||||||||
| 322 | { | - | ||||||||||||||||||
| 323 | if (mirroring == QQuickShaderEffectSource::TextureMirroring(m_textureMirroring)
| 42-66 | ||||||||||||||||||
| 324 | return; executed 66 times by 2 tests: return;Executed by:
| 66 | ||||||||||||||||||
| 325 | m_textureMirroring = mirroring; | - | ||||||||||||||||||
| 326 | update(); | - | ||||||||||||||||||
| 327 | textureMirroringChanged(); | - | ||||||||||||||||||
| 328 | } executed 42 times by 1 test: end of blockExecuted by:
| 42 | ||||||||||||||||||
| 329 | int QQuickShaderEffectSource::samples() const | - | ||||||||||||||||||
| 330 | { | - | ||||||||||||||||||
| 331 | return never executed: m_samples;return m_samples;never executed: return m_samples; | 0 | ||||||||||||||||||
| 332 | } | - | ||||||||||||||||||
| 333 | - | |||||||||||||||||||
| 334 | void QQuickShaderEffectSource::setSamples(int count) | - | ||||||||||||||||||
| 335 | { | - | ||||||||||||||||||
| 336 | if (count == m_samples
| 2-80 | ||||||||||||||||||
| 337 | return; executed 80 times by 2 tests: return;Executed by:
| 80 | ||||||||||||||||||
| 338 | m_samples = count; | - | ||||||||||||||||||
| 339 | update(); | - | ||||||||||||||||||
| 340 | samplesChanged(); | - | ||||||||||||||||||
| 341 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||
| 342 | void QQuickShaderEffectSource::scheduleUpdate() | - | ||||||||||||||||||
| 343 | { | - | ||||||||||||||||||
| 344 | if (m_grab
| 0 | ||||||||||||||||||
| 345 | return; never executed: return; | 0 | ||||||||||||||||||
| 346 | m_grab = true; | - | ||||||||||||||||||
| 347 | update(); | - | ||||||||||||||||||
| 348 | } never executed: end of block | 0 | ||||||||||||||||||
| 349 | - | |||||||||||||||||||
| 350 | static void get_wrap_mode(QQuickShaderEffectSource::WrapMode mode, QSGTexture::WrapMode *hWrap, QSGTexture::WrapMode *vWrap) | - | ||||||||||||||||||
| 351 | { | - | ||||||||||||||||||
| 352 | switch (mode) { | - | ||||||||||||||||||
| 353 | case never executed: QQuickShaderEffectSource::RepeatHorizontally:case QQuickShaderEffectSource::RepeatHorizontally:never executed: case QQuickShaderEffectSource::RepeatHorizontally: | 0 | ||||||||||||||||||
| 354 | *hWrap = QSGTexture::Repeat; | - | ||||||||||||||||||
| 355 | *vWrap = QSGTexture::ClampToEdge; | - | ||||||||||||||||||
| 356 | break; never executed: break; | 0 | ||||||||||||||||||
| 357 | case never executed: QQuickShaderEffectSource::RepeatVertically:case QQuickShaderEffectSource::RepeatVertically:never executed: case QQuickShaderEffectSource::RepeatVertically: | 0 | ||||||||||||||||||
| 358 | *vWrap = QSGTexture::Repeat; | - | ||||||||||||||||||
| 359 | *hWrap = QSGTexture::ClampToEdge; | - | ||||||||||||||||||
| 360 | break; never executed: break; | 0 | ||||||||||||||||||
| 361 | case never executed: QQuickShaderEffectSource::Repeat:case QQuickShaderEffectSource::Repeat:never executed: case QQuickShaderEffectSource::Repeat: | 0 | ||||||||||||||||||
| 362 | *hWrap = *vWrap = QSGTexture::Repeat; | - | ||||||||||||||||||
| 363 | break; never executed: break; | 0 | ||||||||||||||||||
| 364 | default executed 240 times by 4 tests: :default:Executed by:
executed 240 times by 4 tests: default:Executed by:
| 240 | ||||||||||||||||||
| 365 | - | |||||||||||||||||||
| 366 | *hWrap = *vWrap = QSGTexture::ClampToEdge; | - | ||||||||||||||||||
| 367 | break; executed 240 times by 4 tests: break;Executed by:
| 240 | ||||||||||||||||||
| 368 | } | - | ||||||||||||||||||
| 369 | } | - | ||||||||||||||||||
| 370 | - | |||||||||||||||||||
| 371 | - | |||||||||||||||||||
| 372 | void QQuickShaderEffectSource::releaseResources() | - | ||||||||||||||||||
| 373 | { | - | ||||||||||||||||||
| 374 | if (m_texture
| 0-91 | ||||||||||||||||||
| 375 | window()->scheduleRenderJob(new QQuickShaderEffectSourceCleanup(m_texture, m_provider), | - | ||||||||||||||||||
| 376 | QQuickWindow::AfterSynchronizingStage); | - | ||||||||||||||||||
| 377 | m_texture = nullptr; | - | ||||||||||||||||||
| 378 | m_provider = nullptr; | - | ||||||||||||||||||
| 379 | } executed 91 times by 4 tests: end of blockExecuted by:
| 91 | ||||||||||||||||||
| 380 | } executed 101 times by 4 tests: end of blockExecuted by:
| 101 | ||||||||||||||||||
| 381 | - | |||||||||||||||||||
| 382 | class QQuickShaderSourceAttachedNode : public QObject, public QSGNode | - | ||||||||||||||||||
| 383 | { | - | ||||||||||||||||||
| 384 | public: | - | ||||||||||||||||||
| 385 | #pragma GCC diagnostic push | - | ||||||||||||||||||
| 386 | - | |||||||||||||||||||
| 387 | #pragma GCC diagnostic ignored "-Wsuggest-override" | - | ||||||||||||||||||
| 388 | static const QMetaObject staticMetaObject; virtual const QMetaObject *metaObject() const; virtual void *qt_metacast(const char *); virtual int qt_metacall(QMetaObject::Call, int, void **); static inline QString tr(const char *s, const char *c = nullptr, int n = -1) { return staticMetaObject.tr(s, c, n); } __attribute__ ((__deprecated__)) static inline QString trUtf8(const char *s, const char *c = nullptr, int n = -1) { return staticMetaObject.tr(s, c, n); } private: | - | ||||||||||||||||||
| 389 | #pragma GCC diagnostic ignored "-Wattributes" | - | ||||||||||||||||||
| 390 | __attribute__((visibility("hidden"))) static void qt_static_metacall(QObject *, QMetaObject::Call, int, void **); | - | ||||||||||||||||||
| 391 | #pragma GCC diagnostic pop | - | ||||||||||||||||||
| 392 | struct QPrivateSignal {}; | - | ||||||||||||||||||
| 393 | public: | - | ||||||||||||||||||
| 394 | void markTextureDirty() { | - | ||||||||||||||||||
| 395 | QSGNode *pn = QSGNode::parent(); | - | ||||||||||||||||||
| 396 | if (pn
| 0-52 | ||||||||||||||||||
| 397 | ((pn->type() == QSGNode::GeometryNodeType) ? static_cast<void>(0) : qt_assert("pn->type() == QSGNode::GeometryNodeType", __FILE__, 677)); | - | ||||||||||||||||||
| 398 | pn->markDirty(DirtyMaterial); | - | ||||||||||||||||||
| 399 | } executed 52 times by 2 tests: end of blockExecuted by:
| 52 | ||||||||||||||||||
| 400 | } executed 52 times by 2 tests: end of blockExecuted by:
| 52 | ||||||||||||||||||
| 401 | }; | - | ||||||||||||||||||
| 402 | - | |||||||||||||||||||
| 403 | QSGNode *QQuickShaderEffectSource::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) | - | ||||||||||||||||||
| 404 | { | - | ||||||||||||||||||
| 405 | if (!m_sourceItem
| 0-183 | ||||||||||||||||||
| 406 | if (m_texture
| 0-4 | ||||||||||||||||||
| 407 | m_texture->setItem(nullptr); executed 4 times by 1 test: m_texture->setItem(nullptr);Executed by:
| 4 | ||||||||||||||||||
| 408 | delete oldNode; | - | ||||||||||||||||||
| 409 | return executed 4 times by 1 test: nullptr;return nullptr;Executed by:
executed 4 times by 1 test: return nullptr;Executed by:
| 4 | ||||||||||||||||||
| 410 | } | - | ||||||||||||||||||
| 411 | - | |||||||||||||||||||
| 412 | ensureTexture(); | - | ||||||||||||||||||
| 413 | - | |||||||||||||||||||
| 414 | m_texture->setLive(m_live); | - | ||||||||||||||||||
| 415 | m_texture->setItem(QQuickItemPrivate::get(m_sourceItem)->itemNode()); | - | ||||||||||||||||||
| 416 | QRectF sourceRect = m_sourceRect.width() == 0
| 0-179 | ||||||||||||||||||
| 417 | ? QRectF(0, 0, m_sourceItem->width(), m_sourceItem->height()) | - | ||||||||||||||||||
| 418 | : m_sourceRect; | - | ||||||||||||||||||
| 419 | m_texture->setRect(sourceRect); | - | ||||||||||||||||||
| 420 | QSize textureSize = m_textureSize.isEmpty()
| 2-181 | ||||||||||||||||||
| 421 | ? QSize(qCeil(qAbs(sourceRect.width())), qCeil(qAbs(sourceRect.height()))) | - | ||||||||||||||||||
| 422 | : m_textureSize; | - | ||||||||||||||||||
| 423 | ((!textureSize.isEmpty()) ? static_cast<void>(0) : qt_assert("!textureSize.isEmpty()", __FILE__, 703)); | - | ||||||||||||||||||
| 424 | - | |||||||||||||||||||
| 425 | QQuickItemPrivate *d = static_cast<QQuickItemPrivate *>(QObjectPrivate::get(this)); | - | ||||||||||||||||||
| 426 | - | |||||||||||||||||||
| 427 | - | |||||||||||||||||||
| 428 | if (sourceItem()
| 0-183 | ||||||||||||||||||
| 429 | textureSize *= d->window->effectiveDevicePixelRatio(); executed 183 times by 4 tests: textureSize *= d->window->effectiveDevicePixelRatio();Executed by:
| 183 | ||||||||||||||||||
| 430 | - | |||||||||||||||||||
| 431 | const QSize minTextureSize = d->sceneGraphContext()->minimumFBOSize(); | - | ||||||||||||||||||
| 432 | - | |||||||||||||||||||
| 433 | while (textureSize.width() < minTextureSize.width()
| 0-183 | ||||||||||||||||||
| 434 | textureSize.rwidth() *= 2; never executed: textureSize.rwidth() *= 2; | 0 | ||||||||||||||||||
| 435 | while (textureSize.height() < minTextureSize.height()
| 0-183 | ||||||||||||||||||
| 436 | textureSize.rheight() *= 2; never executed: textureSize.rheight() *= 2; | 0 | ||||||||||||||||||
| 437 | - | |||||||||||||||||||
| 438 | m_texture->setDevicePixelRatio(d->window->effectiveDevicePixelRatio()); | - | ||||||||||||||||||
| 439 | m_texture->setSize(textureSize); | - | ||||||||||||||||||
| 440 | m_texture->setRecursive(m_recursive); | - | ||||||||||||||||||
| 441 | m_texture->setFormat(m_format); | - | ||||||||||||||||||
| 442 | m_texture->setHasMipmaps(m_mipmap); | - | ||||||||||||||||||
| 443 | m_texture->setMirrorHorizontal(m_textureMirroring & MirrorHorizontally); | - | ||||||||||||||||||
| 444 | m_texture->setMirrorVertical(m_textureMirroring & MirrorVertically); | - | ||||||||||||||||||
| 445 | m_texture->setSamples(m_samples); | - | ||||||||||||||||||
| 446 | - | |||||||||||||||||||
| 447 | if (m_grab
| 82-101 | ||||||||||||||||||
| 448 | m_texture->scheduleUpdate(); executed 101 times by 4 tests: m_texture->scheduleUpdate();Executed by:
| 101 | ||||||||||||||||||
| 449 | m_grab = false; | - | ||||||||||||||||||
| 450 | - | |||||||||||||||||||
| 451 | QSGTexture::Filtering filtering = QQuickItemPrivate::get(this)->smooth
| 53-130 | ||||||||||||||||||
| 452 | ? QSGTexture::Linear | - | ||||||||||||||||||
| 453 | : QSGTexture::Nearest; | - | ||||||||||||||||||
| 454 | QSGTexture::Filtering mmFiltering = m_mipmap
| 4-179 | ||||||||||||||||||
| 455 | QSGTexture::WrapMode hWrap, vWrap; | - | ||||||||||||||||||
| 456 | get_wrap_mode(m_wrapMode, &hWrap, &vWrap); | - | ||||||||||||||||||
| 457 | - | |||||||||||||||||||
| 458 | if (m_provider
| 87-96 | ||||||||||||||||||
| 459 | m_provider->mipmapFiltering = mmFiltering; | - | ||||||||||||||||||
| 460 | m_provider->filtering = filtering; | - | ||||||||||||||||||
| 461 | m_provider->horizontalWrap = hWrap; | - | ||||||||||||||||||
| 462 | m_provider->verticalWrap = vWrap; | - | ||||||||||||||||||
| 463 | } executed 96 times by 3 tests: end of blockExecuted by:
| 96 | ||||||||||||||||||
| 464 | - | |||||||||||||||||||
| 465 | - | |||||||||||||||||||
| 466 | if (width() <= 0
| 0-120 | ||||||||||||||||||
| 467 | delete oldNode; | - | ||||||||||||||||||
| 468 | return executed 63 times by 4 tests: nullptr;return nullptr;Executed by:
executed 63 times by 4 tests: return nullptr;Executed by:
| 63 | ||||||||||||||||||
| 469 | } | - | ||||||||||||||||||
| 470 | - | |||||||||||||||||||
| 471 | QSGInternalImageNode *node = static_cast<QSGInternalImageNode *>(oldNode); | - | ||||||||||||||||||
| 472 | if (!node
| 56-64 | ||||||||||||||||||
| 473 | node = d->sceneGraphContext()->createInternalImageNode(); | - | ||||||||||||||||||
| 474 | node->setFlag(QSGNode::UsePreprocess); | - | ||||||||||||||||||
| 475 | node->setTexture(m_texture); | - | ||||||||||||||||||
| 476 | QQuickShaderSourceAttachedNode *attached = new QQuickShaderSourceAttachedNode; | - | ||||||||||||||||||
| 477 | node->appendChildNode(attached); | - | ||||||||||||||||||
| 478 | connect(m_texture, qFlagLocation("2""updateRequested()" "\0" __FILE__ ":" "758"), attached, qFlagLocation("1""markTextureDirty()" "\0" __FILE__ ":" "758")); | - | ||||||||||||||||||
| 479 | } executed 64 times by 2 tests: end of blockExecuted by:
| 64 | ||||||||||||||||||
| 480 | - | |||||||||||||||||||
| 481 | - | |||||||||||||||||||
| 482 | if (m_live
| 0-120 | ||||||||||||||||||
| 483 | node->markDirty(QSGNode::DirtyMaterial); never executed: node->markDirty(QSGNode::DirtyMaterial); | 0 | ||||||||||||||||||
| 484 | - | |||||||||||||||||||
| 485 | node->setMipmapFiltering(mmFiltering); | - | ||||||||||||||||||
| 486 | node->setFiltering(filtering); | - | ||||||||||||||||||
| 487 | node->setHorizontalWrapMode(hWrap); | - | ||||||||||||||||||
| 488 | node->setVerticalWrapMode(vWrap); | - | ||||||||||||||||||
| 489 | node->setTargetRect(QRectF(0, 0, width(), height())); | - | ||||||||||||||||||
| 490 | node->setInnerTargetRect(QRectF(0, 0, width(), height())); | - | ||||||||||||||||||
| 491 | node->update(); | - | ||||||||||||||||||
| 492 | - | |||||||||||||||||||
| 493 | return executed 120 times by 2 tests: node;return node;Executed by:
executed 120 times by 2 tests: return node;Executed by:
| 120 | ||||||||||||||||||
| 494 | } | - | ||||||||||||||||||
| 495 | - | |||||||||||||||||||
| 496 | void QQuickShaderEffectSource::invalidateSceneGraph() | - | ||||||||||||||||||
| 497 | { | - | ||||||||||||||||||
| 498 | if (m_texture
| 0-8 | ||||||||||||||||||
| 499 | delete m_texture; executed 8 times by 1 test: delete m_texture;Executed by:
| 8 | ||||||||||||||||||
| 500 | if (m_provider
| 2-6 | ||||||||||||||||||
| 501 | delete m_provider; executed 6 times by 1 test: delete m_provider;Executed by:
| 6 | ||||||||||||||||||
| 502 | m_texture = nullptr; | - | ||||||||||||||||||
| 503 | m_provider = nullptr; | - | ||||||||||||||||||
| 504 | } executed 8 times by 1 test: end of blockExecuted by:
| 8 | ||||||||||||||||||
| 505 | - | |||||||||||||||||||
| 506 | void QQuickShaderEffectSource::itemChange(ItemChange change, const ItemChangeData &value) | - | ||||||||||||||||||
| 507 | { | - | ||||||||||||||||||
| 508 | if (change == QQuickItem::ItemSceneChange
| 24-262 | ||||||||||||||||||
| 509 | - | |||||||||||||||||||
| 510 | if (value.window
| 81-99 | ||||||||||||||||||
| 511 | QQuickItemPrivate::get(m_sourceItem)->refWindow(value.window); executed 81 times by 4 tests: QQuickItemPrivate::get(m_sourceItem)->refWindow(value.window);Executed by:
| 81 | ||||||||||||||||||
| 512 | else | - | ||||||||||||||||||
| 513 | QQuickItemPrivate::get(m_sourceItem)->derefWindow(); executed 99 times by 3 tests: QQuickItemPrivate::get(m_sourceItem)->derefWindow();Executed by:
| 99 | ||||||||||||||||||
| 514 | } | - | ||||||||||||||||||
| 515 | QQuickItem::itemChange(change, value); | - | ||||||||||||||||||
| 516 | } executed 466 times by 4 tests: end of blockExecuted by:
| 466 | ||||||||||||||||||
| 517 | - | |||||||||||||||||||
| 518 | - | |||||||||||||||||||
| 519 | - | |||||||||||||||||||
| Switch to Source code | Preprocessed file |