add SkDataTable::NewEmpty()

git-svn-id: http://skia.googlecode.com/svn/trunk@8780 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
reed@google.com 2013-04-19 20:22:39 +00:00
parent 8c5c7a905b
commit 3cceb9f400
2 changed files with 13 additions and 0 deletions

View File

@ -64,6 +64,8 @@ public:
return str;
}
static SkDataTable* NewEmpty();
/**
* Return a new DataTable that contains a copy of the data stored in each
* "array".

View File

@ -53,6 +53,17 @@ void SkDataTable::flatten(SkFlattenableWriteBuffer& buffer) const {
buffer.writeFlattenable(fData);
}
///////////////////////////////////////////////////////////////////////////////
SkDataTable* SkDataTable::NewEmpty() {
static SkDataTable* gEmpty;
if (NULL == gEmpty) {
gEmpty = SkNEW_ARGS(SkDataTable, (0, SkData::NewEmpty()));
}
gEmpty->ref();
return gEmpty;
}
SkDataTable* SkDataTable::NewCopyArrays(const void * const * ptrs,
const size_t sizes[], int count) {
if (count < 0) {