forked from firka/flutter
Update minikin/sample code to use new GetTable
We changed the signature of the MinikinFont::GetTable method. This patch updates the sample code, and fixes the build. Change-Id: I1977be868bf7636986fc802915f3dd54c418a73a
This commit is contained in:
@@ -47,16 +47,20 @@ void MinikinFontSkia::GetBounds(MinikinRect* bounds, uint32_t glyph_id,
|
||||
bounds->mBottom = skBounds.fBottom;
|
||||
}
|
||||
|
||||
bool MinikinFontSkia::GetTable(uint32_t tag, uint8_t *buf, size_t *size) {
|
||||
if (buf == NULL) {
|
||||
const size_t tableSize = mTypeface->getTableSize(tag);
|
||||
*size = tableSize;
|
||||
return tableSize != 0;
|
||||
} else {
|
||||
const size_t actualSize = mTypeface->getTableData(tag, 0, *size, buf);
|
||||
*size = actualSize;
|
||||
return actualSize != 0;
|
||||
const void* MinikinFontSkia::GetTable(uint32_t tag, size_t* size, MinikinDestroyFunc* destroy) {
|
||||
// we don't have a buffer to the font data, copy to own buffer
|
||||
const size_t tableSize = mTypeface->getTableSize(tag);
|
||||
*size = tableSize;
|
||||
if (tableSize == 0) {
|
||||
return nullptr;
|
||||
}
|
||||
void* buf = malloc(tableSize);
|
||||
if (buf == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
mTypeface->getTableData(tag, 0, tableSize, buf);
|
||||
*destroy = free;
|
||||
return buf;
|
||||
}
|
||||
|
||||
SkTypeface *MinikinFontSkia::GetSkTypeface() {
|
||||
|
||||
@@ -12,8 +12,7 @@ public:
|
||||
void GetBounds(MinikinRect* bounds, uint32_t glyph_id,
|
||||
const MinikinPaint& paint) const;
|
||||
|
||||
// If buf is NULL, just update size
|
||||
bool GetTable(uint32_t tag, uint8_t *buf, size_t *size);
|
||||
const void* GetTable(uint32_t tag, size_t* size, MinikinDestroyFunc* destroy);
|
||||
|
||||
int32_t GetUniqueId() const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user