| 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 | 76 |
| 77 void loadImage(const char* fileName) | 77 void loadImage(const char* fileName) |
| 78 { | 78 { |
| 79 RefPtr<SharedBuffer> imageData = readFile(fileName); | 79 RefPtr<SharedBuffer> imageData = readFile(fileName); |
| 80 ASSERT_TRUE(imageData.get()); | 80 ASSERT_TRUE(imageData.get()); |
| 81 | 81 |
| 82 m_image->setData(imageData, true); | 82 m_image->setData(imageData, true); |
| 83 EXPECT_EQ(0u, decodedSize()); | 83 EXPECT_EQ(0u, decodedSize()); |
| 84 | 84 |
| 85 size_t frameCount = m_image->frameCount(); | 85 size_t frameCount = m_image->frameCount(); |
| 86 SkBitmap dummy; |
| 86 for (size_t i = 0; i < frameCount; ++i) | 87 for (size_t i = 0; i < frameCount; ++i) |
| 87 m_image->frameAtIndex(i); | 88 m_image->frameAtIndex(i, &dummy); |
| 88 } | 89 } |
| 89 | 90 |
| 90 size_t decodedSize() | 91 size_t decodedSize() |
| 91 { | 92 { |
| 92 // In the context of this test, the following loop will give the correct
result, but only because the test | 93 // In the context of this test, the following loop will give the correct
result, but only because the test |
| 93 // forces all frames to be decoded in loadImage() above. There is no gen
eral guarantee that frameDecodedSize() | 94 // forces all frames to be decoded in loadImage() above. There is no gen
eral guarantee that frameDecodedSize() |
| 94 // is up-to-date. Because of how multi frame images (like GIF) work, req
uesting one frame to be decoded may | 95 // is up-to-date. Because of how multi frame images (like GIF) work, req
uesting one frame to be decoded may |
| 95 // require other previous frames to be decoded as well. In those cases f
rameDecodedSize() wouldn't return the | 96 // require other previous frames to be decoded as well. In those cases f
rameDecodedSize() wouldn't return the |
| 96 // correct thing for the previous frame because the decoded size wouldn'
t have propagated upwards to the | 97 // correct thing for the previous frame because the decoded size wouldn'
t have propagated upwards to the |
| 97 // BitmapImage frame cache. | 98 // BitmapImage frame cache. |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 TEST_F(BitmapImageTest, icoHasWrongFrameDimensions) | 229 TEST_F(BitmapImageTest, icoHasWrongFrameDimensions) |
| 229 { | 230 { |
| 230 loadImage("/LayoutTests/fast/images/resources/wrong-frame-dimensions.ico"); | 231 loadImage("/LayoutTests/fast/images/resources/wrong-frame-dimensions.ico"); |
| 231 // This call would cause crash without fix for 408026 | 232 // This call would cause crash without fix for 408026 |
| 232 imageForDefaultFrame(); | 233 imageForDefaultFrame(); |
| 233 } | 234 } |
| 234 | 235 |
| 235 #endif // USE(QCMSLIB) | 236 #endif // USE(QCMSLIB) |
| 236 | 237 |
| 237 } // namespace blink | 238 } // namespace blink |
| OLD | NEW |