No public texture coordinates.
svn path=/trunk/KDE/kdebase/workspace/; revision=689926
This commit is contained in:
parent
9400def76b
commit
dbade7f1a4
2 changed files with 22 additions and 20 deletions
|
@ -318,6 +318,7 @@ WindowQuad WindowQuad::makeSubQuad( float x1, float y1, float x2, float y2 ) con
|
|||
assert( x1 < x2 && y1 < y2 && x1 >= left() && x2 <= right() && y1 >= top() && y2 <= bottom());
|
||||
checkUntransformed();
|
||||
WindowQuad ret( *this );
|
||||
// vertices are clockwise starting from topleft
|
||||
ret.verts[ 0 ].px = x1;
|
||||
ret.verts[ 3 ].px = x1;
|
||||
ret.verts[ 1 ].px = x2;
|
||||
|
@ -335,10 +336,14 @@ WindowQuad WindowQuad::makeSubQuad( float x1, float y1, float x2, float y2 ) con
|
|||
ret.verts[ 1 ].oy = y1;
|
||||
ret.verts[ 2 ].oy = y2;
|
||||
ret.verts[ 3 ].oy = y2;
|
||||
float tleft = ( x1 - left()) / ( right() - left()) * ( textureRight() - textureLeft()) + textureLeft();
|
||||
float tright = ( x2 - left()) / ( right() - left()) * ( textureRight() - textureLeft()) + textureLeft();
|
||||
float ttop = ( y1 - top()) / ( bottom() - top()) * ( textureBottom() - textureTop()) + textureTop();
|
||||
float tbottom = ( y2 - top()) / ( bottom() - top()) * ( textureBottom() - textureTop()) + textureTop();
|
||||
float my_tleft = verts[ 0 ].tx;
|
||||
float my_tright = verts[ 2 ].tx;
|
||||
float my_ttop = verts[ 0 ].ty;
|
||||
float my_tbottom = verts[ 2 ].ty;
|
||||
float tleft = ( x1 - left()) / ( right() - left()) * ( my_tright - my_tleft ) + my_tleft;
|
||||
float tright = ( x2 - left()) / ( right() - left()) * ( my_tright - my_tleft ) + my_tleft;
|
||||
float ttop = ( y1 - top()) / ( bottom() - top()) * ( my_tbottom - my_ttop ) + my_ttop;
|
||||
float tbottom = ( y2 - top()) / ( bottom() - top()) * ( my_tbottom - my_ttop ) + my_ttop;
|
||||
ret.verts[ 0 ].tx = tleft;
|
||||
ret.verts[ 3 ].tx = tleft;
|
||||
ret.verts[ 1 ].tx = tright;
|
||||
|
|
|
@ -391,6 +391,7 @@ enum WindowQuadType
|
|||
* @short Class representing one area of a window.
|
||||
* WindowQuads consists of four WindowVertex objects and represents one part of a window.
|
||||
*/
|
||||
// NOTE: This class expects the (original) vertices to be in the clockwise order starting from topleft.
|
||||
class KWIN_EXPORT WindowQuad
|
||||
{
|
||||
public:
|
||||
|
@ -404,10 +405,10 @@ class KWIN_EXPORT WindowQuad
|
|||
float right() const;
|
||||
float top() const;
|
||||
float bottom() const;
|
||||
float textureLeft() const;
|
||||
float textureRight() const;
|
||||
float textureTop() const;
|
||||
float textureBottom() const;
|
||||
float originalLeft() const;
|
||||
float originalRight() const;
|
||||
float originalTop() const;
|
||||
float originalBottom() const;
|
||||
private:
|
||||
friend class WindowQuadList;
|
||||
void checkUntransformed() const;
|
||||
|
@ -623,31 +624,27 @@ float WindowQuad::bottom() const
|
|||
}
|
||||
|
||||
inline
|
||||
float WindowQuad::textureLeft() const
|
||||
float WindowQuad::originalLeft() const
|
||||
{
|
||||
checkUntransformed();
|
||||
return verts[ 0 ].tx;
|
||||
return verts[ 0 ].ox;
|
||||
}
|
||||
|
||||
inline
|
||||
float WindowQuad::textureRight() const
|
||||
float WindowQuad::originalRight() const
|
||||
{
|
||||
checkUntransformed();
|
||||
return verts[ 2 ].tx;
|
||||
return verts[ 2 ].ox;
|
||||
}
|
||||
|
||||
inline
|
||||
float WindowQuad::textureTop() const
|
||||
float WindowQuad::originalTop() const
|
||||
{
|
||||
checkUntransformed();
|
||||
return verts[ 0 ].ty;
|
||||
return verts[ 0 ].oy;
|
||||
}
|
||||
|
||||
inline
|
||||
float WindowQuad::textureBottom() const
|
||||
float WindowQuad::originalBottom() const
|
||||
{
|
||||
checkUntransformed();
|
||||
return verts[ 2 ].ty;
|
||||
return verts[ 2 ].oy;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
|
Loading…
Reference in a new issue