| 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 "SkData.h" | 10 #include "SkData.h" |
| 11 #include "SkCodec_libgif.h" | 11 #include "SkCodec_libgif.h" |
| 12 #include "SkCodec_libico.h" | 12 #include "SkCodec_libico.h" |
| 13 #include "SkCodec_libpng.h" | 13 #include "SkCodec_libpng.h" |
| 14 #include "SkCodec_wbmp.h" | 14 #include "SkCodec_wbmp.h" |
| 15 #include "SkCodecPriv.h" | 15 #include "SkCodecPriv.h" |
| 16 #if !defined(GOOGLE3) | 16 #if !defined(GOOGLE3) |
| 17 #include "SkJpegCodec.h" | 17 #include "SkJpegCodec.h" |
| 18 #endif | 18 #endif |
| 19 #include "SkStream.h" | 19 #include "SkStream.h" |
| 20 #include "SkWebpCodec.h" | 20 #include "SkWebpCodec.h" |
| 21 #include "SkRawCodec.h" |
| 21 | 22 |
| 22 struct DecoderProc { | 23 struct DecoderProc { |
| 23 bool (*IsFormat)(SkStream*); | 24 bool (*IsFormat)(SkStream*); |
| 24 SkCodec* (*NewFromStream)(SkStream*); | 25 SkCodec* (*NewFromStream)(SkStream*); |
| 25 }; | 26 }; |
| 26 | 27 |
| 27 static const DecoderProc gDecoderProcs[] = { | 28 static const DecoderProc gDecoderProcs[] = { |
| 28 { SkPngCodec::IsPng, SkPngCodec::NewFromStream }, | 29 { SkPngCodec::IsPng, SkPngCodec::NewFromStream }, |
| 29 #if !defined(GOOGLE3) | 30 #if !defined(GOOGLE3) |
| 30 { SkJpegCodec::IsJpeg, SkJpegCodec::NewFromStream }, | 31 { SkJpegCodec::IsJpeg, SkJpegCodec::NewFromStream }, |
| 31 #endif | 32 #endif |
| 32 { SkWebpCodec::IsWebp, SkWebpCodec::NewFromStream }, | 33 { SkWebpCodec::IsWebp, SkWebpCodec::NewFromStream }, |
| 33 { SkGifCodec::IsGif, SkGifCodec::NewFromStream }, | 34 { SkGifCodec::IsGif, SkGifCodec::NewFromStream }, |
| 34 { SkIcoCodec::IsIco, SkIcoCodec::NewFromStream }, | 35 { SkIcoCodec::IsIco, SkIcoCodec::NewFromStream }, |
| 35 { SkBmpCodec::IsBmp, SkBmpCodec::NewFromStream }, | 36 { SkBmpCodec::IsBmp, SkBmpCodec::NewFromStream }, |
| 36 { SkWbmpCodec::IsWbmp, SkWbmpCodec::NewFromStream } | 37 { SkWbmpCodec::IsWbmp, SkWbmpCodec::NewFromStream }, |
| 38 { SkRawCodec::IsRaw, SkRawCodec::NewFromStream } |
| 37 }; | 39 }; |
| 38 | 40 |
| 39 SkCodec* SkCodec::NewFromStream(SkStream* stream) { | 41 SkCodec* SkCodec::NewFromStream(SkStream* stream) { |
| 40 if (!stream) { | 42 if (!stream) { |
| 41 return nullptr; | 43 return nullptr; |
| 42 } | 44 } |
| 43 | 45 |
| 44 SkAutoTDelete<SkStream> streamDeleter(stream); | 46 SkAutoTDelete<SkStream> streamDeleter(stream); |
| 45 | 47 |
| 46 SkAutoTDelete<SkCodec> codec(nullptr); | 48 SkAutoTDelete<SkCodec> codec(nullptr); |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 SkASSERT(1 == linesRequested || this->getInfo().height() == linesReq
uested); | 345 SkASSERT(1 == linesRequested || this->getInfo().height() == linesReq
uested); |
| 344 const SkImageInfo fillInfo = info.makeWH(info.width(), 1); | 346 const SkImageInfo fillInfo = info.makeWH(info.width(), 1); |
| 345 for (int srcY = linesDecoded; srcY < linesRequested; srcY++) { | 347 for (int srcY = linesDecoded; srcY < linesRequested; srcY++) { |
| 346 fillDst = SkTAddOffset<void>(dst, this->outputScanline(srcY) * r
owBytes); | 348 fillDst = SkTAddOffset<void>(dst, this->outputScanline(srcY) * r
owBytes); |
| 347 fill_proc(fillInfo, fillDst, rowBytes, fillValue, zeroInit, samp
ler); | 349 fill_proc(fillInfo, fillDst, rowBytes, fillValue, zeroInit, samp
ler); |
| 348 } | 350 } |
| 349 break; | 351 break; |
| 350 } | 352 } |
| 351 } | 353 } |
| 352 } | 354 } |
| OLD | NEW |