Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[compositor] Use shader texture from current theme. Contributes to JB…
…#48627
  • Loading branch information
Dmitriy Nikiforov authored and rainemak committed Jan 21, 2020
1 parent df532ed commit ffe45e0
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/compositor/hwcimage.cpp
Expand Up @@ -18,6 +18,8 @@

#include "eglhybrisbuffer.h"

#include <MGConfItem>

#include <QRunnable>
#include <QThreadPool>

Expand All @@ -30,6 +32,7 @@
#include <private/qmemrotate_p.h>

#define HWCIMAGE_LOAD_EVENT ((QEvent::Type) (QEvent::User + 1))
#define DEFAULT_THEME "sailfish-default"

static QRgb swizzleWithAlpha(QRgb rgb)
{
Expand Down Expand Up @@ -161,7 +164,14 @@ class HwcImageLoadRequest : public QRunnable, public QEvent

// Apply glass..
if (effect.contains(QStringLiteral("glass"))) {
QImage glass("/usr/share/themes/sailfish-default/meegotouch/icons/graphic-shader-texture.png");
const auto shaderImageTemplate = QStringLiteral("/usr/share/themes/%1/meegotouch/icons/graphic-shader-texture.png");
const auto themeName = MGConfItem("/meegotouch/theme/name").value(DEFAULT_THEME).toString();
auto shaderImage = shaderImageTemplate.arg(themeName);
if (themeName != QStringLiteral(DEFAULT_THEME) && !QFile::exists(shaderImage)) {
qCDebug(LIPSTICK_LOG_HWC, "Shader texture file does not exist: %s", qPrintable(shaderImage));
shaderImage = shaderImageTemplate.arg(DEFAULT_THEME);
}
QImage glass(shaderImage);

if (rotation != 0) { // Counter rotate the glass effect so it is reset when the entire picture is rotated.
QTransform transform;
Expand Down

0 comments on commit ffe45e0

Please sign in to comment.