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

Unified Diff: Source/modules/canvas2d/CanvasRenderingContext2D.cpp

Issue 1288773005: 2D canvas: remain in deferred rendering mode with canvas to canvas drawImage (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: add init of snapShot state Created 5 years, 4 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 | « Source/core/html/HTMLCanvasElement.cpp ('k') | Source/platform/graphics/ImageBuffer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/canvas2d/CanvasRenderingContext2D.cpp
diff --git a/Source/modules/canvas2d/CanvasRenderingContext2D.cpp b/Source/modules/canvas2d/CanvasRenderingContext2D.cpp
index 41d48fe8be8d093508a6b6f92642f749708b670b..4e3e06d2f42195553adec4d946b0c6b8eb677e55 100644
--- a/Source/modules/canvas2d/CanvasRenderingContext2D.cpp
+++ b/Source/modules/canvas2d/CanvasRenderingContext2D.cpp
@@ -1353,6 +1353,20 @@ void CanvasRenderingContext2D::drawImageInternal(SkCanvas* c, CanvasImageSource*
c->restoreToCount(initialSaveCount);
}
+bool shouldDisableDeferral(CanvasImageSource* imageSource)
+{
+ if (imageSource->isVideoElement())
+ return true;
+ if (imageSource->isCanvasElement()) {
+ HTMLCanvasElement* canvas = static_cast<HTMLCanvasElement*>(imageSource);
+ if (canvas->is3D())
+ return true;
+ if (canvas->isAnimated2D())
+ return true;
+ }
+ return false;
+}
+
void CanvasRenderingContext2D::drawImage(CanvasImageSource* imageSource,
float sx, float sy, float sw, float sh,
float dx, float dy, float dw, float dh, ExceptionState& exceptionState)
@@ -1388,12 +1402,7 @@ void CanvasRenderingContext2D::drawImage(CanvasImageSource* imageSource,
if (srcRect.isEmpty())
return;
- // FIXME: crbug.com/521001
- // We make the destination canvas fall out of display list mode by forcing
- // immediate rendering. This is to prevent run-away memory consumption caused by SkSurface
- // copyOnWrite when the source canvas is animated and consumed at a rate higher than the
- // presentation frame rate of the destination canvas.
- if (imageSource->isVideoElement() || imageSource->isCanvasElement())
+ if (shouldDisableDeferral(imageSource))
canvas()->disableDeferral();
validateStateStack();
« no previous file with comments | « Source/core/html/HTMLCanvasElement.cpp ('k') | Source/platform/graphics/ImageBuffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698