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

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

Issue 240013005: read/write function_ptrs as just void*, and not as 'array of bytes' (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | include/core/SkWriteBuffer.h » ('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 2011 Google Inc. 3 * Copyright 2011 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 SkReadBuffer_DEFINED 9 #ifndef SkReadBuffer_DEFINED
10 #define SkReadBuffer_DEFINED 10 #define SkReadBuffer_DEFINED
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 bool isScalarFloat() const { return SkToBool(fFlags & kScalarIsFloat_Flag); } 66 bool isScalarFloat() const { return SkToBool(fFlags & kScalarIsFloat_Flag); }
67 bool isPtr64Bit() const { return SkToBool(fFlags & kPtrIs64Bit_Flag); } 67 bool isPtr64Bit() const { return SkToBool(fFlags & kPtrIs64Bit_Flag); }
68 bool isValidating() const { return SkToBool(fFlags & kValidation_Flag); } 68 bool isValidating() const { return SkToBool(fFlags & kValidation_Flag); }
69 69
70 SkReader32* getReader32() { return &fReader; } 70 SkReader32* getReader32() { return &fReader; }
71 71
72 uint32_t size() { return fReader.size(); } 72 uint32_t size() { return fReader.size(); }
73 uint32_t offset() { return fReader.offset(); } 73 uint32_t offset() { return fReader.offset(); }
74 bool eof() { return fReader.eof(); } 74 bool eof() { return fReader.eof(); }
75 const void* skip(size_t size) { return fReader.skip(size); } 75 const void* skip(size_t size) { return fReader.skip(size); }
76 void* readFunctionPtr() { return fReader.readPtr(); }
bungeman-skia 2014/04/16 16:51:36 So, I think this was 'incorrect' before, so this c
76 77
77 // primitives 78 // primitives
78 virtual bool readBool(); 79 virtual bool readBool();
79 virtual SkColor readColor(); 80 virtual SkColor readColor();
80 virtual SkFixed readFixed(); 81 virtual SkFixed readFixed();
81 virtual int32_t readInt(); 82 virtual int32_t readInt();
82 virtual SkScalar readScalar(); 83 virtual SkScalar readScalar();
83 virtual uint32_t readUInt(); 84 virtual uint32_t readUInt();
84 virtual int32_t read32(); 85 virtual int32_t read32();
85 86
86 void* readFunctionPtr() {
87 void* ptr;
88 this->readByteArray(&ptr, sizeof(ptr));
89 return ptr;
90 }
91
92 // strings -- the caller is responsible for freeing the string contents 87 // strings -- the caller is responsible for freeing the string contents
93 virtual void readString(SkString* string); 88 virtual void readString(SkString* string);
94 virtual void* readEncodedString(size_t* length, SkPaint::TextEncoding encodi ng); 89 virtual void* readEncodedString(size_t* length, SkPaint::TextEncoding encodi ng);
95 90
96 // common data structures 91 // common data structures
97 virtual void readPoint(SkPoint* point); 92 virtual void readPoint(SkPoint* point);
98 SkPoint readPoint() { SkPoint p; this->readPoint(&p); return p; } 93 SkPoint readPoint() { SkPoint p; this->readPoint(&p); return p; }
99 virtual void readMatrix(SkMatrix* matrix); 94 virtual void readMatrix(SkMatrix* matrix);
100 virtual void readIRect(SkIRect* rect); 95 virtual void readIRect(SkIRect* rect);
101 virtual void readRect(SkRect* rect); 96 virtual void readRect(SkRect* rect);
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 SkPicture::InstallPixelRefProc fBitmapDecoder; 203 SkPicture::InstallPixelRefProc fBitmapDecoder;
209 204
210 #ifdef DEBUG_NON_DETERMINISTIC_ASSERT 205 #ifdef DEBUG_NON_DETERMINISTIC_ASSERT
211 // Debugging counter to keep track of how many bitmaps we 206 // Debugging counter to keep track of how many bitmaps we
212 // have decoded. 207 // have decoded.
213 int fDecodedBitmapIndex; 208 int fDecodedBitmapIndex;
214 #endif // DEBUG_NON_DETERMINISTIC_ASSERT 209 #endif // DEBUG_NON_DETERMINISTIC_ASSERT
215 }; 210 };
216 211
217 #endif // SkReadBuffer_DEFINED 212 #endif // SkReadBuffer_DEFINED
OLDNEW
« no previous file with comments | « no previous file | include/core/SkWriteBuffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698