property color color: "#ffffff"
property real blend;
+ onSourceChanged: {
+ if (source != null) {
+ source.visible = false;
+ vertexShader = source.isYInverted() ? vShaderInvertedY : vShader;
+ }
+ }
+
+ property string vShader: "
+ uniform highp mat4 qt_ModelViewProjectionMatrix;
+ attribute highp vec4 qt_Vertex;
+ attribute highp vec2 qt_MultiTexCoord0;
+ varying highp vec2 qt_TexCoord0;
+ void main() {
+ qt_TexCoord0 = qt_MultiTexCoord0;
+ gl_Position = qt_ModelViewProjectionMatrix * qt_Vertex;
+ }
+ "
+ property string vShaderInvertedY: "
+ uniform highp mat4 qt_ModelViewProjectionMatrix;
+ attribute highp vec4 qt_Vertex;
+ attribute highp vec2 qt_MultiTexCoord0;
+ varying highp vec2 qt_TexCoord0;
+ void main() {
+ qt_TexCoord0 = vec2(0, 1) + qt_MultiTexCoord0 * vec2(1, -1);
+ gl_Position = qt_ModelViewProjectionMatrix * qt_Vertex;
+ }
+ "
+
fragmentShader: "
uniform sampler2D source;
uniform float qt_Opacity;
delete m_texture;
if (m_surface->type() == WaylandSurface::Texture) {
- //qDebug() << "createTextureFromId" << m_surface->texture() << m_surface->geometry().size();
m_texture = canvas()->sceneGraphEngine()->createTextureFromId(m_surface->texture(),
m_surface->geometry().size());
- m_texture_needs_flipping = true;
} else {
m_texture = canvas()->sceneGraphEngine()->createTextureFromImage(m_surface->image());
- m_texture_needs_flipping = false;
}
emit textureChanged();
: QSGItem(parent)
, m_surface(0)
, m_texture(0)
- , m_texture_needs_flipping(false)
{
}
: QSGItem(parent)
, m_surface(0)
, m_texture(0)
- , m_texture_needs_flipping(false)
{
init(surface);
}
}
node->setTexture(m_texture);
- if (m_texture_needs_flipping)
- node->setRect(0, height(), width(), -height());
- else
- node->setRect(0, 0, width(), height());
-
node->setFiltering(smooth() ? QSGTexture::Linear : QSGTexture::Nearest);
return node;