Commit 507027de authored by suzuki toshiya's avatar suzuki toshiya Committed by Albert Astals Cid

[cpp] introduce a boolean font_info_cache_initialized, to distinguish an...

[cpp] introduce a boolean font_info_cache_initialized, to distinguish an initialized-but-empty cache from the uninitialized cache
Co-authored-by: Adam Reichold's avatarAdam Reichold <adam.reichold@t-online.de>
parent 2cd79c73
......@@ -49,6 +49,7 @@ public:
{ return const_cast<poppler::page *>(p)->d; }
std::vector<font_info> font_info_cache;
bool font_info_cache_initialized;
size_t init_font_info_cache();
};
......
......@@ -48,6 +48,7 @@ page_private::page_private(document_private *_doc, int _index)
, page(doc->doc->getCatalog()->getPage(_index + 1))
, index(_index)
, transition(nullptr)
, font_info_cache_initialized(false)
{
}
......@@ -58,7 +59,7 @@ page_private::~page_private()
size_t page_private::init_font_info_cache()
{
if (font_info_cache.size() > 0)
if (font_info_cache_initialized)
return font_info_cache.size();
poppler::font_iterator it(index, doc);
......@@ -67,6 +68,7 @@ size_t page_private::init_font_info_cache()
font_info_cache = it.next();
}
font_info_cache_initialized = true;
return font_info_cache.size();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment