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

Unified Diff: Source/core/html/canvas/WebGLRenderingContextBase.cpp

Issue 749653002: WebGL: clarify which Front or Back buffer is used by each API. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase to ToT Created 6 years, 1 month 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: Source/core/html/canvas/WebGLRenderingContextBase.cpp
diff --git a/Source/core/html/canvas/WebGLRenderingContextBase.cpp b/Source/core/html/canvas/WebGLRenderingContextBase.cpp
index 151e37c8648804dee30863e729eda0cf64fff09c..6b9cf49f9f5481824024e3b6a48114020acf8c95 100644
--- a/Source/core/html/canvas/WebGLRenderingContextBase.cpp
+++ b/Source/core/html/canvas/WebGLRenderingContextBase.cpp
@@ -91,10 +91,19 @@
namespace blink {
+namespace {
+
const double secondsBetweenRestoreAttempts = 1.0;
const int maxGLErrorsAllowedToConsole = 256;
const unsigned maxGLActiveContexts = 16;
+DrawingBuffer::SourceBuffer convertSourceBuffer(CanvasRenderingContext::SourceBuffer sourceBuffer)
+{
+ return static_cast<DrawingBuffer::SourceBuffer>(sourceBuffer);
+}
+
+} // namesapce
+
// FIXME: Oilpan: static vectors to heap allocated WebGLRenderingContextBase objects
// are kept here. This relies on the WebGLRenderingContextBase finalization to
// explicitly retire themselves from these vectors, but it'd be preferable if
@@ -915,7 +924,7 @@ void WebGLRenderingContextBase::paintRenderingResultsToCanvas(SourceBuffer sourc
drawingBuffer()->bind();
}
-PassRefPtrWillBeRawPtr<ImageData> WebGLRenderingContextBase::paintRenderingResultsToImageData()
+PassRefPtrWillBeRawPtr<ImageData> WebGLRenderingContextBase::paintRenderingResultsToImageData(SourceBuffer sourceBuffer)
{
if (isContextLost())
return nullptr;
@@ -923,7 +932,8 @@ PassRefPtrWillBeRawPtr<ImageData> WebGLRenderingContextBase::paintRenderingResul
clearIfComposited();
drawingBuffer()->commit();
int width, height;
- RefPtr<Uint8ClampedArray> imageDataPixels = drawingBuffer()->paintRenderingResultsToImageData(width, height);
+ RefPtr<Uint8ClampedArray> imageDataPixels =
+ drawingBuffer()->paintRenderingResultsToImageData(width, height, convertSourceBuffer(sourceBuffer));
if (!imageDataPixels)
return nullptr;
@@ -3557,11 +3567,7 @@ void WebGLRenderingContextBase::texImage2D(GLenum target, GLint level, GLenum in
}
}
- RefPtrWillBeRawPtr<ImageData> imageData = canvas->getImageData();
- if (imageData)
- texImage2D(target, level, internalformat, format, type, imageData.get(), exceptionState);
- else
- texImage2DImpl(target, level, internalformat, format, type, canvas->copiedImage(), WebGLImageConversion::HtmlDomCanvas, m_unpackFlipY, m_unpackPremultiplyAlpha, exceptionState);
+ texImage2DImpl(target, level, internalformat, format, type, canvas->copiedImage(HTMLCanvasElement::Back), WebGLImageConversion::HtmlDomCanvas, m_unpackFlipY, m_unpackPremultiplyAlpha, exceptionState);
}
PassRefPtr<Image> WebGLRenderingContextBase::videoFrameToImage(HTMLVideoElement* video, BackingStoreCopy backingStoreCopy)
@@ -3795,11 +3801,7 @@ void WebGLRenderingContextBase::texSubImage2D(GLenum target, GLint level, GLint
|| !validateTexFunc("texSubImage2D", TexSubImage2D, SourceHTMLCanvasElement, target, level, format, canvas->width(), canvas->height(), 0, format, type, xoffset, yoffset))
return;
- RefPtrWillBeRawPtr<ImageData> imageData = canvas->getImageData();
- if (imageData)
- texSubImage2D(target, level, xoffset, yoffset, format, type, imageData.get(), exceptionState);
- else
- texSubImage2DImpl(target, level, xoffset, yoffset, format, type, canvas->copiedImage(), WebGLImageConversion::HtmlDomCanvas, m_unpackFlipY, m_unpackPremultiplyAlpha, exceptionState);
+ texSubImage2DImpl(target, level, xoffset, yoffset, format, type, canvas->copiedImage(HTMLCanvasElement::Back), WebGLImageConversion::HtmlDomCanvas, m_unpackFlipY, m_unpackPremultiplyAlpha, exceptionState);
}
void WebGLRenderingContextBase::texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,

Powered by Google App Engine
This is Rietveld 408576698