Diff
Modified: trunk/Source/WebCore/CMakeLists.txt (181467 => 181468)
--- trunk/Source/WebCore/CMakeLists.txt 2015-03-13 01:57:59 UTC (rev 181467)
+++ trunk/Source/WebCore/CMakeLists.txt 2015-03-13 02:01:42 UTC (rev 181468)
@@ -3074,8 +3074,6 @@
platform/graphics/ANGLEWebKitBridge.cpp
platform/graphics/GraphicsContext3D.cpp
platform/graphics/FormatConverter.cpp
-
- platform/graphics/gpu/DrawingBuffer.cpp
)
endif ()
Modified: trunk/Source/WebCore/ChangeLog (181467 => 181468)
--- trunk/Source/WebCore/ChangeLog 2015-03-13 01:57:59 UTC (rev 181467)
+++ trunk/Source/WebCore/ChangeLog 2015-03-13 02:01:42 UTC (rev 181468)
@@ -1,3 +1,62 @@
+2015-03-12 Zan Dobersek <[email protected]>
+
+ Remove DrawingBuffer
+ https://bugs.webkit.org/show_bug.cgi?id=142641
+
+ Reviewed by Darin Adler.
+
+ Remove the DrawingBuffer class. Objects of this type were only held in the
+ WebGLRenderingContext (later renamed to WebGLRenderingContextBase) on the
+ Chromium port, with the relevant code removed in r147888. Since then, the
+ m_drawingBuffer member variable has always been null.
+
+ * CMakeLists.txt:
+ * PlatformEfl.cmake:
+ * PlatformGTK.cmake:
+ * WebCore.vcxproj/WebCore.vcxproj:
+ * WebCore.vcxproj/WebCore.vcxproj.filters:
+ * WebCore.xcodeproj/project.pbxproj:
+ * html/canvas/WebGL2RenderingContext.cpp:
+ (WebCore::WebGL2RenderingContext::copyTexImage2D):
+ * html/canvas/WebGLRenderingContext.cpp:
+ (WebCore::WebGLRenderingContext::copyTexImage2D):
+ * html/canvas/WebGLRenderingContextBase.cpp:
+ (WebCore::WebGLRenderingContextBase::WebGLRenderingContextBase):
+ (WebCore::WebGLRenderingContextBase::initializeNewContext):
+ (WebCore::WebGLRenderingContextBase::destroyGraphicsContext3D):
+ (WebCore::WebGLRenderingContextBase::markContextChanged):
+ (WebCore::WebGLRenderingContextBase::clearIfComposited):
+ (WebCore::WebGLRenderingContextBase::paintRenderingResultsToCanvas):
+ (WebCore::WebGLRenderingContextBase::paintRenderingResultsToImageData):
+ (WebCore::WebGLRenderingContextBase::reshape):
+ (WebCore::WebGLRenderingContextBase::drawingBufferWidth):
+ (WebCore::WebGLRenderingContextBase::drawingBufferHeight):
+ (WebCore::WebGLRenderingContextBase::activeTexture):
+ (WebCore::WebGLRenderingContextBase::bindFramebuffer):
+ (WebCore::WebGLRenderingContextBase::bindTexture):
+ (WebCore::WebGLRenderingContextBase::copyTexSubImage2D):
+ (WebCore::WebGLRenderingContextBase::deleteFramebuffer):
+ (WebCore::WebGLRenderingContextBase::disable):
+ (WebCore::WebGLRenderingContextBase::enable):
+ (WebCore::WebGLRenderingContextBase::getContextAttributes):
+ (WebCore::WebGLRenderingContextBase::readPixels):
+ (WebCore::WebGLRenderingContextBase::loseContextImpl):
+ (WebCore::WebGLRenderingContextBase::getBoundFramebufferWidth):
+ (WebCore::WebGLRenderingContextBase::getBoundFramebufferHeight):
+ (WebCore::WebGLRenderingContextBase::maybeRestoreContext):
+ * html/canvas/WebGLRenderingContextBase.h:
+ (WebCore::ScopedDrawingBufferBinder::ScopedDrawingBufferBinder): Deleted.
+ (WebCore::ScopedDrawingBufferBinder::~ScopedDrawingBufferBinder): Deleted.
+ * platform/graphics/GraphicsContext.h:
+ * platform/graphics/GraphicsContext3D.h:
+ * platform/graphics/cairo/DrawingBufferCairo.cpp: Removed.
+ * platform/graphics/gpu/DrawingBuffer.cpp: Removed.
+ * platform/graphics/gpu/DrawingBuffer.h: Removed.
+ * platform/graphics/gpu/mac/DrawingBufferMac.mm: Removed.
+ * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
+ (WebCore::GraphicsContext3D::paintRenderingResultsToCanvas):
+ (WebCore::GraphicsContext3D::paintRenderingResultsToImageData):
+
2015-03-12 Ryosuke Niwa <[email protected]>
REGRESSION(r180726): Removing an empty line at the end of textarea clears the entire texture
Modified: trunk/Source/WebCore/PlatformEfl.cmake (181467 => 181468)
--- trunk/Source/WebCore/PlatformEfl.cmake 2015-03-13 01:57:59 UTC (rev 181467)
+++ trunk/Source/WebCore/PlatformEfl.cmake 2015-03-13 02:01:42 UTC (rev 181468)
@@ -113,7 +113,6 @@
platform/graphics/cairo/BackingStoreBackendCairoImpl.cpp
platform/graphics/cairo/BitmapImageCairo.cpp
platform/graphics/cairo/CairoUtilities.cpp
- platform/graphics/cairo/DrawingBufferCairo.cpp
platform/graphics/cairo/FontCairo.cpp
platform/graphics/cairo/FontCairoHarfbuzzNG.cpp
platform/graphics/cairo/GradientCairo.cpp
Modified: trunk/Source/WebCore/PlatformGTK.cmake (181467 => 181468)
--- trunk/Source/WebCore/PlatformGTK.cmake 2015-03-13 01:57:59 UTC (rev 181467)
+++ trunk/Source/WebCore/PlatformGTK.cmake 2015-03-13 02:01:42 UTC (rev 181468)
@@ -71,7 +71,6 @@
platform/graphics/cairo/BackingStoreBackendCairoX11.cpp
platform/graphics/cairo/BitmapImageCairo.cpp
platform/graphics/cairo/CairoUtilities.cpp
- platform/graphics/cairo/DrawingBufferCairo.cpp
platform/graphics/cairo/FloatRectCairo.cpp
platform/graphics/cairo/FontCairo.cpp
platform/graphics/cairo/FontCairoHarfbuzzNG.cpp
Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj (181467 => 181468)
--- trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj 2015-03-13 01:57:59 UTC (rev 181467)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj 2015-03-13 02:01:42 UTC (rev 181468)
@@ -7432,7 +7432,6 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\platform\graphics\egl\GLContextEGL.cpp" />
- <ClCompile Include="..\platform\graphics\gpu\DrawingBuffer.cpp" />
<ClCompile Include="..\platform\graphics\gpu\Texture.cpp" />
<ClCompile Include="..\platform\graphics\gpu\TilingData.cpp" />
<ClCompile Include="..\platform\graphics\FormatConverter.cpp" />
@@ -19449,7 +19448,6 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|x64'">true</ExcludedFromBuild>
</ClInclude>
<ClInclude Include="..\platform\graphics\egl\GLContextEGL.h" />
- <ClInclude Include="..\platform\graphics\gpu\DrawingBuffer.h" />
<ClInclude Include="..\platform\graphics\gpu\Texture.h" />
<ClInclude Include="..\platform\graphics\gpu\TilingData.h" />
<ClInclude Include="..\platform\graphics\FormatConverter.h" />
Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters (181467 => 181468)
--- trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters 2015-03-13 01:57:59 UTC (rev 181467)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters 2015-03-13 02:01:42 UTC (rev 181468)
@@ -6511,9 +6511,6 @@
<ClCompile Include="..\platform\graphics\OpenGLShims.cpp">
<Filter>platform\graphics</Filter>
</ClCompile>
- <ClCompile Include="..\platform\graphics\gpu\DrawingBuffer.cpp">
- <Filter>platform\graphics\gpu</Filter>
- </ClCompile>
<ClCompile Include="..\platform\graphics\gpu\Texture.cpp">
<Filter>platform\graphics\gpu</Filter>
</ClCompile>
@@ -13889,9 +13886,6 @@
<ClInclude Include="..\platform\graphics\OpenGLShims.h">
<Filter>platform\graphics</Filter>
</ClInclude>
- <ClInclude Include="..\platform\graphics\gpu\DrawingBuffer.h">
- <Filter>platform\graphics\gpu</Filter>
- </ClInclude>
<ClInclude Include="..\platform\graphics\gpu\Texture.h">
<Filter>platform\graphics\gpu</Filter>
</ClInclude>
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (181467 => 181468)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2015-03-13 01:57:59 UTC (rev 181467)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2015-03-13 02:01:42 UTC (rev 181468)
@@ -1665,13 +1665,10 @@
498391520F1E76B400C23782 /* DOMWebKitCSSMatrixInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 4983914F0F1E76B400C23782 /* DOMWebKitCSSMatrixInternal.h */; };
498391580F1E776900C23782 /* WebKitCSSMatrix.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 498391550F1E776900C23782 /* WebKitCSSMatrix.cpp */; };
498391590F1E776900C23782 /* WebKitCSSMatrix.h in Headers */ = {isa = PBXBuildFile; fileRef = 498391560F1E776900C23782 /* WebKitCSSMatrix.h */; };
- 498770DB1242C535002226BA /* DrawingBuffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 498770C21242C535002226BA /* DrawingBuffer.cpp */; };
- 498770DC1242C535002226BA /* DrawingBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 498770C31242C535002226BA /* DrawingBuffer.h */; };
498770F01242C535002226BA /* Texture.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 498770D71242C535002226BA /* Texture.cpp */; };
498770F11242C535002226BA /* Texture.h in Headers */ = {isa = PBXBuildFile; fileRef = 498770D81242C535002226BA /* Texture.h */; };
498770F21242C535002226BA /* TilingData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 498770D91242C535002226BA /* TilingData.cpp */; };
498770F31242C535002226BA /* TilingData.h in Headers */ = {isa = PBXBuildFile; fileRef = 498770DA1242C535002226BA /* TilingData.h */; };
- 498771531243F9FA002226BA /* DrawingBufferMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 498771521243F9FA002226BA /* DrawingBufferMac.mm */; };
4998AEC613F9D0EA0090B1AA /* RequestAnimationFrameCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = 4998AEC413F9D0EA0090B1AA /* RequestAnimationFrameCallback.h */; };
4998AECD13F9D6C90090B1AA /* JSRequestAnimationFrameCallback.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4998AECB13F9D6C90090B1AA /* JSRequestAnimationFrameCallback.cpp */; };
4998AECE13F9D6C90090B1AA /* JSRequestAnimationFrameCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = 4998AECC13F9D6C90090B1AA /* JSRequestAnimationFrameCallback.h */; };
@@ -8798,13 +8795,10 @@
498391550F1E776900C23782 /* WebKitCSSMatrix.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebKitCSSMatrix.cpp; sourceTree = "<group>"; };
498391560F1E776900C23782 /* WebKitCSSMatrix.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebKitCSSMatrix.h; sourceTree = "<group>"; };
498391570F1E776900C23782 /* WebKitCSSMatrix.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebKitCSSMatrix.idl; sourceTree = "<group>"; };
- 498770C21242C535002226BA /* DrawingBuffer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DrawingBuffer.cpp; path = gpu/DrawingBuffer.cpp; sourceTree = "<group>"; };
- 498770C31242C535002226BA /* DrawingBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DrawingBuffer.h; path = gpu/DrawingBuffer.h; sourceTree = "<group>"; };
498770D71242C535002226BA /* Texture.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Texture.cpp; path = gpu/Texture.cpp; sourceTree = "<group>"; };
498770D81242C535002226BA /* Texture.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Texture.h; path = gpu/Texture.h; sourceTree = "<group>"; };
498770D91242C535002226BA /* TilingData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = TilingData.cpp; path = gpu/TilingData.cpp; sourceTree = "<group>"; };
498770DA1242C535002226BA /* TilingData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TilingData.h; path = gpu/TilingData.h; sourceTree = "<group>"; };
- 498771521243F9FA002226BA /* DrawingBufferMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = DrawingBufferMac.mm; path = gpu/mac/DrawingBufferMac.mm; sourceTree = "<group>"; };
4998AEC413F9D0EA0090B1AA /* RequestAnimationFrameCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RequestAnimationFrameCallback.h; sourceTree = "<group>"; };
4998AEC513F9D0EA0090B1AA /* RequestAnimationFrameCallback.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = RequestAnimationFrameCallback.idl; sourceTree = "<group>"; };
4998AECB13F9D6C90090B1AA /* JSRequestAnimationFrameCallback.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSRequestAnimationFrameCallback.cpp; sourceTree = "<group>"; };
@@ -16072,8 +16066,6 @@
isa = PBXGroup;
children = (
498771161242CD7F002226BA /* mac */,
- 498770C21242C535002226BA /* DrawingBuffer.cpp */,
- 498770C31242C535002226BA /* DrawingBuffer.h */,
498770D71242C535002226BA /* Texture.cpp */,
498770D81242C535002226BA /* Texture.h */,
498770D91242C535002226BA /* TilingData.cpp */,
@@ -16082,14 +16074,6 @@
name = gpu;
sourceTree = "<group>";
};
- 498771161242CD7F002226BA /* mac */ = {
- isa = PBXGroup;
- children = (
- 498771521243F9FA002226BA /* DrawingBufferMac.mm */,
- );
- name = mac;
- sourceTree = "<group>";
- };
499B3EC0128CCC1800E726C2 /* ca */ = {
isa = PBXGroup;
children = (
@@ -24444,7 +24428,6 @@
A7B6E69F0B291A9600D0529F /* DragData.h in Headers */,
A7CFB3D20B7ED10A0070C32D /* DragImage.h in Headers */,
81F65FF613788FAA00FF6F2D /* DragState.h in Headers */,
- 498770DC1242C535002226BA /* DrawingBuffer.h in Headers */,
E1BA66F11742BD8600C20251 /* DynamicLinkerInterposing.h in Headers */,
CE1252451A16C22500864480 /* DynamicLinkerSPI.h in Headers */,
FD6ED2C8136B8E66003CF072 /* DynamicsCompressor.h in Headers */,
@@ -27958,8 +27941,6 @@
A7CFB3D10B7ED10A0070C32D /* DragImage.cpp in Sources */,
0FDA7C23188330A900C954B5 /* DragImageIOS.mm in Sources */,
A7CFB3D50B7ED1180070C32D /* DragImageMac.mm in Sources */,
- 498770DB1242C535002226BA /* DrawingBuffer.cpp in Sources */,
- 498771531243F9FA002226BA /* DrawingBufferMac.mm in Sources */,
FD6ED2C7136B8E66003CF072 /* DynamicsCompressor.cpp in Sources */,
FD537356137B653B00008DCE /* DynamicsCompressorKernel.cpp in Sources */,
FD6ED2C3136B8E42003CF072 /* DynamicsCompressorNode.cpp in Sources */,
Modified: trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.cpp (181467 => 181468)
--- trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.cpp 2015-03-13 01:57:59 UTC (rev 181467)
+++ trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.cpp 2015-03-13 02:01:42 UTC (rev 181468)
@@ -1092,11 +1092,9 @@
return;
}
clearIfComposited();
- if (isResourceSafe()) {
- ScopedDrawingBufferBinder binder(m_drawingBuffer.get(), m_framebufferBinding.get());
+ if (isResourceSafe())
m_context->copyTexImage2D(target, level, internalformat, x, y, width, height, border);
- } else {
- ScopedDrawingBufferBinder binder(m_drawingBuffer.get(), m_framebufferBinding.get());
+ else {
GC3Dint clippedX, clippedY;
GC3Dsizei clippedWidth, clippedHeight;
if (clip2D(x, y, width, height, getBoundFramebufferWidth(), getBoundFramebufferHeight(), &clippedX, &clippedY, &clippedWidth, &clippedHeight)) {
Modified: trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp (181467 => 181468)
--- trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp 2015-03-13 01:57:59 UTC (rev 181467)
+++ trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp 2015-03-13 02:01:42 UTC (rev 181468)
@@ -441,11 +441,9 @@
return;
}
clearIfComposited();
- if (isResourceSafe()) {
- ScopedDrawingBufferBinder binder(m_drawingBuffer.get(), m_framebufferBinding.get());
+ if (isResourceSafe())
m_context->copyTexImage2D(target, level, internalformat, x, y, width, height, border);
- } else {
- ScopedDrawingBufferBinder binder(m_drawingBuffer.get(), m_framebufferBinding.get());
+ else {
GC3Dint clippedX, clippedY;
GC3Dsizei clippedWidth, clippedHeight;
if (clip2D(x, y, width, height, getBoundFramebufferWidth(), getBoundFramebufferHeight(), &clippedX, &clippedY, &clippedWidth, &clippedHeight)) {
Modified: trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp (181467 => 181468)
--- trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp 2015-03-13 01:57:59 UTC (rev 181467)
+++ trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp 2015-03-13 02:01:42 UTC (rev 181468)
@@ -429,7 +429,6 @@
: CanvasRenderingContext(passedCanvas)
, ActiveDOMObject(&passedCanvas->document())
, m_context(0)
- , m_drawingBuffer(0)
, m_dispatchContextLostEventTimer(*this, &WebGLRenderingContextBase::dispatchContextLostEvent)
, m_restoreAllowed(false)
, m_restoreTimer(*this, &WebGLRenderingContextBase::maybeRestoreContext)
@@ -448,7 +447,6 @@
: CanvasRenderingContext(passedCanvas)
, ActiveDOMObject(&passedCanvas->document())
, m_context(context)
- , m_drawingBuffer(0)
, m_dispatchContextLostEventTimer(*this, &WebGLRenderingContextBase::dispatchContextLostEvent)
, m_restoreAllowed(false)
, m_restoreTimer(*this, &WebGLRenderingContextBase::maybeRestoreContext)
@@ -470,9 +468,6 @@
m_maxViewportDims[0] = m_maxViewportDims[1] = 0;
m_context->getIntegerv(GraphicsContext3D::MAX_VIEWPORT_DIMS, m_maxViewportDims);
- if (m_drawingBuffer)
- m_drawingBuffer->bind();
-
setupFlags();
initializeNewContext();
}
@@ -547,9 +542,6 @@
initVertexAttrib0();
IntSize canvasSize = clampedCanvasSize();
- if (m_drawingBuffer)
- m_drawingBuffer->reset(canvasSize);
-
m_context->reshape(canvasSize.width(), canvasSize.height());
m_context->viewport(0, 0, canvasSize.width(), canvasSize.height());
m_context->scissor(0, 0, canvasSize.width(), canvasSize.height());
@@ -623,11 +615,6 @@
if (m_isPendingPolicyResolution)
return;
- // The drawing buffer holds a context reference. It must also be destroyed
- // in order for the context to be released.
- if (m_drawingBuffer)
- m_drawingBuffer.clear();
-
if (m_context) {
m_context->setContextLostCallback(nullptr);
m_context->setErrorMessageCallback(nullptr);
@@ -642,9 +629,6 @@
m_context->markContextChanged();
- if (m_drawingBuffer)
- m_drawingBuffer->markContentsChanged();
-
m_layerCleared = false;
RenderBox* renderBox = canvas()->renderBox();
if (isAccelerated() && renderBox && renderBox->hasAcceleratedCompositing()) {
@@ -697,13 +681,9 @@
clearMask |= GraphicsContext3D::STENCIL_BUFFER_BIT;
m_context->stencilMaskSeparate(GraphicsContext3D::FRONT, 0xFFFFFFFF);
}
- if (m_drawingBuffer)
- m_drawingBuffer->clearFramebuffers(clearMask);
- else {
- if (m_framebufferBinding)
- m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, 0);
- m_context->clear(clearMask);
- }
+ if (m_framebufferBinding)
+ m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, 0);
+ m_context->clear(clearMask);
restoreStateAfterClear();
if (m_framebufferBinding)
@@ -759,16 +739,7 @@
canvas()->clearCopiedImage();
m_markedCanvasDirty = false;
- if (m_drawingBuffer)
- m_drawingBuffer->commit();
- m_context->paintRenderingResultsToCanvas(canvas()->buffer(), m_drawingBuffer.get());
-
- if (m_drawingBuffer) {
- if (m_framebufferBinding)
- m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, objectOrZero(m_framebufferBinding.get()));
- else
- m_drawingBuffer->bind();
- }
+ m_context->paintRenderingResultsToCanvas(canvas()->buffer());
}
PassRefPtr<ImageData> WebGLRenderingContextBase::paintRenderingResultsToImageData()
@@ -776,18 +747,7 @@
if (isContextLostOrPending())
return nullptr;
clearIfComposited();
- if (m_drawingBuffer)
- m_drawingBuffer->commit();
- RefPtr<ImageData> imageData = m_context->paintRenderingResultsToImageData(m_drawingBuffer.get());
-
- if (m_drawingBuffer) {
- if (m_framebufferBinding)
- m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, objectOrZero(m_framebufferBinding.get()));
- else
- m_drawingBuffer->bind();
- }
-
- return imageData;
+ return m_context->paintRenderingResultsToImageData();
}
void WebGLRenderingContextBase::reshape(int width, int height)
@@ -815,11 +775,7 @@
// We don't have to mark the canvas as dirty, since the newly created image buffer will also start off
// clear (and this matches what reshape will do).
- if (m_drawingBuffer) {
- m_drawingBuffer->reset(IntSize(width, height));
- restoreStateAfterClear();
- } else
- m_context->reshape(width, height);
+ m_context->reshape(width, height);
m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, objectOrZero(m_textureUnits[m_activeTextureUnit].texture2DBinding.get()));
m_context->bindRenderbuffer(GraphicsContext3D::RENDERBUFFER, objectOrZero(m_renderbufferBinding.get()));
@@ -829,17 +785,11 @@
int WebGLRenderingContextBase::drawingBufferWidth() const
{
- if (m_drawingBuffer)
- return m_drawingBuffer->size().width();
-
return m_context->getInternalFramebufferSize().width();
}
int WebGLRenderingContextBase::drawingBufferHeight() const
{
- if (m_drawingBuffer)
- return m_drawingBuffer->size().height();
-
return m_context->getInternalFramebufferSize().height();
}
@@ -876,9 +826,6 @@
}
m_activeTextureUnit = texture - GraphicsContext3D::TEXTURE0;
m_context->activeTexture(texture);
-
- if (m_drawingBuffer)
- m_drawingBuffer->setActiveTextureUnit(texture);
}
void WebGLRenderingContextBase::attachShader(WebGLProgram* program, WebGLShader* shader, ExceptionCode& ec)
@@ -968,13 +915,7 @@
return;
}
m_framebufferBinding = buffer;
- if (m_drawingBuffer)
- m_drawingBuffer->setFramebufferBinding(objectOrZero(m_framebufferBinding.get()));
- if (!m_framebufferBinding && m_drawingBuffer) {
- // Instead of binding fb 0, bind the drawing buffer.
- m_drawingBuffer->bind();
- } else
- m_context->bindFramebuffer(target, objectOrZero(buffer));
+ m_context->bindFramebuffer(target, objectOrZero(buffer));
if (buffer)
buffer->setHasEverBeenBound();
applyStencilTest();
@@ -1014,10 +955,6 @@
if (target == GraphicsContext3D::TEXTURE_2D) {
m_textureUnits[m_activeTextureUnit].texture2DBinding = texture;
maxLevel = m_maxTextureLevel;
-
- if (m_drawingBuffer && !m_activeTextureUnit)
- m_drawingBuffer->setTexture2DBinding(objectOrZero(texture));
-
} else if (target == GraphicsContext3D::TEXTURE_CUBE_MAP) {
m_textureUnits[m_activeTextureUnit].textureCubeMapBinding = texture;
maxLevel = m_maxCubeMapTextureLevel;
@@ -1430,10 +1367,9 @@
return;
}
clearIfComposited();
- if (isResourceSafe()) {
- ScopedDrawingBufferBinder binder(m_drawingBuffer.get(), m_framebufferBinding.get());
+ if (isResourceSafe())
m_context->copyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
- } else {
+ else {
GC3Dint clippedX, clippedY;
GC3Dsizei clippedWidth, clippedHeight;
if (clip2D(x, y, width, height, getBoundFramebufferWidth(), getBoundFramebufferHeight(), &clippedX, &clippedY, &clippedWidth, &clippedHeight)) {
@@ -1455,15 +1391,11 @@
memset(zero.get(), 0, size);
}
m_context->texSubImage2D(target, level, xoffset, yoffset, width, height, format, type, zero.get());
- if (clippedWidth > 0 && clippedHeight > 0) {
- ScopedDrawingBufferBinder binder(m_drawingBuffer.get(), m_framebufferBinding.get());
+ if (clippedWidth > 0 && clippedHeight > 0)
m_context->copyTexSubImage2D(target, level, xoffset + clippedX - x, yoffset + clippedY - y,
clippedX, clippedY, clippedWidth, clippedHeight);
- }
- } else {
- ScopedDrawingBufferBinder binder(m_drawingBuffer.get(), m_framebufferBinding.get());
+ } else
m_context->copyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
- }
}
}
@@ -1565,12 +1497,7 @@
return;
if (framebuffer == m_framebufferBinding) {
m_framebufferBinding = 0;
- if (m_drawingBuffer) {
- m_drawingBuffer->setFramebufferBinding(0);
- // Have to call bindFramebuffer here to bind back to internal fbo.
- m_drawingBuffer->bind();
- } else
- m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, 0);
+ m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, 0);
}
}
@@ -1658,11 +1585,8 @@
applyStencilTest();
return;
}
- if (cap == GraphicsContext3D::SCISSOR_TEST) {
+ if (cap == GraphicsContext3D::SCISSOR_TEST)
m_scissorEnabled = false;
- if (m_drawingBuffer)
- m_drawingBuffer->setScissorEnabled(m_scissorEnabled);
- }
m_context->disable(cap);
}
@@ -1952,11 +1876,8 @@
applyStencilTest();
return;
}
- if (cap == GraphicsContext3D::SCISSOR_TEST) {
+ if (cap == GraphicsContext3D::SCISSOR_TEST)
m_scissorEnabled = true;
- if (m_drawingBuffer)
- m_drawingBuffer->setScissorEnabled(m_scissorEnabled);
- }
m_context->enable(cap);
}
@@ -2203,17 +2124,12 @@
// Also, we need to enforce requested values of "false" for depth
// and stencil, regardless of the properties of the underlying
- // GraphicsContext3D or DrawingBuffer.
+ // GraphicsContext3D.
RefPtr<WebGLContextAttributes> attributes = WebGLContextAttributes::create(m_context->getContextAttributes());
if (!m_attributes.depth)
attributes->setDepth(false);
if (!m_attributes.stencil)
attributes->setStencil(false);
- if (m_drawingBuffer) {
- // The DrawingBuffer obtains its parameters from GraphicsContext3D::getContextAttributes(),
- // but it makes its own determination of whether multisampling is supported.
- attributes->setAntialias(m_drawingBuffer->multisample());
- }
return attributes.release();
}
@@ -2867,7 +2783,6 @@
void* data = ""
{
- ScopedDrawingBufferBinder binder(m_drawingBuffer.get(), m_framebufferBinding.get());
if (m_isRobustnessEXTSupported)
m_context->getExtensions()->readnPixelsEXT(x, y, width, height, format, type, pixels->byteLength(), data);
else
@@ -3828,12 +3743,6 @@
detachAndRemoveAllObjects();
- if (m_drawingBuffer) {
- // Make absolutely sure we do not refer to an already-deleted texture or framebuffer.
- m_drawingBuffer->setTexture2DBinding(0);
- m_drawingBuffer->setFramebufferBinding(0);
- }
-
// There is no direct way to clear errors from a GL implementation and
// looping until getError() becomes NO_ERROR might cause an infinite loop if
// the driver or context implementation had a bug. So, loop a reasonably
@@ -4118,14 +4027,14 @@
{
if (m_framebufferBinding && m_framebufferBinding->object())
return m_framebufferBinding->getColorBufferWidth();
- return m_drawingBuffer ? m_drawingBuffer->size().width() : m_context->getInternalFramebufferSize().width();
+ return m_context->getInternalFramebufferSize().width();
}
int WebGLRenderingContextBase::getBoundFramebufferHeight()
{
if (m_framebufferBinding && m_framebufferBinding->object())
return m_framebufferBinding->getColorBufferHeight();
- return m_drawingBuffer ? m_drawingBuffer->size().height() : m_context->getInternalFramebufferSize().height();
+ return m_context->getInternalFramebufferSize().height();
}
WebGLTexture* WebGLRenderingContextBase::validateTextureBinding(const char* functionName, GC3Denum target, bool useSixEnumsForCubeMap)
@@ -4842,15 +4751,6 @@
return;
}
- // Construct a new drawing buffer with the new GraphicsContext3D.
- if (m_drawingBuffer) {
- m_drawingBuffer->discardResources();
- DrawingBuffer::PreserveDrawingBuffer preserve = m_attributes.preserveDrawingBuffer ? DrawingBuffer::Preserve : DrawingBuffer::Discard;
- DrawingBuffer::AlphaRequirement alpha = m_attributes.alpha ? DrawingBuffer::Alpha : DrawingBuffer::Opaque;
- m_drawingBuffer = DrawingBuffer::create(context.get(), m_drawingBuffer->size(), preserve, alpha);
- m_drawingBuffer->bind();
- }
-
m_context = context;
m_contextLost = false;
setupFlags();
Modified: trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.h (181467 => 181468)
--- trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.h 2015-03-13 01:57:59 UTC (rev 181467)
+++ trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.h 2015-03-13 02:01:42 UTC (rev 181468)
@@ -28,7 +28,6 @@
#include "ActiveDOMObject.h"
#include "CanvasRenderingContext.h"
-#include "DrawingBuffer.h"
#include "GraphicsContext3D.h"
#include "ImageBuffer.h"
#include "Timer.h"
@@ -86,29 +85,6 @@
typedef int ExceptionCode;
-class ScopedDrawingBufferBinder {
-public:
- ScopedDrawingBufferBinder(DrawingBuffer* drawingBuffer, WebGLFramebuffer* framebufferBinding)
- : m_drawingBuffer(drawingBuffer)
- , m_framebufferBinding(framebufferBinding)
- {
- // Commit DrawingBuffer if needed (e.g., for multisampling)
- if (!m_framebufferBinding && m_drawingBuffer)
- m_drawingBuffer->commit();
- }
-
- ~ScopedDrawingBufferBinder()
- {
- // Restore DrawingBuffer if needed
- if (!m_framebufferBinding && m_drawingBuffer)
- m_drawingBuffer->bind();
- }
-
-private:
- DrawingBuffer* m_drawingBuffer;
- WebGLFramebuffer* m_framebufferBinding;
-};
-
inline void clip1D(GC3Dint start, GC3Dsizei range, GC3Dsizei sourceRange, GC3Dint* clippedStart, GC3Dsizei* clippedRange)
{
ASSERT(clippedStart && clippedRange);
@@ -456,10 +432,6 @@
RefPtr<GraphicsContext3D> m_context;
RefPtr<WebGLContextGroup> m_contextGroup;
- // Optional structure for rendering to a DrawingBuffer, instead of directly
- // to the back-buffer of m_context.
- RefPtr<DrawingBuffer> m_drawingBuffer;
-
// Dispatches a context lost event once it is determined that one is needed.
// This is used both for synthetic and real context losses. For real ones, it's
// likely that there's no _javascript_ on the stack, but that might be dependent
Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext.h (181467 => 181468)
--- trunk/Source/WebCore/platform/graphics/GraphicsContext.h 2015-03-13 01:57:59 UTC (rev 181467)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext.h 2015-03-13 02:01:42 UTC (rev 181468)
@@ -73,7 +73,6 @@
const int cMisspellingLinePatternGapWidth = 1;
class AffineTransform;
- class DrawingBuffer;
class FloatRoundedRect;
class Gradient;
class GraphicsContextPlatformPrivate;
Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h (181467 => 181468)
--- trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h 2015-03-13 01:57:59 UTC (rev 181467)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h 2015-03-13 02:01:42 UTC (rev 181468)
@@ -84,7 +84,6 @@
const Platform3DObject NullPlatform3DObject = 0;
namespace WebCore {
-class DrawingBuffer;
class Extensions3D;
#if USE(OPENGL_ES_2)
class Extensions3DOpenGLES;
@@ -1132,8 +1131,8 @@
bool layerComposited() const;
void forceContextLost();
- void paintRenderingResultsToCanvas(ImageBuffer*, DrawingBuffer*);
- PassRefPtr<ImageData> paintRenderingResultsToImageData(DrawingBuffer*);
+ void paintRenderingResultsToCanvas(ImageBuffer*);
+ PassRefPtr<ImageData> paintRenderingResultsToImageData();
bool paintCompositedResultsToCanvas(ImageBuffer*);
#if PLATFORM(IOS)
Deleted: trunk/Source/WebCore/platform/graphics/cairo/DrawingBufferCairo.cpp (181467 => 181468)
--- trunk/Source/WebCore/platform/graphics/cairo/DrawingBufferCairo.cpp 2015-03-13 01:57:59 UTC (rev 181467)
+++ trunk/Source/WebCore/platform/graphics/cairo/DrawingBufferCairo.cpp 2015-03-13 02:01:42 UTC (rev 181468)
@@ -1,45 +0,0 @@
-/*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "DrawingBuffer.h"
-
-#if USE(CAIRO) && (ENABLE(ACCELERATED_2D_CANVAS) || USE(3D_GRAPHICS))
-#include "Extensions3D.h"
-
-namespace WebCore {
-
-unsigned DrawingBuffer::frontColorBuffer() const
-{
- return colorBuffer();
-}
-
-void DrawingBuffer::paintCompositedResultsToCanvas(ImageBuffer*)
-{
-}
-
-}
-
-#endif // USE(CAIRO) && (ENABLE(ACCELERATED_2D_CANVAS) || USE(3D_GRAPHICS))
Deleted: trunk/Source/WebCore/platform/graphics/gpu/DrawingBuffer.cpp (181467 => 181468)
--- trunk/Source/WebCore/platform/graphics/gpu/DrawingBuffer.cpp 2015-03-13 01:57:59 UTC (rev 181467)
+++ trunk/Source/WebCore/platform/graphics/gpu/DrawingBuffer.cpp 2015-03-13 02:01:42 UTC (rev 181468)
@@ -1,466 +0,0 @@
-/*
- * Copyright (c) 2010, Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-
-#if ENABLE(ACCELERATED_2D_CANVAS) || USE(3D_GRAPHICS)
-
-#include "DrawingBuffer.h"
-
-#include "Extensions3D.h"
-#include "GraphicsContext3D.h"
-
-namespace WebCore {
-
-#if PLATFORM(WIN) || USE(CAIRO)
-DrawingBuffer::DrawingBuffer(GraphicsContext3D* context, const IntSize& size, bool multisampleExtensionSupported, bool packedDepthStencilExtensionSupported, PreserveDrawingBuffer preserveDrawingBuffer, AlphaRequirement alpha)
- : m_preserveDrawingBuffer(preserveDrawingBuffer)
- , m_alpha(alpha)
- , m_scissorEnabled(false)
- , m_texture2DBinding(0)
- , m_framebufferBinding(0)
- , m_activeTextureUnit(GraphicsContext3D::TEXTURE0)
- , m_context(context)
- , m_size(-1, -1)
- , m_multisampleExtensionSupported(multisampleExtensionSupported)
- , m_packedDepthStencilExtensionSupported(packedDepthStencilExtensionSupported)
- , m_fbo(context->createFramebuffer())
- , m_colorBuffer(0)
- , m_frontColorBuffer(0)
- , m_separateFrontTexture(false)
- , m_depthStencilBuffer(0)
- , m_depthBuffer(0)
- , m_stencilBuffer(0)
- , m_multisampleFBO(0)
- , m_multisampleColorBuffer(0)
-{
- ASSERT(m_fbo);
- if (!m_fbo) {
- clear();
- return;
- }
-
- // create a texture to render into
- m_colorBuffer = context->createTexture();
- context->bindTexture(GraphicsContext3D::TEXTURE_2D, m_colorBuffer);
- context->texParameterf(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MAG_FILTER, GraphicsContext3D::LINEAR);
- context->texParameterf(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MIN_FILTER, GraphicsContext3D::LINEAR);
- context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_S, GraphicsContext3D::CLAMP_TO_EDGE);
- context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_T, GraphicsContext3D::CLAMP_TO_EDGE);
- context->bindTexture(GraphicsContext3D::TEXTURE_2D, 0);
-
- createSecondaryBuffers();
- reset(size);
-}
-
-DrawingBuffer::~DrawingBuffer()
-{
- clear();
-}
-#endif
-
-// Global resource ceiling (expressed in terms of pixels) for DrawingBuffer creation and resize.
-// When this limit is set, DrawingBuffer::create() and DrawingBuffer::reset() calls that would
-// exceed the global cap will instead clear the buffer.
-static int s_maximumResourceUsePixels = 0;
-static int s_currentResourceUsePixels = 0;
-static const float s_resourceAdjustedRatio = 0.5;
-
-PassRefPtr<DrawingBuffer> DrawingBuffer::create(GraphicsContext3D* context, const IntSize& size, PreserveDrawingBuffer preserve, AlphaRequirement alpha)
-{
- Extensions3D* extensions = context->getExtensions();
- bool multisampleSupported = extensions->maySupportMultisampling()
- && extensions->supports("GL_ANGLE_framebuffer_blit")
- && extensions->supports("GL_ANGLE_framebuffer_multisample")
- && extensions->supports("GL_OES_rgb8_rgba8");
- if (multisampleSupported) {
- extensions->ensureEnabled("GL_ANGLE_framebuffer_blit");
- extensions->ensureEnabled("GL_ANGLE_framebuffer_multisample");
- extensions->ensureEnabled("GL_OES_rgb8_rgba8");
- }
- bool packedDepthStencilSupported = extensions->supports("GL_OES_packed_depth_stencil");
- if (packedDepthStencilSupported)
- extensions->ensureEnabled("GL_OES_packed_depth_stencil");
- RefPtr<DrawingBuffer> drawingBuffer = adoptRef(new DrawingBuffer(context, size, multisampleSupported, packedDepthStencilSupported, preserve, alpha));
- return (drawingBuffer->m_context) ? drawingBuffer.release() : 0;
-}
-
-void DrawingBuffer::clear()
-{
- if (!m_context)
- return;
-
- m_context->makeContextCurrent();
-
- if (!m_size.isEmpty()) {
- s_currentResourceUsePixels -= m_size.width() * m_size.height();
- m_size = IntSize();
- }
-
- if (m_colorBuffer) {
- m_context->deleteTexture(m_colorBuffer);
- m_colorBuffer = 0;
- }
-
- if (m_frontColorBuffer) {
- m_context->deleteTexture(m_frontColorBuffer);
- m_frontColorBuffer = 0;
- }
-
- if (m_multisampleColorBuffer) {
- m_context->deleteRenderbuffer(m_multisampleColorBuffer);
- m_multisampleColorBuffer = 0;
- }
-
- if (m_depthStencilBuffer) {
- m_context->deleteRenderbuffer(m_depthStencilBuffer);
- m_depthStencilBuffer = 0;
- }
-
- if (m_depthBuffer) {
- m_context->deleteRenderbuffer(m_depthBuffer);
- m_depthBuffer = 0;
- }
-
- if (m_stencilBuffer) {
- m_context->deleteRenderbuffer(m_stencilBuffer);
- m_stencilBuffer = 0;
- }
-
- if (m_multisampleFBO) {
- m_context->deleteFramebuffer(m_multisampleFBO);
- m_multisampleFBO = 0;
- }
-
- if (m_fbo) {
- m_context->deleteFramebuffer(m_fbo);
- m_fbo = 0;
- }
-}
-
-void DrawingBuffer::createSecondaryBuffers()
-{
- // create a multisample FBO
- if (multisample()) {
- m_multisampleFBO = m_context->createFramebuffer();
- m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_multisampleFBO);
- m_multisampleColorBuffer = m_context->createRenderbuffer();
- }
-}
-
-void DrawingBuffer::resizeDepthStencil(int sampleCount)
-{
- const GraphicsContext3D::Attributes& attributes = m_context->getContextAttributes();
- if (attributes.depth && attributes.stencil && m_packedDepthStencilExtensionSupported) {
- if (!m_depthStencilBuffer)
- m_depthStencilBuffer = m_context->createRenderbuffer();
- m_context->bindRenderbuffer(GraphicsContext3D::RENDERBUFFER, m_depthStencilBuffer);
- if (multisample())
- m_context->getExtensions()->renderbufferStorageMultisample(GraphicsContext3D::RENDERBUFFER, sampleCount, Extensions3D::DEPTH24_STENCIL8, m_size.width(), m_size.height());
- else
- m_context->renderbufferStorage(GraphicsContext3D::RENDERBUFFER, Extensions3D::DEPTH24_STENCIL8, m_size.width(), m_size.height());
- m_context->framebufferRenderbuffer(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::STENCIL_ATTACHMENT, GraphicsContext3D::RENDERBUFFER, m_depthStencilBuffer);
- m_context->framebufferRenderbuffer(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::DEPTH_ATTACHMENT, GraphicsContext3D::RENDERBUFFER, m_depthStencilBuffer);
- } else {
- if (attributes.depth) {
- if (!m_depthBuffer)
- m_depthBuffer = m_context->createRenderbuffer();
- m_context->bindRenderbuffer(GraphicsContext3D::RENDERBUFFER, m_depthBuffer);
- if (multisample())
- m_context->getExtensions()->renderbufferStorageMultisample(GraphicsContext3D::RENDERBUFFER, sampleCount, GraphicsContext3D::DEPTH_COMPONENT16, m_size.width(), m_size.height());
- else
- m_context->renderbufferStorage(GraphicsContext3D::RENDERBUFFER, GraphicsContext3D::DEPTH_COMPONENT16, m_size.width(), m_size.height());
- m_context->framebufferRenderbuffer(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::DEPTH_ATTACHMENT, GraphicsContext3D::RENDERBUFFER, m_depthBuffer);
- }
- if (attributes.stencil) {
- if (!m_stencilBuffer)
- m_stencilBuffer = m_context->createRenderbuffer();
- m_context->bindRenderbuffer(GraphicsContext3D::RENDERBUFFER, m_stencilBuffer);
- if (multisample())
- m_context->getExtensions()->renderbufferStorageMultisample(GraphicsContext3D::RENDERBUFFER, sampleCount, GraphicsContext3D::STENCIL_INDEX8, m_size.width(), m_size.height());
- else
- m_context->renderbufferStorage(GraphicsContext3D::RENDERBUFFER, GraphicsContext3D::STENCIL_INDEX8, m_size.width(), m_size.height());
- m_context->framebufferRenderbuffer(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::STENCIL_ATTACHMENT, GraphicsContext3D::RENDERBUFFER, m_stencilBuffer);
- }
- }
- m_context->bindRenderbuffer(GraphicsContext3D::RENDERBUFFER, 0);
-}
-
-void DrawingBuffer::clearFramebuffers(GC3Dbitfield clearMask)
-{
- m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_multisampleFBO ? m_multisampleFBO : m_fbo);
-
- m_context->clear(clearMask);
-
- // The multisample fbo was just cleared, but we also need to clear the non-multisampled buffer too.
- if (m_multisampleFBO) {
- m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_fbo);
- m_context->clear(GraphicsContext3D::COLOR_BUFFER_BIT);
- m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_multisampleFBO);
- }
-}
-
-// Only way to ensure that we're not getting a bad framebuffer on some AMD/OSX devices.
-// FIXME: This can be removed once renderbufferStorageMultisample starts reporting GL_OUT_OF_MEMORY properly.
-bool DrawingBuffer::checkBufferIntegrity()
-{
- if (!m_multisampleFBO)
- return true;
-
- if (m_scissorEnabled)
- m_context->disable(GraphicsContext3D::SCISSOR_TEST);
-
- m_context->colorMask(true, true, true, true);
-
- m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_multisampleFBO);
- m_context->clearColor(1.0f, 0.0f, 1.0f, 1.0f);
- m_context->clear(GraphicsContext3D::COLOR_BUFFER_BIT);
-
- commit(0, 0, 1, 1);
-
- unsigned char pixel[4] = {0, 0, 0, 0};
- m_context->readPixels(0, 0, 1, 1, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, &pixel);
-
- if (m_scissorEnabled)
- m_context->enable(GraphicsContext3D::SCISSOR_TEST);
-
- return (pixel[0] == 0xFF && pixel[1] == 0x00 && pixel[2] == 0xFF && pixel[3] == 0xFF);
-}
-
-bool DrawingBuffer::reset(const IntSize& newSize)
-{
- if (!m_context)
- return false;
-
- m_context->makeContextCurrent();
-
- int maxTextureSize = 0;
- m_context->getIntegerv(GraphicsContext3D::MAX_TEXTURE_SIZE, &maxTextureSize);
- if (newSize.height() > maxTextureSize || newSize.width() > maxTextureSize) {
- clear();
- return false;
- }
-
- int pixelDelta = newSize.width() * newSize.height();
- int oldSize = 0;
- if (!m_size.isEmpty()) {
- oldSize = m_size.width() * m_size.height();
- pixelDelta -= oldSize;
- }
-
- IntSize adjustedSize = newSize;
- if (s_maximumResourceUsePixels) {
- while ((s_currentResourceUsePixels + pixelDelta) > s_maximumResourceUsePixels) {
- adjustedSize.scale(s_resourceAdjustedRatio);
- if (adjustedSize.isEmpty()) {
- clear();
- return false;
- }
- pixelDelta = adjustedSize.width() * adjustedSize.height();
- pixelDelta -= oldSize;
- }
- }
-
- const GraphicsContext3D::Attributes& attributes = m_context->getContextAttributes();
-
- if (adjustedSize != m_size) {
-
- unsigned internalColorFormat, colorFormat, internalRenderbufferFormat;
- if (attributes.alpha) {
- internalColorFormat = GraphicsContext3D::RGBA;
- colorFormat = GraphicsContext3D::RGBA;
- internalRenderbufferFormat = Extensions3D::RGBA8_OES;
- } else {
- internalColorFormat = GraphicsContext3D::RGB;
- colorFormat = GraphicsContext3D::RGB;
- internalRenderbufferFormat = Extensions3D::RGB8_OES;
- }
-
- do {
- m_size = adjustedSize;
- // resize multisample FBO
- if (multisample()) {
- int maxSampleCount = 0;
-
- m_context->getIntegerv(Extensions3D::MAX_SAMPLES, &maxSampleCount);
- int sampleCount = std::min(4, maxSampleCount);
-
- m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_multisampleFBO);
-
- m_context->bindRenderbuffer(GraphicsContext3D::RENDERBUFFER, m_multisampleColorBuffer);
- m_context->getExtensions()->renderbufferStorageMultisample(GraphicsContext3D::RENDERBUFFER, sampleCount, internalRenderbufferFormat, m_size.width(), m_size.height());
-
- if (m_context->getError() == GraphicsContext3D::OUT_OF_MEMORY) {
- adjustedSize.scale(s_resourceAdjustedRatio);
- continue;
- }
-
- m_context->framebufferRenderbuffer(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::COLOR_ATTACHMENT0, GraphicsContext3D::RENDERBUFFER, m_multisampleColorBuffer);
- resizeDepthStencil(sampleCount);
- if (m_context->checkFramebufferStatus(GraphicsContext3D::FRAMEBUFFER) != GraphicsContext3D::FRAMEBUFFER_COMPLETE) {
- adjustedSize.scale(s_resourceAdjustedRatio);
- continue;
- }
- }
-
- // resize regular FBO
- m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_fbo);
-
- m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, m_colorBuffer);
- m_context->texImage2D(GraphicsContext3D::TEXTURE_2D, 0, internalColorFormat, m_size.width(), m_size.height(), 0, colorFormat, GraphicsContext3D::UNSIGNED_BYTE, 0);
-
- m_context->framebufferTexture2D(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::COLOR_ATTACHMENT0, GraphicsContext3D::TEXTURE_2D, m_colorBuffer, 0);
-
- // resize the front color buffer
- if (m_separateFrontTexture) {
- m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, m_frontColorBuffer);
- m_context->texImage2D(GraphicsContext3D::TEXTURE_2D, 0, internalColorFormat, m_size.width(), m_size.height(), 0, colorFormat, GraphicsContext3D::UNSIGNED_BYTE, 0);
- }
-
- m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, 0);
-
- if (!multisample())
- resizeDepthStencil(0);
- if (m_context->checkFramebufferStatus(GraphicsContext3D::FRAMEBUFFER) != GraphicsContext3D::FRAMEBUFFER_COMPLETE) {
- adjustedSize.scale(s_resourceAdjustedRatio);
- continue;
- }
-
-#if OS(DARWIN)
- // FIXME: This can be removed once renderbufferStorageMultisample starts reporting GL_OUT_OF_MEMORY properly on OSX.
- if (!checkBufferIntegrity()) {
- adjustedSize.scale(s_resourceAdjustedRatio);
- continue;
- }
-#endif
-
- break;
-
- } while (!adjustedSize.isEmpty());
-
- pixelDelta = m_size.width() * m_size.height();
- pixelDelta -= oldSize;
- s_currentResourceUsePixels += pixelDelta;
-
- if (!newSize.isEmpty() && adjustedSize.isEmpty()) {
- clear();
- return false;
- }
- }
-
- m_context->disable(GraphicsContext3D::SCISSOR_TEST);
- m_context->clearColor(0, 0, 0, 0);
- m_context->colorMask(true, true, true, true);
-
- GC3Dbitfield clearMask = GraphicsContext3D::COLOR_BUFFER_BIT;
- if (attributes.depth) {
- m_context->clearDepth(1.0f);
- clearMask |= GraphicsContext3D::DEPTH_BUFFER_BIT;
- m_context->depthMask(true);
- }
- if (attributes.stencil) {
- m_context->clearStencil(0);
- clearMask |= GraphicsContext3D::STENCIL_BUFFER_BIT;
- m_context->stencilMaskSeparate(GraphicsContext3D::FRONT, 0xFFFFFFFF);
- }
-
- clearFramebuffers(clearMask);
-
- return true;
-}
-
-void DrawingBuffer::commit(long x, long y, long width, long height)
-{
- if (!m_context)
- return;
-
- if (width < 0)
- width = m_size.width();
- if (height < 0)
- height = m_size.height();
-
- m_context->makeContextCurrent();
-
- if (m_multisampleFBO) {
- m_context->bindFramebuffer(Extensions3D::READ_FRAMEBUFFER, m_multisampleFBO);
- m_context->bindFramebuffer(Extensions3D::DRAW_FRAMEBUFFER, m_fbo);
-
- if (m_scissorEnabled)
- m_context->disable(GraphicsContext3D::SCISSOR_TEST);
-
- // Use NEAREST, because there is no scale performed during the blit.
- m_context->getExtensions()->blitFramebuffer(x, y, width, height, x, y, width, height, GraphicsContext3D::COLOR_BUFFER_BIT, GraphicsContext3D::NEAREST);
-
- if (m_scissorEnabled)
- m_context->enable(GraphicsContext3D::SCISSOR_TEST);
- }
-
- m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_fbo);
-}
-
-void DrawingBuffer::restoreFramebufferBinding()
-{
- if (!m_context || !m_framebufferBinding)
- return;
-
- m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_framebufferBinding);
-}
-
-bool DrawingBuffer::multisample() const
-{
- return m_context && m_context->getContextAttributes().antialias && m_multisampleExtensionSupported;
-}
-
-void DrawingBuffer::discardResources()
-{
- m_colorBuffer = 0;
- m_frontColorBuffer = 0;
- m_multisampleColorBuffer = 0;
-
- m_depthStencilBuffer = 0;
- m_depthBuffer = 0;
-
- m_stencilBuffer = 0;
-
- m_multisampleFBO = 0;
- m_fbo = 0;
-}
-
-void DrawingBuffer::bind()
-{
- if (!m_context)
- return;
-
- m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_multisampleFBO ? m_multisampleFBO : m_fbo);
-}
-
-} // namespace WebCore
-
-#endif
Deleted: trunk/Source/WebCore/platform/graphics/gpu/DrawingBuffer.h (181467 => 181468)
--- trunk/Source/WebCore/platform/graphics/gpu/DrawingBuffer.h 2015-03-13 01:57:59 UTC (rev 181467)
+++ trunk/Source/WebCore/platform/graphics/gpu/DrawingBuffer.h 2015-03-13 02:01:42 UTC (rev 181468)
@@ -1,169 +0,0 @@
-/*
- * Copyright (c) 2010, Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef DrawingBuffer_h
-#define DrawingBuffer_h
-
-#include "GraphicsContext3D.h"
-#include "GraphicsTypes3D.h"
-#include "IntSize.h"
-#include "PlatformLayer.h"
-
-#include <wtf/Noncopyable.h>
-#if PLATFORM(COCOA)
-#include <wtf/RetainPtr.h>
-#endif
-
-namespace WebCore {
-class GraphicsContext3D;
-
-// Manages a rendering target (framebuffer + attachment) for a canvas. Can publish its rendering
-// results to a PlatformLayer for compositing.
-class DrawingBuffer : public RefCounted<DrawingBuffer> {
-public:
- enum PreserveDrawingBuffer {
- Preserve,
- Discard
- };
-
- enum AlphaRequirement {
- Alpha,
- Opaque
- };
-
- static PassRefPtr<DrawingBuffer> create(GraphicsContext3D*, const IntSize&, PreserveDrawingBuffer, AlphaRequirement);
- friend class GraphicsContext3D;
-
- ~DrawingBuffer();
-
- // Issues a glClear() on all framebuffers associated with this DrawingBuffer. The caller is responsible for
- // making the context current and setting the clear values and masks. Modifies the framebuffer binding.
- void clearFramebuffers(GC3Dbitfield clearMask);
-
- // Returns true if the buffer was successfully resized.
- bool reset(const IntSize&);
- void bind();
- IntSize size() const { return m_size; }
- Platform3DObject colorBuffer() const { return m_colorBuffer; }
-
- // Clear all resources from this object, as well as context. Called when context is destroyed
- // to prevent invalid accesses to the resources.
- void clear();
-
- // Create the depth/stencil and multisample buffers, if needed.
- void createSecondaryBuffers();
-
- void resizeDepthStencil(int sampleCount);
-
- // Copies the multisample color buffer to the normal color buffer and leaves m_fbo bound
- void commit(long x = 0, long y = 0, long width = -1, long height = -1);
-
- // commit should copy the full multisample buffer, and not respect the
- // current scissor bounds. Track the state of the scissor test so that it
- // can be disabled during calls to commit.
- void setScissorEnabled(bool scissorEnabled) { m_scissorEnabled = scissorEnabled; }
-
- // The DrawingBuffer needs to track the texture bound to texture unit 0.
- // The bound texture is tracked to avoid costly queries during rendering.
- void setTexture2DBinding(Platform3DObject texture) { m_texture2DBinding = texture; }
-
- // The DrawingBuffer needs to track the currently bound framebuffer so it
- // restore the binding when needed.
- void setFramebufferBinding(Platform3DObject fbo) { m_framebufferBinding = fbo; }
-
- // Bind to the m_framebufferBinding if it's not 0.
- void restoreFramebufferBinding();
-
- // Track the currently active texture unit. Texture unit 0 is used as host for a scratch
- // texture.
- void setActiveTextureUnit(GC3Dint textureUnit) { m_activeTextureUnit = textureUnit; }
-
- bool multisample() const;
-
- Platform3DObject framebuffer() const;
-
- // Immediately releases ownership of all resources. Call upon loss of the
- // graphics context to prevent freeing invalid resources.
- void discardResources();
-
- void markContentsChanged() { m_contentsChanged = true; }
-
- PlatformLayer* platformLayer();
- unsigned frontColorBuffer() const;
- void paintCompositedResultsToCanvas(ImageBuffer*);
-
- GraphicsContext3D* graphicsContext3D() const { return m_context.get(); }
-
-private:
- DrawingBuffer(GraphicsContext3D*, const IntSize&, bool multisampleExtensionSupported,
- bool packedDepthStencilExtensionSupported, PreserveDrawingBuffer, AlphaRequirement);
-
- void initialize(const IntSize&);
-
- bool checkBufferIntegrity();
-
- PreserveDrawingBuffer m_preserveDrawingBuffer;
- AlphaRequirement m_alpha;
- bool m_scissorEnabled;
- Platform3DObject m_texture2DBinding;
- Platform3DObject m_framebufferBinding;
- GC3Denum m_activeTextureUnit;
-
- RefPtr<GraphicsContext3D> m_context;
- IntSize m_size;
- bool m_multisampleExtensionSupported;
- bool m_packedDepthStencilExtensionSupported;
- Platform3DObject m_fbo;
- Platform3DObject m_colorBuffer;
- Platform3DObject m_frontColorBuffer;
- bool m_separateFrontTexture;
-
- // This is used when we have OES_packed_depth_stencil.
- Platform3DObject m_depthStencilBuffer;
-
- // These are used when we don't.
- Platform3DObject m_depthBuffer;
- Platform3DObject m_stencilBuffer;
-
- // For multisampling
- Platform3DObject m_multisampleFBO;
- Platform3DObject m_multisampleColorBuffer;
-
- // True if our contents have been modified since the last presentation of this buffer.
- bool m_contentsChanged;
-
-#if PLATFORM(COCOA)
- RetainPtr<WebGLLayer> m_platformLayer;
-#endif
-};
-
-} // namespace WebCore
-
-#endif // DrawingBuffer_h
Modified: trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp (181467 => 181468)
--- trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp 2015-03-13 01:57:59 UTC (rev 181467)
+++ trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp 2015-03-13 02:01:42 UTC (rev 181468)
@@ -145,7 +145,7 @@
return false;
}
-void GraphicsContext3D::paintRenderingResultsToCanvas(ImageBuffer* imageBuffer, DrawingBuffer*)
+void GraphicsContext3D::paintRenderingResultsToCanvas(ImageBuffer* imageBuffer)
{
int rowBytes = m_currentWidth * 4;
int totalBytes = rowBytes * m_currentHeight;
@@ -184,7 +184,7 @@
return false;
}
-PassRefPtr<ImageData> GraphicsContext3D::paintRenderingResultsToImageData(DrawingBuffer*)
+PassRefPtr<ImageData> GraphicsContext3D::paintRenderingResultsToImageData()
{
// Reading premultiplied alpha would involve unpremultiplying, which is
// lossy.