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

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

Issue 1220733013: SkCodec no longer inherits from SkImageGenerator. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Manually handle the lifetime of fScanlineDecoder. Created 5 years, 5 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
« no previous file with comments | « src/codec/SkCodec.cpp ('k') | src/codec/SkCodec_libpng.cpp » ('j') | 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 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"
(...skipping 1112 matching lines...) Expand 10 before | Expand all | Expand 10 after
1123 default: 1123 default:
1124 SkASSERT(false); 1124 SkASSERT(false);
1125 return kInvalidInput; 1125 return kInvalidInput;
1126 } 1126 }
1127 1127
1128 // Get a pointer to the color table if it exists 1128 // Get a pointer to the color table if it exists
1129 const SkPMColor* colorPtr = NULL != fColorTable.get() ? fColorTable->readCol ors() : NULL; 1129 const SkPMColor* colorPtr = NULL != fColorTable.get() ? fColorTable->readCol ors() : NULL;
1130 1130
1131 // Create swizzler 1131 // Create swizzler
1132 SkAutoTDelete<SkSwizzler> swizzler(SkSwizzler::CreateSwizzler(config, 1132 SkAutoTDelete<SkSwizzler> swizzler(SkSwizzler::CreateSwizzler(config,
1133 colorPtr, dstInfo, dst, dstRowBytes, 1133 colorPtr, dstInfo, dst, dstRowBytes, kNo_ZeroInitialized));
1134 SkImageGenerator::kNo_ZeroInitialized));
1135 1134
1136 // Allocate space for a row buffer and a source for the swizzler 1135 // Allocate space for a row buffer and a source for the swizzler
1137 SkAutoTDeleteArray<uint8_t> srcBuffer(SkNEW_ARRAY(uint8_t, rowBytes)); 1136 SkAutoTDeleteArray<uint8_t> srcBuffer(SkNEW_ARRAY(uint8_t, rowBytes));
1138 1137
1139 // Iterate over rows of the image 1138 // Iterate over rows of the image
1140 // FIXME: bool transparent = true; 1139 // FIXME: bool transparent = true;
1141 for (int y = 0; y < height; y++) { 1140 for (int y = 0; y < height; y++) {
1142 // Read a row of the input 1141 // Read a row of the input
1143 if (stream()->read(srcBuffer.get(), rowBytes) != rowBytes) { 1142 if (stream()->read(srcBuffer.get(), rowBytes) != rowBytes) {
1144 SkCodecPrintf("Warning: incomplete input stream.\n"); 1143 SkCodecPrintf("Warning: incomplete input stream.\n");
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
1222 uint32_t alphaBit = 1221 uint32_t alphaBit =
1223 (srcBuffer.get()[quotient] >> shift) & 0x1; 1222 (srcBuffer.get()[quotient] >> shift) & 0x1;
1224 dstRow[x] &= alphaBit - 1; 1223 dstRow[x] &= alphaBit - 1;
1225 } 1224 }
1226 } 1225 }
1227 } 1226 }
1228 1227
1229 // Finished decoding the entire image 1228 // Finished decoding the entire image
1230 return kSuccess; 1229 return kSuccess;
1231 } 1230 }
OLDNEW
« no previous file with comments | « src/codec/SkCodec.cpp ('k') | src/codec/SkCodec_libpng.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698