kwineffects: Remove WindowQuad::uvAxisSwapped
Since makeSubQuad() uses bilinear interpolation, the flag to indicate whether UV-coordinates are swapped is redundant.
This commit is contained in:
parent
8386a8bb66
commit
c6ffdf4f7f
3 changed files with 11 additions and 36 deletions
|
@ -194,8 +194,6 @@ WindowQuadList DecorationItem::buildQuads() const
|
|||
continue;
|
||||
}
|
||||
|
||||
const bool swap = orientations[i] == Qt::Vertical;
|
||||
|
||||
const int x0 = r.x();
|
||||
const int y0 = r.y();
|
||||
const int x1 = r.x() + r.width();
|
||||
|
@ -207,9 +205,8 @@ WindowQuadList DecorationItem::buildQuads() const
|
|||
const int v1 = (y1 + offsets[i].y()) * textureScale;
|
||||
|
||||
WindowQuad quad;
|
||||
quad.setUVAxisSwapped(swap);
|
||||
|
||||
if (swap) {
|
||||
if (orientations[i] == Qt::Vertical) {
|
||||
quad[0] = WindowVertex(x0, y0, v0, u0); // Top-left
|
||||
quad[1] = WindowVertex(x1, y0, v0, u1); // Top-right
|
||||
quad[2] = WindowVertex(x1, y1, v1, u1); // Bottom-right
|
||||
|
|
|
@ -860,37 +860,19 @@ WindowQuad WindowQuad::makeSubQuad(double x1, double y1, double x2, double y2) c
|
|||
const double widthReciprocal = 1 / (right() - xOrigin);
|
||||
const double heightReciprocal = 1 / (bottom() - yOrigin);
|
||||
|
||||
if (!uvAxisSwapped()) {
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
const double w1 = (ret.verts[i].px - xOrigin) * widthReciprocal;
|
||||
const double w2 = (ret.verts[i].py - yOrigin) * heightReciprocal;
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
const double w1 = (ret.verts[i].px - xOrigin) * widthReciprocal;
|
||||
const double w2 = (ret.verts[i].py - yOrigin) * heightReciprocal;
|
||||
|
||||
// Use bilinear interpolation to compute the texture coords.
|
||||
ret.verts[i].tx = (1 - w1) * (1 - w2) * verts[0].tx +
|
||||
w1 * (1 - w2) * verts[1].tx +
|
||||
w1 * w2 * verts[2].tx + (1 - w1) * w2 * verts[3].tx;
|
||||
ret.verts[i].ty = (1 - w1) * (1 - w2) * verts[0].ty +
|
||||
w1 * (1 - w2) * verts[1].ty +
|
||||
w1 * w2 * verts[2].ty + (1 - w1) * w2 * verts[3].ty;
|
||||
}
|
||||
} else {
|
||||
// Same as above, with just verts[1] and verts[3] being swapped.
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
const double w1 = (ret.verts[i].py - yOrigin) * heightReciprocal;
|
||||
const double w2 = (ret.verts[i].px - xOrigin) * widthReciprocal;
|
||||
|
||||
// Use bilinear interpolation to compute the texture coords.
|
||||
ret.verts[i].tx = (1 - w1) * (1 - w2) * verts[0].tx +
|
||||
w1 * (1 - w2) * verts[3].tx +
|
||||
w1 * w2 * verts[2].tx + (1 - w1) * w2 * verts[1].tx;
|
||||
ret.verts[i].ty = (1 - w1) * (1 - w2) * verts[0].ty +
|
||||
w1 * (1 - w2) * verts[3].ty +
|
||||
w1 * w2 * verts[2].ty + (1 - w1) * w2 * verts[1].ty;
|
||||
}
|
||||
// Use bilinear interpolation to compute the texture coords.
|
||||
ret.verts[i].tx = (1 - w1) * (1 - w2) * verts[0].tx +
|
||||
w1 * (1 - w2) * verts[1].tx +
|
||||
w1 * w2 * verts[2].tx + (1 - w1) * w2 * verts[3].tx;
|
||||
ret.verts[i].ty = (1 - w1) * (1 - w2) * verts[0].ty +
|
||||
w1 * (1 - w2) * verts[1].ty +
|
||||
w1 * w2 * verts[2].ty + (1 - w1) * w2 * verts[3].ty;
|
||||
}
|
||||
|
||||
ret.setUVAxisSwapped(uvAxisSwapped());
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -2579,8 +2579,6 @@ public:
|
|||
WindowQuad makeSubQuad(double x1, double y1, double x2, double y2) const;
|
||||
WindowVertex& operator[](int index);
|
||||
const WindowVertex& operator[](int index) const;
|
||||
void setUVAxisSwapped(bool value) { uvSwapped = value; }
|
||||
bool uvAxisSwapped() const { return uvSwapped; }
|
||||
double left() const;
|
||||
double right() const;
|
||||
double top() const;
|
||||
|
@ -2588,7 +2586,6 @@ public:
|
|||
private:
|
||||
friend class WindowQuadList;
|
||||
WindowVertex verts[ 4 ];
|
||||
bool uvSwapped;
|
||||
};
|
||||
|
||||
class KWINEFFECTS_EXPORT WindowQuadList
|
||||
|
@ -3765,7 +3762,6 @@ void WindowVertex::setY(double y)
|
|||
|
||||
inline
|
||||
WindowQuad::WindowQuad()
|
||||
: uvSwapped(false)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue