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

Side by Side Diff: Source/platform/graphics/BitmapImageTest.cpp

Issue 1001703003: Take NativeImageSkia out behind the woodshed. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Switch to skia-style API (return bool instead of SkBitmap) Created 5 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « Source/platform/graphics/BitmapImage.cpp ('k') | Source/platform/graphics/BitmapPattern.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 ASSERT_TRUE(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
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
OLDNEW
« no previous file with comments | « Source/platform/graphics/BitmapImage.cpp ('k') | Source/platform/graphics/BitmapPattern.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698