| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 SkReadBuffer_DEFINED | 8 #ifndef SkReadBuffer_DEFINED |
| 9 #define SkReadBuffer_DEFINED | 9 #define SkReadBuffer_DEFINED |
| 10 | 10 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 #endif | 32 #endif |
| 33 | 33 |
| 34 class SkReadBuffer { | 34 class SkReadBuffer { |
| 35 public: | 35 public: |
| 36 SkReadBuffer(); | 36 SkReadBuffer(); |
| 37 SkReadBuffer(const void* data, size_t size); | 37 SkReadBuffer(const void* data, size_t size); |
| 38 SkReadBuffer(SkStream* stream); | 38 SkReadBuffer(SkStream* stream); |
| 39 virtual ~SkReadBuffer(); | 39 virtual ~SkReadBuffer(); |
| 40 | 40 |
| 41 enum Version { | 41 enum Version { |
| 42 /* |
| 42 kFilterLevelIsEnum_Version = 23, | 43 kFilterLevelIsEnum_Version = 23, |
| 43 kGradientFlippedFlag_Version = 24, | 44 kGradientFlippedFlag_Version = 24, |
| 44 kDashWritesPhaseIntervals_Version = 25, | 45 kDashWritesPhaseIntervals_Version = 25, |
| 45 kColorShaderNoBool_Version = 26, | 46 kColorShaderNoBool_Version = 26, |
| 46 kNoUnitMappers_Version = 27, | 47 kNoUnitMappers_Version = 27, |
| 47 kNoMoreBitmapFlatten_Version = 28, | 48 kNoMoreBitmapFlatten_Version = 28, |
| 48 kSimplifyLocalMatrix_Version = 30, | 49 kSimplifyLocalMatrix_Version = 30, |
| 49 kImageFilterUniqueID_Version = 31, | 50 kImageFilterUniqueID_Version = 31, |
| 50 kRemoveAndroidPaintOpts_Version = 32, | 51 kRemoveAndroidPaintOpts_Version = 32, |
| 51 kFlattenCreateProc_Version = 33, | 52 kFlattenCreateProc_Version = 33, |
| 53 */ |
| 52 kRemoveColorTableAlpha_Version = 36, | 54 kRemoveColorTableAlpha_Version = 36, |
| 53 kDropShadowMode_Version = 37, | 55 kDropShadowMode_Version = 37, |
| 54 }; | 56 }; |
| 55 | 57 |
| 56 /** | 58 /** |
| 57 * Returns true IFF the version is older than the specified version. | 59 * Returns true IFF the version is older than the specified version. |
| 58 */ | 60 */ |
| 59 bool isVersionLT(Version targetVersion) const { | 61 bool isVersionLT(Version targetVersion) const { |
| 60 SkASSERT(targetVersion > 0); | 62 SkASSERT(targetVersion > 0); |
| 61 return fVersion > 0 && fVersion < targetVersion; | 63 return fVersion > 0 && fVersion < targetVersion; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 virtual void readString(SkString* string); | 107 virtual void readString(SkString* string); |
| 106 virtual void* readEncodedString(size_t* length, SkPaint::TextEncoding encodi
ng); | 108 virtual void* readEncodedString(size_t* length, SkPaint::TextEncoding encodi
ng); |
| 107 | 109 |
| 108 // common data structures | 110 // common data structures |
| 109 virtual void readPoint(SkPoint* point); | 111 virtual void readPoint(SkPoint* point); |
| 110 SkPoint readPoint() { SkPoint p; this->readPoint(&p); return p; } | 112 SkPoint readPoint() { SkPoint p; this->readPoint(&p); return p; } |
| 111 virtual void readMatrix(SkMatrix* matrix); | 113 virtual void readMatrix(SkMatrix* matrix); |
| 112 virtual void readIRect(SkIRect* rect); | 114 virtual void readIRect(SkIRect* rect); |
| 113 virtual void readRect(SkRect* rect); | 115 virtual void readRect(SkRect* rect); |
| 114 virtual void readRegion(SkRegion* region); | 116 virtual void readRegion(SkRegion* region); |
| 115 | 117 |
| 116 virtual void readPath(SkPath* path); | 118 virtual void readPath(SkPath* path); |
| 117 void readPaint(SkPaint* paint) { paint->unflatten(*this); } | 119 void readPaint(SkPaint* paint) { paint->unflatten(*this); } |
| 118 | 120 |
| 119 virtual SkFlattenable* readFlattenable(SkFlattenable::Type); | 121 virtual SkFlattenable* readFlattenable(SkFlattenable::Type); |
| 120 template <typename T> T* readFlattenable() { | 122 template <typename T> T* readFlattenable() { |
| 121 return (T*) this->readFlattenable(T::GetFlattenableType()); | 123 return (T*) this->readFlattenable(T::GetFlattenableType()); |
| 122 } | 124 } |
| 123 SkColorFilter* readColorFilter() { return this->readFlattenable<SkColorFilte
r>(); } | 125 SkColorFilter* readColorFilter() { return this->readFlattenable<SkColorFilte
r>(); } |
| 124 SkDrawLooper* readDrawLooper() { return this->readFlattenable<SkDrawLooper
>(); } | 126 SkDrawLooper* readDrawLooper() { return this->readFlattenable<SkDrawLooper
>(); } |
| 125 SkImageFilter* readImageFilter() { return this->readFlattenable<SkImageFilte
r>(); } | 127 SkImageFilter* readImageFilter() { return this->readFlattenable<SkImageFilte
r>(); } |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 SkPicture::InstallPixelRefProc fBitmapDecoder; | 231 SkPicture::InstallPixelRefProc fBitmapDecoder; |
| 230 | 232 |
| 231 #ifdef DEBUG_NON_DETERMINISTIC_ASSERT | 233 #ifdef DEBUG_NON_DETERMINISTIC_ASSERT |
| 232 // Debugging counter to keep track of how many bitmaps we | 234 // Debugging counter to keep track of how many bitmaps we |
| 233 // have decoded. | 235 // have decoded. |
| 234 int fDecodedBitmapIndex; | 236 int fDecodedBitmapIndex; |
| 235 #endif // DEBUG_NON_DETERMINISTIC_ASSERT | 237 #endif // DEBUG_NON_DETERMINISTIC_ASSERT |
| 236 }; | 238 }; |
| 237 | 239 |
| 238 #endif // SkReadBuffer_DEFINED | 240 #endif // SkReadBuffer_DEFINED |
| OLD | NEW |