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

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: Rebase 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
« no previous file with comments | « src/images/SkImageDecoder_libpng.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
839 SkScaledBitmapSampler::RowProc actual = RowProcTester::getRo wProc(sampler); 843 SkScaledBitmapSampler::RowProc actual = RowProcTester::getRo wProc(sampler);
840 SkASSERT(expected == actual); 844 SkASSERT(expected == actual);
841 procCounter++; 845 procCounter++;
842 } 846 }
843 } 847 }
844 } 848 }
845 } 849 }
846 SkASSERT(SK_ARRAY_COUNT(gTestProcs) == procCounter); 850 SkASSERT(SK_ARRAY_COUNT(gTestProcs) == procCounter);
847 } 851 }
848 #endif // SK_DEBUG 852 #endif // SK_DEBUG
OLDNEW
« no previous file with comments | « src/images/SkImageDecoder_libpng.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698