Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Unified Diff: include/core/SkFlattenableBuffers.h

Issue 26928002: SkData need not be a Flattenable, since it does not need subclass/factories (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/core/SkData.h ('k') | src/core/SkData.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkFlattenableBuffers.h
diff --git a/include/core/SkFlattenableBuffers.h b/include/core/SkFlattenableBuffers.h
index 03c03f3877e6f8e3f508d29e371d5c7ebd91624e..dd51e08967e8c9ea1552d5aa66daad770cdb7d2c 100644
--- a/include/core/SkFlattenableBuffers.h
+++ b/include/core/SkFlattenableBuffers.h
@@ -10,6 +10,7 @@
#define SkFlattenableBuffers_DEFINED
#include "SkColor.h"
+#include "SkData.h"
#include "SkPaint.h"
#include "SkPoint.h"
@@ -97,6 +98,13 @@ public:
this->readPoint(&point);
return point;
}
+
+ SkData* readByteArrayAsData() {
mtklein 2013/10/10 21:32:03 Mentioning byte array here seems weird to me. rea
sugoi 2013/10/11 12:03:35 Shouldn't it be pure virtual and defined in SkOrde
sugoi 2013/10/11 12:03:35 +1
reed1 2013/10/14 13:32:14 I think there is no value-added to storing SkData
+ size_t len = this->getArrayCount();
+ void* buffer = sk_malloc_throw(len);
+ (void)this->readByteArray(buffer);
+ return SkData::NewFromMalloc(buffer, len);
+ }
template <typename T> T* readFlattenableT() {
return static_cast<T*>(this->readFlattenable());
@@ -165,6 +173,10 @@ public:
bool persistTypeface() const { return (fFlags & kCrossProcess_Flag) != 0; }
+ void writeDataAsByteArray(SkData* data) {
+ this->writeByteArray(data->data(), data->size());
+ }
+
protected:
// A helper function so that each subclass does not have to be a friend of SkFlattenable
void flattenObject(SkFlattenable* obj, SkFlattenableWriteBuffer& buffer);
« no previous file with comments | « include/core/SkData.h ('k') | src/core/SkData.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698