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