aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph/util/qsgatlastexture.cpp
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-04-27 08:47:35 +0200
committerLiang Qi <liang.qi@qt.io>2016-04-27 08:47:35 +0200
commitda374438be8f34f746f359aa39ae6c59fd1c4854 (patch)
tree2f3e2a2b93b39dfb825339c98580f23e824fad0e /src/quick/scenegraph/util/qsgatlastexture.cpp
parent1be53f4e143d417d60cd1f9a292193dab59b5b20 (diff)
parent2e6f7f362e62c3285e7d395aca607502c8e8160e (diff)
Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts: src/quick/items/qquickimagebase.cpp src/imports/layouts/plugin.cpp Change-Id: I5f48474df4034a1347ec74795c85d369a55b6b21
Diffstat (limited to 'src/quick/scenegraph/util/qsgatlastexture.cpp')
-rw-r--r--src/quick/scenegraph/util/qsgatlastexture.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/quick/scenegraph/util/qsgatlastexture.cpp b/src/quick/scenegraph/util/qsgatlastexture.cpp
index 68dc813933..a93e7bbd30 100644
--- a/src/quick/scenegraph/util/qsgatlastexture.cpp
+++ b/src/quick/scenegraph/util/qsgatlastexture.cpp
@@ -127,6 +127,7 @@ Atlas::Atlas(const QSize &size)
: m_allocator(size)
, m_texture_id(0)
, m_size(size)
+ , m_atlas_transient_image_threshold(0)
, m_allocated(false)
{
@@ -176,6 +177,11 @@ Atlas::Atlas(const QSize &size)
m_use_bgra_fallback = qEnvironmentVariableIsSet("QSG_ATLAS_USE_BGRA_FALLBACK");
m_debug_overlay = qEnvironmentVariableIsSet("QSG_ATLAS_OVERLAY");
+
+ // images smaller than this will retain their QImage.
+ // by default no images are retained (favoring memory)
+ // set to a very large value to retain all images (allowing quick removal from the atlas)
+ m_atlas_transient_image_threshold = qt_sg_envInt("QSG_ATLAS_TRANSIENT_IMAGE_THRESHOLD", 0);
}
Atlas::~Atlas()
@@ -398,7 +404,10 @@ void Atlas::bind(QSGTexture::Filtering filtering)
} else {
upload(t);
}
- t->releaseImage();
+ const QSize textureSize = t->textureSize();
+ if (textureSize.width() > m_atlas_transient_image_threshold ||
+ textureSize.height() > m_atlas_transient_image_threshold)
+ t->releaseImage();
qCDebug(QSG_LOG_TIME_TEXTURE).nospace() << "atlastexture uploaded in: " << qsg_renderer_timer.elapsed()
<< "ms (" << t->textureSize().width() << "x"