bug 288042 make the cairo svg renderer work with xlib and qt

r=tor


git-svn-id: svn://10.0.0.236/trunk@178151 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
cbiesinger%web.de 2005-08-18 12:31:30 +00:00
parent 107cbec591
commit 69bcbc8894
3 changed files with 56 additions and 3 deletions

View File

@ -196,6 +196,12 @@ EXTRA_DSO_LDOPTS = \
$(MOZ_JS_LIBS) \
$(NULL)
ifdef MOZ_ENABLE_XLIB
EXTRA_DSO_LDOPTS += \
-lxlibrgb \
$(NULL)
endif
ifdef NS_TRACE_MALLOC
EXTRA_DSO_LIBS += tracemalloc
endif

View File

@ -105,6 +105,20 @@ CFLAGS += $(MOZ_GTK_CFLAGS) $(MOZ_GTK2_CFLAGS)
CXXFLAGS += $(MOZ_GTK_CFLAGS) $(MOZ_GTK2_CFLAGS)
endif
ifdef MOZ_ENABLE_XLIB
LOCAL_INCLUDES += -I$(topsrcdir)/gfx/src/xlib
CFLAGS += $(TK_CFLAGS)
CXXFLAGS += $(TK_CFLAGS)
REQUIRES += xlibrgb \
$(NULL)
endif
ifdef MOZ_ENABLE_QT
LOCAL_INCLUDES += -I$(topsrcdir)/gfx/src/qt
CFLAGS += $(TK_CFLAGS)
CXXFLAGS += $(TK_CFLAGS)
endif
ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT)))
LOCAL_INCLUDES += -I$(topsrcdir)/gfx/src/mac
endif

View File

@ -51,6 +51,12 @@
#include "nsISVGCairoSurface.h"
#include <cairo.h>
#ifdef MOZ_X11
extern "C" {
#include <cairo-xlib.h>
}
#endif
#include "nsIImage.h"
#include "nsIComponentManager.h"
#include "imgIContainer.h"
@ -63,6 +69,11 @@
extern "C" {
#include <cairo-quartz.h>
}
#elif defined(MOZ_WIDGET_XLIB)
#include "nsDrawingSurfaceXlib.h"
#elif defined(MOZ_WIDGET_QT)
#undef CursorShape
#include "nsDrawingSurfaceQt.h"
#elif defined(XP_WIN)
#include "nsDrawingSurfaceWin.h"
extern "C" {
@ -71,9 +82,6 @@ extern "C" {
#else
#include "nsRenderingContextGTK.h"
#include <gdk/gdkx.h>
extern "C" {
#include <cairo-xlib.h>
}
#endif
/**
@ -202,6 +210,31 @@ nsSVGCairoCanvas::Init(nsIRenderingContext *ctx,
cairoSurf = cairo_quartz_surface_create(mQuartzRef,
portRect.right - portRect.left,
portRect.bottom - portRect.top);
#elif defined(MOZ_WIDGET_XLIB)
nsIDrawingSurfaceXlib* surface;
ctx->GetDrawingSurface((nsIDrawingSurface**)&surface);
surface->GetDimensions(&mWidth, &mHeight);
XlibRgbHandle* handle;
surface->GetXlibRgbHandle(handle);
Drawable drawable = surface->GetDrawable();
cairoSurf = cairo_xlib_surface_create(xxlib_rgb_get_display(handle),
drawable,
xxlib_rgb_get_visual(handle),
mWidth, mHeight);
#elif defined(MOZ_WIDGET_QT)
nsDrawingSurfaceQt* surface;
ctx->GetDrawingSurface((nsIDrawingSurface**)&surface);
surface->GetDimensions(&mWidth, &mHeight);
QPaintDevice* dev = surface->GetPaintDevice();
cairoSurf = cairo_xlib_surface_create(dev->x11Display(),
dev->handle(),
(Visual*)dev->x11Visual(),
mWidth, mHeight);
#elif defined(XP_WIN)
nsDrawingSurfaceWin *surface;
HDC hdc;