OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2008, 2009, Google Inc. All rights reserved. | 2 * Copyright (c) 2008, 2009, Google 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 are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 24 matching lines...) Expand all Loading... |
35 #include "wtf/OwnPtr.h" | 35 #include "wtf/OwnPtr.h" |
36 | 36 |
37 namespace WebCore { | 37 namespace WebCore { |
38 | 38 |
39 // This class decodes the BMP image format. | 39 // This class decodes the BMP image format. |
40 class PLATFORM_EXPORT BMPImageDecoder : public ImageDecoder { | 40 class PLATFORM_EXPORT BMPImageDecoder : public ImageDecoder { |
41 public: | 41 public: |
42 BMPImageDecoder(ImageSource::AlphaOption, ImageSource::GammaAndColorProfileO
ption, size_t maxDecodedBytes); | 42 BMPImageDecoder(ImageSource::AlphaOption, ImageSource::GammaAndColorProfileO
ption, size_t maxDecodedBytes); |
43 | 43 |
44 // ImageDecoder | 44 // ImageDecoder |
45 virtual String filenameExtension() const { return "bmp"; } | 45 virtual String filenameExtension() const OVERRIDE { return "bmp"; } |
46 virtual void setData(SharedBuffer*, bool allDataReceived); | 46 virtual void setData(SharedBuffer*, bool allDataReceived) OVERRIDE; |
47 virtual bool isSizeAvailable(); | 47 virtual bool isSizeAvailable() OVERRIDE; |
48 virtual ImageFrame* frameBufferAtIndex(size_t); | 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 // BMPImageReader! | 51 // BMPImageReader! |
52 virtual bool setFailed(); | 52 virtual bool setFailed() OVERRIDE; |
53 | 53 |
54 private: | 54 private: |
55 inline uint32_t readUint32(int offset) const | 55 inline uint32_t readUint32(int offset) const |
56 { | 56 { |
57 return BMPImageReader::readUint32(m_data.get(), m_decodedOffset + offset
); | 57 return BMPImageReader::readUint32(m_data.get(), m_decodedOffset + offset
); |
58 } | 58 } |
59 | 59 |
60 // Decodes the image. If |onlySize| is true, stops decoding after | 60 // Decodes the image. If |onlySize| is true, stops decoding after |
61 // calculating the image size. If decoding fails but there is no more | 61 // calculating the image size. If decoding fails but there is no more |
62 // data coming, sets the "decode failure" flag. | 62 // data coming, sets the "decode failure" flag. |
(...skipping 13 matching lines...) Expand all Loading... |
76 // BMPImageReader takes over this will not be updated further. | 76 // BMPImageReader takes over this will not be updated further. |
77 size_t m_decodedOffset; | 77 size_t m_decodedOffset; |
78 | 78 |
79 // The reader used to do most of the BMP decoding. | 79 // The reader used to do most of the BMP decoding. |
80 OwnPtr<BMPImageReader> m_reader; | 80 OwnPtr<BMPImageReader> m_reader; |
81 }; | 81 }; |
82 | 82 |
83 } // namespace WebCore | 83 } // namespace WebCore |
84 | 84 |
85 #endif | 85 #endif |
OLD | NEW |