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

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

Issue 388253004: Drawing an animated image to a canvas now behave as expected (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Corrections according to comments + rebase master 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
« no previous file with comments | « Source/platform/graphics/BitmapImage.h ('k') | Source/platform/graphics/Image.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) 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 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 if (index < m_frames.size() && m_frames[index].m_haveMetadata) 360 if (index < m_frames.size() && m_frames[index].m_haveMetadata)
361 return m_frames[index].m_duration; 361 return m_frames[index].m_duration;
362 return m_source.frameDurationAtIndex(index); 362 return m_source.frameDurationAtIndex(index);
363 } 363 }
364 364
365 PassRefPtr<NativeImageSkia> BitmapImage::nativeImageForCurrentFrame() 365 PassRefPtr<NativeImageSkia> BitmapImage::nativeImageForCurrentFrame()
366 { 366 {
367 return frameAtIndex(currentFrame()); 367 return frameAtIndex(currentFrame());
368 } 368 }
369 369
370 PassRefPtr<Image> BitmapImage::imageForDefaultFrame()
371 {
372 if (isBitmapImage() && maybeAnimated())
373 return BitmapImage::create(frameAtIndex(0));
374
375 return Image::imageForDefaultFrame();
376 }
377
370 bool BitmapImage::frameHasAlphaAtIndex(size_t index) 378 bool BitmapImage::frameHasAlphaAtIndex(size_t index)
371 { 379 {
372 if (m_frames.size() <= index) 380 if (m_frames.size() <= index)
373 return true; 381 return true;
374 382
375 if (m_frames[index].m_haveMetadata) 383 if (m_frames[index].m_haveMetadata)
376 return m_frames[index].m_hasAlpha; 384 return m_frames[index].m_hasAlpha;
377 385
378 return m_source.frameHasAlphaAtIndex(index); 386 return m_source.frameHasAlphaAtIndex(index);
379 } 387 }
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
624 } 632 }
625 return m_isSolidColor && !m_currentFrame; 633 return m_isSolidColor && !m_currentFrame;
626 } 634 }
627 635
628 Color BitmapImage::solidColor() const 636 Color BitmapImage::solidColor() const
629 { 637 {
630 return m_solidColor; 638 return m_solidColor;
631 } 639 }
632 640
633 } 641 }
OLDNEW
« no previous file with comments | « Source/platform/graphics/BitmapImage.h ('k') | Source/platform/graphics/Image.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698