diff options
author | Liang Qi <liang.qi@theqtcompany.com> | 2016-01-19 10:00:53 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@theqtcompany.com> | 2016-01-19 10:03:01 +0100 |
commit | 8f569c740a91b98365dcdaee2444038ce4957a76 (patch) | |
tree | 749302d8bf9023ae51873a74dc641fd005744502 /src/gui/text | |
parent | 465e93aa95d99f799300867b07f81bdd5162c9f1 (diff) | |
parent | e8ad49d6cba6521f20b1b08bf65d92fc81c158e4 (diff) |
Merge remote-tracking branch 'origin/5.5' into 5.6
Conflicts:
config.tests/common/atomic64/atomic64.cpp
configure
src/3rdparty/forkfd/forkfd.c
src/corelib/io/forkfd_qt.cpp
src/widgets/kernel/qwidgetwindow.cpp
tests/auto/corelib/statemachine/qstatemachine/tst_qstatemachine.cpp
tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp
tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp
tools/configure/configureapp.cpp
Change-Id: Ic6168d82e51a0ef1862c3a63bee6722e8f138414
Diffstat (limited to 'src/gui/text')
-rw-r--r-- | src/gui/text/qfont.cpp | 12 | ||||
-rw-r--r-- | src/gui/text/qfont_p.h | 1 | ||||
-rw-r--r-- | src/gui/text/qfontengine_ft.cpp | 2 | ||||
-rw-r--r-- | src/gui/text/qfontengine_p.h | 2 |
4 files changed, 14 insertions, 3 deletions
diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp index 947c538234..bc9da5b564 100644 --- a/src/gui/text/qfont.cpp +++ b/src/gui/text/qfont.cpp @@ -2796,6 +2796,10 @@ void QFontCache::insertEngineData(const QFontDef &def, QFontEngineData *engineDa Q_ASSERT(!engineDataCache.contains(def)); engineData->ref.ref(); + // Decrease now rather than waiting + if (total_cost > min_cost * 2) + decreaseCache(); + engineDataCache.insert(def, engineData); increaseCost(sizeof(QFontEngineData)); } @@ -2833,8 +2837,10 @@ void QFontCache::insertEngine(const Key &key, QFontEngine *engine, bool insertMu key.def.pixelSize, key.def.weight, key.def.style, key.def.fixedPitch); } #endif - engine->ref.ref(); + // Decrease now rather than waiting + if (total_cost > min_cost * 2) + decreaseCache(); Engine data(engine); data.timestamp = ++current_timestamp; @@ -2895,7 +2901,11 @@ void QFontCache::timerEvent(QTimerEvent *) return; } + decreaseCache(); +} +void QFontCache::decreaseCache() +{ // go through the cache and count up everything in use uint in_use_cost = 0; diff --git a/src/gui/text/qfont_p.h b/src/gui/text/qfont_p.h index 25b5ef0b0e..ff9265ca19 100644 --- a/src/gui/text/qfont_p.h +++ b/src/gui/text/qfont_p.h @@ -276,6 +276,7 @@ private: void increaseCost(uint cost); void decreaseCost(uint cost); void timerEvent(QTimerEvent *event) Q_DECL_OVERRIDE; + void decreaseCache(); static const uint min_cost; uint total_cost, max_cost; diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp index 89bc72ae4f..4dd2ee35b1 100644 --- a/src/gui/text/qfontengine_ft.cpp +++ b/src/gui/text/qfontengine_ft.cpp @@ -646,7 +646,7 @@ QFontEngineFT::QFontEngineFT(const QFontDef &fd) matrix.yy = 0x10000; matrix.xy = 0; matrix.yx = 0; - cache_cost = 100; + cache_cost = 100 * 1024; kerning_pairs_loaded = false; transform = false; embolden = false; diff --git a/src/gui/text/qfontengine_p.h b/src/gui/text/qfontengine_p.h index 5282a4033e..be9eaa5020 100644 --- a/src/gui/text/qfontengine_p.h +++ b/src/gui/text/qfontengine_p.h @@ -278,7 +278,7 @@ public: qt_get_font_table_func_t get_font_table; } faceData; - uint cache_cost; // amount of mem used in kb by the font + uint cache_cost; // amount of mem used in bytes by the font uint fsType : 16; bool symbol; struct KernPair { |