From 9f54811d3140684bbfad918a6c3476ec2c32516b Mon Sep 17 00:00:00 2001 From: rachytski Date: Thu, 25 Aug 2011 17:50:54 +0300 Subject: [PATCH] moved log2vis into GlyphCache to make it multithreaded. --- yg/glyph_cache.cpp | 14 ++++++++++++++ yg/glyph_cache.hpp | 3 +++ yg/text_element.cpp | 13 +------------ yg/text_element.hpp | 2 -- 4 files changed, 18 insertions(+), 14 deletions(-) diff --git a/yg/glyph_cache.cpp b/yg/glyph_cache.cpp index c274b38de1..d6a35915ab 100644 --- a/yg/glyph_cache.cpp +++ b/yg/glyph_cache.cpp @@ -4,6 +4,9 @@ #include "internal/opengl.hpp" #include "ft2_debug.hpp" +#include "../3party/fribidi/lib/fribidi-deprecated.h" +#include "../3party/fribidi/lib/fribidi.h" + #include "../coding/lodepng_io.hpp" #include "../base/logging.hpp" @@ -294,4 +297,15 @@ namespace yg return len; } + strings::UniString GlyphCache::log2vis(strings::UniString const & str) + { +// FriBidiEnv e; +/* size_t const count = str.size(); + strings::UniString res(count); + FriBidiParType dir = FRIBIDI_PAR_LTR; // requested base direction + fribidi_log2vis(&str[0], count, &dir, &res[0], 0, 0, 0); + return res;*/ + return str; + } + } diff --git a/yg/glyph_cache.hpp b/yg/glyph_cache.hpp index e0692057fc..f209f4f2a6 100644 --- a/yg/glyph_cache.hpp +++ b/yg/glyph_cache.hpp @@ -93,5 +93,8 @@ namespace yg GlyphMetrics const getGlyphMetrics(GlyphKey const & key); double getTextLength(double fontSize, string const & text); + + strings::UniString log2vis(strings::UniString const & str); + }; } diff --git a/yg/text_element.cpp b/yg/text_element.cpp index 2485f75233..359757c0b7 100644 --- a/yg/text_element.cpp +++ b/yg/text_element.cpp @@ -4,21 +4,10 @@ #include "overlay_renderer.hpp" #include "resource_style.hpp" -#include "../3party/fribidi/lib/fribidi-deprecated.h" - #include "../base/logging.hpp" namespace yg { - strings::UniString TextElement::log2vis(strings::UniString const & str) - { - size_t const count = str.size(); - strings::UniString res(count); - FriBidiParType dir = FRIBIDI_PAR_LTR; // requested base direction - fribidi_log2vis(&str[0], count, &dir, &res[0], 0, 0, 0); - return res; - } - TextElement::TextElement(Params const & p) : OverlayElement(p), m_fontDesc(p.m_fontDesc), @@ -27,7 +16,7 @@ namespace yg m_glyphCache(p.m_glyphCache) { if (m_log2vis) - m_visText = log2vis(m_logText); + m_visText = m_glyphCache->log2vis(m_logText); else m_visText = m_logText; } diff --git a/yg/text_element.hpp b/yg/text_element.hpp index 5283b02887..d8001dbe51 100644 --- a/yg/text_element.hpp +++ b/yg/text_element.hpp @@ -33,8 +33,6 @@ namespace yg bool m_log2vis; GlyphCache * m_glyphCache; - strings::UniString log2vis(strings::UniString const & str); - public: struct Params : OverlayElement::Params