Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Plasma
KWin
Commits
2d56154f
Commit
2d56154f
authored
Feb 16, 2022
by
Kai Uwe Broulik
Committed by
Kai Uwe Broulik
Feb 16, 2022
Browse files
kwineffects: Support setting opacity on OffscreenQuickView
Signed-off-by:
Eike Hein
<
eike.hein@mbition.io
>
parent
c2e34968
Pipeline
#138504
passed with stage
in 35 minutes and 15 seconds
Changes
4
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
src/libkwineffects/kwinoffscreenquickview.cpp
View file @
2d56154f
...
...
@@ -383,6 +383,16 @@ QRect OffscreenQuickView::geometry() const
return
d
->
m_view
->
geometry
();
}
void
OffscreenQuickView
::
setOpacity
(
qreal
opacity
)
{
d
->
m_view
->
setOpacity
(
opacity
);
}
qreal
OffscreenQuickView
::
opacity
()
const
{
return
d
->
m_view
->
opacity
();
}
QQuickItem
*
OffscreenQuickView
::
contentItem
()
const
{
return
d
->
m_view
->
contentItem
();
...
...
src/libkwineffects/kwinoffscreenquickview.h
View file @
2d56154f
...
...
@@ -94,6 +94,9 @@ public:
void
setGeometry
(
const
QRect
&
rect
);
QRect
geometry
()
const
;
void
setOpacity
(
qreal
opacity
);
qreal
opacity
()
const
;
/**
* Render the current scene graph into the FBO.
* This is typically done automatically when the scene changes
...
...
src/scenes/opengl/scene_opengl.cpp
View file @
2d56154f
...
...
@@ -337,18 +337,28 @@ void SceneOpenGL::paintDesktop(int desktop, int mask, const QRegion ®ion, Scr
void
SceneOpenGL
::
paintOffscreenQuickView
(
OffscreenQuickView
*
w
)
{
GLShader
*
shader
=
ShaderManager
::
instance
()
->
pushShader
(
ShaderTrait
::
MapTexture
);
const
QRect
rect
=
w
->
geometry
();
GLTexture
*
t
=
w
->
bufferAsTexture
();
if
(
!
t
)
{
return
;
}
ShaderTraits
traits
=
ShaderTrait
::
MapTexture
;
const
qreal
a
=
w
->
opacity
();
if
(
a
!=
1.0
)
{
traits
|=
ShaderTrait
::
Modulate
;
}
GLShader
*
shader
=
ShaderManager
::
instance
()
->
pushShader
(
traits
);
const
QRect
rect
=
w
->
geometry
();
QMatrix4x4
mvp
(
renderTargetProjectionMatrix
());
mvp
.
translate
(
rect
.
x
(),
rect
.
y
());
shader
->
setUniform
(
GLShader
::
ModelViewProjectionMatrix
,
mvp
);
if
(
a
!=
1.0
)
{
shader
->
setUniform
(
GLShader
::
ModulationConstant
,
QVector4D
(
a
,
a
,
a
,
a
));
}
glEnable
(
GL_BLEND
);
glBlendFunc
(
GL_ONE
,
GL_ONE_MINUS_SRC_ALPHA
);
t
->
bind
();
...
...
src/scenes/qpainter/scene_qpainter.cpp
View file @
2d56154f
...
...
@@ -130,7 +130,10 @@ void SceneQPainter::paintOffscreenQuickView(OffscreenQuickView *w)
if
(
buffer
.
isNull
())
{
return
;
}
painter
->
save
();
painter
->
setOpacity
(
w
->
opacity
());
painter
->
drawImage
(
w
->
geometry
(),
buffer
);
painter
->
restore
();
}
Scene
::
Window
*
SceneQPainter
::
createWindow
(
Toplevel
*
toplevel
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment