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

Unified Diff: third_party/WebKit/Source/modules/offscreencanvas2d/OffscreenCanvasRenderingContext2D.cpp

Issue 1995733005: Fix 2D canvas state persistency after OffscreenCanvas.transferToImageBitmap (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix test Created 4 years, 7 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
Index: third_party/WebKit/Source/modules/offscreencanvas2d/OffscreenCanvasRenderingContext2D.cpp
diff --git a/third_party/WebKit/Source/modules/offscreencanvas2d/OffscreenCanvasRenderingContext2D.cpp b/third_party/WebKit/Source/modules/offscreencanvas2d/OffscreenCanvasRenderingContext2D.cpp
index 96c8a22dcdc363acd8d5531af65a3079dbbd880c..3b84e6e22ae42fb8e7f025da09be7b285ecd5d5b 100644
--- a/third_party/WebKit/Source/modules/offscreencanvas2d/OffscreenCanvasRenderingContext2D.cpp
+++ b/third_party/WebKit/Source/modules/offscreencanvas2d/OffscreenCanvasRenderingContext2D.cpp
@@ -73,7 +73,11 @@ ImageBuffer* OffscreenCanvasRenderingContext2D::imageBuffer() const
// TODO: crbug.com/593514 Add support for GPU rendering
OffscreenCanvasRenderingContext2D* nonConstThis = const_cast<OffscreenCanvasRenderingContext2D*>(this);
nonConstThis->m_imageBuffer = ImageBuffer::create(IntSize(width(), height()), m_hasAlpha ? NonOpaque : Opaque, InitializeImagePixels);
- // TODO: crbug.com/593349 Restore matrix and clip state on the new ImageBuffer.
+
+ if (m_needsMatrixClipRestore) {
+ restoreMatrixClipStack(m_imageBuffer->canvas());
+ nonConstThis->m_needsMatrixClipRestore = false;
+ }
}
return m_imageBuffer.get();
@@ -88,6 +92,7 @@ ImageBitmap* OffscreenCanvasRenderingContext2D::transferToImageBitmap(ExceptionS
RefPtr<StaticBitmapImage> image = StaticBitmapImage::create(skImage.release());
image->setOriginClean(this->originClean());
m_imageBuffer.reset(); // "Transfer" means no retained buffer
+ m_needsMatrixClipRestore = true;
return ImageBitmap::create(image.release());
}

Powered by Google App Engine
This is Rietveld 408576698