Merge branch 'KDE/4.7'

This commit is contained in:
Martin Gräßlin 2011-06-30 17:50:58 +02:00
commit 5f0bbe4617
2 changed files with 18 additions and 7 deletions

View file

@ -586,13 +586,13 @@ void SceneOpenGL::Window::performPaint(int mask, QRegion region, WindowPaintData
if (!(mask & PAINT_DECORATION_ONLY)) { if (!(mask & PAINT_DECORATION_ONLY)) {
texture.bind(); texture.bind();
prepareStates(Content, data.opacity * data.contents_opacity, data.brightness, data.saturation, data.shader); 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); restoreStates(Content, data.opacity * data.contents_opacity, data.brightness, data.saturation, data.shader);
texture.unbind(); texture.unbind();
#ifndef KWIN_HAVE_OPENGLES #ifndef KWIN_HAVE_OPENGLES
if (static_cast<SceneOpenGL*>(scene)->debug) { if (static_cast<SceneOpenGL*>(scene)->debug) {
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); 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); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
} }
#endif #endif
@ -673,13 +673,13 @@ void SceneOpenGL::Window::paintShadow(WindowQuadType type, const QRegion &region
texture->setWrapMode(GL_CLAMP_TO_EDGE); texture->setWrapMode(GL_CLAMP_TO_EDGE);
texture->bind(); texture->bind();
prepareStates(Shadow, data.opacity, data.brightness, data.saturation, data.shader, texture); 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); restoreStates(Shadow, data.opacity, data.brightness, data.saturation, data.shader, texture);
texture->unbind(); texture->unbind();
#ifndef KWIN_HAVE_OPENGLES #ifndef KWIN_HAVE_OPENGLES
if (static_cast<SceneOpenGL*>(scene)->debug) { if (static_cast<SceneOpenGL*>(scene)->debug) {
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); 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); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
} }
#endif #endif
@ -738,14 +738,25 @@ void SceneOpenGL::Window::makeDecorationArrays(const WindowQuadList& quads, cons
GLVertexBuffer::streamingBuffer()->setData(quads.count() * 6, 2, vertices.data(), texcoords.data()); 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()) if (quads.isEmpty())
return; return;
// Render geometry // Render geometry
float* vertices; float* vertices;
float* texcoords; 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()->setData(quads.count() * 6, 2, vertices, texcoords);
GLVertexBuffer::streamingBuffer()->render(region, GL_TRIANGLES); GLVertexBuffer::streamingBuffer()->render(region, GL_TRIANGLES);
delete[] vertices; delete[] vertices;

View file

@ -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 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 &region, const WindowPaintData &data); void paintShadow(WindowQuadType type, const QRegion &region, const WindowPaintData &data);
void makeDecorationArrays(const WindowQuadList& quads, const QRect& rect, bool y_inverted) const; 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);
void prepareStates(TextureType type, double opacity, double brightness, double saturation, GLShader* shader, Texture *texture); 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); void prepareRenderStates(TextureType type, double opacity, double brightness, double saturation, Texture *tex);