From cfce7af3f662cbb9569bfa2b095977009b8f77b1 Mon Sep 17 00:00:00 2001 From: Sungyeon Woo Date: Mon, 1 Apr 2013 15:16:12 +0900 Subject: [PATCH] bidi cache Change-Id: I9f96b35ebb33807ef575612e88280584797d61c2 Signed-off-by: Sungyeon Woo --- src/graphics/FGrp_Font.cpp | 4 ++-- src/graphics/FGrp_FontFt2.cpp | 19 ++++++++++++++++++- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/graphics/FGrp_Font.cpp b/src/graphics/FGrp_Font.cpp index a3d241c..83824f3 100644 --- a/src/graphics/FGrp_Font.cpp +++ b/src/graphics/FGrp_Font.cpp @@ -1452,7 +1452,7 @@ _Font::__GetTextExtentList(_TextBidiPropertyWithReorder& bidiProperty, _Util::Ac _IFont::Glyph* pGlyph; pEnum->GetCurrent(pGlyph); - delete pGlyph; + pBaseFont->UnloadGlyph(&pGlyph); } delete pEnum; @@ -1800,7 +1800,7 @@ _Font::__DrawText(_Canvas& canvas, const Point& point, const Tizen::Base::String _IFont::Glyph* pGlyph; pEnum->GetCurrent(pGlyph); - delete pGlyph; + pBaseFont->UnloadGlyph(&pGlyph); } delete pEnum; diff --git a/src/graphics/FGrp_FontFt2.cpp b/src/graphics/FGrp_FontFt2.cpp index c66a1d5..821647d 100644 --- a/src/graphics/FGrp_FontFt2.cpp +++ b/src/graphics/FGrp_FontFt2.cpp @@ -903,6 +903,16 @@ _FontFt2::GetGlyphList(const _Util::String& reorderedText, Tizen::Base::Collecti FT_UInt glyph_index = auxInfo.glyphIndex; + _IFont::Glyph *pFontGlyphData; + + bool rtn = FindCache(glyph_index, __fontAttrib.size, __fontAttrib.style, &pFontGlyphData); + + if (rtn) + { + out.Add(pFontGlyphData); + continue; + } + if (isSynthetic) { error = FT_Load_Glyph(pFace, glyph_index, FT_LOAD_DEFAULT | FT_LOAD_NO_BITMAP); @@ -950,7 +960,7 @@ _FontFt2::GetGlyphList(const _Util::String& reorderedText, Tizen::Base::Collecti image.bytesPerLine = pSlot->bitmap.pitch; image.pBitmap = pSlot->bitmap.buffer; - _IFont::Glyph *pFontGlyphData = (_IFont::Glyph*) new (std::nothrow) char[sizeof(_IFont::Glyph) + (image.bytesPerLine * image.height)]; + pFontGlyphData = (_IFont::Glyph*) new (std::nothrow) char[sizeof(_IFont::Glyph) + (image.bytesPerLine * image.height)]; if (pFontGlyphData == null) { @@ -978,6 +988,13 @@ _FontFt2::GetGlyphList(const _Util::String& reorderedText, Tizen::Base::Collecti memcpy(pFontGlyphData->image.pBitmap, image.pBitmap, image.bytesPerLine * image.height); out.Add(pFontGlyphData); + + AddCache(glyph_index, __fontAttrib.size, __fontAttrib.style, pFontGlyphData); + + if (pFontGlyphData != null) + { + pFontGlyphData->hasOwnerShip = 1; + } } return true; -- 2.7.4