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

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

Issue 1372973002: Move all knowledge of X sampling into SkScaledCodec (Closed) Base URL: https://skia.googlesource.com/skia.git@codecSDmerge
Patch Set: Attempt to fix RLE overflow Created 5 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
« no previous file with comments | « src/codec/SkBmpStandardCodec.h ('k') | src/codec/SkCodec.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 "SkBmpStandardCodec.h" 8 #include "SkBmpStandardCodec.h"
9 #include "SkCodecPriv.h" 9 #include "SkCodecPriv.h"
10 #include "SkColorPriv.h" 10 #include "SkColorPriv.h"
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 default: 189 default:
190 SkASSERT(false); 190 SkASSERT(false);
191 return false; 191 return false;
192 } 192 }
193 193
194 // Get a pointer to the color table if it exists 194 // Get a pointer to the color table if it exists
195 const SkPMColor* colorPtr = get_color_ptr(fColorTable.get()); 195 const SkPMColor* colorPtr = get_color_ptr(fColorTable.get());
196 196
197 // Create swizzler 197 // Create swizzler
198 fSwizzler.reset(SkSwizzler::CreateSwizzler(config, 198 fSwizzler.reset(SkSwizzler::CreateSwizzler(config,
199 colorPtr, dstInfo, opts.fZeroInitialized, this->getInfo())); 199 colorPtr, dstInfo, opts.fZeroInitialized));
200 200
201 if (nullptr == fSwizzler.get()) { 201 if (nullptr == fSwizzler.get()) {
202 return false; 202 return false;
203 } 203 }
204 return true; 204 return true;
205 } 205 }
206 206
207 SkCodec::Result SkBmpStandardCodec::prepareToDecode(const SkImageInfo& dstInfo, 207 SkCodec::Result SkBmpStandardCodec::prepareToDecode(const SkImageInfo& dstInfo,
208 const SkCodec::Options& options, SkPMColor inputColorPtr[], int* inputCo lorCount) { 208 const SkCodec::Options& options, SkPMColor inputColorPtr[], int* inputCo lorCount) {
209 // Create the color table if necessary and prepare the stream for decode 209 // Create the color table if necessary and prepare the stream for decode
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 int modulus; 287 int modulus;
288 SkTDivMod(x, 8, &quotient, &modulus); 288 SkTDivMod(x, 8, &quotient, &modulus);
289 uint32_t shift = 7 - modulus; 289 uint32_t shift = 7 - modulus;
290 uint32_t alphaBit = 290 uint32_t alphaBit =
291 (fSrcBuffer.get()[quotient] >> shift) & 0x1; 291 (fSrcBuffer.get()[quotient] >> shift) & 0x1;
292 dstRow[x] &= alphaBit - 1; 292 dstRow[x] &= alphaBit - 1;
293 } 293 }
294 } 294 }
295 return kSuccess; 295 return kSuccess;
296 } 296 }
OLDNEW
« no previous file with comments | « src/codec/SkBmpStandardCodec.h ('k') | src/codec/SkCodec.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698