Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(341)

Side by Side Diff: Source/platform/graphics/test/MockImageDecoder.h

Issue 418653002: Allowing YUV data to be retrieved from the JPEG Decoder. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Changed unsigned char to appropriate JSAMP... types Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698