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

Unified Diff: Source/core/html/canvas/CanvasRenderingContext2D.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: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | Source/platform/graphics/BitmapImage.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/canvas/CanvasRenderingContext2D.cpp
diff --git a/Source/core/html/canvas/CanvasRenderingContext2D.cpp b/Source/core/html/canvas/CanvasRenderingContext2D.cpp
index d71fa2918bff5ff9cda380ecc013c34614338c6e..5dd6509af524b176c9527359cfa176b8c7cf3ddf 100644
--- a/Source/core/html/canvas/CanvasRenderingContext2D.cpp
+++ b/Source/core/html/canvas/CanvasRenderingContext2D.cpp
@@ -61,6 +61,7 @@
#include "core/rendering/RenderTheme.h"
#include "platform/fonts/FontCache.h"
#include "platform/geometry/FloatQuad.h"
+#include "platform/graphics/BitmapImage.h"
#include "platform/graphics/DrawLooperBuilder.h"
#include "platform/graphics/GraphicsContextStateSaver.h"
#include "platform/text/TextRun.h"
@@ -1508,6 +1509,9 @@ void CanvasRenderingContext2D::drawImageInternal(CanvasImageSource* imageSource,
if (srcRect.isEmpty())
return;
+ if (image->isBitmapImage() && image->maybeAnimated())
+ image = BitmapImage::create(static_cast<BitmapImage*>(image.get())->frameAtIndex(0));
Justin Novosad 2014/07/16 19:36:02 Would be cleaner to put this logic inside BitmapIm
Rémi Piotaix 2014/07/17 17:38:20 Done.
+
FloatRect dirtyRect = clipBounds;
if (imageSource->isVideoElement()) {
drawVideo(static_cast<HTMLVideoElement*>(imageSource), srcRect, dstRect);
« no previous file with comments | « no previous file | Source/platform/graphics/BitmapImage.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698