more getting stuff out of my tree (npotb)

This commit is contained in:
vladimir@pobox.com 2007-04-06 11:09:22 -07:00
Родитель 54fbe8a6b5
Коммит 08a45680f0
3 изменённых файлов: 34 добавлений и 9 удалений

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

@ -138,6 +138,7 @@ GLITZ_CSRCS += \
glitz_wgl_context.c \
glitz_wgl_pbuffer.c \
$(NULL)
endif
ifneq (,$(filter $(MOZ_WIDGET_TOOLKIT),mac cocoa))
@ -154,9 +155,9 @@ CPPSRCS = nsCanvas3DModule.cpp \
nsCanvasRenderingContextGLWeb20.cpp \
$(NULL)
DEFINES += -DXPCOM_GLUE -DGLEW_MX -DGLEW_STATIC
DEFINES += -DXPCOM_GLUE -DXPCOM_GLUE_USE_NSPR -DGLEW_MX -DGLEW_STATIC
EXTRA_DSO_LIBS += js3250 xpcom nspr4 xpcom_core unicharutil_s
EXTRA_DSO_LIBS += js3250 xpcom xpcom_core unicharutil_s
# mozcairo mozlibpixman
ifdef MOZ_ENABLE_CAIRO_GFX
@ -173,11 +174,13 @@ include $(topsrcdir)/config/rules.mk
CFLAGS += -I$(GLITZ_SRC_DIR) -I$(GLITZ_PLATFORM_SRC_DIR) $(RTL_FLAGS)
CXXFLAGS += -I$(GLITZ_SRC_DIR) -I$(GLITZ_PLATFORM_SRC_DIR) $(MOZ_CAIRO_CFLAGS) $(TK_CFLAGS)
EXTRA_DSO_LIBS += $(NSPR_LIBS)
ifdef MOZ_X11
endif
ifeq ($(MOZ_WIDGET_TOOLKIT),windows)
EXTRA_DSO_LDOPTS += opengl32.lib glu32.lib
EXTRA_DSO_LDOPTS += opengl32.lib glu32.lib usp10.lib
endif
ifneq (,$(filter $(MOZ_WIDGET_TOOLKIT),mac cocoa))

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

@ -534,8 +534,10 @@ nsCanvasRenderingContextGLPrivate::SetCanvasElement(nsICanvasElement* aParentCan
if (!SafeToCreateCanvas3DContext())
return NS_ERROR_FAILURE;
if (!ValidateGL())
if (!ValidateGL()) {
LogMessage(NS_LITERAL_CSTRING("Canvas 3D: Couldn't validate OpenGL implementation; is everything needed present?"));
return NS_ERROR_FAILURE;
}
mCanvasElement = aParentCanvas;
fprintf (stderr, "VVVV SetCanvasElement: %p\n", mCanvasElement);
@ -604,8 +606,10 @@ nsCanvasRenderingContextGLPrivate::SetDimensions(PRInt32 width, PRInt32 height)
&templ, 0);
} while (gdformat == nsnull && templ.samples > 0);
if (!gdformat)
if (!gdformat) {
LogMessage(NS_LITERAL_CSTRING("Canvas 3D: Unable to find pbuffer format (maybe pbuffers are not available?"));
return NS_ERROR_INVALID_ARG;
}
mGlitzDrawable =
glitz_wgl_create_pbuffer_drawable(gdformat,
@ -613,13 +617,17 @@ nsCanvasRenderingContextGLPrivate::SetDimensions(PRInt32 width, PRInt32 height)
height);
#endif
if (!gdformat || !mGlitzDrawable)
if (!gdformat || !mGlitzDrawable) {
LogMessage(NS_LITERAL_CSTRING("Canvas 3D: Failed to create pbuffer drawable."));
return NS_ERROR_FAILURE;
}
glitz_format_t *gformat =
glitz_find_standard_format(mGlitzDrawable, GLITZ_STANDARD_ARGB32);
if (!gformat)
if (!gformat) {
LogMessage(NS_LITERAL_CSTRING("Canvas 3D: Couldn't find ARGB32 format (this should never happen!)"));
return NS_ERROR_INVALID_ARG;
}
mGlitzSurface =
glitz_surface_create(mGlitzDrawable,
@ -628,8 +636,10 @@ nsCanvasRenderingContextGLPrivate::SetDimensions(PRInt32 width, PRInt32 height)
height,
0,
NULL);
if (!mGlitzSurface)
if (!mGlitzSurface) {
LogMessage(NS_LITERAL_CSTRING("Canvas 3D: Failed to create glitz surface"));
return NS_ERROR_INVALID_ARG;
}
glitz_surface_attach(mGlitzSurface, mGlitzDrawable, GLITZ_DRAWABLE_BUFFER_FRONT_COLOR);
@ -640,6 +650,7 @@ nsCanvasRenderingContextGLPrivate::SetDimensions(PRInt32 width, PRInt32 height)
GLenum err = glewInit();
if (err != GLEW_OK) {
// er, something very bad happened
LogMessage(NS_LITERAL_CSTRING("Canvas 3D: GLEW init failed"));
NS_ERROR("glewInit failed! Leaking lots of memory");
return NS_ERROR_FAILURE;
}
@ -1484,7 +1495,7 @@ nsCanvasRenderingContextGLPrivate::DoSwapBuffers()
// nsIFrame::Invalidate is an internal non-virtual method,
// so we basically recreate it here. I would suggest
// an InvalidateExternal for the trunk.
nsIPresShell *shell = frame->GetPresContext()->GetPresShell();
nsIPresShell *shell = frame->PresContext()->GetPresShell();
if (shell) {
PRBool suppressed = PR_FALSE;
shell->IsPaintingSuppressed(&suppressed);
@ -1544,5 +1555,7 @@ nsCanvasRenderingContextGLPrivate::SafeToCreateCanvas3DContext()
if (enabled)
return PR_TRUE;
LogMessage("Canvas 3D: Web content tried to create 3D Canvas Context, but pref extensions.canvas3d.enabledForWebContent is not set!");
return PR_FALSE;
}

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

@ -63,6 +63,9 @@
#include "nsDOMError.h"
#include "nsIJSRuntimeService.h"
#include "nsIServiceManager.h"
#include "nsIConsoleService.h"
#include "nsDOMError.h"
#include "nsContentUtils.h"
@ -267,6 +270,12 @@ protected:
jsvector[i] = INT_TO_JSVAL(vals[i]);
return JS_NewArrayObject(ctx, len, jsvector);
}
void LogMessage (const nsCString& errorString) {
nsresult rv;
nsCOMPtr<nsIConsoleService> console(do_GetService(NS_CONSOLESERVICE_CONTRACTID));
console->LogStringMessage(NS_ConvertUTF8toUTF16(errorString).get());
}
};
class NativeJSContext {