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 |
11 #include "SkRefCnt.h" | 11 #include "SkRefCnt.h" |
12 #include "SkBitmapHeap.h" | 12 #include "SkBitmapHeap.h" |
13 #include "SkReadBuffer.h" | 13 #include "SkReadBuffer.h" |
14 #include "SkWriteBuffer.h" | 14 #include "SkWriteBuffer.h" |
15 #include "SkPath.h" | 15 #include "SkPath.h" |
16 #include "SkPicture.h" | 16 #include "SkPicture.h" |
17 #include "SkReader32.h" | 17 #include "SkReader32.h" |
18 | 18 |
19 class SkBitmap; | 19 class SkBitmap; |
20 | 20 |
21 class SkValidatingReadBuffer : public SkReadBuffer { | 21 class SkValidatingReadBuffer : public SkReadBuffer { |
22 public: | 22 public: |
23 SkValidatingReadBuffer(const void* data, size_t size); | 23 SkValidatingReadBuffer(const void* data, size_t size); |
24 virtual ~SkValidatingReadBuffer(); | 24 ~SkValidatingReadBuffer() override; |
| 25 |
| 26 SkReadBuffer* clone(const void* data, size_t size) const override { |
| 27 return new SkValidatingReadBuffer(data, size); |
| 28 } |
25 | 29 |
26 const void* skip(size_t size) override; | 30 const void* skip(size_t size) override; |
27 | 31 |
28 // primitives | 32 // primitives |
29 bool readBool() override; | 33 bool readBool() override; |
30 SkColor readColor() override; | 34 SkColor readColor() override; |
31 int32_t readInt() override; | 35 int32_t readInt() override; |
32 SkScalar readScalar() override; | 36 SkScalar readScalar() override; |
33 uint32_t readUInt() override; | 37 uint32_t readUInt() override; |
34 int32_t read32() override; | 38 int32_t read32() override; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 static bool IsPtrAlign4(const void* ptr) { | 78 static bool IsPtrAlign4(const void* ptr) { |
75 return SkIsAlign4((uintptr_t)ptr); | 79 return SkIsAlign4((uintptr_t)ptr); |
76 } | 80 } |
77 | 81 |
78 bool fError; | 82 bool fError; |
79 | 83 |
80 typedef SkReadBuffer INHERITED; | 84 typedef SkReadBuffer INHERITED; |
81 }; | 85 }; |
82 | 86 |
83 #endif // SkValidatingReadBuffer_DEFINED | 87 #endif // SkValidatingReadBuffer_DEFINED |
OLD | NEW |