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 * Copyright (C) 2008-2009 Torch Mobile, Inc. | 3 * Copyright (C) 2008-2009 Torch Mobile, Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 23 matching lines...) Expand all Loading... |
34 | 34 |
35 namespace blink { | 35 namespace blink { |
36 | 36 |
37 class JPEGImageReader; | 37 class JPEGImageReader; |
38 | 38 |
39 // This class decodes the JPEG image format. | 39 // This class decodes the JPEG image format. |
40 class PLATFORM_EXPORT JPEGImageDecoder : public ImageDecoder { | 40 class PLATFORM_EXPORT JPEGImageDecoder : public ImageDecoder { |
41 WTF_MAKE_NONCOPYABLE(JPEGImageDecoder); | 41 WTF_MAKE_NONCOPYABLE(JPEGImageDecoder); |
42 public: | 42 public: |
43 JPEGImageDecoder(ImageSource::AlphaOption, ImageSource::GammaAndColorProfile
Option, size_t maxDecodedBytes); | 43 JPEGImageDecoder(ImageSource::AlphaOption, ImageSource::GammaAndColorProfile
Option, size_t maxDecodedBytes); |
44 virtual ~JPEGImageDecoder(); | 44 ~JPEGImageDecoder() override; |
45 | 45 |
46 // ImageDecoder: | 46 // ImageDecoder: |
47 virtual String filenameExtension() const override { return "jpg"; } | 47 String filenameExtension() const override { return "jpg"; } |
48 virtual bool hasColorProfile() const override { return m_hasColorProfile; } | 48 bool hasColorProfile() const override { return m_hasColorProfile; } |
49 virtual IntSize decodedSize() const override { return m_decodedSize; } | 49 IntSize decodedSize() const override { return m_decodedSize; } |
50 virtual IntSize decodedYUVSize(int component, SizeType) const override; | 50 IntSize decodedYUVSize(int component, SizeType) const override; |
51 virtual bool setSize(unsigned width, unsigned height) override; | 51 bool setSize(unsigned width, unsigned height) override; |
52 virtual bool canDecodeToYUV() override; | 52 bool canDecodeToYUV() override; |
53 virtual bool decodeToYUV() override; | 53 bool decodeToYUV() override; |
54 virtual void setImagePlanes(PassOwnPtr<ImagePlanes>) override; | 54 void setImagePlanes(PassOwnPtr<ImagePlanes>) override; |
55 bool hasImagePlanes() const { return m_imagePlanes; } | 55 bool hasImagePlanes() const { return m_imagePlanes; } |
56 | 56 |
57 bool outputScanlines(); | 57 bool outputScanlines(); |
58 unsigned desiredScaleNumerator() const; | 58 unsigned desiredScaleNumerator() const; |
59 void complete(); | 59 void complete(); |
60 | 60 |
61 void setOrientation(ImageOrientation orientation) { m_orientation = orientat
ion; } | 61 void setOrientation(ImageOrientation orientation) { m_orientation = orientat
ion; } |
62 void setHasColorProfile(bool hasColorProfile) { m_hasColorProfile = hasColor
Profile; } | 62 void setHasColorProfile(bool hasColorProfile) { m_hasColorProfile = hasColor
Profile; } |
63 void setDecodedSize(unsigned width, unsigned height); | 63 void setDecodedSize(unsigned width, unsigned height); |
64 | 64 |
65 private: | 65 private: |
66 // ImageDecoder: | 66 // ImageDecoder: |
67 virtual void decodeSize() override { decode(true); } | 67 void decodeSize() override { decode(true); } |
68 virtual void decode(size_t) override { decode(false); } | 68 void decode(size_t) override { decode(false); } |
69 | 69 |
70 // Decodes the image. If |onlySize| is true, stops decoding after | 70 // Decodes the image. If |onlySize| is true, stops decoding after |
71 // calculating the image size. If decoding fails but there is no more | 71 // calculating the image size. If decoding fails but there is no more |
72 // data coming, sets the "decode failure" flag. | 72 // data coming, sets the "decode failure" flag. |
73 void decode(bool onlySize); | 73 void decode(bool onlySize); |
74 | 74 |
75 OwnPtr<JPEGImageReader> m_reader; | 75 OwnPtr<JPEGImageReader> m_reader; |
76 OwnPtr<ImagePlanes> m_imagePlanes; | 76 OwnPtr<ImagePlanes> m_imagePlanes; |
77 IntSize m_decodedSize; | 77 IntSize m_decodedSize; |
78 bool m_hasColorProfile; | 78 bool m_hasColorProfile; |
79 }; | 79 }; |
80 | 80 |
81 } // namespace blink | 81 } // namespace blink |
82 | 82 |
83 #endif | 83 #endif |
OLD | NEW |