Index: src/core/SkAnnotation.cpp |
diff --git a/src/core/SkAnnotation.cpp b/src/core/SkAnnotation.cpp |
index 52fa9b79f208d3ff1cde4f8e839e2411bcdd2b75..1230cb4de81003f0de90accbc8517706d685374d 100644 |
--- a/src/core/SkAnnotation.cpp |
+++ b/src/core/SkAnnotation.cpp |
@@ -6,37 +6,40 @@ |
*/ |
#include "SkAnnotation.h" |
-#include "SkDataSet.h" |
+#include "SkData.h" |
#include "SkFlattenableBuffers.h" |
#include "SkPoint.h" |
#include "SkStream.h" |
-SkAnnotation::SkAnnotation(SkDataSet* data, uint32_t flags) { |
- if (NULL == data) { |
- data = SkDataSet::NewEmpty(); |
+SkAnnotation::SkAnnotation(const char key[], SkData* value, uint32_t flags) |
+ : fKey(key) { |
+ if (NULL == value) { |
+ value = SkData::NewEmpty(); |
} else { |
- data->ref(); |
+ value->ref(); |
} |
- fDataSet = data; |
+ fData = value; |
fFlags = flags; |
} |
SkAnnotation::~SkAnnotation() { |
- fDataSet->unref(); |
+ fData->unref(); |
} |
-SkData* SkAnnotation::find(const char name[]) const { |
- return fDataSet->find(name); |
+SkData* SkAnnotation::find(const char key[]) const { |
+ return fKey.equals(key) ? fData : NULL; |
} |
SkAnnotation::SkAnnotation(SkFlattenableReadBuffer& buffer) : INHERITED(buffer) { |
fFlags = buffer.readUInt(); |
- fDataSet = buffer.readFlattenableT<SkDataSet>(); |
+ buffer.readString(&fKey); |
+ fData = buffer.readByteArrayAsData(); |
} |
void SkAnnotation::flatten(SkFlattenableWriteBuffer& buffer) const { |
buffer.writeUInt(fFlags); |
- buffer.writeFlattenable(fDataSet); |
+ buffer.writeString(fKey.c_str()); |
+ buffer.writeDataAsByteArray(fData); |
} |
const char* SkAnnotationKeys::URL_Key() { |
@@ -56,8 +59,7 @@ const char* SkAnnotationKeys::Link_Named_Dest_Key() { |
#include "SkCanvas.h" |
static void annotate_paint(SkPaint& paint, const char* key, SkData* value) { |
- SkAutoTUnref<SkDataSet> dataset(SkNEW_ARGS(SkDataSet, (key, value))); |
- SkAnnotation* ann = SkNEW_ARGS(SkAnnotation, (dataset, |
+ SkAnnotation* ann = SkNEW_ARGS(SkAnnotation, (key, value, |
SkAnnotation::kNoDraw_Flag)); |
paint.setAnnotation(ann)->unref(); |