| 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 "SkCodec.h" | 8 #include "SkCodec.h" |
| 9 #include "SkColorTable.h" | 9 #include "SkColorTable.h" |
| 10 #include "SkPngChunkReader.h" | 10 #include "SkPngChunkReader.h" |
| 11 #include "SkEncodedFormat.h" | 11 #include "SkEncodedFormat.h" |
| 12 #include "SkImageInfo.h" | 12 #include "SkImageInfo.h" |
| 13 #include "SkRefCnt.h" | 13 #include "SkRefCnt.h" |
| 14 #include "SkSwizzler.h" | 14 #include "SkSwizzler.h" |
| 15 | 15 |
| 16 #include "png.h" | 16 #include "png.h" |
| 17 | 17 |
| 18 class SkStream; | 18 class SkStream; |
| 19 | 19 |
| 20 class SkPngCodec : public SkCodec { | 20 class SkPngCodec : public SkCodec { |
| 21 public: | 21 public: |
| 22 static bool IsPng(SkStream*); | 22 static bool IsPng(const char*, size_t); |
| 23 | 23 |
| 24 // Assume IsPng was called and returned true. | 24 // Assume IsPng was called and returned true. |
| 25 static SkCodec* NewFromStream(SkStream*, SkPngChunkReader* = NULL); | 25 static SkCodec* NewFromStream(SkStream*, SkPngChunkReader* = NULL); |
| 26 | 26 |
| 27 virtual ~SkPngCodec(); | 27 virtual ~SkPngCodec(); |
| 28 | 28 |
| 29 protected: | 29 protected: |
| 30 Result onGetPixels(const SkImageInfo&, void*, size_t, const Options&, SkPMCo
lor*, int*, int*) | 30 Result onGetPixels(const SkImageInfo&, void*, size_t, const Options&, SkPMCo
lor*, int*, int*) |
| 31 override; | 31 override; |
| 32 SkEncodedFormat onGetEncodedFormat() const override { return kPNG_SkEncodedF
ormat; } | 32 SkEncodedFormat onGetEncodedFormat() const override { return kPNG_SkEncodedF
ormat; } |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 SkSwizzler::SrcConfig fSrcConfig; | 74 SkSwizzler::SrcConfig fSrcConfig; |
| 75 const int fNumberPasses; | 75 const int fNumberPasses; |
| 76 int fBitDepth; | 76 int fBitDepth; |
| 77 AlphaState fAlphaState; | 77 AlphaState fAlphaState; |
| 78 | 78 |
| 79 bool decodePalette(bool premultiply, int* ctableCount); | 79 bool decodePalette(bool premultiply, int* ctableCount); |
| 80 void destroyReadStruct(); | 80 void destroyReadStruct(); |
| 81 | 81 |
| 82 typedef SkCodec INHERITED; | 82 typedef SkCodec INHERITED; |
| 83 }; | 83 }; |
| OLD | NEW |