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.
This commit is contained in:
Fredrik Höglund 2013-03-26 19:49:35 +01:00
parent 57b78daf33
commit 40918e0193

View file

@ -1722,6 +1722,7 @@ private:
class KWIN_EXPORT WindowQuad class KWIN_EXPORT WindowQuad
{ {
public: public:
explicit WindowQuad();
explicit WindowQuad(WindowQuadType type, int id = -1); explicit WindowQuad(WindowQuadType type, int id = -1);
WindowQuad makeSubQuad(double x1, double y1, double x2, double y2) const; WindowQuad makeSubQuad(double x1, double y1, double x2, double y2) const;
WindowVertex& operator[](int index); WindowVertex& operator[](int index);
@ -1748,7 +1749,7 @@ private:
}; };
class KWIN_EXPORT WindowQuadList class KWIN_EXPORT WindowQuadList
: public QList< WindowQuad > : public QVector<WindowQuad>
{ {
public: public:
WindowQuadList splitAtX(double x) const; WindowQuadList splitAtX(double x) const;
@ -2642,6 +2643,13 @@ void WindowVertex::setY(double y)
WindowQuad WindowQuad
***************************************************************/ ***************************************************************/
inline
WindowQuad::WindowQuad()
: quadType(WindowQuadError)
, quadID(-1)
{
}
inline inline
WindowQuad::WindowQuad(WindowQuadType t, int id) WindowQuad::WindowQuad(WindowQuadType t, int id)
: quadType(t) : quadType(t)