merge with changes for GPU backend
git-svn-id: http://skia.googlecode.com/svn/trunk@637 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/views/SkMetaData.cpp b/src/views/SkMetaData.cpp
index c366bd3..c871efb 100644
--- a/src/views/SkMetaData.cpp
+++ b/src/views/SkMetaData.cpp
@@ -89,6 +89,10 @@
(void)this->set(name, &value, sizeof(bool), kBool_Type, 1);
}
+void SkMetaData::setData(const char name[], const void* data, size_t byteCount) {
+ (void)this->set(name, data, sizeof(char), kData_Type, byteCount);
+}
+
void* SkMetaData::set(const char name[], const void* data, size_t dataSize, Type type, int count)
{
SkASSERT(name);
@@ -129,6 +133,9 @@
case kBool_Type:
rec->fData.fBool = *(const bool*)rec->data();
break;
+ case kData_Type:
+ rec->fData.fPtr = rec->data();
+ break;
default:
SkASSERT(!"bad type");
break;
@@ -213,6 +220,18 @@
return false;
}
+const void* SkMetaData::findData(const char name[], size_t* length) const {
+ const Rec* rec = this->find(name, kData_Type);
+ if (rec) {
+ SkASSERT(rec->fDataLen == sizeof(char));
+ if (length) {
+ *length = rec->fDataCount;
+ }
+ return rec->data();
+ }
+ return NULL;
+}
+
const SkMetaData::Rec* SkMetaData::find(const char name[], Type type) const
{
const Rec* rec = fRec;
@@ -272,6 +291,10 @@
return this->remove(name, kBool_Type);
}
+bool SkMetaData::removeData(const char name[]) {
+ return this->remove(name, kData_Type);
+}
+
///////////////////////////////////////////////////////////////////////////////////
SkMetaData::Iter::Iter(const SkMetaData& metadata)