| 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 26 matching lines...) Expand all Loading... |
| 37 virtual ImageFrame::Status status() = 0; | 37 virtual ImageFrame::Status status() = 0; |
| 38 virtual size_t frameCount() = 0; | 38 virtual size_t frameCount() = 0; |
| 39 virtual int repetitionCount() const = 0; | 39 virtual int repetitionCount() const = 0; |
| 40 virtual float frameDuration() const = 0; | 40 virtual float frameDuration() const = 0; |
| 41 | 41 |
| 42 // Clients can control the behavior of MockImageDecoder::decodedSize() by | 42 // Clients can control the behavior of MockImageDecoder::decodedSize() by |
| 43 // overriding this method. The default implementation causes | 43 // overriding this method. The default implementation causes |
| 44 // MockImageDecoder::decodedSize() to return the same thing as | 44 // MockImageDecoder::decodedSize() to return the same thing as |
| 45 // MockImageDecoder::size(). See the precise implementation of | 45 // MockImageDecoder::size(). See the precise implementation of |
| 46 // MockImageDecoder::decodedSize() below. | 46 // MockImageDecoder::decodedSize() below. |
| 47 virtual IntSize decodedSize() const { return IntSize(); } | 47 virtual IntSize decodedSize(int component = 0) const { return IntSize(); } |
| 48 }; | 48 }; |
| 49 | 49 |
| 50 class MockImageDecoder : public ImageDecoder { | 50 class MockImageDecoder : public ImageDecoder { |
| 51 public: | 51 public: |
| 52 static PassOwnPtr<MockImageDecoder> create(MockImageDecoderClient* client) {
return adoptPtr(new MockImageDecoder(client)); } | 52 static PassOwnPtr<MockImageDecoder> create(MockImageDecoderClient* client) {
return adoptPtr(new MockImageDecoder(client)); } |
| 53 | 53 |
| 54 MockImageDecoder(MockImageDecoderClient* client) | 54 MockImageDecoder(MockImageDecoderClient* client) |
| 55 : ImageDecoder(ImageSource::AlphaPremultiplied, ImageSource::GammaAndCol
orProfileApplied, noDecodedImageByteLimit) | 55 : ImageDecoder(ImageSource::AlphaPremultiplied, ImageSource::GammaAndCol
orProfileApplied, noDecodedImageByteLimit) |
| 56 , m_client(client) | 56 , m_client(client) |
| 57 { } | 57 { } |
| 58 | 58 |
| 59 ~MockImageDecoder() | 59 ~MockImageDecoder() |
| 60 { | 60 { |
| 61 m_client->decoderBeingDestroyed(); | 61 m_client->decoderBeingDestroyed(); |
| 62 } | 62 } |
| 63 | 63 |
| 64 virtual IntSize decodedSize() const OVERRIDE | 64 virtual IntSize decodedSize(int component = 0) const OVERRIDE |
| 65 { | 65 { |
| 66 return m_client->decodedSize().isEmpty() ? size() : m_client->decodedSiz
e(); | 66 return m_client->decodedSize(component).isEmpty() ? size() : m_client->d
ecodedSize(component); |
| 67 } | 67 } |
| 68 | 68 |
| 69 virtual bool setSize(unsigned width, unsigned height) OVERRIDE | 69 virtual bool setSize(unsigned width, unsigned height) OVERRIDE |
| 70 { | 70 { |
| 71 ImageDecoder::setSize(width, height); | 71 ImageDecoder::setSize(width, height); |
| 72 m_frameBufferCache.resize(1); | 72 m_frameBufferCache.resize(1); |
| 73 m_frameBufferCache[0].setSize(width, height); | 73 m_frameBufferCache[0].setSize(width, height); |
| 74 return true; | 74 return true; |
| 75 } | 75 } |
| 76 | 76 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 { | 140 { |
| 141 } | 141 } |
| 142 | 142 |
| 143 MockImageDecoderClient* m_client; | 143 MockImageDecoderClient* m_client; |
| 144 IntSize m_decodedSize; | 144 IntSize m_decodedSize; |
| 145 }; | 145 }; |
| 146 | 146 |
| 147 } // namespace blink | 147 } // namespace blink |
| 148 | 148 |
| 149 #endif // MockImageDecoder_h | 149 #endif // MockImageDecoder_h |
| OLD | NEW |