aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph/util/qsgatlastexture.cpp
diff options
context:
space:
mode:
authorLaszlo Agocs <[email protected]>2016-05-24 11:08:09 +0200
committerLaszlo Agocs <[email protected]>2016-05-24 11:33:42 +0200
commit9ff09fb283cd130fb717769b44f54bfbb28efd8a (patch)
tree711f70b4b494bd996d54bdab5c44f3c89b37a6d1 /src/quick/scenegraph/util/qsgatlastexture.cpp
parent592b5b49b6c0043fae5db7721689813ebd226032 (diff)
parentec2b2a5f5d804095b6b2b8575b1cd1b75a8335ff (diff)
Merge remote-tracking branch 'origin/dev' into wip/scenegraphng
Conflicts: src/quick/items/qquickopenglshadereffectnode.cpp src/quick/items/qquickshadereffect.cpp src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h src/quick/scenegraph/qsgdefaultglyphnode_p.h Change-Id: I3d6874b4e4231a89d2836c04fe8e7f2ef2d698c4
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 06c4129a33..098a4a666b 100644
--- a/src/quick/scenegraph/util/qsgatlastexture.cpp
+++ b/src/quick/scenegraph/util/qsgatlastexture.cpp
@@ -128,6 +128,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)
{
@@ -177,6 +178,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()
@@ -399,7 +405,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"