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

Side by Side Diff: src/core/SkOrderedReadBuffer.h

Issue 37803002: Adding size parameter to read array functions (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Fixed comments 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
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 SkOrderedReadBuffer_DEFINED 9 #ifndef SkOrderedReadBuffer_DEFINED
10 #define SkOrderedReadBuffer_DEFINED 10 #define SkOrderedReadBuffer_DEFINED
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 // common data structures 54 // common data structures
55 virtual SkFlattenable* readFlattenable(SkFlattenable::Type) SK_OVERRIDE; 55 virtual SkFlattenable* readFlattenable(SkFlattenable::Type) SK_OVERRIDE;
56 virtual void readPoint(SkPoint* point) SK_OVERRIDE; 56 virtual void readPoint(SkPoint* point) SK_OVERRIDE;
57 virtual void readMatrix(SkMatrix* matrix) SK_OVERRIDE; 57 virtual void readMatrix(SkMatrix* matrix) SK_OVERRIDE;
58 virtual void readIRect(SkIRect* rect) SK_OVERRIDE; 58 virtual void readIRect(SkIRect* rect) SK_OVERRIDE;
59 virtual void readRect(SkRect* rect) SK_OVERRIDE; 59 virtual void readRect(SkRect* rect) SK_OVERRIDE;
60 virtual void readRegion(SkRegion* region) SK_OVERRIDE; 60 virtual void readRegion(SkRegion* region) SK_OVERRIDE;
61 virtual void readPath(SkPath* path) SK_OVERRIDE; 61 virtual void readPath(SkPath* path) SK_OVERRIDE;
62 62
63 // binary data and arrays 63 // binary data and arrays
64 virtual uint32_t readByteArray(void* value) SK_OVERRIDE; 64 virtual bool readByteArray(void* value, size_t size) SK_OVERRIDE;
65 virtual uint32_t readColorArray(SkColor* colors) SK_OVERRIDE; 65 virtual bool readColorArray(SkColor* colors, size_t size) SK_OVERRIDE;
66 virtual uint32_t readIntArray(int32_t* values) SK_OVERRIDE; 66 virtual bool readIntArray(int32_t* values, size_t size) SK_OVERRIDE;
67 virtual uint32_t readPointArray(SkPoint* points) SK_OVERRIDE; 67 virtual bool readPointArray(SkPoint* points, size_t size) SK_OVERRIDE;
68 virtual uint32_t readScalarArray(SkScalar* values) SK_OVERRIDE; 68 virtual bool readScalarArray(SkScalar* values, size_t size) SK_OVERRIDE;
69 69
70 // helpers to get info about arrays and binary data 70 // helpers to get info about arrays and binary data
71 virtual uint32_t getArrayCount() SK_OVERRIDE; 71 virtual uint32_t getArrayCount() SK_OVERRIDE;
72 72
73 virtual void readBitmap(SkBitmap* bitmap) SK_OVERRIDE; 73 virtual void readBitmap(SkBitmap* bitmap) SK_OVERRIDE;
74 virtual SkTypeface* readTypeface() SK_OVERRIDE; 74 virtual SkTypeface* readTypeface() SK_OVERRIDE;
75 75
76 void setBitmapStorage(SkBitmapHeapReader* bitmapStorage) { 76 void setBitmapStorage(SkBitmapHeapReader* bitmapStorage) {
77 SkRefCnt_SafeAssign(fBitmapStorage, bitmapStorage); 77 SkRefCnt_SafeAssign(fBitmapStorage, bitmapStorage);
78 } 78 }
(...skipping 27 matching lines...) Expand all
106 /** 106 /**
107 * Provide a function to decode an SkBitmap from encoded data. Only used if the writer 107 * Provide a function to decode an SkBitmap from encoded data. Only used if the writer
108 * encoded the SkBitmap. If the proper decoder cannot be used, a red bitmap with the 108 * encoded the SkBitmap. If the proper decoder cannot be used, a red bitmap with the
109 * appropriate size will be used. 109 * appropriate size will be used.
110 */ 110 */
111 void setBitmapDecoder(SkPicture::InstallPixelRefProc bitmapDecoder) { 111 void setBitmapDecoder(SkPicture::InstallPixelRefProc bitmapDecoder) {
112 fBitmapDecoder = bitmapDecoder; 112 fBitmapDecoder = bitmapDecoder;
113 } 113 }
114 114
115 private: 115 private:
116 bool readArray(void* value, size_t size, size_t elementSize);
117
116 SkReader32 fReader; 118 SkReader32 fReader;
117 void* fMemoryPtr; 119 void* fMemoryPtr;
118 120
119 SkBitmapHeapReader* fBitmapStorage; 121 SkBitmapHeapReader* fBitmapStorage;
120 SkTypeface** fTFArray; 122 SkTypeface** fTFArray;
121 int fTFCount; 123 int fTFCount;
122 124
123 SkTDArray<SkFlattenable::Factory>* fFactoryTDArray; 125 SkTDArray<SkFlattenable::Factory>* fFactoryTDArray;
124 SkFlattenable::Factory* fFactoryArray; 126 SkFlattenable::Factory* fFactoryArray;
125 int fFactoryCount; 127 int fFactoryCount;
126 128
127 SkPicture::InstallPixelRefProc fBitmapDecoder; 129 SkPicture::InstallPixelRefProc fBitmapDecoder;
128 130
129 #ifdef DEBUG_NON_DETERMINISTIC_ASSERT 131 #ifdef DEBUG_NON_DETERMINISTIC_ASSERT
130 // Debugging counter to keep track of how many bitmaps we 132 // Debugging counter to keep track of how many bitmaps we
131 // have decoded. 133 // have decoded.
132 int fDecodedBitmapIndex; 134 int fDecodedBitmapIndex;
133 #endif // DEBUG_NON_DETERMINISTIC_ASSERT 135 #endif // DEBUG_NON_DETERMINISTIC_ASSERT
134 136
135 typedef SkFlattenableReadBuffer INHERITED; 137 typedef SkFlattenableReadBuffer INHERITED;
136 }; 138 };
137 139
138 #endif // SkOrderedReadBuffer_DEFINED 140 #endif // SkOrderedReadBuffer_DEFINED
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698