Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 /* | |
| 2 * Copyright 2013 Google Inc. | |
| 3 * | |
| 4 * Use of this source code is governed by a BSD-style license that can be | |
| 5 * found in the LICENSE file. | |
| 6 */ | |
| 7 | |
| 8 #ifndef SkValidatingReadBuffer_DEFINED | |
| 9 #define SkValidatingReadBuffer_DEFINED | |
| 10 | |
| 11 #include "SkRefCnt.h" | |
| 12 #include "SkBitmapHeap.h" | |
| 13 #include "SkFlattenableBuffers.h" | |
| 14 #include "SkPath.h" | |
| 15 #include "SkPicture.h" | |
| 16 #include "SkReader32.h" | |
| 17 | |
| 18 class SkBitmap; | |
| 19 | |
| 20 #if defined(SK_DEBUG) && defined(SK_BUILD_FOR_MAC) | |
|
mtklein
2013/10/07 19:29:56
Is this left over from an old version? Any idea w
sugoi1
2013/10/08 20:23:10
Yeah, that's from SkOrderedReadBuffer.h. I removed
| |
| 21 #define DEBUG_NON_DETERMINISTIC_ASSERT | |
| 22 #endif | |
| 23 | |
| 24 class SkValidatingReadBuffer : public SkFlattenableReadBuffer { | |
| 25 public: | |
| 26 SkValidatingReadBuffer(); | |
| 27 SkValidatingReadBuffer(const void* data, size_t size); | |
| 28 SkValidatingReadBuffer(SkStream* stream); | |
| 29 virtual ~SkValidatingReadBuffer(); | |
| 30 | |
| 31 const void* skip(size_t size); | |
| 32 | |
| 33 // primitives | |
| 34 virtual bool readBool() SK_OVERRIDE; | |
| 35 virtual SkColor readColor() SK_OVERRIDE; | |
| 36 virtual SkFixed readFixed() SK_OVERRIDE; | |
| 37 virtual int32_t readInt() SK_OVERRIDE; | |
| 38 virtual SkScalar readScalar() SK_OVERRIDE; | |
| 39 virtual uint32_t readUInt() SK_OVERRIDE; | |
| 40 virtual int32_t read32() SK_OVERRIDE; | |
| 41 | |
| 42 // strings -- the caller is responsible for freeing the string contents | |
| 43 virtual void readString(SkString* string) SK_OVERRIDE; | |
| 44 virtual void* readEncodedString(size_t* length, SkPaint::TextEncoding encodi ng) SK_OVERRIDE; | |
| 45 | |
| 46 // common data structures | |
| 47 virtual SkFlattenable* readFlattenable( | |
| 48 const char* name = SkFlattenable::GetName()) SK_OVERRIDE; | |
| 49 virtual void readPoint(SkPoint* point) SK_OVERRIDE; | |
| 50 virtual void readMatrix(SkMatrix* matrix) SK_OVERRIDE; | |
| 51 virtual void readIRect(SkIRect* rect) SK_OVERRIDE; | |
| 52 virtual void readRect(SkRect* rect) SK_OVERRIDE; | |
| 53 virtual void readRegion(SkRegion* region) SK_OVERRIDE; | |
| 54 virtual void readPath(SkPath* path) SK_OVERRIDE; | |
| 55 | |
| 56 // binary data and arrays | |
| 57 virtual uint32_t readByteArray(void* value) SK_OVERRIDE; | |
| 58 virtual uint32_t readColorArray(SkColor* colors) SK_OVERRIDE; | |
| 59 virtual uint32_t readIntArray(int32_t* values) SK_OVERRIDE; | |
| 60 virtual uint32_t readPointArray(SkPoint* points) SK_OVERRIDE; | |
| 61 virtual uint32_t readScalarArray(SkScalar* values) SK_OVERRIDE; | |
| 62 | |
| 63 // helpers to get info about arrays and binary data | |
| 64 virtual uint32_t getArrayCount() SK_OVERRIDE; | |
| 65 | |
| 66 virtual void readBitmap(SkBitmap* bitmap) SK_OVERRIDE; | |
| 67 // TODO: Implement this (with securely) when needed | |
|
mtklein
2013/10/07 19:29:56
with securely?
sugoi1
2013/10/08 20:23:10
That's what happens when I'm thinking of 2 sentenc
| |
| 68 virtual SkTypeface* readTypeface() SK_OVERRIDE { return NULL; } | |
| 69 | |
| 70 private: | |
| 71 void setMemory(const void* data, size_t size); | |
| 72 | |
| 73 static bool IsPtrAlign4(const void* ptr) { | |
| 74 return SkIsAlign4((uintptr_t)ptr); | |
| 75 } | |
| 76 | |
| 77 SkReader32 fReader; | |
| 78 void* fMemoryPtr; | |
| 79 | |
| 80 typedef SkFlattenableReadBuffer INHERITED; | |
| 81 }; | |
| 82 | |
| 83 #endif // SkValidatingReadBuffer_DEFINED | |
| OLD | NEW |