Index: include/core/SkFlattenableBuffers.h |
diff --git a/include/core/SkFlattenableBuffers.h b/include/core/SkFlattenableBuffers.h |
index 6e44550be561c6f267ade5f6655557a03d2edb3f..ce19b12bbdac7a4627bac1c71a369c51a46e9d17 100644 |
--- a/include/core/SkFlattenableBuffers.h |
+++ b/include/core/SkFlattenableBuffers.h |
@@ -99,11 +99,20 @@ public: |
virtual void readPath(SkPath* path) = 0; |
// binary data and arrays |
- virtual uint32_t readByteArray(void* value) = 0; |
- virtual uint32_t readColorArray(SkColor* colors) = 0; |
- virtual uint32_t readIntArray(int32_t* values) = 0; |
- virtual uint32_t readPointArray(SkPoint* points) = 0; |
- virtual uint32_t readScalarArray(SkScalar* values) = 0; |
+ |
+ /** |
+ * In the following read.*Array(...) functions, the size parameter specifies the allocation |
+ * size (in bytes) of the pointer parameter. In the case where isValidating() is true, then |
+ * if the pointer parameter's size does not match the size to be read, the pointer |
+ * parameter's memory will then stay uninitialized, the function will return 0 and an error |
+ * flag will be set internally (see SkValidatingReadBuffer). |
+ * If isValidating() is false, then the size parameter is ignored. |
reed1
2013/10/29 19:39:43
What gets return if there is *not* an error? (in b
sugoi1
2013/10/29 20:04:50
It returns the size (or amount) of memory actually
|
+ */ |
+ virtual uint32_t readByteArray(void* value, uint32_t size) = 0; |
reed1
2013/10/29 19:39:43
shouldn't these be size_t instead of uint32_t, jus
reed1
2013/10/29 19:44:09
What is the state of the buffer if we get an error
sugoi1
2013/10/29 20:04:50
Will add in the description. Thanks.
sugoi1
2013/10/29 20:04:50
Sure, but I'll just mention that, currently, the u
|
+ virtual uint32_t readColorArray(SkColor* colors, uint32_t size) = 0; |
+ virtual uint32_t readIntArray(int32_t* values, uint32_t size) = 0; |
+ virtual uint32_t readPointArray(SkPoint* points, uint32_t size) = 0; |
+ virtual uint32_t readScalarArray(SkScalar* values, uint32_t size) = 0; |
/** This helper peeks into the buffer and reports back the length of the next array in |
* the buffer but does not change the state of the buffer. |
@@ -127,7 +136,7 @@ public: |
SkData* readByteArrayAsData() { |
size_t len = this->getArrayCount(); |
void* buffer = sk_malloc_throw(len); |
- (void)this->readByteArray(buffer); |
+ (void)this->readByteArray(buffer, len); |
return SkData::NewFromMalloc(buffer, len); |
} |