| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. | 2 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 namespace blink { | 32 namespace blink { |
| 33 | 33 |
| 34 class PNGImageReader; | 34 class PNGImageReader; |
| 35 | 35 |
| 36 class PLATFORM_EXPORT PNGImageDecoder final : public ImageDecoder { | 36 class PLATFORM_EXPORT PNGImageDecoder final : public ImageDecoder { |
| 37 WTF_MAKE_NONCOPYABLE(PNGImageDecoder); | 37 WTF_MAKE_NONCOPYABLE(PNGImageDecoder); |
| 38 | 38 |
| 39 public: | 39 public: |
| 40 PNGImageDecoder(AlphaOption, | 40 PNGImageDecoder(AlphaOption, |
| 41 ColorSpaceOption, | 41 const ColorBehavior&, |
| 42 sk_sp<SkColorSpace>, | |
| 43 size_t maxDecodedBytes, | 42 size_t maxDecodedBytes, |
| 44 size_t offset = 0); | 43 size_t offset = 0); |
| 45 ~PNGImageDecoder() override; | 44 ~PNGImageDecoder() override; |
| 46 | 45 |
| 47 // ImageDecoder: | 46 // ImageDecoder: |
| 48 String filenameExtension() const override { return "png"; } | 47 String filenameExtension() const override { return "png"; } |
| 49 | 48 |
| 50 // Callbacks from libpng | 49 // Callbacks from libpng |
| 51 void headerAvailable(); | 50 void headerAvailable(); |
| 52 void rowAvailable(unsigned char* row, unsigned rowIndex, int); | 51 void rowAvailable(unsigned char* row, unsigned rowIndex, int); |
| 53 void complete(); | 52 void complete(); |
| 54 | 53 |
| 55 private: | 54 private: |
| 56 // ImageDecoder: | 55 // ImageDecoder: |
| 57 void decodeSize() override { decode(true); } | 56 void decodeSize() override { decode(true); } |
| 58 void decode(size_t) override { decode(false); } | 57 void decode(size_t) override { decode(false); } |
| 59 | 58 |
| 60 // Decodes the image. If |onlySize| is true, stops decoding after | 59 // Decodes the image. If |onlySize| is true, stops decoding after |
| 61 // calculating the image size. If decoding fails but there is no more | 60 // calculating the image size. If decoding fails but there is no more |
| 62 // data coming, sets the "decode failure" flag. | 61 // data coming, sets the "decode failure" flag. |
| 63 void decode(bool onlySize); | 62 void decode(bool onlySize); |
| 64 | 63 |
| 65 std::unique_ptr<PNGImageReader> m_reader; | 64 std::unique_ptr<PNGImageReader> m_reader; |
| 66 const unsigned m_offset; | 65 const unsigned m_offset; |
| 67 }; | 66 }; |
| 68 | 67 |
| 69 } // namespace blink | 68 } // namespace blink |
| 70 | 69 |
| 71 #endif | 70 #endif |
| OLD | NEW |