OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
10 #include "SkErrorInternals.h" | 10 #include "SkErrorInternals.h" |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 if (index) { | 260 if (index) { |
261 SkDebugf("====== typeface index %d\n", index); | 261 SkDebugf("====== typeface index %d\n", index); |
262 } | 262 } |
263 return NULL; | 263 return NULL; |
264 } else { | 264 } else { |
265 SkASSERT(fTFArray); | 265 SkASSERT(fTFArray); |
266 return fTFArray[index - 1]; | 266 return fTFArray[index - 1]; |
267 } | 267 } |
268 } | 268 } |
269 | 269 |
| 270 bool SkOrderedReadBuffer::isAvailable(size_t size) const { |
| 271 return (size <= SK_MaxU32) && fReader.isAvailable(static_cast<uint32_t>(size
)); |
| 272 } |
| 273 |
270 SkFlattenable* SkOrderedReadBuffer::readFlattenable(SkFlattenable::Type ft) { | 274 SkFlattenable* SkOrderedReadBuffer::readFlattenable(SkFlattenable::Type ft) { |
271 // | 275 // |
272 // TODO: confirm that ft matches the factory we decide to use | 276 // TODO: confirm that ft matches the factory we decide to use |
273 // | 277 // |
274 | 278 |
275 SkFlattenable::Factory factory = NULL; | 279 SkFlattenable::Factory factory = NULL; |
276 | 280 |
277 if (fFactoryCount > 0) { | 281 if (fFactoryCount > 0) { |
278 int32_t index = fReader.readU32(); | 282 int32_t index = fReader.readU32(); |
279 if (0 == index) { | 283 if (0 == index) { |
(...skipping 28 matching lines...) Expand all Loading... |
308 if (sizeRecorded != sizeRead) { | 312 if (sizeRecorded != sizeRead) { |
309 // we could try to fix up the offset... | 313 // we could try to fix up the offset... |
310 sk_throw(); | 314 sk_throw(); |
311 } | 315 } |
312 } else { | 316 } else { |
313 // we must skip the remaining data | 317 // we must skip the remaining data |
314 fReader.skip(sizeRecorded); | 318 fReader.skip(sizeRecorded); |
315 } | 319 } |
316 return obj; | 320 return obj; |
317 } | 321 } |
OLD | NEW |