diff --git a/scene_opengl.cpp b/scene_opengl.cpp index 4d248eb504..230d174120 100644 --- a/scene_opengl.cpp +++ b/scene_opengl.cpp @@ -586,13 +586,13 @@ void SceneOpenGL::Window::performPaint(int mask, QRegion region, WindowPaintData if (!(mask & PAINT_DECORATION_ONLY)) { texture.bind(); prepareStates(Content, data.opacity * data.contents_opacity, data.brightness, data.saturation, data.shader); - renderQuads(mask, region, data.quads.select(WindowQuadContents), toplevel->size(), texture.getYInverted()); + renderQuads(mask, region, data.quads.select(WindowQuadContents), &texture); restoreStates(Content, data.opacity * data.contents_opacity, data.brightness, data.saturation, data.shader); texture.unbind(); #ifndef KWIN_HAVE_OPENGLES if (static_cast(scene)->debug) { glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); - renderQuads(mask, region, data.quads.select(WindowQuadContents), toplevel->size(), texture.getYInverted()); + renderQuads(mask, region, data.quads.select(WindowQuadContents), &texture); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); } #endif @@ -673,13 +673,13 @@ void SceneOpenGL::Window::paintShadow(WindowQuadType type, const QRegion ®ion texture->setWrapMode(GL_CLAMP_TO_EDGE); texture->bind(); prepareStates(Shadow, data.opacity, data.brightness, data.saturation, data.shader, texture); - renderQuads(0, region, quads, QSizeF(1.0, 1.0), texture->getYInverted()); + renderQuads(0, region, quads, texture, true); restoreStates(Shadow, data.opacity, data.brightness, data.saturation, data.shader, texture); texture->unbind(); #ifndef KWIN_HAVE_OPENGLES if (static_cast(scene)->debug) { glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); - renderQuads(0, region, quads, QSizeF(1.0, 1.0), texture->getYInverted()); + renderQuads(0, region, quads, texture); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); } #endif @@ -738,14 +738,25 @@ void SceneOpenGL::Window::makeDecorationArrays(const WindowQuadList& quads, cons GLVertexBuffer::streamingBuffer()->setData(quads.count() * 6, 2, vertices.data(), texcoords.data()); } -void SceneOpenGL::Window::renderQuads(int, const QRegion& region, const WindowQuadList& quads, const QSizeF &size, bool yInverted) +void SceneOpenGL::Window::renderQuads(int, const QRegion& region, const WindowQuadList& quads, Texture *tex, bool normalized) { if (quads.isEmpty()) return; // Render geometry float* vertices; float* texcoords; - quads.makeArrays(&vertices, &texcoords, size, yInverted); + QSizeF size(tex->size()); + if (normalized) { + size.setWidth(1.0); + size.setHeight(1.0); + } +#ifndef KWIN_HAVE_OPENGLES + if (tex->target() == GL_TEXTURE_RECTANGLE_ARB) { + size.setWidth(1.0); + size.setHeight(1.0); + } +#endif + quads.makeArrays(&vertices, &texcoords, size, tex->getYInverted()); GLVertexBuffer::streamingBuffer()->setData(quads.count() * 6, 2, vertices, texcoords); GLVertexBuffer::streamingBuffer()->render(region, GL_TRIANGLES); delete[] vertices; diff --git a/scene_opengl.h b/scene_opengl.h index 8a9ad55c11..61ed866d4c 100644 --- a/scene_opengl.h +++ b/scene_opengl.h @@ -169,7 +169,7 @@ protected: void paintDecoration(const QPixmap* decoration, TextureType decorationType, const QRegion& region, const QRect& rect, const WindowPaintData& data, const WindowQuadList& quads, bool updateDeco); void paintShadow(WindowQuadType type, const QRegion ®ion, const WindowPaintData &data); void makeDecorationArrays(const WindowQuadList& quads, const QRect& rect, bool y_inverted) const; - void renderQuads(int, const QRegion& region, const KWin::WindowQuadList& quads, const QSizeF& size, bool yInverted); + void renderQuads(int, const QRegion& region, const WindowQuadList& quads, Texture* tex, bool normalized = false); void prepareStates(TextureType type, double opacity, double brightness, double saturation, GLShader* shader); void prepareStates(TextureType type, double opacity, double brightness, double saturation, GLShader* shader, Texture *texture); void prepareRenderStates(TextureType type, double opacity, double brightness, double saturation, Texture *tex);