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

Side by Side Diff: src/codec/SkCodec_libbmp.cpp

Issue 1061713007: Adding png scanline decoding to kIndex8 (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Added simpler version of getScanlineDecoder Created 5 years, 8 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
OLDNEW
1 /* 1 /*
2 * Copyright 2015 Google Inc. 2 * Copyright 2015 Google Inc.
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 "SkCodec_libbmp.h" 8 #include "SkCodec_libbmp.h"
9 #include "SkCodecPriv.h" 9 #include "SkCodecPriv.h"
10 #include "SkColorPriv.h" 10 #include "SkColorPriv.h"
11 #include "SkStream.h" 11 #include "SkStream.h"
12 #include "SkUtils.h"
13 12
14 /* 13 /*
15 * 14 *
16 * Checks if the conversion between the input image and the requested output 15 * Checks if the conversion between the input image and the requested output
17 * image has been implemented 16 * image has been implemented
18 * 17 *
19 */ 18 */
20 static bool conversion_possible(const SkImageInfo& dst, 19 static bool conversion_possible(const SkImageInfo& dst,
21 const SkImageInfo& src) { 20 const SkImageInfo& src) {
22 // Ensure that the profile type is unchanged 21 // Ensure that the profile type is unchanged
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 } 595 }
597 596
598 // Create the color table if necessary and prepare the stream for decode 597 // Create the color table if necessary and prepare the stream for decode
599 // Note that if it is non-NULL, inputColorCount will be modified 598 // Note that if it is non-NULL, inputColorCount will be modified
600 if (!createColorTable(dstInfo.alphaType(), inputColorCount)) { 599 if (!createColorTable(dstInfo.alphaType(), inputColorCount)) {
601 SkCodecPrintf("Error: could not create color table.\n"); 600 SkCodecPrintf("Error: could not create color table.\n");
602 return kInvalidInput; 601 return kInvalidInput;
603 } 602 }
604 603
605 // Copy the color table to the client if necessary 604 // Copy the color table to the client if necessary
606 if (kIndex_8_SkColorType == dstInfo.colorType()) { 605 copy_color_table(dstInfo, fColorTable, inputColorPtr, inputColorCount);
607 SkASSERT(NULL != inputColorPtr);
608 SkASSERT(NULL != inputColorCount);
609 SkASSERT(NULL != fColorTable.get());
610 sk_memcpy32(inputColorPtr, fColorTable->readColors(), *inputColorCount);
611 }
612 606
613 // Perform the decode 607 // Perform the decode
614 switch (fInputFormat) { 608 switch (fInputFormat) {
615 case kBitMask_BitmapInputFormat: 609 case kBitMask_BitmapInputFormat:
616 return decodeMask(dstInfo, dst, dstRowBytes, opts); 610 return decodeMask(dstInfo, dst, dstRowBytes, opts);
617 case kRLE_BitmapInputFormat: 611 case kRLE_BitmapInputFormat:
618 return decodeRLE(dstInfo, dst, dstRowBytes, opts); 612 return decodeRLE(dstInfo, dst, dstRowBytes, opts);
619 case kStandard_BitmapInputFormat: 613 case kStandard_BitmapInputFormat:
620 return decode(dstInfo, dst, dstRowBytes, opts); 614 return decode(dstInfo, dst, dstRowBytes, opts);
621 default: 615 default:
(...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after
1229 uint32_t alphaBit = 1223 uint32_t alphaBit =
1230 (srcBuffer.get()[quotient] >> shift) & 0x1; 1224 (srcBuffer.get()[quotient] >> shift) & 0x1;
1231 dstRow[x] &= alphaBit - 1; 1225 dstRow[x] &= alphaBit - 1;
1232 } 1226 }
1233 } 1227 }
1234 } 1228 }
1235 1229
1236 // Finished decoding the entire image 1230 // Finished decoding the entire image
1237 return kSuccess; 1231 return kSuccess;
1238 } 1232 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698