summaryrefslogtreecommitdiff
path: root/Source/WebCore/html/canvas/WebGLFramebuffer.cpp
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2016-04-10 09:28:39 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2016-04-10 09:28:39 +0000
commit32761a6cee1d0dee366b885b7b9c777e67885688 (patch)
treed6bec92bebfb216f4126356e55518842c2f476a1 /Source/WebCore/html/canvas/WebGLFramebuffer.cpp
parenta4e969f4965059196ca948db781e52f7cfebf19e (diff)
downloadWebKitGtk-tarball-32761a6cee1d0dee366b885b7b9c777e67885688.tar.gz
webkitgtk-2.4.11webkitgtk-2.4.11
Diffstat (limited to 'Source/WebCore/html/canvas/WebGLFramebuffer.cpp')
-rw-r--r--Source/WebCore/html/canvas/WebGLFramebuffer.cpp70
1 files changed, 31 insertions, 39 deletions
diff --git a/Source/WebCore/html/canvas/WebGLFramebuffer.cpp b/Source/WebCore/html/canvas/WebGLFramebuffer.cpp
index 7317ed20f..7e1dc07f5 100644
--- a/Source/WebCore/html/canvas/WebGLFramebuffer.cpp
+++ b/Source/WebCore/html/canvas/WebGLFramebuffer.cpp
@@ -10,10 +10,10 @@
* 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
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, 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
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, 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
@@ -29,10 +29,10 @@
#include "WebGLFramebuffer.h"
+#include "EXTDrawBuffers.h"
#include "Extensions3D.h"
#include "WebGLContextGroup.h"
-#include "WebGLDrawBuffers.h"
-#include "WebGLRenderingContextBase.h"
+#include "WebGLRenderingContext.h"
namespace WebCore {
@@ -45,7 +45,7 @@ namespace {
class WebGLRenderbufferAttachment : public WebGLFramebuffer::WebGLAttachment {
public:
- static Ref<WebGLFramebuffer::WebGLAttachment> create(WebGLRenderbuffer*);
+ static PassRefPtr<WebGLFramebuffer::WebGLAttachment> create(WebGLRenderbuffer*);
private:
WebGLRenderbufferAttachment(WebGLRenderbuffer*);
@@ -66,9 +66,9 @@ namespace {
RefPtr<WebGLRenderbuffer> m_renderbuffer;
};
- Ref<WebGLFramebuffer::WebGLAttachment> WebGLRenderbufferAttachment::create(WebGLRenderbuffer* renderbuffer)
+ PassRefPtr<WebGLFramebuffer::WebGLAttachment> WebGLRenderbufferAttachment::create(WebGLRenderbuffer* renderbuffer)
{
- return adoptRef(*new WebGLRenderbufferAttachment(renderbuffer));
+ return adoptRef(new WebGLRenderbufferAttachment(renderbuffer));
}
WebGLRenderbufferAttachment::WebGLRenderbufferAttachment(WebGLRenderbuffer* renderbuffer)
@@ -139,7 +139,7 @@ namespace {
class WebGLTextureAttachment : public WebGLFramebuffer::WebGLAttachment {
public:
- static Ref<WebGLFramebuffer::WebGLAttachment> create(WebGLTexture*, GC3Denum target, GC3Dint level);
+ static PassRefPtr<WebGLFramebuffer::WebGLAttachment> create(WebGLTexture*, GC3Denum target, GC3Dint level);
private:
WebGLTextureAttachment(WebGLTexture*, GC3Denum target, GC3Dint level);
@@ -162,9 +162,9 @@ namespace {
GC3Dint m_level;
};
- Ref<WebGLFramebuffer::WebGLAttachment> WebGLTextureAttachment::create(WebGLTexture* texture, GC3Denum target, GC3Dint level)
+ PassRefPtr<WebGLFramebuffer::WebGLAttachment> WebGLTextureAttachment::create(WebGLTexture* texture, GC3Denum target, GC3Dint level)
{
- return adoptRef(*new WebGLTextureAttachment(texture, target, level));
+ return adoptRef(new WebGLTextureAttachment(texture, target, level));
}
WebGLTextureAttachment::WebGLTextureAttachment(WebGLTexture* texture, GC3Denum target, GC3Dint level)
@@ -269,12 +269,12 @@ WebGLFramebuffer::WebGLAttachment::~WebGLAttachment()
{
}
-Ref<WebGLFramebuffer> WebGLFramebuffer::create(WebGLRenderingContextBase* ctx)
+PassRefPtr<WebGLFramebuffer> WebGLFramebuffer::create(WebGLRenderingContext* ctx)
{
- return adoptRef(*new WebGLFramebuffer(ctx));
+ return adoptRef(new WebGLFramebuffer(ctx));
}
-WebGLFramebuffer::WebGLFramebuffer(WebGLRenderingContextBase* ctx)
+WebGLFramebuffer::WebGLFramebuffer(WebGLRenderingContext* ctx)
: WebGLContextObject(ctx)
, m_hasEverBeenBound(false)
{
@@ -369,19 +369,19 @@ void WebGLFramebuffer::removeAttachmentFromBoundFramebuffer(WebGLSharedObject* a
return;
bool checkMore = true;
- do {
+ while (checkMore) {
checkMore = false;
- for (auto& entry : m_attachments) {
- WebGLAttachment* attachmentObject = entry.value.get();
+ for (AttachmentMap::iterator it = m_attachments.begin(); it != m_attachments.end(); ++it) {
+ WebGLAttachment* attachmentObject = it->value.get();
if (attachmentObject->isSharedObject(attachment)) {
- GC3Denum attachmentType = entry.key;
+ GC3Denum attachmentType = it->key;
attachmentObject->unattach(context()->graphicsContext3D(), attachmentType);
removeAttachmentFromBoundFramebuffer(attachmentType);
checkMore = true;
break;
}
}
- } while (checkMore);
+ }
}
GC3Dsizei WebGLFramebuffer::getColorBufferWidth() const
@@ -423,25 +423,19 @@ GC3Denum WebGLFramebuffer::checkStatus(const char** reason) const
bool haveDepth = false;
bool haveStencil = false;
bool haveDepthStencil = false;
- for (auto& entry : m_attachments) {
- WebGLAttachment* attachment = entry.value.get();
- if (!isAttachmentComplete(attachment, entry.key, reason))
+ for (AttachmentMap::const_iterator it = m_attachments.begin(); it != m_attachments.end(); ++it) {
+ WebGLAttachment* attachment = it->value.get();
+ if (!isAttachmentComplete(attachment, it->key, reason))
return GraphicsContext3D::FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
if (!attachment->isValid()) {
*reason = "attachment is not valid";
return GraphicsContext3D::FRAMEBUFFER_UNSUPPORTED;
}
- GC3Denum attachmentFormat = attachment->getFormat();
-
- // Attaching an SRGB_EXT format attachment to a framebuffer is invalid.
- if (attachmentFormat == Extensions3D::SRGB_EXT)
- attachmentFormat = 0;
-
- if (!attachmentFormat) {
+ if (!attachment->getFormat()) {
*reason = "attachment is an unsupported format";
return GraphicsContext3D::FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
}
- switch (entry.key) {
+ switch (it->key) {
case GraphicsContext3D::DEPTH_ATTACHMENT:
haveDepth = true;
break;
@@ -498,8 +492,8 @@ bool WebGLFramebuffer::hasStencilBuffer() const
void WebGLFramebuffer::deleteObjectImpl(GraphicsContext3D* context3d, Platform3DObject object)
{
- for (auto& attachment : m_attachments.values())
- attachment->onDetached(context3d);
+ for (AttachmentMap::iterator it = m_attachments.begin(); it != m_attachments.end(); ++it)
+ it->value->onDetached(context3d);
context3d->deleteFramebuffer(object);
}
@@ -509,9 +503,9 @@ bool WebGLFramebuffer::initializeAttachments(GraphicsContext3D* g3d, const char*
ASSERT(object());
GC3Dbitfield mask = 0;
- for (auto& entry : m_attachments) {
- GC3Denum attachmentType = entry.key;
- WebGLAttachment* attachment = entry.value.get();
+ for (AttachmentMap::iterator it = m_attachments.begin(); it != m_attachments.end(); ++it) {
+ GC3Denum attachmentType = it->key;
+ WebGLAttachment* attachment = it->value.get();
if (!attachment->isInitialized())
mask |= GraphicsContext3D::getClearBitsByAttachmentType(attachmentType);
}
@@ -600,17 +594,15 @@ void WebGLFramebuffer::drawBuffers(const Vector<GC3Denum>& bufs)
{
m_drawBuffers = bufs;
m_filteredDrawBuffers.resize(m_drawBuffers.size());
- for (auto& buffer : m_filteredDrawBuffers)
- buffer = GraphicsContext3D::NONE;
+ for (size_t i = 0; i < m_filteredDrawBuffers.size(); ++i)
+ m_filteredDrawBuffers[i] = GraphicsContext3D::NONE;
drawBuffersIfNecessary(true);
}
void WebGLFramebuffer::drawBuffersIfNecessary(bool force)
{
-#if ENABLE(WEBGL2)
- if (!context()->m_webglDrawBuffers && !context()->isWebGL2())
+ if (!context()->m_extDrawBuffers)
return;
-#endif
bool reset = force;
// This filtering works around graphics driver bugs on Mac OS X.
for (size_t i = 0; i < m_drawBuffers.size(); ++i) {