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

Side by Side Diff: src/images/SkScaledBitmapSampler.cpp

Issue 26210007: Image decoder fixes (mostly) around A8. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 2 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright 2007 The Android Open Source Project 2 * Copyright 2007 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 8
9 #include "SkScaledBitmapSampler.h" 9 #include "SkScaledBitmapSampler.h"
10 #include "SkBitmap.h" 10 #include "SkBitmap.h"
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 } 542 }
543 // Ignore dither and skip zeroes 543 // Ignore dither and skip zeroes
544 return Sample_Index_DI; 544 return Sample_Index_DI;
545 } 545 }
546 546
547 // A8 547 // A8
548 static bool Sample_Gray_DA8(void* SK_RESTRICT dstRow, 548 static bool Sample_Gray_DA8(void* SK_RESTRICT dstRow,
549 const uint8_t* SK_RESTRICT src, 549 const uint8_t* SK_RESTRICT src,
550 int width, int deltaSrc, int, 550 int width, int deltaSrc, int,
551 const SkPMColor[]) { 551 const SkPMColor[]) {
552 memcpy(dstRow, src, width); 552 // Sampling Gray to A8 uses the same function as Index to Index8,
553 // except we assume that there is alpha for speed, since an A8
554 // bitmap with no alpha is not interesting.
555 (void) Sample_Index_DI(dstRow, src, width, deltaSrc, /* y unused */ 0,
556 /* ctable unused */ NULL);
553 return true; 557 return true;
554 } 558 }
555 559
556 static SkScaledBitmapSampler::RowProc get_gray_to_A8_proc(const SkImageDecoder& decoder) { 560 static SkScaledBitmapSampler::RowProc get_gray_to_A8_proc(const SkImageDecoder& decoder) {
557 if (decoder.getRequireUnpremultipliedColors()) { 561 if (decoder.getRequireUnpremultipliedColors()) {
558 return NULL; 562 return NULL;
559 } 563 }
560 // Ignore skip and dither. 564 // Ignore skip and dither.
561 return Sample_Gray_DA8; 565 return Sample_Gray_DA8;
562 } 566 }
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
812 SkScaledBitmapSampler::RowProc actual = RowProcTester::getRo wProc(sampler); 816 SkScaledBitmapSampler::RowProc actual = RowProcTester::getRo wProc(sampler);
813 SkASSERT(expected == actual); 817 SkASSERT(expected == actual);
814 procCounter++; 818 procCounter++;
815 } 819 }
816 } 820 }
817 } 821 }
818 } 822 }
819 SkASSERT(SK_ARRAY_COUNT(gTestProcs) == procCounter); 823 SkASSERT(SK_ARRAY_COUNT(gTestProcs) == procCounter);
820 } 824 }
821 #endif // SK_DEBUG 825 #endif // SK_DEBUG
OLDNEW
« src/images/SkImageDecoder_libpng.cpp ('K') | « src/images/SkImageDecoder_libpng.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698