diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-06-03 09:07:45 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-06-03 09:07:45 (GMT) |
commit | e91dff94de4851b4b8ac48cadccd516893fe4661 (patch) | |
tree | c3dea50c87c5be7b467ae9ceb08ab618e98cba14 /src/declarative/fx | |
parent | 694b270d78d99e94c8ab7543b7371edbe16ecaab (diff) | |
download | Qt-e91dff94de4851b4b8ac48cadccd516893fe4661.zip Qt-e91dff94de4851b4b8ac48cadccd516893fe4661.tar.gz Qt-e91dff94de4851b4b8ac48cadccd516893fe4661.tar.bz2 |
Use POT textures only
Diffstat (limited to 'src/declarative/fx')
-rw-r--r-- | src/declarative/fx/qfximage.cpp | 14 | ||||
-rw-r--r-- | src/declarative/fx/qfxrect.cpp | 41 | ||||
-rw-r--r-- | src/declarative/fx/qfxtext.cpp | 13 |
3 files changed, 37 insertions, 31 deletions
diff --git a/src/declarative/fx/qfximage.cpp b/src/declarative/fx/qfximage.cpp index d28cf7d..d3ac38f 100644 --- a/src/declarative/fx/qfximage.cpp +++ b/src/declarative/fx/qfximage.cpp @@ -462,7 +462,7 @@ uint QFxImage::glSimpleItemData(float *vertices, float *texVertices, void QFxImagePrivate::checkDirty() { if (_texDirty && !_pix.isNull()) { - _tex.setImage(_pix.toImage()); + _tex.setImage(_pix.toImage(), GLTexture::PowerOfTwo); _tex.setHorizontalWrap(GLTexture::Repeat); _tex.setVerticalWrap(GLTexture::Repeat); } @@ -548,8 +548,8 @@ void QFxImage::paintGLContents(GLPainter &p) float heightV = height(); float texleft = 0; - float texright = 1; - float textop = 1; + float texright = d->_tex.glWidth(); + float textop = d->_tex.glHeight(); float texbottom = 0; float imgleft = 0; float imgright = widthV; @@ -562,19 +562,19 @@ void QFxImage::paintGLContents(GLPainter &p) const int sgb = d->_scaleGrid->bottom(); if (sgl) { - texleft = float(sgl) / imgWidth; + texleft = d->_tex.glWidth() * float(sgl) / imgWidth; imgleft = sgl; } if (sgr) { - texright = 1. - float(sgr) / imgWidth; + texright = d->_tex.glWidth() - float(sgr) / imgWidth; imgright = widthV - sgr; } if (sgt) { - textop = 1. - float(sgb) / imgHeight; + textop = d->_tex.glHeight() - float(sgb) / imgHeight; imgtop = sgt; } if (sgb) { - texbottom = float(sgt) / imgHeight; + texbottom = d->_tex.glHeight() * float(sgt) / imgHeight; imgbottom = heightV - sgb; } diff --git a/src/declarative/fx/qfxrect.cpp b/src/declarative/fx/qfxrect.cpp index 3d6897e..c053001 100644 --- a/src/declarative/fx/qfxrect.cpp +++ b/src/declarative/fx/qfxrect.cpp @@ -535,7 +535,7 @@ void QFxRect::generateRoundedRect() } p.setBrush(d->_color); p.drawRoundedRect((pw+1)/2, (pw+1)/2, roundRect.width()-(pw+1)/2*2, roundRect.height()-(pw+1)/2*2, d->_radius, d->_radius); - d->_rectTexture.setImage(roundRect); + d->_rectTexture.setImage(roundRect, GLTexture::PowerOfTwo); } } @@ -556,7 +556,7 @@ void QFxRect::generateBorderedRect() } p.setBrush(d->_color); p.drawRect(qreal(pw+1)/2, qreal(pw+1)/2, borderedRect.width()-(pw+1)/2*2, borderedRect.height()-(pw+1)/2*2); - d->_rectTexture.setImage(borderedRect); + d->_rectTexture.setImage(borderedRect, GLTexture::PowerOfTwo); } } #endif @@ -756,6 +756,11 @@ void QFxRect::paintGLContents(GLPainter &p) if (offset==1) texleft=texright=textop=texbottom=0.5; + texleft *= d->_rectTexture.glWidth(); + texright *= d->_rectTexture.glWidth(); + textop *= d->_rectTexture.glHeight(); + texbottom *= d->_rectTexture.glHeight(); + float vert1[] = { -pw/2, -pw/2, -pw/2, imgtop, imgleft, -pw/2, @@ -847,35 +852,35 @@ void QFxRect::paintGLContents(GLPainter &p) texright, 0, texright, textop, - 1, 0, + d->_rectTexture.glWidth(), 0, texright, textop, - 1, 0, - 1, textop, + d->_rectTexture.glWidth(), 0, + d->_rectTexture.glWidth(), textop, - 0, 1, + 0, d->_rectTexture.glHeight(), 0, texbottom, - texleft, 1, + texleft, d->_rectTexture.glHeight(), 0, texbottom, - texleft, 1, + texleft, d->_rectTexture.glHeight(), texleft, texbottom, - texleft, 1, + texleft, d->_rectTexture.glHeight(), texleft, texbottom, - texright, 1, + texright, d->_rectTexture.glHeight(), texleft, texbottom, - texright, 1, + texright, d->_rectTexture.glHeight(), texright, texbottom, - texright, 1, + texright, d->_rectTexture.glHeight(), texright, texbottom, - 1, 1, + d->_rectTexture.glWidth(), d->_rectTexture.glHeight(), texright, texbottom, - 1, 1, - 1, texbottom, + d->_rectTexture.glWidth(), d->_rectTexture.glHeight(), + d->_rectTexture.glWidth(), texbottom, 0, textop, 0, texbottom, @@ -895,11 +900,11 @@ void QFxRect::paintGLContents(GLPainter &p) texright, textop, texright, texbottom, - 1, textop, + d->_rectTexture.glWidth(), textop, texright, texbottom, - 1, textop, - 1, texbottom }; + d->_rectTexture.glWidth(), textop, + d->_rectTexture.glWidth(), texbottom }; diff --git a/src/declarative/fx/qfxtext.cpp b/src/declarative/fx/qfxtext.cpp index 1b5c080..7a2dd8d 100644 --- a/src/declarative/fx/qfxtext.cpp +++ b/src/declarative/fx/qfxtext.cpp @@ -696,7 +696,7 @@ void QFxTextPrivate::checkImgCache() } #if defined(QFX_RENDER_OPENGL) - tex.setImage(imgCache.toImage()); + tex.setImage(imgCache.toImage(), GLTexture::PowerOfTwo); #endif imgDirty = false; @@ -755,6 +755,7 @@ void QFxText::paintContents(QPainter &p) #elif defined(QFX_RENDER_OPENGL2) void QFxText::paintGLContents(GLPainter &p) { + //return; Q_D(QFxText); d->checkImgCache(); if (d->imgCache.isNull()) @@ -804,12 +805,12 @@ void QFxText::paintGLContents(GLPainter &p) x + widthV, y }; GLfloat texVertices[] = { 0, 0, - 1, 0, - 0, 1, + d->tex.glWidth(), 0, + 0, d->tex.glHeight(), - 1, 0, - 0, 1, - 1, 1 }; + d->tex.glWidth(), 0, + 0, d->tex.glHeight(), + d->tex.glWidth(), d->tex.glHeight() }; shader->setAttributeArray(SingleTextureShader::Vertices, vertices, 2); shader->setAttributeArray(SingleTextureShader::TextureCoords, texVertices, 2); |