| 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 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 // not having a decoder. | 245 // not having a decoder. |
| 246 SkErrorInternals::SetError(kParseError_SkError, | 246 SkErrorInternals::SetError(kParseError_SkError, |
| 247 "Could not decode bitmap. Resulting bitma
p will be red."); | 247 "Could not decode bitmap. Resulting bitma
p will be red."); |
| 248 } else { | 248 } else { |
| 249 // A size of zero means the SkBitmap was simply flattened. | 249 // A size of zero means the SkBitmap was simply flattened. |
| 250 bitmap->unflatten(*this); | 250 bitmap->unflatten(*this); |
| 251 return; | 251 return; |
| 252 } | 252 } |
| 253 } | 253 } |
| 254 // Could not read the SkBitmap. Use a placeholder bitmap. | 254 // Could not read the SkBitmap. Use a placeholder bitmap. |
| 255 bitmap->setConfig(SkBitmap::kARGB_8888_Config, width, height); | 255 bitmap->allocPixels(SkImageInfo::MakeN32Premul(width, height)); |
| 256 bitmap->allocPixels(); | |
| 257 bitmap->eraseColor(SK_ColorRED); | 256 bitmap->eraseColor(SK_ColorRED); |
| 258 } | 257 } |
| 259 | 258 |
| 260 SkTypeface* SkOrderedReadBuffer::readTypeface() { | 259 SkTypeface* SkOrderedReadBuffer::readTypeface() { |
| 261 | 260 |
| 262 uint32_t index = fReader.readU32(); | 261 uint32_t index = fReader.readU32(); |
| 263 if (0 == index || index > (unsigned)fTFCount) { | 262 if (0 == index || index > (unsigned)fTFCount) { |
| 264 if (index) { | 263 if (index) { |
| 265 SkDebugf("====== typeface index %d\n", index); | 264 SkDebugf("====== typeface index %d\n", index); |
| 266 } | 265 } |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 if (sizeRecorded != sizeRead) { | 311 if (sizeRecorded != sizeRead) { |
| 313 // we could try to fix up the offset... | 312 // we could try to fix up the offset... |
| 314 sk_throw(); | 313 sk_throw(); |
| 315 } | 314 } |
| 316 } else { | 315 } else { |
| 317 // we must skip the remaining data | 316 // we must skip the remaining data |
| 318 fReader.skip(sizeRecorded); | 317 fReader.skip(sizeRecorded); |
| 319 } | 318 } |
| 320 return obj; | 319 return obj; |
| 321 } | 320 } |
| OLD | NEW |