OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013, Google Inc. All rights reserved. | 2 * Copyright (c) 2013, 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 are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 EXPECT_EQ(0u, decodedSize()); | 95 EXPECT_EQ(0u, decodedSize()); |
96 | 96 |
97 size_t frameCount = m_image->frameCount(); | 97 size_t frameCount = m_image->frameCount(); |
98 if (loadAllFrames) { | 98 if (loadAllFrames) { |
99 for (size_t i = 0; i < frameCount; ++i) | 99 for (size_t i = 0; i < frameCount; ++i) |
100 frameAtIndex(i); | 100 frameAtIndex(i); |
101 } | 101 } |
102 } | 102 } |
103 | 103 |
104 size_t decodedSize() { | 104 size_t decodedSize() { |
105 // In the context of this test, the following loop will give the correct res
ult, but only because the test | 105 // In the context of this test, the following loop will give the correct |
106 // forces all frames to be decoded in loadImage() above. There is no general
guarantee that frameDecodedSize() | 106 // result, but only because the test forces all frames to be decoded in |
107 // is up to date. Because of how multi frame images (like GIF) work, request
ing one frame to be decoded may | 107 // loadImage() above. There is no general guarantee that frameDecodedSize() |
108 // require other previous frames to be decoded as well. In those cases frame
DecodedSize() wouldn't return the | 108 // is up to date. Because of how multi frame images (like GIF) work, |
109 // correct thing for the previous frame because the decoded size wouldn't ha
ve propagated upwards to the | 109 // requesting one frame to be decoded may require other previous frames to |
110 // BitmapImage frame cache. | 110 // be decoded as well. In those cases frameDecodedSize() wouldn't return the |
| 111 // correct thing for the previous frame because the decoded size wouldn't |
| 112 // have propagated upwards to the BitmapImage frame cache. |
111 size_t size = 0; | 113 size_t size = 0; |
112 for (size_t i = 0; i < decodedFramesCount(); ++i) | 114 for (size_t i = 0; i < decodedFramesCount(); ++i) |
113 size += frameDecodedSize(i); | 115 size += frameDecodedSize(i); |
114 return size; | 116 return size; |
115 } | 117 } |
116 | 118 |
117 void advanceAnimation() { m_image->advanceAnimation(0); } | 119 void advanceAnimation() { m_image->advanceAnimation(0); } |
118 | 120 |
119 int repetitionCount() { return m_image->repetitionCount(true); } | 121 int repetitionCount() { return m_image->repetitionCount(true); } |
120 | 122 |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 OriginRightBottom}, | 327 OriginRightBottom}, |
326 {"/LayoutTests/fast/images/resources/exif-orientation-8-llo.jpg", | 328 {"/LayoutTests/fast/images/resources/exif-orientation-8-llo.jpg", |
327 OriginLeftBottom}}; | 329 OriginLeftBottom}}; |
328 | 330 |
329 INSTANTIATE_TEST_CASE_P( | 331 INSTANTIATE_TEST_CASE_P( |
330 DecodedImageOrientationHistogramTest, | 332 DecodedImageOrientationHistogramTest, |
331 DecodedImageOrientationHistogramTest, | 333 DecodedImageOrientationHistogramTest, |
332 ::testing::ValuesIn(kDecodedImageOrientationHistogramTestParams)); | 334 ::testing::ValuesIn(kDecodedImageOrientationHistogramTestParams)); |
333 | 335 |
334 } // namespace blink | 336 } // namespace blink |
OLD | NEW |