kwin: Split WindowQuadDecoration into two types
Split WindowQuadDecoration into WindowQuadDecorationLeftRight and WindowQuadDecorationTopBottom. This simplifies the code in SceneOpenGL::Window::paintDecoration().icc-effect-5.14.5
parent
120e65b2c1
commit
ac5f1317e9
|
@ -179,7 +179,8 @@ X-KDE-Library=kwin4_effect_cooleffect
|
|||
enum WindowQuadType {
|
||||
WindowQuadError, // for the stupid default ctor
|
||||
WindowQuadContents,
|
||||
WindowQuadDecoration,
|
||||
WindowQuadDecorationLeftRight,
|
||||
WindowQuadDecorationTopBottom,
|
||||
// Shadow Quad types
|
||||
WindowQuadShadowTop,
|
||||
WindowQuadShadowTopRight,
|
||||
|
@ -2679,7 +2680,8 @@ inline
|
|||
bool WindowQuad::decoration() const
|
||||
{
|
||||
assert(quadType != WindowQuadError);
|
||||
return quadType == WindowQuadDecoration;
|
||||
return quadType == WindowQuadDecorationLeftRight ||
|
||||
quadType == WindowQuadDecorationTopBottom;
|
||||
}
|
||||
|
||||
inline
|
||||
|
|
|
@ -748,6 +748,13 @@ WindowQuadList Scene::Window::makeDecorationQuads(const QRect *rects, const QReg
|
|||
QPoint(-rects[3].x(), -rects[3].y() + rects[1].height()) // Bottom
|
||||
};
|
||||
|
||||
const WindowQuadType types[4] = {
|
||||
WindowQuadDecorationLeftRight, // Left
|
||||
WindowQuadDecorationTopBottom, // Top
|
||||
WindowQuadDecorationLeftRight, // Right
|
||||
WindowQuadDecorationTopBottom // Bottom
|
||||
};
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
foreach (const QRect &r, (region & rects[i]).rects()) {
|
||||
if (!r.isValid())
|
||||
|
@ -763,7 +770,7 @@ WindowQuadList Scene::Window::makeDecorationQuads(const QRect *rects, const QReg
|
|||
const int u1 = x1 + offsets[i].x();
|
||||
const int v1 = y1 + offsets[i].y();
|
||||
|
||||
WindowQuad quad(WindowQuadDecoration);
|
||||
WindowQuad quad(types[i]);
|
||||
quad[0] = WindowVertex(x0, y0, u0, v0); // Top-left
|
||||
quad[1] = WindowVertex(x1, y0, u1, v0); // Top-right
|
||||
quad[2] = WindowVertex(x1, y1, u1, v1); // Bottom-right
|
||||
|
|
|
@ -1156,24 +1156,26 @@ void SceneOpenGL::Window::paintDecorations(const WindowPaintData &data, const QR
|
|||
}
|
||||
|
||||
WindowQuadList quads[2]; // left-right, top-bottom
|
||||
GLTexture *textures[2];
|
||||
|
||||
QRect rect[4];
|
||||
t->layoutDecorationRects(rect[0], rect[1], rect[2], rect[3], Client::WindowRelative);
|
||||
|
||||
// Split the quads into two lists
|
||||
foreach (const WindowQuad &quad, data.quads) {
|
||||
if (quad.type() != WindowQuadDecoration)
|
||||
switch (quad.type()) {
|
||||
case WindowQuadDecorationLeftRight:
|
||||
quads[0].append(quad);
|
||||
continue;
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
if (rect[i].contains(QPoint(quad.originalLeft(), quad.originalTop())))
|
||||
quads[i % 2].append(quad);
|
||||
case WindowQuadDecorationTopBottom:
|
||||
quads[1].append(quad);
|
||||
continue;
|
||||
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
redirector->ensurePixmapsPainted();
|
||||
|
||||
GLTexture *textures[2];
|
||||
textures[0] = redirector->leftRightTexture();
|
||||
textures[1] = redirector->topBottomTexture();
|
||||
|
||||
|
|
Loading…
Reference in New Issue