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 { return "png"; } | 45 virtual String filenameExtension() const OVERRIDE { return "png"; } |
46 virtual bool isSizeAvailable(); | 46 virtual bool isSizeAvailable() OVERRIDE; |
47 virtual ImageFrame* frameBufferAtIndex(size_t); | 47 virtual ImageFrame* frameBufferAtIndex(size_t) OVERRIDE; |
48 // CAUTION: setFailed() deletes |m_reader|. Be careful to avoid | 48 // CAUTION: setFailed() deletes |m_reader|. Be careful to avoid |
49 // accessing deleted memory, especially when calling this from inside | 49 // accessing deleted memory, especially when calling this from inside |
50 // PNGImageReader! | 50 // PNGImageReader! |
51 virtual bool setFailed(); | 51 virtual bool setFailed() OVERRIDE; |
52 | 52 |
53 // Callbacks from libpng | 53 // Callbacks from libpng |
54 void headerAvailable(); | 54 void headerAvailable(); |
55 void rowAvailable(unsigned char* rowBuffer, unsigned rowIndex, int interlace
Pass); | 55 void rowAvailable(unsigned char* rowBuffer, unsigned rowIndex, int interlace
Pass); |
56 void pngComplete(); | 56 void pngComplete(); |
57 | 57 |
58 bool isComplete() const | 58 bool isComplete() const |
59 { | 59 { |
60 return !m_frameBufferCache.isEmpty() && (m_frameBufferCache.first().stat
us() == ImageFrame::FrameComplete); | 60 return !m_frameBufferCache.isEmpty() && (m_frameBufferCache.first().stat
us() == ImageFrame::FrameComplete); |
61 } | 61 } |
62 | 62 |
63 private: | 63 private: |
64 // Decodes the image. If |onlySize| is true, stops decoding after | 64 // Decodes the image. If |onlySize| is true, stops decoding after |
65 // calculating the image size. If decoding fails but there is no more | 65 // calculating the image size. If decoding fails but there is no more |
66 // data coming, sets the "decode failure" flag. | 66 // data coming, sets the "decode failure" flag. |
67 void decode(bool onlySize); | 67 void decode(bool onlySize); |
68 | 68 |
69 OwnPtr<PNGImageReader> m_reader; | 69 OwnPtr<PNGImageReader> m_reader; |
70 bool m_doNothingOnFailure; | 70 bool m_doNothingOnFailure; |
71 }; | 71 }; |
72 | 72 |
73 } // namespace WebCore | 73 } // namespace WebCore |
74 | 74 |
75 #endif | 75 #endif |
OLD | NEW |