From f4c0903eee3845941d76935ea94d91bb42470602 Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Mon, 7 Dec 2015 19:41:30 -1000 Subject: [PATCH] Pixel factor switching fix --- specter/include/Specter/FontCache.hpp | 1 + specter/include/Specter/ViewResources.hpp | 1 - specter/lib/FontCache.cpp | 4 ++++ specter/lib/ViewResources.cpp | 2 -- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/specter/include/Specter/FontCache.hpp b/specter/include/Specter/FontCache.hpp index 44db21570..859f6a4ba 100644 --- a/specter/include/Specter/FontCache.hpp +++ b/specter/include/Specter/FontCache.hpp @@ -59,6 +59,7 @@ class FontAtlas friend class FontCache; FT_Face m_face; boo::ITextureSA* m_tex = nullptr; + boo::IGraphicsDataToken m_token; uint32_t m_dpi; FT_Fixed m_ftXscale; FT_UShort m_ftXPpem; diff --git a/specter/include/Specter/ViewResources.hpp b/specter/include/Specter/ViewResources.hpp index 08a87784b..95e5d60be 100644 --- a/specter/include/Specter/ViewResources.hpp +++ b/specter/include/Specter/ViewResources.hpp @@ -57,7 +57,6 @@ public: SplitView::Resources m_splitRes; Toolbar::Resources m_toolbarRes; Button::Resources m_buttonRes; - boo::IGraphicsDataToken m_fontData; boo::IGraphicsDataToken m_resData; Specter::FontTag m_mainFont; diff --git a/specter/lib/FontCache.cpp b/specter/lib/FontCache.cpp index b37a32c92..3b5e86201 100644 --- a/specter/lib/FontCache.cpp +++ b/specter/lib/FontCache.cpp @@ -377,6 +377,7 @@ FontAtlas::FontAtlas(boo::IGraphicsDataFactory* gf, FT_Face face, uint32_t dpi, m_tex = gf->newStaticArrayTexture(TEXMAP_DIM, finalHeight, fullTexmapLayers + 1, boo::TextureFormat::RGBA8, texmap.get(), bufSz); + m_token = gf->commit(); } else { @@ -457,6 +458,7 @@ FontAtlas::FontAtlas(boo::IGraphicsDataFactory* gf, FT_Face face, uint32_t dpi, m_tex = gf->newStaticArrayTexture(TEXMAP_DIM, finalHeight, fullTexmapLayers + 1, boo::TextureFormat::I8, texmap.get(), bufSz); + m_token = gf->commit(); } buildKernTable(face); @@ -576,6 +578,7 @@ FontAtlas::FontAtlas(boo::IGraphicsDataFactory* gf, FT_Face face, uint32_t dpi, m_tex = gf->newStaticArrayTexture(TEXMAP_DIM, finalHeight, fullTexmapLayers + 1, boo::TextureFormat::RGBA8, texmap.get(), bufSz); + m_token = gf->commit(); } else { @@ -656,6 +659,7 @@ FontAtlas::FontAtlas(boo::IGraphicsDataFactory* gf, FT_Face face, uint32_t dpi, m_tex = gf->newStaticArrayTexture(TEXMAP_DIM, finalHeight, fullTexmapLayers + 1, boo::TextureFormat::I8, texmap.get(), bufSz); + m_token = gf->commit(); } buildKernTable(face); diff --git a/specter/lib/ViewResources.cpp b/specter/lib/ViewResources.cpp index 153cb795c..95477d00a 100644 --- a/specter/lib/ViewResources.cpp +++ b/specter/lib/ViewResources.cpp @@ -17,7 +17,6 @@ void ViewResources::init(boo::IGraphicsDataFactory* factory, FontCache* fcache, m_heading14 = fcache->prepMainFont(factory, LatinAndJapaneseCharFilter, false, 14.f, dpi); m_heading18 = fcache->prepMainFont(factory, LatinAndJapaneseCharFilter, false, 18.f, dpi); m_curveFont = fcache->prepCurvesFont(factory, AllCharFilter, false, 8.f, dpi); - m_fontData = factory->commit(); switch (factory->platform()) { case boo::IGraphicsDataFactory::Platform::OGL: @@ -49,7 +48,6 @@ void ViewResources::resetPixelFactor(float pf) m_heading14 = m_fcache->prepMainFont(m_factory, LatinAndJapaneseCharFilter, false, 14.f, dpi); m_heading18 = m_fcache->prepMainFont(m_factory, LatinAndJapaneseCharFilter, false, 18.f, dpi); m_curveFont = m_fcache->prepCurvesFont(m_factory, AllCharFilter, false, 8.f, dpi); - m_fontData = m_factory->commit(); m_fcache->closeBuiltinFonts(); }