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

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

Issue 296823008: Revert of Remove unused (by clients) SkUnitMapper (https://codereview.chromium.org/283273002/) (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 | « include/core/SkPicture.h ('k') | include/core/SkUnitMapper.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 #include "SkBitmapHeap.h" 11 #include "SkBitmapHeap.h"
12 #include "SkColorFilter.h" 12 #include "SkColorFilter.h"
13 #include "SkData.h" 13 #include "SkData.h"
14 #include "SkDrawLooper.h" 14 #include "SkDrawLooper.h"
15 #include "SkImageFilter.h" 15 #include "SkImageFilter.h"
16 #include "SkMaskFilter.h" 16 #include "SkMaskFilter.h"
17 #include "SkPath.h" 17 #include "SkPath.h"
18 #include "SkPathEffect.h" 18 #include "SkPathEffect.h"
19 #include "SkPicture.h" 19 #include "SkPicture.h"
20 #include "SkPixelRef.h" 20 #include "SkPixelRef.h"
21 #include "SkRasterizer.h" 21 #include "SkRasterizer.h"
22 #include "SkReadBuffer.h" 22 #include "SkReadBuffer.h"
23 #include "SkReader32.h" 23 #include "SkReader32.h"
24 #include "SkRefCnt.h" 24 #include "SkRefCnt.h"
25 #include "SkShader.h" 25 #include "SkShader.h"
26 #include "SkUnitMapper.h"
26 #include "SkWriteBuffer.h" 27 #include "SkWriteBuffer.h"
27 #include "SkXfermode.h" 28 #include "SkXfermode.h"
28 29
29 class SkBitmap; 30 class SkBitmap;
30 31
31 #if defined(SK_DEBUG) && defined(SK_BUILD_FOR_MAC) 32 #if defined(SK_DEBUG) && defined(SK_BUILD_FOR_MAC)
32 #define DEBUG_NON_DETERMINISTIC_ASSERT 33 #define DEBUG_NON_DETERMINISTIC_ASSERT
33 #endif 34 #endif
34 35
35 class SkReadBuffer { 36 class SkReadBuffer {
36 public: 37 public:
37 SkReadBuffer(); 38 SkReadBuffer();
38 SkReadBuffer(const void* data, size_t size); 39 SkReadBuffer(const void* data, size_t size);
39 SkReadBuffer(SkStream* stream); 40 SkReadBuffer(SkStream* stream);
40 virtual ~SkReadBuffer(); 41 virtual ~SkReadBuffer();
41 42
42 enum Version { 43 enum Version {
43 kFilterLevelIsEnum_Version = 23, 44 kFilterLevelIsEnum_Version = 23,
44 kGradientFlippedFlag_Version = 24, 45 kGradientFlippedFlag_Version = 24,
45 kDashWritesPhaseIntervals_Version = 25, 46 kDashWritesPhaseIntervals_Version = 25,
46 kColorShaderNoBool_Version = 26, 47 kColorShaderNoBool_Version = 26,
47 kNoUnitMappers_Version = 27,
48 }; 48 };
49 49
50 /** 50 /**
51 * Returns true IFF the version is older than the specified version. 51 * Returns true IFF the version is older than the specified version.
52 */ 52 */
53 bool isVersionLT(Version targetVersion) const { 53 bool isVersionLT(Version targetVersion) const {
54 SkASSERT(targetVersion > 0); 54 SkASSERT(targetVersion > 0);
55 return fVersion > 0 && fVersion < targetVersion; 55 return fVersion > 0 && fVersion < targetVersion;
56 } 56 }
57 57
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 return (T*) this->readFlattenable(T::GetFlattenableType()); 114 return (T*) this->readFlattenable(T::GetFlattenableType());
115 } 115 }
116 SkColorFilter* readColorFilter() { return this->readFlattenable<SkColorFilte r>(); } 116 SkColorFilter* readColorFilter() { return this->readFlattenable<SkColorFilte r>(); }
117 SkDrawLooper* readDrawLooper() { return this->readFlattenable<SkDrawLooper >(); } 117 SkDrawLooper* readDrawLooper() { return this->readFlattenable<SkDrawLooper >(); }
118 SkImageFilter* readImageFilter() { return this->readFlattenable<SkImageFilte r>(); } 118 SkImageFilter* readImageFilter() { return this->readFlattenable<SkImageFilte r>(); }
119 SkMaskFilter* readMaskFilter() { return this->readFlattenable<SkMaskFilter >(); } 119 SkMaskFilter* readMaskFilter() { return this->readFlattenable<SkMaskFilter >(); }
120 SkPathEffect* readPathEffect() { return this->readFlattenable<SkPathEffect >(); } 120 SkPathEffect* readPathEffect() { return this->readFlattenable<SkPathEffect >(); }
121 SkPixelRef* readPixelRef() { return this->readFlattenable<SkPixelRef>( ); } 121 SkPixelRef* readPixelRef() { return this->readFlattenable<SkPixelRef>( ); }
122 SkRasterizer* readRasterizer() { return this->readFlattenable<SkRasterizer >(); } 122 SkRasterizer* readRasterizer() { return this->readFlattenable<SkRasterizer >(); }
123 SkShader* readShader() { return this->readFlattenable<SkShader>(); } 123 SkShader* readShader() { return this->readFlattenable<SkShader>(); }
124 SkUnitMapper* readUnitMapper() { return this->readFlattenable<SkUnitMapper >(); }
124 SkXfermode* readXfermode() { return this->readFlattenable<SkXfermode>( ); } 125 SkXfermode* readXfermode() { return this->readFlattenable<SkXfermode>( ); }
125 126
126 /**
127 * Like readFlattenable() but explicitly just skips the data that was writt en for the
128 * flattenable (or the sentinel that there wasn't one).
129 */
130 virtual void skipFlattenable();
131 127
132 // binary data and arrays 128 // binary data and arrays
133 virtual bool readByteArray(void* value, size_t size); 129 virtual bool readByteArray(void* value, size_t size);
134 virtual bool readColorArray(SkColor* colors, size_t size); 130 virtual bool readColorArray(SkColor* colors, size_t size);
135 virtual bool readIntArray(int32_t* values, size_t size); 131 virtual bool readIntArray(int32_t* values, size_t size);
136 virtual bool readPointArray(SkPoint* points, size_t size); 132 virtual bool readPointArray(SkPoint* points, size_t size);
137 virtual bool readScalarArray(SkScalar* values, size_t size); 133 virtual bool readScalarArray(SkScalar* values, size_t size);
138 134
139 SkData* readByteArrayAsData() { 135 SkData* readByteArrayAsData() {
140 size_t len = this->getArrayCount(); 136 size_t len = this->getArrayCount();
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 SkPicture::InstallPixelRefProc fBitmapDecoder; 214 SkPicture::InstallPixelRefProc fBitmapDecoder;
219 215
220 #ifdef DEBUG_NON_DETERMINISTIC_ASSERT 216 #ifdef DEBUG_NON_DETERMINISTIC_ASSERT
221 // Debugging counter to keep track of how many bitmaps we 217 // Debugging counter to keep track of how many bitmaps we
222 // have decoded. 218 // have decoded.
223 int fDecodedBitmapIndex; 219 int fDecodedBitmapIndex;
224 #endif // DEBUG_NON_DETERMINISTIC_ASSERT 220 #endif // DEBUG_NON_DETERMINISTIC_ASSERT
225 }; 221 };
226 222
227 #endif // SkReadBuffer_DEFINED 223 #endif // SkReadBuffer_DEFINED
OLDNEW
« no previous file with comments | « include/core/SkPicture.h ('k') | include/core/SkUnitMapper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698