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