Paste P174

Masterwork From Distant Lands
ActivePublic

Authored by davidedmundson on Mar 5 2018, 6:42 PM.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b0fad07bf..0f135e438 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.0)
set(KF5_VERSION "5.44.0") # handled by release scripts
-set(KF5_DEP_VERSION "5.44.0") # handled by release scripts
+set(KF5_DEP_VERSION "5.43.0") # handled by release scripts
project(Plasma VERSION ${KF5_VERSION})
# ECM setup
diff --git a/src/declarativeimports/core/fadingmaterial.frag b/src/declarativeimports/core/fadingmaterial.frag
index b23f8debb..cd8c539a9 100644
--- a/src/declarativeimports/core/fadingmaterial.frag
+++ b/src/declarativeimports/core/fadingmaterial.frag
@@ -1,10 +1,12 @@
varying highp vec2 v_coord;
uniform sampler2D u_src;
+uniform vec4 u_src_rect;
uniform sampler2D u_target;
+uniform vec4 u_target_rect;
uniform highp float u_transitionProgress;
uniform lowp float qt_Opacity;
void main() {
- lowp vec4 tex1 = texture2D(u_target, v_coord);
- lowp vec4 tex2 = texture2D(u_src, v_coord);
+ lowp vec4 tex1 = texture2D(u_target, u_target_rect.xy + u_target_rect.zw * v_coord);
+ lowp vec4 tex2 = texture2D(u_src, u_src_rect.xy + u_src_rect.zw * v_coord);
gl_FragColor = mix(tex2, tex1, u_transitionProgress) * qt_Opacity;
}
diff --git a/src/declarativeimports/core/fadingnode.cpp b/src/declarativeimports/core/fadingnode.cpp
index 9c2c93d4f..7e5c381cd 100644
--- a/src/declarativeimports/core/fadingnode.cpp
+++ b/src/declarativeimports/core/fadingnode.cpp
@@ -43,6 +43,8 @@ public:
private:
QOpenGLFunctions *glFuncs = nullptr;
int m_progressId = 0;
+ int m_sourceRectId = 0;
+ int m_targetRectId = 0;
};
@@ -62,6 +64,8 @@ void FadingMaterialShader::updateState(const FadingMaterialState* newState, cons
if (!oldState || oldState->source != newState->source) {
glFuncs->glActiveTexture(GL_TEXTURE1);
newState->source->bind();
+ QRectF rect = newState->source->normalizedTextureSubRect();
+ program()->setUniformValue(m_sourceRectId, QVector4D(rect.x(), rect.y(), rect.width(), rect.height()));
// reset the active texture back to 0 after we changed it to something else
glFuncs->glActiveTexture(GL_TEXTURE0);
}
@@ -69,6 +73,8 @@ void FadingMaterialShader::updateState(const FadingMaterialState* newState, cons
if (!oldState || oldState->target != newState->target) {
glFuncs->glActiveTexture(GL_TEXTURE0);
newState->target->bind();
+ QRectF rect = newState->target->normalizedTextureSubRect();
+ program()->setUniformValue(m_targetRectId, QVector4D(rect.x(), rect.y(), rect.width(), rect.height()));
}
if (!oldState || oldState->progress != newState->progress) {
@@ -87,7 +93,10 @@ void FadingMaterialShader::initialize()
program()->bind();
program()->setUniformValue("u_src", 0);
program()->setUniformValue("u_target", 1);
+
m_progressId = program()->uniformLocation("u_transitionProgress");
+ m_sourceRectId = program()->uniformLocation("u_src_rect");
+ m_targetRectId = program()->uniformLocation("u_target_rect");
}
diff --git a/src/declarativeimports/core/iconitem.cpp b/src/declarativeimports/core/iconitem.cpp
index a4e6bdb72..d8b060f17 100644
--- a/src/declarativeimports/core/iconitem.cpp
+++ b/src/declarativeimports/core/iconitem.cpp
@@ -481,9 +481,9 @@ QSGNode* IconItem::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *update
if (!animatingNode || m_textureChanged) {
delete oldNode;
- QSGTexture *source = window()->createTextureFromImage(m_iconPixmap.toImage());
+ QSGTexture *source = window()->createTextureFromImage(m_oldIconPixmap.toImage(), QQuickWindow::TextureCanUseAtlas);
source->setFiltering(m_smooth ? QSGTexture::Linear : QSGTexture::Nearest);
- QSGTexture *target = window()->createTextureFromImage(m_oldIconPixmap.toImage());
+ QSGTexture *target = window()->createTextureFromImage(m_iconPixmap.toImage(), QQuickWindow::TextureCanUseAtlas);
target->setFiltering(m_smooth ? QSGTexture::Linear : QSGTexture::Nearest);
animatingNode = new FadingNode(source, target);
m_sizeChanged = true;
davidedmundson edited the content of this paste. (Show Details)Mar 5 2018, 6:42 PM
davidedmundson changed the title of this paste from untitled to Masterwork From Distant Lands.
davidedmundson updated the paste's language from autodetect to autodetect.