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

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

Issue 1381483002: Call rewindIfNeeded in SkCodec (Closed) Base URL: https://skia.googlesource.com/skia.git@codecSDmerge
Patch Set: Rebase 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/SkBmpRLECodec.cpp ('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 19 matching lines...) Expand all
30 {} 30 {}
31 31
32 /* 32 /*
33 * Initiates the bitmap decode 33 * Initiates the bitmap decode
34 */ 34 */
35 SkCodec::Result SkBmpStandardCodec::onGetPixels(const SkImageInfo& dstInfo, 35 SkCodec::Result SkBmpStandardCodec::onGetPixels(const SkImageInfo& dstInfo,
36 void* dst, size_t dstRowBytes, 36 void* dst, size_t dstRowBytes,
37 const Options& opts, 37 const Options& opts,
38 SkPMColor* inputColorPtr, 38 SkPMColor* inputColorPtr,
39 int* inputColorCount) { 39 int* inputColorCount) {
40 if (!this->rewindIfNeeded()) {
41 return kCouldNotRewind;
42 }
43 if (opts.fSubset) { 40 if (opts.fSubset) {
44 // Subsets are not supported. 41 // Subsets are not supported.
45 return kUnimplemented; 42 return kUnimplemented;
46 } 43 }
47 if (dstInfo.dimensions() != this->getInfo().dimensions()) { 44 if (dstInfo.dimensions() != this->getInfo().dimensions()) {
48 SkCodecPrintf("Error: scaling not supported.\n"); 45 SkCodecPrintf("Error: scaling not supported.\n");
49 return kInvalidScale; 46 return kInvalidScale;
50 } 47 }
51 if (!conversion_possible(dstInfo, this->getInfo())) { 48 if (!conversion_possible(dstInfo, this->getInfo())) {
52 SkCodecPrintf("Error: cannot convert input type to output type.\n"); 49 SkCodecPrintf("Error: cannot convert input type to output type.\n");
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 int modulus; 287 int modulus;
291 SkTDivMod(x, 8, &quotient, &modulus); 288 SkTDivMod(x, 8, &quotient, &modulus);
292 uint32_t shift = 7 - modulus; 289 uint32_t shift = 7 - modulus;
293 uint32_t alphaBit = 290 uint32_t alphaBit =
294 (fSrcBuffer.get()[quotient] >> shift) & 0x1; 291 (fSrcBuffer.get()[quotient] >> shift) & 0x1;
295 dstRow[x] &= alphaBit - 1; 292 dstRow[x] &= alphaBit - 1;
296 } 293 }
297 } 294 }
298 return kSuccess; 295 return kSuccess;
299 } 296 }
OLDNEW
« no previous file with comments | « src/codec/SkBmpRLECodec.cpp ('k') | src/codec/SkCodec.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698