35 typedef void(*RenderCallback)(
DSGBlurNode *node,
void *data);
36 void setRenderCallback(RenderCallback callback,
void *data);
37 inline void doRenderCallback() {
38 if (!m_renderCallback)
40 m_renderCallback(
this, m_callbackData);
43 inline void setOffscreen(
bool offscreen) {
44 if (m_offscreen == offscreen)
46 m_offscreen = offscreen;
47 markDirty(DirtyMaterial);
50 virtual void setTexture(QSGTexture *texture);
51 inline QSGTexture *texture()
const
53 virtual bool writeToTexture(QSGPlainTexture *targetTexture)
const;
54 virtual void setRadius(qreal radius);
55 void setSourceRect(
const QRectF &source);
56 void setRect(
const QRectF &target);
57 void setDisabledOpaqueRendering(
bool disabled);
58 void setBlendColor(
const QColor &color);
59 void setFollowMatrixForSource(
bool on);
61 RenderingFlags flags()
const override;
62 QRectF rect()
const override;
63 void setWindow(QQuickWindow *window);
66 RenderCallback m_renderCallback =
nullptr;
67 void *m_callbackData =
nullptr;
68 bool m_offscreen =
false;
70 QPointer<QQuickItem> m_item;
71 QSGTexture *m_texture =
nullptr;
75 QColor m_blendColor = Qt::transparent;
76 bool m_disabledOpaqueRendering =
false;
77 bool m_followMatrixForSource =
false;
78 QPointer<QQuickWindow> m_window;
102 void setTexture(QSGTexture *texture)
override;
103 void setRadius(qreal radius)
override;
105 void render(
const RenderState *state)
override;
106 StateFlags changedStates()
const override;
109 bool writeToTexture(QSGPlainTexture *targetTexture)
const override;
112 void initBlurSahder();
113 void applyDaulBlur(QOpenGLFramebufferObject* targetFBO, GLuint sourceTexture, QOpenGLShaderProgram *shader
114 ,
const QSGRenderNode::RenderState *state,
int matrixUniform,
int scale);
115 void applyNoise(GLuint sourceTexture,
const QSGRenderNode::RenderState *state);
116 void renderToScreen(GLuint sourceTexture,
const QSGRenderNode::RenderState *state);
117 void initFBOTextures();
118 void initDispalyShader();
119 void initNoiseShader();
122 bool m_needUpdateFBO =
false;
124 QOpenGLShaderProgram *m_programKawaseUp =
nullptr;
125 QOpenGLShaderProgram *m_programKawaseDown =
nullptr;
126 QVector<QOpenGLFramebufferObject*> m_fboVector;
127 int m_matrixKawaseUpUniform;
128 int m_matrixKawaseDownUniform;
129 QOpenGLBuffer *m_sampleVbo =
nullptr;
131 QOpenGLShaderProgram *m_program =
nullptr;
133 int m_opacityUniform;
134 QOpenGLBuffer *m_vbo =
nullptr;
136 QOpenGLShaderProgram *m_programNoise =
nullptr;
137 QOpenGLBuffer *m_noiseVbo =
nullptr;