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

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

Issue 1006583005: SkCodec: add wbmp class (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-03-27 (Friday) 10:53:14 EDT Created 5 years, 9 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 501 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 /* 512 /*
513 * 513 *
514 * Initiates the bitmap decode 514 * Initiates the bitmap decode
515 * 515 *
516 */ 516 */
517 SkCodec::Result SkBmpCodec::onGetPixels(const SkImageInfo& dstInfo, 517 SkCodec::Result SkBmpCodec::onGetPixels(const SkImageInfo& dstInfo,
518 void* dst, size_t dstRowBytes, 518 void* dst, size_t dstRowBytes,
519 const Options&, 519 const Options&,
520 SkPMColor*, int*) { 520 SkPMColor*, int*) {
521 // Check for proper input and output formats 521 // Check for proper input and output formats
522 if (!this->rewindIfNeeded()) { 522 SkCodec::RewindState rewindState = this->rewindIfNeeded();
523 if (rewindState == kCouldNotRewind_RewindState) {
523 return kCouldNotRewind; 524 return kCouldNotRewind;
525 } else if (rewindState == kRewound_RewindState) {
526 return kCouldNotRewind; // TODO(msarett): handle rewinds
524 } 527 }
525 if (dstInfo.dimensions() != this->getInfo().dimensions()) { 528 if (dstInfo.dimensions() != this->getInfo().dimensions()) {
526 SkCodecPrintf("Error: scaling not supported.\n"); 529 SkCodecPrintf("Error: scaling not supported.\n");
527 return kInvalidScale; 530 return kInvalidScale;
528 } 531 }
529 if (!conversion_possible(dstInfo, this->getInfo())) { 532 if (!conversion_possible(dstInfo, this->getInfo())) {
530 SkCodecPrintf("Error: cannot convert input type to output type.\n"); 533 SkCodecPrintf("Error: cannot convert input type to output type.\n");
531 return kInvalidConversion; 534 return kInvalidConversion;
532 } 535 }
533 536
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after
1102 uint32_t alphaBit = 1105 uint32_t alphaBit =
1103 (srcBuffer.get()[quotient] >> shift) & 0x1; 1106 (srcBuffer.get()[quotient] >> shift) & 0x1;
1104 dstRow[x] &= alphaBit - 1; 1107 dstRow[x] &= alphaBit - 1;
1105 } 1108 }
1106 } 1109 }
1107 } 1110 }
1108 1111
1109 // Finished decoding the entire image 1112 // Finished decoding the entire image
1110 return kSuccess; 1113 return kSuccess;
1111 } 1114 }
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