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 24 matching lines...) Expand all Loading... |
35 class PNGImageReader; | 35 class PNGImageReader; |
36 | 36 |
37 // This class decodes the PNG image format. | 37 // This class decodes the PNG image format. |
38 class PLATFORM_EXPORT PNGImageDecoder : public ImageDecoder { | 38 class PLATFORM_EXPORT PNGImageDecoder : public ImageDecoder { |
39 WTF_MAKE_NONCOPYABLE(PNGImageDecoder); | 39 WTF_MAKE_NONCOPYABLE(PNGImageDecoder); |
40 public: | 40 public: |
41 PNGImageDecoder(ImageSource::AlphaOption, ImageSource::GammaAndColorProfileO
ption, size_t maxDecodedBytes); | 41 PNGImageDecoder(ImageSource::AlphaOption, ImageSource::GammaAndColorProfileO
ption, size_t maxDecodedBytes); |
42 virtual ~PNGImageDecoder(); | 42 virtual ~PNGImageDecoder(); |
43 | 43 |
44 // ImageDecoder | 44 // ImageDecoder |
45 virtual String filenameExtension() const OVERRIDE { return "png"; } | 45 virtual String filenameExtension() const override { return "png"; } |
46 virtual bool isSizeAvailable() OVERRIDE; | 46 virtual bool isSizeAvailable() override; |
47 virtual bool hasColorProfile() const OVERRIDE { return m_hasColorProfile; } | 47 virtual bool hasColorProfile() const override { return m_hasColorProfile; } |
48 virtual ImageFrame* frameBufferAtIndex(size_t) OVERRIDE; | 48 virtual ImageFrame* frameBufferAtIndex(size_t) override; |
49 // CAUTION: setFailed() deletes |m_reader|. Be careful to avoid | 49 // CAUTION: setFailed() deletes |m_reader|. Be careful to avoid |
50 // accessing deleted memory, especially when calling this from inside | 50 // accessing deleted memory, especially when calling this from inside |
51 // PNGImageReader! | 51 // PNGImageReader! |
52 virtual bool setFailed() OVERRIDE; | 52 virtual bool setFailed() override; |
53 | 53 |
54 // Callbacks from libpng | 54 // Callbacks from libpng |
55 void headerAvailable(); | 55 void headerAvailable(); |
56 void rowAvailable(unsigned char* rowBuffer, unsigned rowIndex, int interlace
Pass); | 56 void rowAvailable(unsigned char* rowBuffer, unsigned rowIndex, int interlace
Pass); |
57 void pngComplete(); | 57 void pngComplete(); |
58 | 58 |
59 bool isComplete() const | 59 bool isComplete() const |
60 { | 60 { |
61 return !m_frameBufferCache.isEmpty() && (m_frameBufferCache.first().stat
us() == ImageFrame::FrameComplete); | 61 return !m_frameBufferCache.isEmpty() && (m_frameBufferCache.first().stat
us() == ImageFrame::FrameComplete); |
62 } | 62 } |
63 | 63 |
64 private: | 64 private: |
65 // Decodes the image. If |onlySize| is true, stops decoding after | 65 // Decodes the image. If |onlySize| is true, stops decoding after |
66 // calculating the image size. If decoding fails but there is no more | 66 // calculating the image size. If decoding fails but there is no more |
67 // data coming, sets the "decode failure" flag. | 67 // data coming, sets the "decode failure" flag. |
68 void decode(bool onlySize); | 68 void decode(bool onlySize); |
69 | 69 |
70 OwnPtr<PNGImageReader> m_reader; | 70 OwnPtr<PNGImageReader> m_reader; |
71 bool m_doNothingOnFailure; | 71 bool m_doNothingOnFailure; |
72 bool m_hasColorProfile; | 72 bool m_hasColorProfile; |
73 }; | 73 }; |
74 | 74 |
75 } // namespace blink | 75 } // namespace blink |
76 | 76 |
77 #endif | 77 #endif |
OLD | NEW |