Bug 779611 - part 10: move remaining non-WebGLContext goop to separate files - r=jgilbert

This commit is contained in:
Benoit Jacob 2012-10-09 14:39:51 -04:00
Родитель ee49c790ba
Коммит ba3864f56c
6 изменённых файлов: 75 добавлений и 60 удалений

Просмотреть файл

@ -64,8 +64,10 @@ CPPSRCS += \
WebGLProgram.cpp \
WebGLRenderbuffer.cpp \
WebGLShader.cpp \
WebGLShaderPrecisionFormat.cpp \
WebGLTexelConversions.cpp \
WebGLTexture.cpp \
WebGLUniformLocation.cpp \
$(NULL)
DEFINES += -DUSE_ANGLE

Просмотреть файл

@ -51,8 +51,6 @@ using namespace mozilla::gl;
using namespace mozilla::dom;
using namespace mozilla::layers;
NS_IMPL_ISUPPORTS1(WebGLMemoryPressureObserver, nsIObserver)
NS_IMETHODIMP
WebGLMemoryPressureObserver::Observe(nsISupports* aSubject,
const char* aTopic,
@ -1353,6 +1351,33 @@ WebGLContext::ForceRestoreContext()
mContextStatus = ContextLostAwaitingRestore;
}
void
WebGLContext::GetSupportedExtensions(Nullable< nsTArray<nsString> > &retval)
{
retval.SetNull();
if (!IsContextStable())
return;
nsTArray<nsString>& arr = retval.SetValue();
if (IsExtensionSupported(OES_texture_float))
arr.AppendElement(NS_LITERAL_STRING("OES_texture_float"));
if (IsExtensionSupported(OES_standard_derivatives))
arr.AppendElement(NS_LITERAL_STRING("OES_standard_derivatives"));
if (IsExtensionSupported(EXT_texture_filter_anisotropic))
arr.AppendElement(NS_LITERAL_STRING("EXT_texture_filter_anisotropic"));
if (IsExtensionSupported(WEBGL_lose_context))
arr.AppendElement(NS_LITERAL_STRING("MOZ_WEBGL_lose_context"));
if (IsExtensionSupported(WEBGL_compressed_texture_s3tc))
arr.AppendElement(NS_LITERAL_STRING("MOZ_WEBGL_compressed_texture_s3tc"));
if (IsExtensionSupported(WEBGL_compressed_texture_atc))
arr.AppendElement(NS_LITERAL_STRING("MOZ_WEBGL_compressed_texture_atc"));
if (IsExtensionSupported(WEBGL_compressed_texture_pvrtc))
arr.AppendElement(NS_LITERAL_STRING("MOZ_WEBGL_compressed_texture_pvrtc"));
if (IsExtensionSupported(WEBGL_depth_texture))
arr.AppendElement(NS_LITERAL_STRING("MOZ_WEBGL_depth_texture"));
}
//
// XPCOM goop
//
@ -1389,60 +1414,3 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(WebGLContext)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports,
nsICanvasRenderingContextInternal)
NS_INTERFACE_MAP_END
// WebGLUniformLocation
NS_IMPL_ADDREF(WebGLUniformLocation)
NS_IMPL_RELEASE(WebGLUniformLocation)
NS_INTERFACE_MAP_BEGIN(WebGLUniformLocation)
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_END
JSObject*
WebGLUniformLocation::WrapObject(JSContext *cx, JSObject *scope)
{
return dom::WebGLUniformLocationBinding::Wrap(cx, scope, this);
}
// WebGLShaderPrecisionFormat
NS_INTERFACE_MAP_BEGIN(WebGLShaderPrecisionFormat)
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_END
NS_IMPL_ADDREF(WebGLShaderPrecisionFormat)
NS_IMPL_RELEASE(WebGLShaderPrecisionFormat)
JSObject*
WebGLShaderPrecisionFormat::WrapObject(JSContext *cx, JSObject *scope)
{
return dom::WebGLShaderPrecisionFormatBinding::Wrap(cx, scope, this);
}
void
WebGLContext::GetSupportedExtensions(Nullable< nsTArray<nsString> > &retval)
{
retval.SetNull();
if (!IsContextStable())
return;
nsTArray<nsString>& arr = retval.SetValue();
if (IsExtensionSupported(OES_texture_float))
arr.AppendElement(NS_LITERAL_STRING("OES_texture_float"));
if (IsExtensionSupported(OES_standard_derivatives))
arr.AppendElement(NS_LITERAL_STRING("OES_standard_derivatives"));
if (IsExtensionSupported(EXT_texture_filter_anisotropic))
arr.AppendElement(NS_LITERAL_STRING("EXT_texture_filter_anisotropic"));
if (IsExtensionSupported(WEBGL_lose_context))
arr.AppendElement(NS_LITERAL_STRING("MOZ_WEBGL_lose_context"));
if (IsExtensionSupported(WEBGL_compressed_texture_s3tc))
arr.AppendElement(NS_LITERAL_STRING("MOZ_WEBGL_compressed_texture_s3tc"));
if (IsExtensionSupported(WEBGL_compressed_texture_atc))
arr.AppendElement(NS_LITERAL_STRING("MOZ_WEBGL_compressed_texture_atc"));
if (IsExtensionSupported(WEBGL_compressed_texture_pvrtc))
arr.AppendElement(NS_LITERAL_STRING("MOZ_WEBGL_compressed_texture_pvrtc"));
if (IsExtensionSupported(WEBGL_depth_texture))
arr.AppendElement(NS_LITERAL_STRING("MOZ_WEBGL_depth_texture"));
}

Просмотреть файл

@ -8,6 +8,7 @@
using namespace mozilla;
NS_IMPL_ISUPPORTS1(WebGLMemoryPressureObserver, nsIObserver)
class WebGLMemoryMultiReporter MOZ_FINAL : public nsIMemoryMultiReporter
{

Просмотреть файл

@ -0,0 +1,22 @@
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "WebGLContext.h"
#include "mozilla/dom/WebGLRenderingContextBinding.h"
using namespace mozilla;
NS_INTERFACE_MAP_BEGIN(WebGLShaderPrecisionFormat)
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_END
NS_IMPL_ADDREF(WebGLShaderPrecisionFormat)
NS_IMPL_RELEASE(WebGLShaderPrecisionFormat)
JSObject*
WebGLShaderPrecisionFormat::WrapObject(JSContext *cx, JSObject *scope)
{
return dom::WebGLShaderPrecisionFormatBinding::Wrap(cx, scope, this);
}

Просмотреть файл

@ -21,4 +21,4 @@ NS_IMPL_CYCLE_COLLECTING_RELEASE(WebGLTexture)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(WebGLTexture)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_END
NS_INTERFACE_MAP_END

Просмотреть файл

@ -0,0 +1,22 @@
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "WebGLContext.h"
#include "mozilla/dom/WebGLRenderingContextBinding.h"
using namespace mozilla;
NS_IMPL_ADDREF(WebGLUniformLocation)
NS_IMPL_RELEASE(WebGLUniformLocation)
NS_INTERFACE_MAP_BEGIN(WebGLUniformLocation)
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_END
JSObject*
WebGLUniformLocation::WrapObject(JSContext *cx, JSObject *scope)
{
return dom::WebGLUniformLocationBinding::Wrap(cx, scope, this);
}