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 void readString(SkString* string) override; | 37 void readString(SkString* string) override; |
38 void* readEncodedString(size_t* length, SkPaint::TextEncoding encoding) over ride; | 38 void* readEncodedString(size_t* length, SkPaint::TextEncoding encoding) over ride; |
39 | 39 |
40 // common data structures | 40 // common data structures |
41 SkFlattenable* readFlattenable(SkFlattenable::Type type) override; | 41 SkFlattenable* readFlattenable(SkFlattenable::Type type) override; |
42 void skipFlattenable() override; | 42 void skipFlattenable() override; |
43 void readPoint(SkPoint* point) override; | 43 void readPoint(SkPoint* point) override; |
44 void readMatrix(SkMatrix* matrix) override; | 44 void readMatrix(SkMatrix* matrix) override; |
45 void readIRect(SkIRect* rect) override; | 45 void readIRect(SkIRect* rect) override; |
46 void readRect(SkRect* rect) override; | 46 void readRect(SkRect* rect) override; |
47 void readRRect(SkRRect* rrect) override; | |
47 void readRegion(SkRegion* region) override; | 48 void readRegion(SkRegion* region) override; |
48 void readPath(SkPath* path) override; | 49 void readPath(SkPath* path) override; |
49 | 50 |
50 // binary data and arrays | 51 // binary data and arrays |
51 bool readByteArray(void* value, size_t size) override; | 52 bool readByteArray(void* value, size_t size) override; |
52 bool readColorArray(SkColor* colors, size_t size) override; | 53 bool readColorArray(SkColor* colors, size_t size) override; |
53 bool readIntArray(int32_t* values, size_t size) override; | 54 bool readIntArray(int32_t* values, size_t size) override; |
54 bool readPointArray(SkPoint* points, size_t size) override; | 55 bool readPointArray(SkPoint* points, size_t size) override; |
55 bool readScalarArray(SkScalar* values, size_t size) override; | 56 bool readScalarArray(SkScalar* values, size_t size) override; |
56 | 57 |
57 // helpers to get info about arrays and binary data | 58 // helpers to get info about arrays and binary data |
58 uint32_t getArrayCount() override; | 59 uint32_t getArrayCount() override; |
59 | 60 |
60 // TODO: Implement this (securely) when needed | 61 // TODO: Implement this (securely) when needed |
61 SkTypeface* readTypeface() override; | 62 SkTypeface* readTypeface() override; |
62 | 63 |
63 bool validate(bool isValid) override; | 64 bool validate(bool isValid) override; |
64 bool isValid() const override; | 65 bool isValid() const override; |
66 void makeInvalid() override { fError = true; } | |
reed1
2016/04/19 12:54:11
needed?
robertphillips
2016/04/19 14:34:42
Done.
| |
65 | 67 |
66 bool validateAvailable(size_t size) override; | 68 bool validateAvailable(size_t size) override; |
67 | 69 |
68 private: | 70 private: |
69 bool readArray(void* value, size_t size, size_t elementSize); | 71 bool readArray(void* value, size_t size, size_t elementSize); |
70 | 72 |
71 void setMemory(const void* data, size_t size); | 73 void setMemory(const void* data, size_t size); |
72 | 74 |
73 static bool IsPtrAlign4(const void* ptr) { | 75 static bool IsPtrAlign4(const void* ptr) { |
74 return SkIsAlign4((uintptr_t)ptr); | 76 return SkIsAlign4((uintptr_t)ptr); |
75 } | 77 } |
76 | 78 |
77 bool fError; | 79 bool fError; |
78 | 80 |
79 typedef SkReadBuffer INHERITED; | 81 typedef SkReadBuffer INHERITED; |
80 }; | 82 }; |
81 | 83 |
82 #endif // SkValidatingReadBuffer_DEFINED | 84 #endif // SkValidatingReadBuffer_DEFINED |
OLD | NEW |