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

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

Issue 295793002: stop calling SkBitmap::flatten (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
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
(...skipping 27 matching lines...) Expand all
38 SkReadBuffer(); 38 SkReadBuffer();
39 SkReadBuffer(const void* data, size_t size); 39 SkReadBuffer(const void* data, size_t size);
40 SkReadBuffer(SkStream* stream); 40 SkReadBuffer(SkStream* stream);
41 virtual ~SkReadBuffer(); 41 virtual ~SkReadBuffer();
42 42
43 enum Version { 43 enum Version {
44 kFilterLevelIsEnum_Version = 23, 44 kFilterLevelIsEnum_Version = 23,
45 kGradientFlippedFlag_Version = 24, 45 kGradientFlippedFlag_Version = 24,
46 kDashWritesPhaseIntervals_Version = 25, 46 kDashWritesPhaseIntervals_Version = 25,
47 kColorShaderNoBool_Version = 26, 47 kColorShaderNoBool_Version = 26,
48 kNoMoreBitmapFlatten_Version = 27,
48 }; 49 };
49 50
50 /** 51 /**
51 * Returns true IFF the version is older than the specified version. 52 * Returns true IFF the version is older than the specified version.
52 */ 53 */
53 bool isVersionLT(Version targetVersion) const { 54 bool isVersionLT(Version targetVersion) const {
54 SkASSERT(targetVersion > 0); 55 SkASSERT(targetVersion > 0);
55 return fVersion > 0 && fVersion < targetVersion; 56 return fVersion > 0 && fVersion < targetVersion;
56 } 57 }
57 58
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 return SkData::NewEmpty(); 139 return SkData::NewEmpty();
139 } 140 }
140 void* buffer = sk_malloc_throw(len); 141 void* buffer = sk_malloc_throw(len);
141 this->readByteArray(buffer, len); 142 this->readByteArray(buffer, len);
142 return SkData::NewFromMalloc(buffer, len); 143 return SkData::NewFromMalloc(buffer, len);
143 } 144 }
144 145
145 // helpers to get info about arrays and binary data 146 // helpers to get info about arrays and binary data
146 virtual uint32_t getArrayCount(); 147 virtual uint32_t getArrayCount();
147 148
148 virtual void readBitmap(SkBitmap* bitmap); 149 /**
150 * Returns false if the bitmap could not be completely read. In that case, it will be set
151 * to have width/height, but no pixels.
152 */
153 bool readBitmap(SkBitmap* bitmap);
154
149 virtual SkTypeface* readTypeface(); 155 virtual SkTypeface* readTypeface();
150 156
151 void setBitmapStorage(SkBitmapHeapReader* bitmapStorage) { 157 void setBitmapStorage(SkBitmapHeapReader* bitmapStorage) {
152 SkRefCnt_SafeAssign(fBitmapStorage, bitmapStorage); 158 SkRefCnt_SafeAssign(fBitmapStorage, bitmapStorage);
153 } 159 }
154 160
155 void setTypefaceArray(SkTypeface* array[], int count) { 161 void setTypefaceArray(SkTypeface* array[], int count) {
156 fTFArray = array; 162 fTFArray = array;
157 fTFCount = count; 163 fTFCount = count;
158 } 164 }
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 SkPicture::InstallPixelRefProc fBitmapDecoder; 220 SkPicture::InstallPixelRefProc fBitmapDecoder;
215 221
216 #ifdef DEBUG_NON_DETERMINISTIC_ASSERT 222 #ifdef DEBUG_NON_DETERMINISTIC_ASSERT
217 // Debugging counter to keep track of how many bitmaps we 223 // Debugging counter to keep track of how many bitmaps we
218 // have decoded. 224 // have decoded.
219 int fDecodedBitmapIndex; 225 int fDecodedBitmapIndex;
220 #endif // DEBUG_NON_DETERMINISTIC_ASSERT 226 #endif // DEBUG_NON_DETERMINISTIC_ASSERT
221 }; 227 };
222 228
223 #endif // SkReadBuffer_DEFINED 229 #endif // SkReadBuffer_DEFINED
OLDNEW
« no previous file with comments | « include/core/SkPicture.h ('k') | src/core/SkBitmap.cpp » ('j') | src/core/SkBitmap.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698