Introduce dedicated OpenGL1 and OpenGL2 compositing types
The CompositingType enum turns into flags and two new values are introduced: OpenGL1Compositing and OpenGL2Compositing. Those new values are or-ed to OpenGLCompositing so that a simple check for the flag OpenGLCompositing works in case of one of those two new values. To make the generic check for OpenGL compositing easier a method in EffectsHandler is introduced to just check for this. The scenes now return either OpenGL1Compositing or OpenGL2Compositing depending on which Scene implementation. None returns OpenGLCompositing.
This commit is contained in:
parent
8c38be18b7
commit
6d2dfe06e7
34 changed files with 79 additions and 68 deletions
|
@ -617,7 +617,7 @@ void Client::resizeDecorationPixmaps()
|
|||
XFreePixmap(display(), decorationPixmapTop.handle());
|
||||
}
|
||||
|
||||
if (effects->compositingType() == OpenGLCompositing) {
|
||||
if (effects->isOpenGLCompositing()) {
|
||||
decorationPixmapTop = QPixmap(tr.size());
|
||||
m_responsibleForDecoPixmap = false;
|
||||
} else {
|
||||
|
@ -636,7 +636,7 @@ void Client::resizeDecorationPixmaps()
|
|||
XFreePixmap(display(), decorationPixmapBottom.handle());
|
||||
}
|
||||
|
||||
if (effects->compositingType() == OpenGLCompositing) {
|
||||
if (effects->isOpenGLCompositing()) {
|
||||
decorationPixmapBottom = QPixmap(br.size());
|
||||
m_responsibleForDecoPixmap = false;
|
||||
} else {
|
||||
|
@ -655,7 +655,7 @@ void Client::resizeDecorationPixmaps()
|
|||
XFreePixmap(display(), decorationPixmapLeft.handle());
|
||||
}
|
||||
|
||||
if (effects->compositingType() == OpenGLCompositing) {
|
||||
if (effects->isOpenGLCompositing()) {
|
||||
decorationPixmapLeft = QPixmap(lr.size());
|
||||
m_responsibleForDecoPixmap = false;
|
||||
} else {
|
||||
|
@ -674,7 +674,7 @@ void Client::resizeDecorationPixmaps()
|
|||
XFreePixmap(display(), decorationPixmapRight.handle());
|
||||
}
|
||||
|
||||
if (effects->compositingType() == OpenGLCompositing) {
|
||||
if (effects->isOpenGLCompositing()) {
|
||||
decorationPixmapRight = QPixmap(rr.size());
|
||||
m_responsibleForDecoPixmap = false;
|
||||
} else {
|
||||
|
|
|
@ -742,15 +742,13 @@ QString Compositor::compositingType() const
|
|||
switch (m_scene->compositingType()) {
|
||||
case XRenderCompositing:
|
||||
return "xrender";
|
||||
case OpenGLCompositing:
|
||||
case OpenGL1Compositing:
|
||||
return "gl1";
|
||||
case OpenGL2Compositing:
|
||||
#ifdef KWIN_HAVE_OPENGLES
|
||||
return "gles";
|
||||
#else
|
||||
if (ShaderManager::instance()->isValid()) {
|
||||
return "gl2";
|
||||
} else {
|
||||
return "gl1";
|
||||
}
|
||||
#endif
|
||||
case NoCompositing:
|
||||
default:
|
||||
|
|
|
@ -1685,7 +1685,7 @@ EffectFrameImpl::EffectFrameImpl(EffectFrameStyle style, bool staticSize, QPoint
|
|||
m_selection.setCacheAllRenderedFrames(true);
|
||||
m_selection.setEnabledBorders(Plasma::FrameSvg::AllBorders);
|
||||
|
||||
if (effects->compositingType() == OpenGLCompositing) {
|
||||
if (effects->isOpenGLCompositing()) {
|
||||
m_sceneFrame = new SceneOpenGL::EffectFrame(this, static_cast<SceneOpenGL*>(Compositor::self()->scene()));
|
||||
} else if (effects->compositingType() == XRenderCompositing) {
|
||||
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
|
||||
|
|
|
@ -84,7 +84,7 @@ CoverSwitchEffect::~CoverSwitchEffect()
|
|||
|
||||
bool CoverSwitchEffect::supported()
|
||||
{
|
||||
return effects->compositingType() == OpenGLCompositing;
|
||||
return effects->isOpenGLCompositing();
|
||||
}
|
||||
|
||||
void CoverSwitchEffect::reconfigure(ReconfigureFlags)
|
||||
|
|
|
@ -115,7 +115,7 @@ CubeEffect::CubeEffect()
|
|||
|
||||
bool CubeEffect::supported()
|
||||
{
|
||||
return effects->compositingType() == OpenGLCompositing;
|
||||
return effects->isOpenGLCompositing();
|
||||
}
|
||||
|
||||
void CubeEffect::reconfigure(ReconfigureFlags)
|
||||
|
@ -294,7 +294,7 @@ void CubeEffect::slotWallPaperLoaded()
|
|||
bool CubeEffect::loadShader()
|
||||
{
|
||||
if (!(GLPlatform::instance()->supports(GLSL) &&
|
||||
(effects->compositingType() == OpenGLCompositing)))
|
||||
(effects->compositingType() == OpenGL2Compositing)))
|
||||
return false;
|
||||
QString fragmentshader = KGlobal::dirs()->findResource("data", "kwin/cylinder.frag");
|
||||
QString cylinderVertexshader = KGlobal::dirs()->findResource("data", "kwin/cylinder.vert");
|
||||
|
|
|
@ -51,7 +51,7 @@ CubeSlideEffect::~CubeSlideEffect()
|
|||
|
||||
bool CubeSlideEffect::supported()
|
||||
{
|
||||
return effects->compositingType() == OpenGLCompositing;
|
||||
return effects->isOpenGLCompositing();
|
||||
}
|
||||
|
||||
void CubeSlideEffect::reconfigure(ReconfigureFlags)
|
||||
|
|
|
@ -60,11 +60,7 @@ ExplosionEffect::~ExplosionEffect()
|
|||
|
||||
bool ExplosionEffect::supported()
|
||||
{
|
||||
if (effects->compositingType() == OpenGLCompositing) {
|
||||
return ShaderManager::instance()->isValid();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return effects->compositingType() == OpenGL2Compositing;
|
||||
}
|
||||
|
||||
bool ExplosionEffect::loadData()
|
||||
|
|
|
@ -90,7 +90,7 @@ FlipSwitchEffect::~FlipSwitchEffect()
|
|||
|
||||
bool FlipSwitchEffect::supported()
|
||||
{
|
||||
return effects->compositingType() == OpenGLCompositing;
|
||||
return effects->isOpenGLCompositing();
|
||||
}
|
||||
|
||||
void FlipSwitchEffect::reconfigure(ReconfigureFlags)
|
||||
|
|
|
@ -54,7 +54,7 @@ GlideEffect::~GlideEffect()
|
|||
|
||||
bool GlideEffect::supported()
|
||||
{
|
||||
return effects->compositingType() == OpenGLCompositing;
|
||||
return effects->isOpenGLCompositing();
|
||||
}
|
||||
|
||||
void GlideEffect::reconfigure(ReconfigureFlags)
|
||||
|
|
|
@ -64,11 +64,7 @@ InvertEffect::~InvertEffect()
|
|||
|
||||
bool InvertEffect::supported()
|
||||
{
|
||||
if (effects->compositingType() == OpenGLCompositing) {
|
||||
return ShaderManager::instance()->isValid();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return effects->compositingType() == OpenGL2Compositing;
|
||||
}
|
||||
|
||||
bool InvertEffect::loadData()
|
||||
|
|
|
@ -105,7 +105,7 @@ void LogoutEffect::prePaintScreen(ScreenPrePaintData& data, int time)
|
|||
} else if (!blurTexture) {
|
||||
blurSupported = false;
|
||||
delete blurTarget; // catch as we just tested the texture ;-P
|
||||
if (effects->compositingType() == OpenGLCompositing && GLTexture::NPOTTextureSupported() && GLRenderTarget::blitSupported() && useBlur) {
|
||||
if (effects->isOpenGLCompositing() && GLTexture::NPOTTextureSupported() && GLRenderTarget::blitSupported() && useBlur) {
|
||||
// TODO: It seems that it is not possible to create a GLRenderTarget that has
|
||||
// a different size than the display right now. Most likely a KWin core bug.
|
||||
// Create texture and render target
|
||||
|
@ -143,7 +143,7 @@ void LogoutEffect::prePaintScreen(ScreenPrePaintData& data, int time)
|
|||
void LogoutEffect::paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data)
|
||||
{
|
||||
if (progress > 0.0) {
|
||||
if (effects->compositingType() == KWin::OpenGLCompositing) {
|
||||
if (effects->isOpenGLCompositing()) {
|
||||
// In OpenGL mode we add vignetting and, if supported, a slight blur
|
||||
if (blurSupported) {
|
||||
// When using blur we render everything to an FBO and as such don't do the vignetting
|
||||
|
@ -192,7 +192,7 @@ void LogoutEffect::paintScreen(int mask, QRegion region, ScreenPaintData& data)
|
|||
{
|
||||
effects->paintScreen(mask, region, data);
|
||||
|
||||
if (effects->compositingType() == KWin::OpenGLCompositing && progress > 0.0) {
|
||||
if (effects->isOpenGLCompositing() && progress > 0.0) {
|
||||
if (!blurSupported) {
|
||||
if (!logoutWindowPassed)
|
||||
// The logout window has been deleted but we still want to fade out the vignetting, thus
|
||||
|
|
|
@ -81,11 +81,7 @@ LookingGlassEffect::~LookingGlassEffect()
|
|||
|
||||
bool LookingGlassEffect::supported()
|
||||
{
|
||||
if (effects->compositingType() == OpenGLCompositing) {
|
||||
return ShaderManager::instance()->isValid() && GLRenderTarget::supported();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return effects->compositingType() == OpenGL2Compositing;
|
||||
}
|
||||
|
||||
void LookingGlassEffect::reconfigure(ReconfigureFlags)
|
||||
|
|
|
@ -46,7 +46,7 @@ MagicLampEffect::MagicLampEffect()
|
|||
|
||||
bool MagicLampEffect::supported()
|
||||
{
|
||||
return effects->compositingType() == OpenGLCompositing;
|
||||
return effects->isOpenGLCompositing();
|
||||
}
|
||||
|
||||
void MagicLampEffect::reconfigure(ReconfigureFlags)
|
||||
|
|
|
@ -78,7 +78,7 @@ MagnifierEffect::~MagnifierEffect()
|
|||
bool MagnifierEffect::supported()
|
||||
{
|
||||
return effects->compositingType() == XRenderCompositing ||
|
||||
(effects->compositingType() == OpenGLCompositing && GLRenderTarget::blitSupported());
|
||||
(effects->isOpenGLCompositing() && GLRenderTarget::blitSupported());
|
||||
}
|
||||
|
||||
void MagnifierEffect::reconfigure(ReconfigureFlags)
|
||||
|
@ -129,7 +129,7 @@ void MagnifierEffect::paintScreen(int mask, QRegion region, ScreenPaintData& dat
|
|||
QRect srcArea(cursor.x() - (double)area.width() / (zoom*2),
|
||||
cursor.y() - (double)area.height() / (zoom*2),
|
||||
(double)area.width() / zoom, (double)area.height() / zoom);
|
||||
if (effects->compositingType() == OpenGLCompositing) {
|
||||
if (effects->isOpenGLCompositing()) {
|
||||
m_fbo->blitFromFramebuffer(srcArea);
|
||||
// paint magnifier
|
||||
m_texture->bind();
|
||||
|
|
|
@ -107,7 +107,7 @@ void MouseMarkEffect::paintScreen(int mask, QRegion region, ScreenPaintData& dat
|
|||
effects->paintScreen(mask, region, data); // paint normal screen
|
||||
if (marks.isEmpty() && drawing.isEmpty())
|
||||
return;
|
||||
if ( effects->compositingType() == OpenGLCompositing) {
|
||||
if ( effects->isOpenGLCompositing()) {
|
||||
#ifndef KWIN_HAVE_OPENGLES
|
||||
glEnable(GL_LINE_SMOOTH);
|
||||
#endif
|
||||
|
|
|
@ -386,7 +386,7 @@ void PresentWindowsEffect::paintWindow(EffectWindow *w, int mask, QRegion region
|
|||
QPoint point(rect.x() + rect.width() * 0.95,
|
||||
rect.y() + rect.height() * 0.95);
|
||||
winData->iconFrame->setPosition(point);
|
||||
if (effects->compositingType() == KWin::OpenGLCompositing && data.shader) {
|
||||
if (effects->compositingType() == KWin::OpenGL2Compositing && data.shader) {
|
||||
const float a = 0.9 * data.opacity() * m_decalOpacity * 0.75;
|
||||
data.shader->setUniform(GLShader::ModulationConstant, QVector4D(a, a, a, a));
|
||||
}
|
||||
|
@ -396,7 +396,7 @@ void PresentWindowsEffect::paintWindow(EffectWindow *w, int mask, QRegion region
|
|||
QPoint point(rect.x() + rect.width() / 2,
|
||||
rect.y() + rect.height() / 2);
|
||||
winData->textFrame->setPosition(point);
|
||||
if (effects->compositingType() == KWin::OpenGLCompositing && data.shader) {
|
||||
if (effects->compositingType() == KWin::OpenGL2Compositing && data.shader) {
|
||||
const float a = 0.9 * data.opacity() * m_decalOpacity * 0.75;
|
||||
data.shader->setUniform(GLShader::ModulationConstant, QVector4D(a, a, a, a));
|
||||
}
|
||||
|
|
|
@ -82,7 +82,7 @@ void ResizeEffect::paintWindow(EffectWindow* w, int mask, QRegion region, Window
|
|||
float alpha = 0.8f;
|
||||
QColor color = KColorScheme(QPalette::Normal, KColorScheme::Selection).background().color();
|
||||
|
||||
if (effects->compositingType() == OpenGLCompositing) {
|
||||
if (effects->isOpenGLCompositing()) {
|
||||
GLVertexBuffer *vbo = GLVertexBuffer::streamingBuffer();
|
||||
vbo->reset();
|
||||
vbo->setUseColor(true);
|
||||
|
|
|
@ -39,7 +39,7 @@ KWIN_EFFECT_SUPPORTED(screenshot, ScreenShotEffect::supported())
|
|||
bool ScreenShotEffect::supported()
|
||||
{
|
||||
return effects->compositingType() == XRenderCompositing ||
|
||||
(effects->compositingType() == KWin::OpenGLCompositing && GLRenderTarget::supported());
|
||||
(effects->isOpenGLCompositing() && GLRenderTarget::supported());
|
||||
}
|
||||
|
||||
ScreenShotEffect::ScreenShotEffect()
|
||||
|
@ -64,7 +64,7 @@ void ScreenShotEffect::postPaintScreen()
|
|||
bool validTarget = true;
|
||||
GLTexture* offscreenTexture = 0;
|
||||
GLRenderTarget* target = 0;
|
||||
if (effects->compositingType() == KWin::OpenGLCompositing) {
|
||||
if (effects->isOpenGLCompositing()) {
|
||||
if (!GLTexture::NPOTTextureSupported()) {
|
||||
w = nearestPowerOfTwo(w);
|
||||
h = nearestPowerOfTwo(h);
|
||||
|
@ -114,7 +114,7 @@ void ScreenShotEffect::postPaintScreen()
|
|||
// render window into offscreen texture
|
||||
int mask = PAINT_WINDOW_TRANSFORMED | PAINT_WINDOW_TRANSLUCENT;
|
||||
QImage img;
|
||||
if (effects->compositingType() == KWin::OpenGLCompositing) {
|
||||
if (effects->isOpenGLCompositing()) {
|
||||
GLRenderTarget::pushRenderTarget(target);
|
||||
glClearColor(0.0, 0.0, 0.0, 0.0);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
@ -209,7 +209,7 @@ QString ScreenShotEffect::blitScreenshot(const QRect &geometry)
|
|||
return QString();
|
||||
#else
|
||||
QImage img;
|
||||
if (effects->compositingType() == KWin::OpenGLCompositing)
|
||||
if (effects->isOpenGLCompositing())
|
||||
{
|
||||
if (!GLRenderTarget::blitSupported()) {
|
||||
kDebug(1212) << "Framebuffer Blit not supported";
|
||||
|
|
|
@ -44,7 +44,7 @@ SheetEffect::SheetEffect()
|
|||
|
||||
bool SheetEffect::supported()
|
||||
{
|
||||
return effects->compositingType() == OpenGLCompositing;
|
||||
return effects->isOpenGLCompositing();
|
||||
}
|
||||
|
||||
void SheetEffect::reconfigure(ReconfigureFlags)
|
||||
|
|
|
@ -156,7 +156,7 @@ void ShowFpsEffect::paintScreen(int mask, QRegion region, ScreenPaintData& data)
|
|||
++fps; // count all frames in the last second
|
||||
if (fps > MAX_TIME)
|
||||
fps = MAX_TIME; // keep it the same height
|
||||
if (effects->compositingType() == OpenGLCompositing) {
|
||||
if (effects->isOpenGLCompositing()) {
|
||||
paintGL(fps);
|
||||
glFinish(); // make sure all rendering is done
|
||||
}
|
||||
|
@ -327,7 +327,7 @@ void ShowFpsEffect::paintDrawSizeGraph(int x, int y)
|
|||
|
||||
void ShowFpsEffect::paintGraph(int x, int y, QList<int> values, QList<int> lines, bool colorize)
|
||||
{
|
||||
if (effects->compositingType() == OpenGLCompositing) {
|
||||
if (effects->isOpenGLCompositing()) {
|
||||
QColor color(0, 0, 0);
|
||||
color.setAlphaF(alpha);
|
||||
GLVertexBuffer *vbo = GLVertexBuffer::streamingBuffer();
|
||||
|
|
|
@ -55,7 +55,7 @@ void ShowPaintEffect::paintScreen(int mask, QRegion region, ScreenPaintData& dat
|
|||
{
|
||||
painted = QRegion();
|
||||
effects->paintScreen(mask, region, data);
|
||||
if (effects->compositingType() == OpenGLCompositing)
|
||||
if (effects->isOpenGLCompositing())
|
||||
paintGL();
|
||||
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
|
||||
if (effects->compositingType() == XRenderCompositing)
|
||||
|
|
|
@ -77,7 +77,7 @@ void SnapHelperEffect::postPaintScreen()
|
|||
effects->postPaintScreen();
|
||||
if (m_timeline.currentValue() != 0.0) {
|
||||
// Display the guide
|
||||
if (effects->compositingType() == OpenGLCompositing) {
|
||||
if (effects->isOpenGLCompositing()) {
|
||||
GLVertexBuffer *vbo = GLVertexBuffer::streamingBuffer();
|
||||
vbo->reset();
|
||||
vbo->setUseColor(true);
|
||||
|
|
|
@ -109,7 +109,7 @@ StartupFeedbackEffect::~StartupFeedbackEffect()
|
|||
|
||||
bool StartupFeedbackEffect::supported()
|
||||
{
|
||||
return effects->compositingType() == OpenGLCompositing;
|
||||
return effects->isOpenGLCompositing();
|
||||
}
|
||||
|
||||
void StartupFeedbackEffect::reconfigure(Effect::ReconfigureFlags flags)
|
||||
|
|
|
@ -85,7 +85,7 @@ void TaskbarThumbnailEffect::paintWindow(EffectWindow* w, int mask, QRegion regi
|
|||
thumbRect.translate(w->pos() + QPoint(data.xTranslation(), data.yTranslation()));
|
||||
thumbRect.setSize(QSize(thumbRect.width() * data.xScale(), thumbRect.height() * data.yScale())); // QSize has no vector multiplicator... :-(
|
||||
|
||||
if (effects->compositingType() == KWin::OpenGLCompositing) {
|
||||
if (effects->isOpenGLCompositing()) {
|
||||
if (data.shader) {
|
||||
thumbData.shader = data.shader;
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ TrackMouseEffect::TrackMouseEffect()
|
|||
if ( effects->compositingType() == XRenderCompositing)
|
||||
m_angleBase = 1.57079632679489661923; // Pi/2
|
||||
#endif
|
||||
if ( effects->compositingType() == OpenGLCompositing)
|
||||
if ( effects->isOpenGLCompositing())
|
||||
m_angleBase = 90.0;
|
||||
m_mousePolling = false;
|
||||
KActionCollection *actionCollection = new KActionCollection(this);
|
||||
|
@ -124,7 +124,7 @@ void TrackMouseEffect::paintScreen(int mask, QRegion region, ScreenPaintData& da
|
|||
if (!m_active)
|
||||
return;
|
||||
|
||||
if ( effects->compositingType() == OpenGLCompositing && m_texture[0] && m_texture[1]) {
|
||||
if ( effects->isOpenGLCompositing() && m_texture[0] && m_texture[1]) {
|
||||
GLShader *shader(0);
|
||||
QMatrix4x4 modelview;
|
||||
if (ShaderManager::instance()->isValid()) {
|
||||
|
@ -250,7 +250,7 @@ void TrackMouseEffect::loadTexture()
|
|||
return;
|
||||
|
||||
for (int i = 0; i < 2; ++i) {
|
||||
if ( effects->compositingType() == OpenGLCompositing) {
|
||||
if ( effects->isOpenGLCompositing()) {
|
||||
QImage img(f[i]);
|
||||
m_texture[i] = new GLTexture(img);
|
||||
m_lastRect[i].setSize(img.size());
|
||||
|
|
|
@ -226,7 +226,7 @@ void WobblyWindowsEffect::reconfigure(ReconfigureFlags)
|
|||
|
||||
bool WobblyWindowsEffect::supported()
|
||||
{
|
||||
return effects->compositingType() == OpenGLCompositing;
|
||||
return effects->isOpenGLCompositing();
|
||||
}
|
||||
|
||||
void WobblyWindowsEffect::setParameterSet(const ParameterSet& pset)
|
||||
|
|
|
@ -188,7 +188,7 @@ void ZoomEffect::recreateTexture()
|
|||
imageWidth = ximg->width;
|
||||
imageHeight = ximg->height;
|
||||
QImage img((uchar*)ximg->pixels, imageWidth, imageHeight, QImage::Format_ARGB32_Premultiplied);
|
||||
if (effects->compositingType() == OpenGLCompositing)
|
||||
if (effects->isOpenGLCompositing())
|
||||
texture = new GLTexture(img);
|
||||
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
|
||||
if (effects->compositingType() == XRenderCompositing)
|
||||
|
|
|
@ -158,7 +158,7 @@ void LanczosShader::createOffsets(int count, float width, Qt::Orientation direct
|
|||
|
||||
void LanczosFilter::performPaint(EffectWindowImpl* w, int mask, QRegion region, WindowPaintData& data)
|
||||
{
|
||||
if (effects->compositingType() == KWin::OpenGLCompositing && (data.xScale() < 0.9 || data.yScale() < 0.9) &&
|
||||
if (effects->isOpenGLCompositing() && (data.xScale() < 0.9 || data.yScale() < 0.9) &&
|
||||
KGlobalSettings::graphicEffectsLevel() & KGlobalSettings::SimpleAnimationEffects) {
|
||||
if (!m_inited)
|
||||
init();
|
||||
|
|
|
@ -597,6 +597,11 @@ CompositingType EffectsHandler::compositingType() const
|
|||
return compositing_type;
|
||||
}
|
||||
|
||||
bool EffectsHandler::isOpenGLCompositing() const
|
||||
{
|
||||
return compositing_type & OpenGLCompositing;
|
||||
}
|
||||
|
||||
void EffectsHandler::sendReloadMessage(const QString& effectname)
|
||||
{
|
||||
QDBusMessage message = QDBusMessage::createMethodCall("org.kde.kwin", "/KWin", "org.kde.KWin", "reconfigureEffect");
|
||||
|
@ -1182,7 +1187,7 @@ struct PaintClipper::Iterator::Data {
|
|||
PaintClipper::Iterator::Iterator()
|
||||
: data(new Data)
|
||||
{
|
||||
if (clip() && effects->compositingType() == OpenGLCompositing) {
|
||||
if (clip() && effects->isOpenGLCompositing()) {
|
||||
data->rects = paintArea().rects();
|
||||
data->index = -1;
|
||||
next(); // move to the first one
|
||||
|
@ -1209,7 +1214,7 @@ bool PaintClipper::Iterator::isDone()
|
|||
{
|
||||
if (!clip())
|
||||
return data->index == 1; // run once
|
||||
if (effects->compositingType() == OpenGLCompositing)
|
||||
if (effects->isOpenGLCompositing())
|
||||
return data->index >= data->rects.count(); // run once per each area
|
||||
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
|
||||
if (effects->compositingType() == XRenderCompositing)
|
||||
|
@ -1227,7 +1232,7 @@ QRect PaintClipper::Iterator::boundingRect() const
|
|||
{
|
||||
if (!clip())
|
||||
return infiniteRegion();
|
||||
if (effects->compositingType() == OpenGLCompositing)
|
||||
if (effects->isOpenGLCompositing())
|
||||
return data->rects[ data->index ];
|
||||
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
|
||||
if (effects->compositingType() == XRenderCompositing)
|
||||
|
|
|
@ -783,6 +783,12 @@ public:
|
|||
Q_SCRIPTABLE virtual void addRepaint(int x, int y, int w, int h) = 0;
|
||||
|
||||
CompositingType compositingType() const;
|
||||
/**
|
||||
* @brief Whether the Compositor is OpenGL based (either GL 1 or 2).
|
||||
*
|
||||
* @return bool @c true in case of OpenGL based Compositor, @c false otherwise
|
||||
**/
|
||||
bool isOpenGLCompositing() const;
|
||||
virtual unsigned long xrenderBufferPicture() = 0;
|
||||
virtual void reconfigure() = 0;
|
||||
|
||||
|
|
|
@ -40,8 +40,17 @@ namespace KWin
|
|||
|
||||
enum CompositingType {
|
||||
NoCompositing = 0,
|
||||
OpenGLCompositing,
|
||||
XRenderCompositing
|
||||
/**
|
||||
* Used as a flag whether OpenGL based compositing is used.
|
||||
* The flag is or-ed to the enum values of the specific OpenGL types.
|
||||
* The actual Compositors use the @c OpenGL1Compositing or @c OpenGL2Compositing
|
||||
* flags. If you need to know whether OpenGL is used, either and the flag or
|
||||
* use EffectsHandler::isOpenGLCompositing().
|
||||
**/
|
||||
OpenGLCompositing = 1,
|
||||
XRenderCompositing = 1<<1,
|
||||
OpenGL1Compositing = 1<<2 | OpenGLCompositing,
|
||||
OpenGL2Compositing = 1<<3 | OpenGLCompositing
|
||||
};
|
||||
|
||||
enum clientAreaOption {
|
||||
|
|
|
@ -43,9 +43,6 @@ public:
|
|||
class Window;
|
||||
virtual ~SceneOpenGL();
|
||||
virtual bool initFailed() const;
|
||||
virtual CompositingType compositingType() const {
|
||||
return OpenGLCompositing;
|
||||
}
|
||||
virtual bool hasPendingFlush() const;
|
||||
virtual int paint(QRegion damage, ToplevelList windows);
|
||||
virtual void windowAdded(Toplevel*);
|
||||
|
@ -90,6 +87,9 @@ class SceneOpenGL2 : public SceneOpenGL
|
|||
public:
|
||||
SceneOpenGL2(OpenGLBackend *backend);
|
||||
virtual ~SceneOpenGL2();
|
||||
virtual CompositingType compositingType() const {
|
||||
return OpenGL2Compositing;
|
||||
}
|
||||
|
||||
static bool supported(OpenGLBackend *backend);
|
||||
|
||||
|
@ -107,6 +107,9 @@ public:
|
|||
virtual ~SceneOpenGL1();
|
||||
virtual void screenGeometryChanged(const QSize &size);
|
||||
virtual int paint(QRegion damage, ToplevelList windows);
|
||||
virtual CompositingType compositingType() const {
|
||||
return OpenGL1Compositing;
|
||||
}
|
||||
|
||||
static bool supported(OpenGLBackend *backend);
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ Shadow *Shadow::createShadow(Toplevel *toplevel)
|
|||
QVector<long> data = Shadow::readX11ShadowProperty(toplevel->window());
|
||||
if (!data.isEmpty()) {
|
||||
Shadow *shadow = NULL;
|
||||
if (effects->compositingType() == OpenGLCompositing) {
|
||||
if (effects->isOpenGLCompositing()) {
|
||||
shadow = new SceneOpenGLShadow(toplevel);
|
||||
} else if (effects->compositingType() == XRenderCompositing) {
|
||||
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
|
||||
|
|
|
@ -2121,6 +2121,8 @@ QString Workspace::supportInformation() const
|
|||
if (effects) {
|
||||
support.append("Compositing is active\n");
|
||||
switch (effects->compositingType()) {
|
||||
case OpenGL1Compositing:
|
||||
case OpenGL2Compositing:
|
||||
case OpenGLCompositing: {
|
||||
#ifdef KWIN_HAVE_OPENGLES
|
||||
support.append("Compositing Type: OpenGL ES 2.0\n");
|
||||
|
|
Loading…
Reference in a new issue