summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2022-09-24 08:30:25 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-09-24 12:29:40 +0200
commitab1d9893bad53ae6e1400c502b648e980ca876b5 (patch)
treec56cc6dd2121cba1ddd07ab57fbad6254cf4f054 /vcl
parentaf6f379ec6cd4e2c09094604005a238250a0dbf4 (diff)
flattenTrueTypeTableGeneric
Change-Id: I197b2f45943513af7a514c92b5896bda659adf9d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140536 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/fontsubset/ttcr.cxx32
-rw-r--r--vcl/source/fontsubset/ttcr.hxx4
2 files changed, 12 insertions, 24 deletions
diff --git a/vcl/source/fontsubset/ttcr.cxx b/vcl/source/fontsubset/ttcr.cxx
index e68f50d1f03b..8c2bcaecc21a 100644
--- a/vcl/source/fontsubset/ttcr.cxx
+++ b/vcl/source/fontsubset/ttcr.cxx
@@ -289,12 +289,6 @@ struct table_cmap {
std::unique_ptr<CmapSubTable[]> s; /* sorted array of sub-tables */
};
-struct tdata_generic {
- sal_uInt32 tag;
- sal_uInt32 nbytes;
- std::unique_ptr<sal_uInt8[]> ptr;
-};
-
struct tdata_loca {
sal_uInt32 nbytes; /* number of bytes in loca table */
std::unique_ptr<sal_uInt8[]> ptr; /* pointer to the data */
@@ -358,11 +352,9 @@ TrueTypeTablePost::~TrueTypeTablePost()
int TrueTypeTableGeneric::GetRawData(TableEntry* te)
{
- assert(this->m_generic != nullptr);
-
- te->data = this->m_generic->ptr.get();
- te->length = this->m_generic->nbytes;
- te->tag = this->m_generic->tag;
+ te->data = this->m_ptr.get();
+ te->length = this->m_nbytes;
+ te->tag = this->m_tag;
return TTCR_OK;
}
@@ -664,27 +656,23 @@ int TrueTypeTablePost::GetRawData(TableEntry* te)
TrueTypeTableGeneric::TrueTypeTableGeneric(sal_uInt32 tag,
sal_uInt32 nbytes,
const sal_uInt8* ptr)
- : TrueTypeTable(0),
- m_generic(new tdata_generic)
+ : TrueTypeTable(tag),
+ m_nbytes(nbytes)
{
- m_generic->nbytes = nbytes;
- m_generic->tag = tag;
if (nbytes) {
- m_generic->ptr = ttmalloc(nbytes);
- memcpy(m_generic->ptr.get(), ptr, nbytes);
+ m_ptr = ttmalloc(nbytes);
+ memcpy(m_ptr.get(), ptr, nbytes);
}
}
TrueTypeTableGeneric::TrueTypeTableGeneric(sal_uInt32 tag,
sal_uInt32 nbytes,
std::unique_ptr<sal_uInt8[]> ptr)
- : TrueTypeTable(0),
- m_generic(new tdata_generic)
+ : TrueTypeTable(tag),
+ m_nbytes(nbytes)
{
- m_generic->nbytes = nbytes;
- m_generic->tag = tag;
if (nbytes) {
- m_generic->ptr = std::move(ptr);
+ m_ptr = std::move(ptr);
}
}
diff --git a/vcl/source/fontsubset/ttcr.hxx b/vcl/source/fontsubset/ttcr.hxx
index 2dc10dc31cd2..d5cf47d97308 100644
--- a/vcl/source/fontsubset/ttcr.hxx
+++ b/vcl/source/fontsubset/ttcr.hxx
@@ -32,7 +32,6 @@ namespace vcl
class TrueTypeTable;
struct tdata_loca;
struct table_cmap;
-struct tdata_generic;
struct TableEntry;
@@ -135,7 +134,8 @@ struct TableEntry;
virtual ~TrueTypeTableGeneric() override;
virtual int GetRawData(TableEntry*) override;
private:
- std::unique_ptr<tdata_generic> m_generic;
+ sal_uInt32 m_nbytes;
+ std::unique_ptr<sal_uInt8[]> m_ptr;
};
/**