| 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 #ifndef SkJpegCodec_DEFINED | 8 #ifndef SkJpegCodec_DEFINED |
| 9 #define SkJpegCodec_DEFINED | 9 #define SkJpegCodec_DEFINED |
| 10 | 10 |
| 11 #include "SkCodec.h" | 11 #include "SkCodec.h" |
| 12 #include "SkImageInfo.h" | 12 #include "SkImageInfo.h" |
| 13 #include "SkJpegDecoderMgr.h" | 13 #include "SkJpegDecoderMgr.h" |
| 14 #include "SkJpegUtility_codec.h" | 14 #include "SkJpegUtility_codec.h" |
| 15 #include "SkStream.h" | 15 #include "SkStream.h" |
| 16 | 16 |
| 17 extern "C" { | 17 extern "C" { |
| 18 #include "jpeglib.h" | 18 #include "jpeglib.h" |
| 19 } | 19 } |
| 20 | 20 |
| 21 /* | 21 /* |
| 22 * | 22 * |
| 23 * This class implements the decoding for jpeg images | 23 * This class implements the decoding for jpeg images |
| 24 * | 24 * |
| 25 */ | 25 */ |
| 26 class SkJpegCodec : public SkCodec { | 26 class SkJpegCodec : public SkCodec { |
| 27 public: | 27 public: |
| 28 | 28 static bool IsJpeg(const char*, size_t); |
| 29 /* | |
| 30 * Checks the start of the stream to see if the image is a jpeg | |
| 31 * Does not take ownership of the stream | |
| 32 */ | |
| 33 static bool IsJpeg(SkStream*); | |
| 34 | 29 |
| 35 /* | 30 /* |
| 36 * Assumes IsJpeg was called and returned true | 31 * Assumes IsJpeg was called and returned true |
| 37 * Creates a jpeg decoder | 32 * Creates a jpeg decoder |
| 38 * Takes ownership of the stream | 33 * Takes ownership of the stream |
| 39 */ | 34 */ |
| 40 static SkCodec* NewFromStream(SkStream*); | 35 static SkCodec* NewFromStream(SkStream*); |
| 41 | 36 |
| 42 protected: | 37 protected: |
| 43 | 38 |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 | 112 |
| 118 // scanline decoding | 113 // scanline decoding |
| 119 SkAutoMalloc fStorage; // Only used if sampling is needed | 114 SkAutoMalloc fStorage; // Only used if sampling is needed |
| 120 uint8_t* fSrcRow; // Only used if sampling is needed | 115 uint8_t* fSrcRow; // Only used if sampling is needed |
| 121 SkAutoTDelete<SkSwizzler> fSwizzler; | 116 SkAutoTDelete<SkSwizzler> fSwizzler; |
| 122 | 117 |
| 123 typedef SkCodec INHERITED; | 118 typedef SkCodec INHERITED; |
| 124 }; | 119 }; |
| 125 | 120 |
| 126 #endif | 121 #endif |
| OLD | NEW |