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 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 } | 358 } |
359 transpIndex = find_transpIndex(temp_save, colorCount); | 359 transpIndex = find_transpIndex(temp_save, colorCount); |
360 if (transpIndex >= 0) { | 360 if (transpIndex >= 0) { |
361 colorPtr[transpIndex] = SK_ColorTRANSPARENT; // ram in a tra
nsparent SkPMColor | 361 colorPtr[transpIndex] = SK_ColorTRANSPARENT; // ram in a tra
nsparent SkPMColor |
362 fillIndex = transpIndex; | 362 fillIndex = transpIndex; |
363 } else if (fillIndex >= colorCount) { | 363 } else if (fillIndex >= colorCount) { |
364 // gif->SBackGroundColor should be less than colorCount. | 364 // gif->SBackGroundColor should be less than colorCount. |
365 fillIndex = 0; // If not, fix it. | 365 fillIndex = 0; // If not, fix it. |
366 } | 366 } |
367 | 367 |
368 SkAutoTUnref<SkColorTable> ctable(SkNEW_ARGS(SkColorTable, (colo
rPtr, colorCount))); | 368 SkAutoTUnref<SkColorTable> ctable(new SkColorTable(colorPtr, col
orCount)); |
369 if (!this->allocPixelRef(bm, ctable)) { | 369 if (!this->allocPixelRef(bm, ctable)) { |
370 return error_return(*bm, "allocPixelRef"); | 370 return error_return(*bm, "allocPixelRef"); |
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 |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
517 memcmp(GIF87_STAMP, buf, GIF_STAMP_LEN) == 0 || | 517 memcmp(GIF87_STAMP, buf, GIF_STAMP_LEN) == 0 || |
518 memcmp(GIF89_STAMP, buf, GIF_STAMP_LEN) == 0) { | 518 memcmp(GIF89_STAMP, buf, GIF_STAMP_LEN) == 0) { |
519 return true; | 519 return true; |
520 } | 520 } |
521 } | 521 } |
522 return false; | 522 return false; |
523 } | 523 } |
524 | 524 |
525 static SkImageDecoder* sk_libgif_dfactory(SkStreamRewindable* stream) { | 525 static SkImageDecoder* sk_libgif_dfactory(SkStreamRewindable* stream) { |
526 if (is_gif(stream)) { | 526 if (is_gif(stream)) { |
527 return SkNEW(SkGIFImageDecoder); | 527 return new SkGIFImageDecoder; |
528 } | 528 } |
529 return NULL; | 529 return NULL; |
530 } | 530 } |
531 | 531 |
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 |