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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 String filenameExtension() const override { return "jpg"; } | 47 String filenameExtension() const override { return "jpg"; } |
48 void onSetData(SharedBuffer* data) override; | 48 void onSetData(SharedBuffer* data) override; |
49 bool hasColorProfile() const override { return m_hasColorProfile; } | 49 bool hasColorProfile() const override { return m_hasColorProfile; } |
50 IntSize decodedSize() const override { return m_decodedSize; } | 50 IntSize decodedSize() const override { return m_decodedSize; } |
51 IntSize decodedYUVSize(int component, SizeType) const override; | 51 IntSize decodedYUVSize(int component, SizeType) const override; |
52 bool setSize(unsigned width, unsigned height) override; | 52 bool setSize(unsigned width, unsigned height) override; |
53 bool canDecodeToYUV() override; | 53 bool canDecodeToYUV() override; |
54 bool decodeToYUV() override; | 54 bool decodeToYUV() override; |
55 void setImagePlanes(PassOwnPtr<ImagePlanes>) override; | 55 void setImagePlanes(PassOwnPtr<ImagePlanes>) override; |
56 bool hasImagePlanes() const { return m_imagePlanes; } | 56 bool hasImagePlanes() const { return m_imagePlanes; } |
| 57 void getAvailableDecodeAndScale(ImageFrame::ColorType* outType, float* scale
, float* lowerScale) override; |
| 58 bool activateDecodeAndScale(ImageFrame::ColorType outColor, size_t maxDecode
dBytes = noDecodedImageByteLimit) override; |
| 59 void disableDecodeAndScale() override; |
| 60 bool decodeToRGB565Enabled() const { return (m_decodeColor == ImageFrame::RG
B565); } |
| 61 bool hasFramebufferChanged() const; |
57 | 62 |
58 bool outputScanlines(); | 63 bool outputScanlines(); |
59 unsigned desiredScaleNumerator() const; | 64 unsigned desiredScaleNumerator() const; |
60 void complete(); | 65 void complete(); |
61 | 66 |
62 void setOrientation(ImageOrientation orientation) { m_orientation = orientat
ion; } | 67 void setOrientation(ImageOrientation orientation) { m_orientation = orientat
ion; } |
63 void setHasColorProfile(bool hasColorProfile) { m_hasColorProfile = hasColor
Profile; } | 68 void setHasColorProfile(bool hasColorProfile) { m_hasColorProfile = hasColor
Profile; } |
64 void setDecodedSize(unsigned width, unsigned height); | 69 void setDecodedSize(unsigned width, unsigned height); |
65 | 70 |
66 private: | 71 private: |
67 // ImageDecoder: | 72 // ImageDecoder: |
68 void decodeSize() override { decode(true); } | 73 void decodeSize() override { decode(true); } |
69 void decode(size_t) override { decode(false); } | 74 void decode(size_t) override { decode(false); } |
70 | 75 |
71 // Decodes the image. If |onlySize| is true, stops decoding after | 76 // Decodes the image. If |onlySize| is true, stops decoding after |
72 // calculating the image size. If decoding fails but there is no more | 77 // calculating the image size. If decoding fails but there is no more |
73 // data coming, sets the "decode failure" flag. | 78 // data coming, sets the "decode failure" flag. |
74 void decode(bool onlySize); | 79 void decode(bool onlySize); |
75 | 80 |
76 OwnPtr<JPEGImageReader> m_reader; | 81 OwnPtr<JPEGImageReader> m_reader; |
77 OwnPtr<ImagePlanes> m_imagePlanes; | 82 OwnPtr<ImagePlanes> m_imagePlanes; |
78 IntSize m_decodedSize; | 83 IntSize m_decodedSize; |
79 bool m_hasColorProfile; | 84 bool m_hasColorProfile; |
| 85 ImageFrame::ColorType m_decodeColor; |
| 86 // keep the value to restore after disableDecodeAndScale() |
| 87 size_t m_originalMaxDecodedBytes; |
80 }; | 88 }; |
81 | 89 |
82 } // namespace blink | 90 } // namespace blink |
83 | 91 |
84 #endif | 92 #endif |
OLD | NEW |