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

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

Issue 1288483002: Consolidate SkCodec functions for handling rewind (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 4 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 "SkBmpStandardCodec.h" 8 #include "SkBmpStandardCodec.h"
9 #include "SkCodecPriv.h" 9 #include "SkCodecPriv.h"
10 #include "SkColorPriv.h" 10 #include "SkColorPriv.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 {} 59 {}
60 60
61 /* 61 /*
62 * Initiates the bitmap decode 62 * Initiates the bitmap decode
63 */ 63 */
64 SkCodec::Result SkBmpStandardCodec::onGetPixels(const SkImageInfo& dstInfo, 64 SkCodec::Result SkBmpStandardCodec::onGetPixels(const SkImageInfo& dstInfo,
65 void* dst, size_t dstRowBytes, 65 void* dst, size_t dstRowBytes,
66 const Options& opts, 66 const Options& opts,
67 SkPMColor* inputColorPtr, 67 SkPMColor* inputColorPtr,
68 int* inputColorCount) { 68 int* inputColorCount) {
69 if (!this->handleRewind(fInIco)) { 69 if (!this->rewindIfNeeded()) {
70 return kCouldNotRewind; 70 return kCouldNotRewind;
71 } 71 }
72 if (opts.fSubset) { 72 if (opts.fSubset) {
73 // Subsets are not supported. 73 // Subsets are not supported.
74 return kUnimplemented; 74 return kUnimplemented;
75 } 75 }
76 if (dstInfo.dimensions() != this->getInfo().dimensions()) { 76 if (dstInfo.dimensions() != this->getInfo().dimensions()) {
77 SkCodecPrintf("Error: scaling not supported.\n"); 77 SkCodecPrintf("Error: scaling not supported.\n");
78 return kInvalidScale; 78 return kInvalidScale;
79 } 79 }
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 uint32_t alphaBit = 352 uint32_t alphaBit =
353 (fSrcBuffer.get()[quotient] >> shift) & 0x1; 353 (fSrcBuffer.get()[quotient] >> shift) & 0x1;
354 dstRow[x] &= alphaBit - 1; 354 dstRow[x] &= alphaBit - 1;
355 } 355 }
356 } 356 }
357 } 357 }
358 358
359 // Finished decoding the entire image 359 // Finished decoding the entire image
360 return kSuccess; 360 return kSuccess;
361 } 361 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698