OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
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 #include "SkColor.h" | 8 #include "SkColor.h" |
9 #include "SkColorPriv.h" | 9 #include "SkColorPriv.h" |
10 #include "SkColorTable.h" | 10 #include "SkColorTable.h" |
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 } | 371 } |
372 } | 372 } |
373 | 373 |
374 // abort if either inner dimension is <= 0 | 374 // abort if either inner dimension is <= 0 |
375 if (innerWidth <= 0 || innerHeight <= 0) { | 375 if (innerWidth <= 0 || innerHeight <= 0) { |
376 return error_return(*bm, "non-pos inner width/height"); | 376 return error_return(*bm, "non-pos inner width/height"); |
377 } | 377 } |
378 | 378 |
379 SkAutoLockPixels alp(*bm); | 379 SkAutoLockPixels alp(*bm); |
380 | 380 |
381 SkAutoMalloc storage(innerWidth); | 381 SkAutoTMalloc<uint8_t> storage(innerWidth); |
382 uint8_t* scanline = (uint8_t*) storage.get(); | 382 uint8_t* scanline = storage.get(); |
383 | 383 |
384 // GIF has an option to store the scanlines of an image, plus a larg
er background, | 384 // GIF has an option to store the scanlines of an image, plus a larg
er background, |
385 // filled by a fill color. In this case, we will use a subset of the
larger bitmap | 385 // filled by a fill color. In this case, we will use a subset of the
larger bitmap |
386 // for sampling. | 386 // for sampling. |
387 SkBitmap subset; | 387 SkBitmap subset; |
388 SkBitmap* workingBitmap; | 388 SkBitmap* workingBitmap; |
389 // are we only a subset of the total bounds? | 389 // are we only a subset of the total bounds? |
390 if ((imageTop | imageLeft) > 0 || | 390 if ((imageTop | imageLeft) > 0 || |
391 innerWidth < width || innerHeight < height) { | 391 innerWidth < width || innerHeight < height) { |
392 // Fill the background. | 392 // Fill the background. |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
532 static SkImageDecoder_DecodeReg gReg(sk_libgif_dfactory); | 532 static SkImageDecoder_DecodeReg gReg(sk_libgif_dfactory); |
533 | 533 |
534 static SkImageDecoder::Format get_format_gif(SkStreamRewindable* stream) { | 534 static SkImageDecoder::Format get_format_gif(SkStreamRewindable* stream) { |
535 if (is_gif(stream)) { | 535 if (is_gif(stream)) { |
536 return SkImageDecoder::kGIF_Format; | 536 return SkImageDecoder::kGIF_Format; |
537 } | 537 } |
538 return SkImageDecoder::kUnknown_Format; | 538 return SkImageDecoder::kUnknown_Format; |
539 } | 539 } |
540 | 540 |
541 static SkImageDecoder_FormatReg gFormatReg(get_format_gif); | 541 static SkImageDecoder_FormatReg gFormatReg(get_format_gif); |
OLD | NEW |