From 40918e019394b386ba140e0dad250b53bd514cb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20H=C3=B6glund?= Date: Tue, 26 Mar 2013 19:49:35 +0100 Subject: [PATCH] kwin: Make WindowQuadList inherit from QVector This avoids the overhead of allocating each WindowQuad on the heap when appending items to the list, and also ensures that the quads are continuous in memory. --- libkwineffects/kwineffects.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/libkwineffects/kwineffects.h b/libkwineffects/kwineffects.h index 2b83bbd451..ec74651a45 100644 --- a/libkwineffects/kwineffects.h +++ b/libkwineffects/kwineffects.h @@ -1722,6 +1722,7 @@ private: class KWIN_EXPORT WindowQuad { public: + explicit WindowQuad(); explicit WindowQuad(WindowQuadType type, int id = -1); WindowQuad makeSubQuad(double x1, double y1, double x2, double y2) const; WindowVertex& operator[](int index); @@ -1748,7 +1749,7 @@ private: }; class KWIN_EXPORT WindowQuadList - : public QList< WindowQuad > + : public QVector { public: WindowQuadList splitAtX(double x) const; @@ -2642,6 +2643,13 @@ void WindowVertex::setY(double y) WindowQuad ***************************************************************/ +inline +WindowQuad::WindowQuad() + : quadType(WindowQuadError) + , quadID(-1) +{ +} + inline WindowQuad::WindowQuad(WindowQuadType t, int id) : quadType(t)