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

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

Issue 535823002: Don't crash when an image fails to decode. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 6 years, 3 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) 2006 Samuel Weinig (sam.weinig@gmail.com) 2 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
3 * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved. 3 * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
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 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 return m_source.frameDurationAtIndex(index); 363 return m_source.frameDurationAtIndex(index);
364 } 364 }
365 365
366 PassRefPtr<NativeImageSkia> BitmapImage::nativeImageForCurrentFrame() 366 PassRefPtr<NativeImageSkia> BitmapImage::nativeImageForCurrentFrame()
367 { 367 {
368 return frameAtIndex(currentFrame()); 368 return frameAtIndex(currentFrame());
369 } 369 }
370 370
371 PassRefPtr<Image> BitmapImage::imageForDefaultFrame() 371 PassRefPtr<Image> BitmapImage::imageForDefaultFrame()
372 { 372 {
373 if (frameCount() > 1) 373 if (frameCount() > 1 && frameAtIndex(0))
374 return BitmapImage::create(frameAtIndex(0)); 374 return BitmapImage::create(frameAtIndex(0));
375 375
376 return Image::imageForDefaultFrame(); 376 return Image::imageForDefaultFrame();
377 } 377 }
378 378
379 bool BitmapImage::frameHasAlphaAtIndex(size_t index) 379 bool BitmapImage::frameHasAlphaAtIndex(size_t index)
380 { 380 {
381 if (m_frames.size() <= index) 381 if (m_frames.size() <= index)
382 return true; 382 return true;
383 383
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
633 633
634 return m_isSolidColor && !m_currentFrame; 634 return m_isSolidColor && !m_currentFrame;
635 } 635 }
636 636
637 Color BitmapImage::solidColor() const 637 Color BitmapImage::solidColor() const
638 { 638 {
639 return m_solidColor; 639 return m_solidColor;
640 } 640 }
641 641
642 } // namespace blink 642 } // namespace blink
OLDNEW
« no previous file with comments | « LayoutTests/fast/images/resources/wrong-frame-dimensions.ico ('k') | Source/platform/graphics/BitmapImageTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698