| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2008 The Android Open Source Project | 3 * Copyright 2008 The Android Open Source Project |
| 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 | 9 |
| 10 #ifndef SkReader32_DEFINED | 10 #ifndef SkReader32_DEFINED |
| 11 #define SkReader32_DEFINED | 11 #define SkReader32_DEFINED |
| 12 | 12 |
| 13 #include "SkMatrix.h" | 13 #include "SkMatrix.h" |
| 14 #include "SkPath.h" | 14 #include "SkPath.h" |
| 15 #include "SkRegion.h" | 15 #include "SkRegion.h" |
| 16 #include "SkRRect.h" | 16 #include "SkRRect.h" |
| 17 #include "SkScalar.h" | 17 #include "SkScalar.h" |
| 18 #include "SkPatch.h" | |
| 19 | 18 |
| 20 class SkString; | 19 class SkString; |
| 21 | 20 |
| 22 class SkReader32 : SkNoncopyable { | 21 class SkReader32 : SkNoncopyable { |
| 23 public: | 22 public: |
| 24 SkReader32() : fCurr(NULL), fStop(NULL), fBase(NULL) {} | 23 SkReader32() : fCurr(NULL), fStop(NULL), fBase(NULL) {} |
| 25 SkReader32(const void* data, size_t size) { | 24 SkReader32(const void* data, size_t size) { |
| 26 this->setMemory(data, size); | 25 this->setMemory(data, size); |
| 27 } | 26 } |
| 28 | 27 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 SkASSERT(ptr_align_4(fCurr)); | 98 SkASSERT(ptr_align_4(fCurr)); |
| 100 memcpy(dst, fCurr, size); | 99 memcpy(dst, fCurr, size); |
| 101 fCurr += SkAlign4(size); | 100 fCurr += SkAlign4(size); |
| 102 SkASSERT(fCurr <= fStop); | 101 SkASSERT(fCurr <= fStop); |
| 103 } | 102 } |
| 104 | 103 |
| 105 uint8_t readU8() { return (uint8_t)this->readInt(); } | 104 uint8_t readU8() { return (uint8_t)this->readInt(); } |
| 106 uint16_t readU16() { return (uint16_t)this->readInt(); } | 105 uint16_t readU16() { return (uint16_t)this->readInt(); } |
| 107 int32_t readS32() { return this->readInt(); } | 106 int32_t readS32() { return this->readInt(); } |
| 108 uint32_t readU32() { return this->readInt(); } | 107 uint32_t readU32() { return this->readInt(); } |
| 109 | |
| 110 bool readPatch(SkPatch* patch) { | |
| 111 return this->readObjectFromMemory(patch); | |
| 112 } | |
| 113 | 108 |
| 114 bool readPath(SkPath* path) { | 109 bool readPath(SkPath* path) { |
| 115 return this->readObjectFromMemory(path); | 110 return this->readObjectFromMemory(path); |
| 116 } | 111 } |
| 117 | 112 |
| 118 bool readMatrix(SkMatrix* matrix) { | 113 bool readMatrix(SkMatrix* matrix) { |
| 119 return this->readObjectFromMemory(matrix); | 114 return this->readObjectFromMemory(matrix); |
| 120 } | 115 } |
| 121 | 116 |
| 122 bool readRRect(SkRRect* rrect) { | 117 bool readRRect(SkRRect* rrect) { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 const char* fBase; // beginning of buffer | 151 const char* fBase; // beginning of buffer |
| 157 | 152 |
| 158 #ifdef SK_DEBUG | 153 #ifdef SK_DEBUG |
| 159 static bool ptr_align_4(const void* ptr) { | 154 static bool ptr_align_4(const void* ptr) { |
| 160 return (((const char*)ptr - (const char*)NULL) & 3) == 0; | 155 return (((const char*)ptr - (const char*)NULL) & 3) == 0; |
| 161 } | 156 } |
| 162 #endif | 157 #endif |
| 163 }; | 158 }; |
| 164 | 159 |
| 165 #endif | 160 #endif |
| OLD | NEW |