summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@theqtcompany.com>2016-03-16 11:01:28 +0100
committerLaszlo Agocs <laszlo.agocs@theqtcompany.com>2016-03-16 12:36:55 +0000
commitd64f0781738519add9e3c3eb7a92c7dae5f8470c (patch)
tree0a4f4982186ca3d957377ea7324e476bb71883f6 /src/gui
parentb122989e734013af00ee6a5b9918a65703ea7806 (diff)
Add begin-end virtuals to the internal glyph cache
Just having a single fillTexture() is not sufficient for efficient operation with modern, low-level graphics APIs. Having a begin-end pair of functions that are invoked before the stream of calls to fillTexture allow glyph caches to build command lists and defer command submission until it is known that all pending glyphs have been processed. Change-Id: Ifac645f83e9cfb6f246be9c8e79e5aa3bde5758d Reviewed-by: Andy Nichols <andy.nichols@theqtcompany.com>
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/painting/qtextureglyphcache.cpp2
-rw-r--r--src/gui/painting/qtextureglyphcache_p.h2
2 files changed, 4 insertions, 0 deletions
diff --git a/src/gui/painting/qtextureglyphcache.cpp b/src/gui/painting/qtextureglyphcache.cpp
index d2c3eceeef..bfc8551a9b 100644
--- a/src/gui/painting/qtextureglyphcache.cpp
+++ b/src/gui/painting/qtextureglyphcache.cpp
@@ -247,6 +247,7 @@ void QTextureGlyphCache::fillInPendingGlyphs()
resizeCache(qNextPowerOfTwo(requiredWidth - 1), qNextPowerOfTwo(requiredHeight - 1));
}
+ beginFillTexture();
{
QHash<GlyphAndSubPixelPosition, Coord>::iterator iter = m_pendingGlyphs.begin();
while (iter != m_pendingGlyphs.end()) {
@@ -256,6 +257,7 @@ void QTextureGlyphCache::fillInPendingGlyphs()
++iter;
}
}
+ endFillTexture();
m_pendingGlyphs.clear();
}
diff --git a/src/gui/painting/qtextureglyphcache_p.h b/src/gui/painting/qtextureglyphcache_p.h
index 14271ccc65..a8efb4abb1 100644
--- a/src/gui/painting/qtextureglyphcache_p.h
+++ b/src/gui/painting/qtextureglyphcache_p.h
@@ -117,7 +117,9 @@ public:
virtual void resizeTextureData(int width, int height) = 0;
virtual int glyphPadding() const { return 0; }
+ virtual void beginFillTexture() { }
virtual void fillTexture(const Coord &coord, glyph_t glyph, QFixed subPixelPosition) = 0;
+ virtual void endFillTexture() { }
inline void createCache(int width, int height) {
m_w = width;