OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef SkValidatingReadBuffer_DEFINED | 8 #ifndef SkValidatingReadBuffer_DEFINED |
9 #define SkValidatingReadBuffer_DEFINED | 9 #define SkValidatingReadBuffer_DEFINED |
10 | 10 |
(...skipping 26 matching lines...) Expand all Loading... |
37 int32_t read32() override; | 37 int32_t read32() override; |
38 | 38 |
39 // peek | 39 // peek |
40 uint8_t peekByte() override; | 40 uint8_t peekByte() override; |
41 | 41 |
42 // strings -- the caller is responsible for freeing the string contents | 42 // strings -- the caller is responsible for freeing the string contents |
43 void readString(SkString* string) override; | 43 void readString(SkString* string) override; |
44 | 44 |
45 // common data structures | 45 // common data structures |
46 SkFlattenable* readFlattenable(SkFlattenable::Type type) override; | 46 SkFlattenable* readFlattenable(SkFlattenable::Type type) override; |
| 47 void readColor4f(SkColor4f* color) override; |
47 void readPoint(SkPoint* point) override; | 48 void readPoint(SkPoint* point) override; |
48 void readMatrix(SkMatrix* matrix) override; | 49 void readMatrix(SkMatrix* matrix) override; |
49 void readIRect(SkIRect* rect) override; | 50 void readIRect(SkIRect* rect) override; |
50 void readRect(SkRect* rect) override; | 51 void readRect(SkRect* rect) override; |
51 void readRRect(SkRRect* rrect) override; | 52 void readRRect(SkRRect* rrect) override; |
52 void readRegion(SkRegion* region) override; | 53 void readRegion(SkRegion* region) override; |
53 void readPath(SkPath* path) override; | 54 void readPath(SkPath* path) override; |
54 | 55 |
55 // binary data and arrays | 56 // binary data and arrays |
56 bool readByteArray(void* value, size_t size) override; | 57 bool readByteArray(void* value, size_t size) override; |
57 bool readColorArray(SkColor* colors, size_t size) override; | 58 bool readColorArray(SkColor* colors, size_t size) override; |
| 59 bool readColor4fArray(SkColor4f* colors, size_t size) override; |
58 bool readIntArray(int32_t* values, size_t size) override; | 60 bool readIntArray(int32_t* values, size_t size) override; |
59 bool readPointArray(SkPoint* points, size_t size) override; | 61 bool readPointArray(SkPoint* points, size_t size) override; |
60 bool readScalarArray(SkScalar* values, size_t size) override; | 62 bool readScalarArray(SkScalar* values, size_t size) override; |
61 | 63 |
62 // helpers to get info about arrays and binary data | 64 // helpers to get info about arrays and binary data |
63 uint32_t getArrayCount() override; | 65 uint32_t getArrayCount() override; |
64 | 66 |
65 bool validate(bool isValid) override; | 67 bool validate(bool isValid) override; |
66 bool isValid() const override; | 68 bool isValid() const override; |
67 | 69 |
68 bool validateAvailable(size_t size) override; | 70 bool validateAvailable(size_t size) override; |
69 | 71 |
70 private: | 72 private: |
71 bool readArray(void* value, size_t size, size_t elementSize); | 73 bool readArray(void* value, size_t size, size_t elementSize); |
72 | 74 |
73 void setMemory(const void* data, size_t size); | 75 void setMemory(const void* data, size_t size); |
74 | 76 |
75 static bool IsPtrAlign4(const void* ptr) { | 77 static bool IsPtrAlign4(const void* ptr) { |
76 return SkIsAlign4((uintptr_t)ptr); | 78 return SkIsAlign4((uintptr_t)ptr); |
77 } | 79 } |
78 | 80 |
79 bool fError; | 81 bool fError; |
80 | 82 |
81 typedef SkReadBuffer INHERITED; | 83 typedef SkReadBuffer INHERITED; |
82 }; | 84 }; |
83 | 85 |
84 #endif // SkValidatingReadBuffer_DEFINED | 86 #endif // SkValidatingReadBuffer_DEFINED |
OLD | NEW |