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:
parent
57b78daf33
commit
40918e0193
1 changed files with 9 additions and 1 deletions
|
@ -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<WindowQuad>
|
||||
{
|
||||
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)
|
||||
|
|
Loading…
Reference in a new issue