mirror of https://github.com/axmolengine/axmol.git
Remove last internal use of deprecated `FileUtils::getFileData()`.
This commit is contained in:
parent
43a94c0693
commit
3f8910d80c
|
@ -576,6 +576,16 @@ void CCFreeTypeFont::compute_bbox(std::vector<TGlyph>& glyphs, FT_BBox *abbox)
|
||||||
*abbox = bbox;
|
*abbox = bbox;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
inline unsigned char* takeBuffer(Data& data, ssize_t* size = nullptr) {
|
||||||
|
auto buffer = data.getBytes();
|
||||||
|
if (size)
|
||||||
|
*size = data.getSize();
|
||||||
|
data.fastSet(nullptr, 0);
|
||||||
|
return buffer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
unsigned char* CCFreeTypeFont::loadFont(const char *pFontName, ssize_t *size)
|
unsigned char* CCFreeTypeFont::loadFont(const char *pFontName, ssize_t *size)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -611,7 +621,9 @@ unsigned char* CCFreeTypeFont::loadFont(const char *pFontName, ssize_t *size)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return FileUtils::getInstance()->getFileData(fullpath.c_str(), "rb", size);
|
Data d;
|
||||||
|
FileUtils::getInstance()->getContents(fullpath, &d);
|
||||||
|
return takeBuffer(d, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned char* CCFreeTypeFont::loadSystemFont(const char *pFontName, ssize_t *size)
|
unsigned char* CCFreeTypeFont::loadSystemFont(const char *pFontName, ssize_t *size)
|
||||||
|
@ -750,4 +762,3 @@ unsigned char* CCFreeTypeFont::loadSystemFont(const char *pFontName, ssize_t *si
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_CC_END
|
NS_CC_END
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue