From feb6fa3aea6d2ba0e38930a4b50e02bf6e80b935 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20H=C3=B6glund?= Date: Wed, 29 May 2013 17:53:54 +0200 Subject: [PATCH] kwin: Remove makeDecorationArrays() There is no longer any reason why the decorations cannot be rendered with renderQuads(). --- scene_opengl.cpp | 41 +---------------------------------------- scene_opengl.h | 1 - 2 files changed, 1 insertion(+), 41 deletions(-) diff --git a/scene_opengl.cpp b/scene_opengl.cpp index 2a58c0832e..3035763909 100644 --- a/scene_opengl.cpp +++ b/scene_opengl.cpp @@ -1203,8 +1203,7 @@ void SceneOpenGL::Window::paintDecoration(GLTexture *texture, TextureType type, texture->bind(); prepareStates(type, data.opacity() * data.decorationOpacity(), data.brightness(), data.saturation(), data.screen()); - makeDecorationArrays(quads, texture); - GLVertexBuffer::streamingBuffer()->render(region, GL_TRIANGLES, hardwareClipping); + renderQuads(0, region, quads, texture, false, hardwareClipping); restoreStates(type, data.opacity() * data.decorationOpacity(), data.brightness(), data.saturation()); texture->unbind(); @@ -1266,44 +1265,6 @@ void SceneOpenGL::Window::paintShadow(const QRegion ®ion, const WindowPaintDa #endif } -void SceneOpenGL::Window::makeDecorationArrays(const WindowQuadList &quads, GLTexture *texture) const -{ - const QMatrix4x4 matrix = texture->matrix(UnnormalizedCoordinates); - - // Since we know that the texture matrix just scales and translates - // we can use this information to optimize the transformation - const QVector2D coeff(matrix(0, 0), matrix(1, 1)); - const QVector2D offset(matrix(0, 3), matrix(1, 3)); - - GLVertexBuffer *vbo = GLVertexBuffer::streamingBuffer(); - vbo->setVertexCount(quads.count() * 6); - - GLVertex2D *vertex = (GLVertex2D *) vbo->map(quads.count() * 6 * sizeof(GLVertex2D)); - - foreach (const WindowQuad &quad, quads) { - GLVertex2D v[4]; // Four unique vertices / quad - - for (int i = 0; i < 4; i++) { - const WindowVertex &wv = quad[i]; - - v[i].position = QVector2D(wv.x(), wv.y()); - v[i].texcoord = QVector2D(wv.originalX(), wv.originalY()) * coeff + offset; - } - - // First triangle - *(vertex++) = v[1]; // Top-right - *(vertex++) = v[0]; // Top-left - *(vertex++) = v[3]; // Bottom-left - - // Second triangle - *(vertex++) = v[3]; // Bottom-left - *(vertex++) = v[2]; // Bottom-right - *(vertex++) = v[1]; // Top-right - } - - vbo->unmap(); -} - void SceneOpenGL::Window::renderQuads(int, const QRegion& region, const WindowQuadList& quads, GLTexture *tex, bool normalized, bool hardwareClipping) { diff --git a/scene_opengl.h b/scene_opengl.h index 54d16924ed..6c78909c69 100644 --- a/scene_opengl.h +++ b/scene_opengl.h @@ -235,7 +235,6 @@ protected: QMatrix4x4 transformation(int mask, const WindowPaintData &data) const; void paintDecoration(GLTexture *texture, TextureType type, const QRegion ®ion, const WindowPaintData &data, const WindowQuadList &quads, bool hardwareClipping); void paintShadow(const QRegion ®ion, const WindowPaintData &data, bool hardwareClipping); - void makeDecorationArrays(const WindowQuadList& quads, GLTexture *tex) const; void renderQuads(int, const QRegion& region, const WindowQuadList& quads, GLTexture* tex, bool normalized, bool hardwareClipping); /** * @brief Called from performPaint once it is determined whether the window will be painted.