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

Side by Side Diff: include/core/SkFlattenableBuffers.h

Issue 37803002: Adding size parameter to read array functions (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/core/SkColorTable.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2012 Google Inc. 3 * Copyright 2012 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #ifndef SkFlattenableBuffers_DEFINED 9 #ifndef SkFlattenableBuffers_DEFINED
10 #define SkFlattenableBuffers_DEFINED 10 #define SkFlattenableBuffers_DEFINED
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 92
93 // common data structures 93 // common data structures
94 virtual void readPoint(SkPoint* point) = 0; 94 virtual void readPoint(SkPoint* point) = 0;
95 virtual void readMatrix(SkMatrix* matrix) = 0; 95 virtual void readMatrix(SkMatrix* matrix) = 0;
96 virtual void readIRect(SkIRect* rect) = 0; 96 virtual void readIRect(SkIRect* rect) = 0;
97 virtual void readRect(SkRect* rect) = 0; 97 virtual void readRect(SkRect* rect) = 0;
98 virtual void readRegion(SkRegion* region) = 0; 98 virtual void readRegion(SkRegion* region) = 0;
99 virtual void readPath(SkPath* path) = 0; 99 virtual void readPath(SkPath* path) = 0;
100 100
101 // binary data and arrays 101 // binary data and arrays
102 virtual uint32_t readByteArray(void* value) = 0; 102 virtual uint32_t readByteArray(void* value, uint32_t size) = 0;
reed1 2013/10/23 21:10:10 Lets add some dox here: /** * The size parameter
sugoi1 2013/10/24 11:45:46 Done.
103 virtual uint32_t readColorArray(SkColor* colors) = 0; 103 virtual uint32_t readColorArray(SkColor* colors, uint32_t size) = 0;
104 virtual uint32_t readIntArray(int32_t* values) = 0; 104 virtual uint32_t readIntArray(int32_t* values, uint32_t size) = 0;
105 virtual uint32_t readPointArray(SkPoint* points) = 0; 105 virtual uint32_t readPointArray(SkPoint* points, uint32_t size) = 0;
106 virtual uint32_t readScalarArray(SkScalar* values) = 0; 106 virtual uint32_t readScalarArray(SkScalar* values, uint32_t size) = 0;
107 107
108 /** This helper peeks into the buffer and reports back the length of the nex t array in 108 /** This helper peeks into the buffer and reports back the length of the nex t array in
109 * the buffer but does not change the state of the buffer. 109 * the buffer but does not change the state of the buffer.
110 */ 110 */
111 virtual uint32_t getArrayCount() = 0; 111 virtual uint32_t getArrayCount() = 0;
112 112
113 // helper functions 113 // helper functions
114 virtual void* readFunctionPtr(); 114 virtual void* readFunctionPtr();
115 virtual void readPaint(SkPaint* paint); 115 virtual void readPaint(SkPaint* paint);
116 116
117 virtual void readBitmap(SkBitmap* bitmap) = 0; 117 virtual void readBitmap(SkBitmap* bitmap) = 0;
118 virtual SkTypeface* readTypeface() = 0; 118 virtual SkTypeface* readTypeface() = 0;
119 119
120 // helper function for classes with const SkPoint members 120 // helper function for classes with const SkPoint members
121 SkPoint readPoint() { 121 SkPoint readPoint() {
122 SkPoint point; 122 SkPoint point;
123 this->readPoint(&point); 123 this->readPoint(&point);
124 return point; 124 return point;
125 } 125 }
126 126
127 SkData* readByteArrayAsData() { 127 SkData* readByteArrayAsData() {
128 size_t len = this->getArrayCount(); 128 size_t len = this->getArrayCount();
129 void* buffer = sk_malloc_throw(len); 129 void* buffer = sk_malloc_throw(len);
130 (void)this->readByteArray(buffer); 130 (void)this->readByteArray(buffer, len);
131 return SkData::NewFromMalloc(buffer, len); 131 return SkData::NewFromMalloc(buffer, len);
132 } 132 }
133 133
134 virtual void validate(bool isValid) {} 134 virtual void validate(bool isValid) {}
135 135
136 private: 136 private:
137 template <typename T> T* readFlattenableT(); 137 template <typename T> T* readFlattenableT();
138 uint32_t fFlags; 138 uint32_t fFlags;
139 }; 139 };
140 140
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 } 211 }
212 212
213 protected: 213 protected:
214 // A helper function so that each subclass does not have to be a friend of S kFlattenable 214 // A helper function so that each subclass does not have to be a friend of S kFlattenable
215 void flattenObject(const SkFlattenable* obj, SkFlattenableWriteBuffer& buffe r); 215 void flattenObject(const SkFlattenable* obj, SkFlattenableWriteBuffer& buffe r);
216 216
217 uint32_t fFlags; 217 uint32_t fFlags;
218 }; 218 };
219 219
220 #endif 220 #endif
OLDNEW
« no previous file with comments | « no previous file | src/core/SkColorTable.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698