Replace dynamic_casts to check the type for for Toplevel by isFoo()
calls and use static_casts in such blocks.
Furthermore method shape() returns now a constant reference instead of a
copy of the QRegion.
REVIEW: 106364
SceneOpenGL turns into an abstract class with two concrete subclasses:
* SceneOpenGL1
* SceneOpenGL2
It provides a factory method which first creates either the GLX or EGL
backend which is passed to a static supported() method in the concrete
sub classes. These method can test whether the backend is sufficient to
be used for the OpenGL version in question. E.g. the OpenGL 2 scene
checks whether the context is direct.
The actual rendering is moved into the subclasses with specific OpenGL 1
and OpenGL 2 code. This should make the code more readable and requires
less checks whether a Shader is bound. This is now known through the
Scene: the OpenGL1 scene will never have a shader bound, the OpenGL2 scene
will always have a shader bound.
To make this more reliable the ShaderManager is extended by a disable
method used by SceneOpenGL1 to ensure that the ShaderManager will never
be used. This also obsoletes the need to read the KWin configuration
whether legacy GL is enabled. The check is moved into the supported
method of the OpenGL2 scene.
REVIEW: 106357
The code was basically copy'n'pasted to handle both Client and Deleted
requiring to cast the Toplevel to both Client and Deleted to test whether
it is one of those.
This is now changed from runtime to compile time polymorphism. A
templated method is used to start the rendering process for the decos.
This on the one hand simplifies the code and on the other does not
require any dynamic casts any more as we use the available check on
Toplevel whether it is a Client or Deleted.
The Window implementation performed many checks whether the rendering
uses the OpenGL 1 or OpenGL 2 code path and there were quite a few
cludges around to make this work.
So instead of many if-else blocks the specific code has now been moved
into a specific sub class and calls to pure virtual method in the base
class are used to trigger this behavior. Although that adds some overhead
in a rather hot code path it should be better than the many chained
method calls used before to handle OpenGL 1 and 2.
It also makes the code a little bit more readable as all the complete
OpenGL 1 implementation is now in one block ifdefed for OpenGL ES.
The handling for creating and managing the OpenGL context is
split out of the SceneOpenGL into the abstract OpenGLBackend
and it's two subclasses GlxBackend and EglOnXBackend.
The backends take care of creating the OpenGL context on the
windowing system, e.g. on glx an OpenGL context on the overlay
window is created and in the egl case an EGL context is created.
This means that the SceneOpenGL itself does not have to care
about the specific underlying infrastructure.
Furthermore the backend provides the Textures for the specific
texture from pixmap operations. For that in each of the backend
files an additional subclass of the TexturePrivate is defined.
These subclasses hold the EglImage and GLXPixmap respectively.
The backend is able to create such a private texture and for
that the ctor of the Texture is changed to take the backend as
a parameter and the Scene provides a factory method for
creating Textures. To make this work inside Window the Textures
are now hold as pointers which seems a better choice anyway as
to the member functions pointers are passed.
According to Pierre-Loup Griffais (Plagman on IRC) this is causing
choppy VDPAU video playback when compositing is enabled.
Removing these calls doesn't seem to cause any regressions, and the
commit that added them doesn't give a reason. So let's just get rid
of them for now.
This commit should be cherry-picked to the stable branch if no one
else notices any regressions.
CCMAIL: kwin@kde.org