bidi cache
authorSungyeon Woo <s.woo@samsung.com>
Mon, 1 Apr 2013 06:16:12 +0000 (15:16 +0900)
committerSungyeon Woo <s.woo@samsung.com>
Mon, 1 Apr 2013 06:16:12 +0000 (15:16 +0900)
Change-Id: I9f96b35ebb33807ef575612e88280584797d61c2
Signed-off-by: Sungyeon Woo <s.woo@samsung.com>
src/graphics/FGrp_Font.cpp
src/graphics/FGrp_FontFt2.cpp

index a3d241c..83824f3 100644 (file)
@@ -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;
index c66a1d5..821647d 100644 (file)
@@ -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;