Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(156)

Side by Side Diff: include/core/SkReadBuffer.h

Issue 291913004: formalize named picture versions (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/core/SkPaint.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1
2 /* 1 /*
3 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
4 * 3 *
5 * 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
6 * found in the LICENSE file. 5 * found in the LICENSE file.
7 */ 6 */
8 7
9 #ifndef SkReadBuffer_DEFINED 8 #ifndef SkReadBuffer_DEFINED
10 #define SkReadBuffer_DEFINED 9 #define SkReadBuffer_DEFINED
11 10
(...skipping 22 matching lines...) Expand all
34 #define DEBUG_NON_DETERMINISTIC_ASSERT 33 #define DEBUG_NON_DETERMINISTIC_ASSERT
35 #endif 34 #endif
36 35
37 class SkReadBuffer { 36 class SkReadBuffer {
38 public: 37 public:
39 SkReadBuffer(); 38 SkReadBuffer();
40 SkReadBuffer(const void* data, size_t size); 39 SkReadBuffer(const void* data, size_t size);
41 SkReadBuffer(SkStream* stream); 40 SkReadBuffer(SkStream* stream);
42 virtual ~SkReadBuffer(); 41 virtual ~SkReadBuffer();
43 42
44 /** Return the version of the serialized picture this buffer holds, or 0 if unset. */ 43 enum Version {
45 int pictureVersion() const { return fPictureVersion; } 44 kFilterLevelIsEnum_Version = 23,
45 kGradientFlippedFlag_Version = 24,
46 kDashWritesPhaseIntervals_Version = 25,
47 kColorShaderNoBool_Version = 26,
48 };
49
50 /**
51 * Returns true IFF the version is older than the specified version.
52 */
53 bool isVersionLT(Version targetVersion) const {
54 SkASSERT(targetVersion > 0);
55 return fVersion > 0 && fVersion < targetVersion;
56 }
46 57
47 /** This may be called at most once; most clients of SkReadBuffer should not mess with it. */ 58 /** This may be called at most once; most clients of SkReadBuffer should not mess with it. */
48 void setPictureVersion(int version) { 59 void setVersion(int version) {
49 SkASSERT(0 == fPictureVersion || version == fPictureVersion); 60 SkASSERT(0 == fVersion || version == fVersion);
50 fPictureVersion = version; 61 fVersion = version;
51 } 62 }
52 63
53 enum Flags { 64 enum Flags {
54 kCrossProcess_Flag = 1 << 0, 65 kCrossProcess_Flag = 1 << 0,
55 kScalarIsFloat_Flag = 1 << 1, 66 kScalarIsFloat_Flag = 1 << 1,
56 kPtrIs64Bit_Flag = 1 << 2, 67 kPtrIs64Bit_Flag = 1 << 2,
57 kValidation_Flag = 1 << 3, 68 kValidation_Flag = 1 << 3,
58 }; 69 };
59 70
60 void setFlags(uint32_t flags) { fFlags = flags; } 71 void setFlags(uint32_t flags) { fFlags = flags; }
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 virtual bool isValid() const { return true; } 192 virtual bool isValid() const { return true; }
182 virtual bool validateAvailable(size_t size) { return true; } 193 virtual bool validateAvailable(size_t size) { return true; }
183 194
184 protected: 195 protected:
185 SkReader32 fReader; 196 SkReader32 fReader;
186 197
187 private: 198 private:
188 bool readArray(void* value, size_t size, size_t elementSize); 199 bool readArray(void* value, size_t size, size_t elementSize);
189 200
190 uint32_t fFlags; 201 uint32_t fFlags;
191 int fPictureVersion; 202 int fVersion;
192 203
193 void* fMemoryPtr; 204 void* fMemoryPtr;
194 205
195 SkBitmapHeapReader* fBitmapStorage; 206 SkBitmapHeapReader* fBitmapStorage;
196 SkTypeface** fTFArray; 207 SkTypeface** fTFArray;
197 int fTFCount; 208 int fTFCount;
198 209
199 SkTDArray<SkFlattenable::Factory>* fFactoryTDArray; 210 SkTDArray<SkFlattenable::Factory>* fFactoryTDArray;
200 SkFlattenable::Factory* fFactoryArray; 211 SkFlattenable::Factory* fFactoryArray;
201 int fFactoryCount; 212 int fFactoryCount;
202 213
203 SkPicture::InstallPixelRefProc fBitmapDecoder; 214 SkPicture::InstallPixelRefProc fBitmapDecoder;
204 215
205 #ifdef DEBUG_NON_DETERMINISTIC_ASSERT 216 #ifdef DEBUG_NON_DETERMINISTIC_ASSERT
206 // Debugging counter to keep track of how many bitmaps we 217 // Debugging counter to keep track of how many bitmaps we
207 // have decoded. 218 // have decoded.
208 int fDecodedBitmapIndex; 219 int fDecodedBitmapIndex;
209 #endif // DEBUG_NON_DETERMINISTIC_ASSERT 220 #endif // DEBUG_NON_DETERMINISTIC_ASSERT
210 }; 221 };
211 222
212 #endif // SkReadBuffer_DEFINED 223 #endif // SkReadBuffer_DEFINED
OLDNEW
« no previous file with comments | « no previous file | src/core/SkPaint.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698