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

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

Issue 1472933002: Make SkAndroidCodec support ico (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Response to comments Created 5 years 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/SkAndroidCodec.cpp ('k') | src/codec/SkBmpStandardCodec.h » ('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 "SkBmpCodec.h" 8 #include "SkBmpCodec.h"
9 #include "SkBmpMaskCodec.h" 9 #include "SkBmpMaskCodec.h"
10 #include "SkBmpRLECodec.h" 10 #include "SkBmpRLECodec.h"
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 } 474 }
475 475
476 if (codecOut) { 476 if (codecOut) {
477 // Set the image info 477 // Set the image info
478 const SkImageInfo& imageInfo = SkImageInfo::Make(width, height, 478 const SkImageInfo& imageInfo = SkImageInfo::Make(width, height,
479 colorType, alphaType); 479 colorType, alphaType);
480 480
481 // Return the codec 481 // Return the codec
482 switch (inputFormat) { 482 switch (inputFormat) {
483 case kStandard_BmpInputFormat: 483 case kStandard_BmpInputFormat:
484 // We require streams to have a memory base for Bmp-in-Ico decod es.
485 SkASSERT(!inIco || nullptr != stream->getMemoryBase());
484 *codecOut = new SkBmpStandardCodec(imageInfo, stream, bitsPerPix el, numColors, 486 *codecOut = new SkBmpStandardCodec(imageInfo, stream, bitsPerPix el, numColors,
485 bytesPerColor, offset - bytesRead, rowOrder, inIco); 487 bytesPerColor, offset - bytesRead, rowOrder, inIco);
486 return true; 488 return true;
487 case kBitMask_BmpInputFormat: 489 case kBitMask_BmpInputFormat:
488 // Bmp-in-Ico must be standard mode 490 // Bmp-in-Ico must be standard mode
489 if (inIco) { 491 if (inIco) {
490 SkCodecPrintf("Error: Icos may not use bit mask format.\n"); 492 SkCodecPrintf("Error: Icos may not use bit mask format.\n");
491 return false; 493 return false;
492 } 494 }
493 495
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
571 return prepareToDecode(dstInfo, options, inputColorPtr, inputColorCount); 573 return prepareToDecode(dstInfo, options, inputColorPtr, inputColorCount);
572 } 574 }
573 575
574 int SkBmpCodec::onGetScanlines(void* dst, int count, size_t rowBytes) { 576 int SkBmpCodec::onGetScanlines(void* dst, int count, size_t rowBytes) {
575 // Create a new image info representing the portion of the image to decode 577 // Create a new image info representing the portion of the image to decode
576 SkImageInfo rowInfo = this->dstInfo().makeWH(this->dstInfo().width(), count) ; 578 SkImageInfo rowInfo = this->dstInfo().makeWH(this->dstInfo().width(), count) ;
577 579
578 // Decode the requested rows 580 // Decode the requested rows
579 return this->decodeRows(rowInfo, dst, rowBytes, this->options()); 581 return this->decodeRows(rowInfo, dst, rowBytes, this->options());
580 } 582 }
OLDNEW
« no previous file with comments | « src/codec/SkAndroidCodec.cpp ('k') | src/codec/SkBmpStandardCodec.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698