kwineffects: Remove unused WindowVertex and WindowQuad props
Since window quads are no longer passed in prePaintWindow(), we don't need to track original vertex coords. This results in smaller memory footprint.
This commit is contained in:
parent
5339b1a9d7
commit
4af9d6c234
3 changed files with 3 additions and 105 deletions
|
@ -100,10 +100,6 @@ void WindowQuadListTest::testMakeGrid()
|
|||
if (actualVertex.y() != expectedVertex.y()) return false;
|
||||
if (!qFuzzyIsNull(actualVertex.u() - expectedVertex.u())) return false;
|
||||
if (!qFuzzyIsNull(actualVertex.v() - expectedVertex.v())) return false;
|
||||
if (actualVertex.originalX() != expectedVertex.originalX()) return false;
|
||||
if (actualVertex.originalY() != expectedVertex.originalY()) return false;
|
||||
if (!qFuzzyIsNull(actualVertex.textureX() - expectedVertex.textureX())) return false;
|
||||
if (!qFuzzyIsNull(actualVertex.textureY() - expectedVertex.textureY())) return false;
|
||||
return true;
|
||||
};
|
||||
found = vertexTest(0) && vertexTest(1) && vertexTest(2) && vertexTest(3);
|
||||
|
@ -187,10 +183,6 @@ void WindowQuadListTest::testMakeRegularGrid()
|
|||
if (actualVertex.y() != expectedVertex.y()) return false;
|
||||
if (!qFuzzyIsNull(actualVertex.u() - expectedVertex.u())) return false;
|
||||
if (!qFuzzyIsNull(actualVertex.v() - expectedVertex.v())) return false;
|
||||
if (actualVertex.originalX() != expectedVertex.originalX()) return false;
|
||||
if (actualVertex.originalY() != expectedVertex.originalY()) return false;
|
||||
if (!qFuzzyIsNull(actualVertex.textureX() - expectedVertex.textureX())) return false;
|
||||
if (!qFuzzyIsNull(actualVertex.textureY() - expectedVertex.textureY())) return false;
|
||||
return true;
|
||||
};
|
||||
found = vertexTest(0) && vertexTest(1) && vertexTest(2) && vertexTest(3);
|
||||
|
|
|
@ -843,10 +843,6 @@ EffectWindowGroup::~EffectWindowGroup()
|
|||
WindowQuad WindowQuad::makeSubQuad(double x1, double y1, double x2, double y2) const
|
||||
{
|
||||
Q_ASSERT(x1 < x2 && y1 < y2 && x1 >= left() && x2 <= right() && y1 >= top() && y2 <= bottom());
|
||||
#if !defined(QT_NO_DEBUG)
|
||||
if (isTransformed())
|
||||
qFatal("Splitting quads is allowed only in pre-paint calls!");
|
||||
#endif
|
||||
WindowQuad ret(*this);
|
||||
// vertices are clockwise starting from topleft
|
||||
ret.verts[ 0 ].px = x1;
|
||||
|
@ -857,15 +853,6 @@ WindowQuad WindowQuad::makeSubQuad(double x1, double y1, double x2, double y2) c
|
|||
ret.verts[ 1 ].py = y1;
|
||||
ret.verts[ 2 ].py = y2;
|
||||
ret.verts[ 3 ].py = y2;
|
||||
// original x/y are supposed to be the same, no transforming is done here
|
||||
ret.verts[ 0 ].ox = x1;
|
||||
ret.verts[ 3 ].ox = x1;
|
||||
ret.verts[ 1 ].ox = x2;
|
||||
ret.verts[ 2 ].ox = x2;
|
||||
ret.verts[ 0 ].oy = y1;
|
||||
ret.verts[ 1 ].oy = y1;
|
||||
ret.verts[ 2 ].oy = y2;
|
||||
ret.verts[ 3 ].oy = y2;
|
||||
|
||||
const double xOrigin = left();
|
||||
const double yOrigin = top();
|
||||
|
@ -907,15 +894,6 @@ WindowQuad WindowQuad::makeSubQuad(double x1, double y1, double x2, double y2) c
|
|||
return ret;
|
||||
}
|
||||
|
||||
bool WindowQuad::smoothNeeded() const
|
||||
{
|
||||
// smoothing is needed if the width or height of the quad does not match the original size
|
||||
double width = verts[ 1 ].ox - verts[ 0 ].ox;
|
||||
double height = verts[ 2 ].oy - verts[ 1 ].oy;
|
||||
return(verts[ 1 ].px - verts[ 0 ].px != width || verts[ 2 ].px - verts[ 3 ].px != width
|
||||
|| verts[ 2 ].py - verts[ 1 ].py != height || verts[ 3 ].py - verts[ 0 ].py != height);
|
||||
}
|
||||
|
||||
/***************************************************************
|
||||
WindowQuadList
|
||||
***************************************************************/
|
||||
|
@ -925,10 +903,6 @@ WindowQuadList WindowQuadList::splitAtX(double x) const
|
|||
WindowQuadList ret;
|
||||
ret.reserve(count());
|
||||
for (const WindowQuad & quad : *this) {
|
||||
#if !defined(QT_NO_DEBUG)
|
||||
if (quad.isTransformed())
|
||||
qFatal("Splitting quads is allowed only in pre-paint calls!");
|
||||
#endif
|
||||
bool wholeleft = true;
|
||||
bool wholeright = true;
|
||||
for (int i = 0;
|
||||
|
@ -958,10 +932,6 @@ WindowQuadList WindowQuadList::splitAtY(double y) const
|
|||
WindowQuadList ret;
|
||||
ret.reserve(count());
|
||||
for (const WindowQuad & quad : *this) {
|
||||
#if !defined(QT_NO_DEBUG)
|
||||
if (quad.isTransformed())
|
||||
qFatal("Splitting quads is allowed only in pre-paint calls!");
|
||||
#endif
|
||||
bool wholetop = true;
|
||||
bool wholebottom = true;
|
||||
for (int i = 0;
|
||||
|
@ -998,10 +968,6 @@ WindowQuadList WindowQuadList::makeGrid(int maxQuadSize) const
|
|||
double bottom = first().bottom();
|
||||
|
||||
Q_FOREACH (const WindowQuad &quad, *this) {
|
||||
#if !defined(QT_NO_DEBUG)
|
||||
if (quad.isTransformed())
|
||||
qFatal("Splitting quads is allowed only in pre-paint calls!");
|
||||
#endif
|
||||
left = qMin(left, quad.left());
|
||||
right = qMax(right, quad.right());
|
||||
top = qMin(top, quad.top());
|
||||
|
@ -1055,10 +1021,6 @@ WindowQuadList WindowQuadList::makeRegularGrid(int xSubdivisions, int ySubdivisi
|
|||
double bottom = first().bottom();
|
||||
|
||||
for (const WindowQuad &quad : *this) {
|
||||
#if !defined(QT_NO_DEBUG)
|
||||
if (quad.isTransformed())
|
||||
qFatal("Splitting quads is allowed only in pre-paint calls!");
|
||||
#endif
|
||||
left = qMin(left, quad.left());
|
||||
right = qMax(right, quad.right());
|
||||
top = qMin(top, quad.top());
|
||||
|
@ -1253,16 +1215,6 @@ void WindowQuadList::makeArrays(float **vertices, float **texcoords, const QSize
|
|||
}
|
||||
}
|
||||
|
||||
bool WindowQuadList::smoothNeeded() const
|
||||
{
|
||||
return std::any_of(constBegin(), constEnd(), [] (const WindowQuad & q) { return q.smoothNeeded(); });
|
||||
}
|
||||
|
||||
bool WindowQuadList::isTransformed() const
|
||||
{
|
||||
return std::any_of(constBegin(), constEnd(), [] (const WindowQuad & q) { return q.isTransformed(); });
|
||||
}
|
||||
|
||||
/***************************************************************
|
||||
Motion1D
|
||||
***************************************************************/
|
||||
|
|
|
@ -2566,10 +2566,6 @@ public:
|
|||
double y() const { return py; }
|
||||
double u() const { return tx; }
|
||||
double v() const { return ty; }
|
||||
double originalX() const { return ox; }
|
||||
double originalY() const { return oy; }
|
||||
double textureX() const { return tx; }
|
||||
double textureY() const { return ty; }
|
||||
void move(double x, double y);
|
||||
void setX(double x);
|
||||
void setY(double y);
|
||||
|
@ -2578,7 +2574,6 @@ private:
|
|||
friend class WindowQuad;
|
||||
friend class WindowQuadList;
|
||||
double px, py; // position
|
||||
double ox, oy; // origional position
|
||||
double tx, ty; // texture coords
|
||||
};
|
||||
|
||||
|
@ -2601,12 +2596,6 @@ public:
|
|||
double right() const;
|
||||
double top() const;
|
||||
double bottom() const;
|
||||
double originalLeft() const;
|
||||
double originalRight() const;
|
||||
double originalTop() const;
|
||||
double originalBottom() const;
|
||||
bool smoothNeeded() const;
|
||||
bool isTransformed() const;
|
||||
private:
|
||||
friend class WindowQuadList;
|
||||
WindowVertex verts[ 4 ];
|
||||
|
@ -2621,10 +2610,8 @@ public:
|
|||
WindowQuadList splitAtY(double y) const;
|
||||
WindowQuadList makeGrid(int maxquadsize) const;
|
||||
WindowQuadList makeRegularGrid(int xSubdivisions, int ySubdivisions) const;
|
||||
bool smoothNeeded() const;
|
||||
void makeInterleavedArrays(unsigned int type, GLVertex2D *vertices, const QMatrix4x4 &matrix) const;
|
||||
void makeArrays(float** vertices, float** texcoords, const QSizeF &size, bool yInverted) const;
|
||||
bool isTransformed() const;
|
||||
};
|
||||
|
||||
class KWINEFFECTS_EXPORT WindowPrePaintData
|
||||
|
@ -3747,20 +3734,20 @@ extern KWINEFFECTS_EXPORT EffectsHandler* effects;
|
|||
|
||||
inline
|
||||
WindowVertex::WindowVertex()
|
||||
: px(0), py(0), ox(0), oy(0), tx(0), ty(0)
|
||||
: px(0), py(0), tx(0), ty(0)
|
||||
{
|
||||
}
|
||||
|
||||
inline
|
||||
WindowVertex::WindowVertex(double _x, double _y, double _tx, double _ty)
|
||||
: px(_x), py(_y), ox(_x), oy(_y), tx(_tx), ty(_ty)
|
||||
: px(_x), py(_y), tx(_tx), ty(_ty)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
WindowVertex::WindowVertex(const QPointF &position, const QPointF &texturePosition)
|
||||
: px(position.x()), py(position.y()), ox(position.x()), oy(position.y()), tx(texturePosition.x()), ty(texturePosition.y())
|
||||
: px(position.x()), py(position.y()), tx(texturePosition.x()), ty(texturePosition.y())
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -3807,15 +3794,6 @@ const WindowVertex& WindowQuad::operator[](int index) const
|
|||
return verts[ index ];
|
||||
}
|
||||
|
||||
inline
|
||||
bool WindowQuad::isTransformed() const
|
||||
{
|
||||
return !(verts[ 0 ].px == verts[ 0 ].ox && verts[ 0 ].py == verts[ 0 ].oy
|
||||
&& verts[ 1 ].px == verts[ 1 ].ox && verts[ 1 ].py == verts[ 1 ].oy
|
||||
&& verts[ 2 ].px == verts[ 2 ].ox && verts[ 2 ].py == verts[ 2 ].oy
|
||||
&& verts[ 3 ].px == verts[ 3 ].ox && verts[ 3 ].py == verts[ 3 ].oy);
|
||||
}
|
||||
|
||||
inline
|
||||
double WindowQuad::left() const
|
||||
{
|
||||
|
@ -3840,30 +3818,6 @@ double WindowQuad::bottom() const
|
|||
return qMax(verts[ 0 ].py, qMax(verts[ 1 ].py, qMax(verts[ 2 ].py, verts[ 3 ].py)));
|
||||
}
|
||||
|
||||
inline
|
||||
double WindowQuad::originalLeft() const
|
||||
{
|
||||
return verts[ 0 ].ox;
|
||||
}
|
||||
|
||||
inline
|
||||
double WindowQuad::originalRight() const
|
||||
{
|
||||
return verts[ 2 ].ox;
|
||||
}
|
||||
|
||||
inline
|
||||
double WindowQuad::originalTop() const
|
||||
{
|
||||
return verts[ 0 ].oy;
|
||||
}
|
||||
|
||||
inline
|
||||
double WindowQuad::originalBottom() const
|
||||
{
|
||||
return verts[ 2 ].oy;
|
||||
}
|
||||
|
||||
/***************************************************************
|
||||
Motion
|
||||
***************************************************************/
|
||||
|
|
Loading…
Reference in a new issue