OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 | 60 |
61 class MockImageDecoder : public ImageDecoder { | 61 class MockImageDecoder : public ImageDecoder { |
62 public: | 62 public: |
63 static std::unique_ptr<MockImageDecoder> create( | 63 static std::unique_ptr<MockImageDecoder> create( |
64 MockImageDecoderClient* client) { | 64 MockImageDecoderClient* client) { |
65 return makeUnique<MockImageDecoder>(client); | 65 return makeUnique<MockImageDecoder>(client); |
66 } | 66 } |
67 | 67 |
68 MockImageDecoder(MockImageDecoderClient* client) | 68 MockImageDecoder(MockImageDecoderClient* client) |
69 : ImageDecoder(AlphaPremultiplied, | 69 : ImageDecoder(AlphaPremultiplied, |
70 ColorSpaceApplied, | 70 ColorSpaceTransformed, |
| 71 targetColorSpaceForTesting(), |
71 noDecodedImageByteLimit), | 72 noDecodedImageByteLimit), |
72 m_client(client) {} | 73 m_client(client) {} |
73 | 74 |
74 ~MockImageDecoder() { m_client->decoderBeingDestroyed(); } | 75 ~MockImageDecoder() { m_client->decoderBeingDestroyed(); } |
75 | 76 |
76 IntSize decodedSize() const override { | 77 IntSize decodedSize() const override { |
77 return m_client->decodedSize().isEmpty() ? size() : m_client->decodedSize(); | 78 return m_client->decodedSize().isEmpty() ? size() : m_client->decodedSize(); |
78 } | 79 } |
79 | 80 |
80 String filenameExtension() const override { return "mock"; } | 81 String filenameExtension() const override { return "mock"; } |
(...skipping 24 matching lines...) Expand all Loading... |
105 | 106 |
106 size_t decodeFrameCount() override { return m_client->frameCount(); } | 107 size_t decodeFrameCount() override { return m_client->frameCount(); } |
107 | 108 |
108 void decode(size_t index) override { | 109 void decode(size_t index) override { |
109 m_client->decodeRequested(); | 110 m_client->decodeRequested(); |
110 m_frameBufferCache[index].setStatus(m_client->status()); | 111 m_frameBufferCache[index].setStatus(m_client->status()); |
111 } | 112 } |
112 | 113 |
113 void initializeNewFrame(size_t index) override { | 114 void initializeNewFrame(size_t index) override { |
114 m_frameBufferCache[index].setSizeAndColorSpace( | 115 m_frameBufferCache[index].setSizeAndColorSpace( |
115 size().width(), size().height(), colorSpace()); | 116 size().width(), size().height(), colorSpaceForSkImages()); |
116 m_frameBufferCache[index].setHasAlpha(false); | 117 m_frameBufferCache[index].setHasAlpha(false); |
117 } | 118 } |
118 | 119 |
119 MockImageDecoderClient* m_client; | 120 MockImageDecoderClient* m_client; |
120 }; | 121 }; |
121 | 122 |
122 class MockImageDecoderFactory : public ImageDecoderFactory { | 123 class MockImageDecoderFactory : public ImageDecoderFactory { |
123 public: | 124 public: |
124 static std::unique_ptr<MockImageDecoderFactory> create( | 125 static std::unique_ptr<MockImageDecoderFactory> create( |
125 MockImageDecoderClient* client, | 126 MockImageDecoderClient* client, |
(...skipping 20 matching lines...) Expand all Loading... |
146 const IntSize& decodedSize) | 147 const IntSize& decodedSize) |
147 : m_client(client), m_decodedSize(decodedSize) {} | 148 : m_client(client), m_decodedSize(decodedSize) {} |
148 | 149 |
149 MockImageDecoderClient* m_client; | 150 MockImageDecoderClient* m_client; |
150 IntSize m_decodedSize; | 151 IntSize m_decodedSize; |
151 }; | 152 }; |
152 | 153 |
153 } // namespace blink | 154 } // namespace blink |
154 | 155 |
155 #endif // MockImageDecoder_h | 156 #endif // MockImageDecoder_h |
OLD | NEW |