aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph
diff options
context:
space:
mode:
authorGunnar Sletta <gunnar.sletta@jollamobile.com>2014-01-27 10:08:14 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-02-12 09:24:40 +0100
commit15999f14f146b5c04fb40b31b69ceeeece273430 (patch)
treec4694e18da30dc10075ca10e254bca02c3061383 /src/quick/scenegraph
parent4cf4d18b98f5ceaafc3f595c5eadad9ceb337813 (diff)
Add Image::mipmap to support mipmapping of images.
[ChangeLog][QtQuick] New feature: Image.mipmap Task-number: QTBUG-19961 Change-Id: I13acb2408d5b126790adaf9d324ad4beda1e3646 Reviewed-by: Michael Brasser <michael.brasser@live.com>
Diffstat (limited to 'src/quick/scenegraph')
-rw-r--r--src/quick/scenegraph/util/qsgatlastexture.cpp1
-rw-r--r--src/quick/scenegraph/util/qsgpainternode.cpp1
-rw-r--r--src/quick/scenegraph/util/qsgtexture.cpp15
-rw-r--r--src/quick/scenegraph/util/qsgtexture_p.h4
4 files changed, 4 insertions, 17 deletions
diff --git a/src/quick/scenegraph/util/qsgatlastexture.cpp b/src/quick/scenegraph/util/qsgatlastexture.cpp
index e6a2096c80..e39949253f 100644
--- a/src/quick/scenegraph/util/qsgatlastexture.cpp
+++ b/src/quick/scenegraph/util/qsgatlastexture.cpp
@@ -459,6 +459,7 @@ QSGTexture *Texture::removedFromAtlas() const
m_nonatlas_texture = new QSGPlainTexture();
m_nonatlas_texture->setImage(m_image);
m_nonatlas_texture->setFiltering(filtering());
+ m_nonatlas_texture->setMipmapFiltering(mipmapFiltering());
}
return m_nonatlas_texture;
}
diff --git a/src/quick/scenegraph/util/qsgpainternode.cpp b/src/quick/scenegraph/util/qsgpainternode.cpp
index 797fc4d145..ec44a994e0 100644
--- a/src/quick/scenegraph/util/qsgpainternode.cpp
+++ b/src/quick/scenegraph/util/qsgpainternode.cpp
@@ -205,7 +205,6 @@ void QSGPainterNode::update()
void QSGPainterNode::updateTexture()
{
- m_texture->setHasMipmaps(m_mipmapping);
m_texture->setHasAlphaChannel(!m_opaquePainting);
m_material.setTexture(m_texture);
m_materialO.setTexture(m_texture);
diff --git a/src/quick/scenegraph/util/qsgtexture.cpp b/src/quick/scenegraph/util/qsgtexture.cpp
index b738896a6c..9620e48588 100644
--- a/src/quick/scenegraph/util/qsgtexture.cpp
+++ b/src/quick/scenegraph/util/qsgtexture.cpp
@@ -533,7 +533,6 @@ QSGPlainTexture::QSGPlainTexture()
: QSGTexture()
, m_texture_id(0)
, m_has_alpha(false)
- , m_has_mipmaps(false)
, m_dirty_texture(false)
, m_dirty_bind_options(false)
, m_owns_texture(true)
@@ -597,18 +596,11 @@ void QSGPlainTexture::setTextureId(int id)
m_mipmaps_generated = false;
}
-void QSGPlainTexture::setHasMipmaps(bool mm)
-{
- m_has_mipmaps = mm;
- m_mipmaps_generated = false;
-}
-
-
void QSGPlainTexture::bind()
{
if (!m_dirty_texture) {
glBindTexture(GL_TEXTURE_2D, m_texture_id);
- if (m_has_mipmaps && !m_mipmaps_generated) {
+ if (mipmapFiltering() != QSGTexture::None && !m_mipmaps_generated) {
QOpenGLContext *ctx = QOpenGLContext::currentContext();
ctx->functions()->glGenerateMipmap(GL_TEXTURE_2D);
m_mipmaps_generated = true;
@@ -642,11 +634,8 @@ void QSGPlainTexture::bind()
}
m_texture_id = 0;
m_texture_size = QSize();
- m_has_mipmaps = false;
m_has_alpha = false;
-
-
return;
}
@@ -726,7 +715,7 @@ void QSGPlainTexture::bind()
#endif
- if (m_has_mipmaps) {
+ if (mipmapFiltering() != QSGTexture::None) {
context->functions()->glGenerateMipmap(GL_TEXTURE_2D);
m_mipmaps_generated = true;
}
diff --git a/src/quick/scenegraph/util/qsgtexture_p.h b/src/quick/scenegraph/util/qsgtexture_p.h
index e0d386e20c..bc81569f84 100644
--- a/src/quick/scenegraph/util/qsgtexture_p.h
+++ b/src/quick/scenegraph/util/qsgtexture_p.h
@@ -85,8 +85,7 @@ public:
void setHasAlphaChannel(bool alpha) { m_has_alpha = alpha; }
bool hasAlphaChannel() const { return m_has_alpha; }
- void setHasMipmaps(bool mm);
- bool hasMipmaps() const { return m_has_mipmaps; }
+ bool hasMipmaps() const { return mipmapFiltering() != QSGTexture::None; }
void setImage(const QImage &image);
const QImage &image() { return m_image; }
@@ -107,7 +106,6 @@ protected:
QRectF m_texture_rect;
uint m_has_alpha : 1;
- uint m_has_mipmaps : 1;
uint m_dirty_texture : 1;
uint m_dirty_bind_options : 1;
uint m_owns_texture : 1;