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

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

Issue 1779263003: Make sp variants for SkData (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « src/core/SkPixmap.cpp ('k') | src/core/SkReader32.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
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 */ 145 */
146 virtual void skipFlattenable(); 146 virtual void skipFlattenable();
147 147
148 // binary data and arrays 148 // binary data and arrays
149 virtual bool readByteArray(void* value, size_t size); 149 virtual bool readByteArray(void* value, size_t size);
150 virtual bool readColorArray(SkColor* colors, size_t size); 150 virtual bool readColorArray(SkColor* colors, size_t size);
151 virtual bool readIntArray(int32_t* values, size_t size); 151 virtual bool readIntArray(int32_t* values, size_t size);
152 virtual bool readPointArray(SkPoint* points, size_t size); 152 virtual bool readPointArray(SkPoint* points, size_t size);
153 virtual bool readScalarArray(SkScalar* values, size_t size); 153 virtual bool readScalarArray(SkScalar* values, size_t size);
154 154
155 SkData* readByteArrayAsData() { 155 sk_sp<SkData> readByteArrayAsData() {
156 size_t len = this->getArrayCount(); 156 size_t len = this->getArrayCount();
157 if (!this->validateAvailable(len)) { 157 if (!this->validateAvailable(len)) {
158 return SkData::NewEmpty(); 158 return SkData::MakeEmpty();
159 } 159 }
160 void* buffer = sk_malloc_throw(len); 160 void* buffer = sk_malloc_throw(len);
161 this->readByteArray(buffer, len); 161 this->readByteArray(buffer, len);
162 return SkData::NewFromMalloc(buffer, len); 162 return SkData::MakeFromMalloc(buffer, len);
163 } 163 }
164 164
165 // helpers to get info about arrays and binary data 165 // helpers to get info about arrays and binary data
166 virtual uint32_t getArrayCount(); 166 virtual uint32_t getArrayCount();
167 167
168 /** 168 /**
169 * Returns false if the bitmap could not be completely read. In that case, it will be set 169 * Returns false if the bitmap could not be completely read. In that case, it will be set
170 * to have width/height, but no pixels. 170 * to have width/height, but no pixels.
171 */ 171 */
172 bool readBitmap(SkBitmap* bitmap); 172 bool readBitmap(SkBitmap* bitmap);
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 SkPicture::InstallPixelRefProc fBitmapDecoder; 241 SkPicture::InstallPixelRefProc fBitmapDecoder;
242 242
243 #ifdef DEBUG_NON_DETERMINISTIC_ASSERT 243 #ifdef DEBUG_NON_DETERMINISTIC_ASSERT
244 // Debugging counter to keep track of how many bitmaps we 244 // Debugging counter to keep track of how many bitmaps we
245 // have decoded. 245 // have decoded.
246 int fDecodedBitmapIndex; 246 int fDecodedBitmapIndex;
247 #endif // DEBUG_NON_DETERMINISTIC_ASSERT 247 #endif // DEBUG_NON_DETERMINISTIC_ASSERT
248 }; 248 };
249 249
250 #endif // SkReadBuffer_DEFINED 250 #endif // SkReadBuffer_DEFINED
OLDNEW
« no previous file with comments | « src/core/SkPixmap.cpp ('k') | src/core/SkReader32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698