| OLD | NEW |
| 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 "SkCodec.h" | 9 #include "SkCodec.h" |
| 10 #include "SkCodecPriv.h" | 10 #include "SkCodecPriv.h" |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 return nullptr; | 106 return nullptr; |
| 107 } | 107 } |
| 108 | 108 |
| 109 SkCodec* SkCodec::NewFromData(SkData* data, SkPngChunkReader* reader) { | 109 SkCodec* SkCodec::NewFromData(SkData* data, SkPngChunkReader* reader) { |
| 110 if (!data) { | 110 if (!data) { |
| 111 return nullptr; | 111 return nullptr; |
| 112 } | 112 } |
| 113 return NewFromStream(new SkMemoryStream(data), reader); | 113 return NewFromStream(new SkMemoryStream(data), reader); |
| 114 } | 114 } |
| 115 | 115 |
| 116 SkCodec::SkCodec(const SkImageInfo& info, SkStream* stream) | 116 SkCodec::SkCodec(const SkImageInfo& info, SkStream* stream, SkColorSpace* colorS
pace) |
| 117 : fSrcInfo(info) | 117 : fSrcInfo(info) |
| 118 , fStream(stream) | 118 , fStream(stream) |
| 119 , fNeedsRewind(false) | 119 , fNeedsRewind(false) |
| 120 , fColorSpace(colorSpace ? SkRef(colorSpace) : nullptr) |
| 120 , fDstInfo() | 121 , fDstInfo() |
| 121 , fOptions() | 122 , fOptions() |
| 122 , fCurrScanline(-1) | 123 , fCurrScanline(-1) |
| 123 {} | 124 {} |
| 124 | 125 |
| 125 SkCodec::~SkCodec() {} | 126 SkCodec::~SkCodec() {} |
| 126 | 127 |
| 127 bool SkCodec::rewindIfNeeded() { | 128 bool SkCodec::rewindIfNeeded() { |
| 128 if (!fStream) { | 129 if (!fStream) { |
| 129 // Some codecs do not have a stream, but they hold others that do. They | 130 // Some codecs do not have a stream, but they hold others that do. They |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 SkASSERT(1 == linesRequested || this->getInfo().height() == linesReq
uested); | 378 SkASSERT(1 == linesRequested || this->getInfo().height() == linesReq
uested); |
| 378 const SkImageInfo fillInfo = info.makeWH(fillWidth, 1); | 379 const SkImageInfo fillInfo = info.makeWH(fillWidth, 1); |
| 379 for (int srcY = linesDecoded; srcY < linesRequested; srcY++) { | 380 for (int srcY = linesDecoded; srcY < linesRequested; srcY++) { |
| 380 fillDst = SkTAddOffset<void>(dst, this->outputScanline(srcY) * r
owBytes); | 381 fillDst = SkTAddOffset<void>(dst, this->outputScanline(srcY) * r
owBytes); |
| 381 fill_proc(fillInfo, fillDst, rowBytes, fillValue, zeroInit, samp
ler); | 382 fill_proc(fillInfo, fillDst, rowBytes, fillValue, zeroInit, samp
ler); |
| 382 } | 383 } |
| 383 break; | 384 break; |
| 384 } | 385 } |
| 385 } | 386 } |
| 386 } | 387 } |
| OLD | NEW |