Bug 710958 - Remove gfx{Glitz,DirectFB,QuartzPDF}Surface. r=joedrew.

--HG--
extra : rebase_source : da77b2ceb7840a42651386c822d5b21499bae439
This commit is contained in:
Nicholas Nethercote 2011-12-18 14:54:50 -08:00
parent 88102487c7
commit dcb5c7be56
21 changed files with 4 additions and 976 deletions

View File

@ -94,7 +94,6 @@ OMNIJAR_NAME = @OMNIJAR_NAME@
MOZ_WIDGET_TOOLKIT = @MOZ_WIDGET_TOOLKIT@
MOZ_GFX_OPTIMIZE_MOBILE = @MOZ_GFX_OPTIMIZE_MOBILE@
MOZ_DFB = @MOZ_DFB@
MOZ_X11 = @MOZ_X11@
MOZ_PANGO = @MOZ_PANGO@

View File

@ -113,11 +113,6 @@ fusion/protocol.h
fusion/fusion.h
fusion/arena.h
fusion/object.h
directfbgl.h
directfb_version.h
directfb.h
directfb_util.h
directfb_keynames.h
dgiff.h
direct/util.h
direct/memcpy.h

View File

@ -4799,7 +4799,6 @@ MOZ_ARG_HEADER(Toolkit Options)
Mac OS X - cairo-cocoa
OS/2 - cairo-os2
Win32 - cairo-windows
Gtk2 with DirectFB - cairo-gtk2-dfb
* - cairo-gtk2
* - cairo-qt],
[ _DEFAULT_TOOLKIT=$enableval ],
@ -4807,7 +4806,6 @@ MOZ_ARG_HEADER(Toolkit Options)
if test "$_DEFAULT_TOOLKIT" = "cairo-windows" \
-o "$_DEFAULT_TOOLKIT" = "cairo-gtk2" \
-o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-dfb" \
-o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-x11" \
-o "$_DEFAULT_TOOLKIT" = "cairo-qt" \
-o "$_DEFAULT_TOOLKIT" = "cairo-os2" \
@ -4854,24 +4852,6 @@ cairo-gtk2|cairo-gtk2-x11)
MOZ_INSTRUMENT_EVENT_LOOP=1
;;
cairo-gtk2-dfb)
MOZ_WIDGET_TOOLKIT=gtk2
MOZ_ENABLE_GTK2=1
MOZ_WEBGL=
AC_DEFINE(MOZ_DFB)
MOZ_DFB=1
TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
TK_LIBS='$(MOZ_GTK2_LIBS)'
AC_DEFINE(MOZ_WIDGET_GTK2)
if test "$no_x" != "yes"; then
AC_MSG_WARN([Disabling X when DirectFB is specified.])
no_x=yes
fi
MOZ_PDF_PRINTING=1
;;
cairo-qt)
MOZ_WIDGET_TOOLKIT=qt
MOZ_ENABLE_QT=1
@ -4967,9 +4947,6 @@ if test "$COMPILE_ENVIRONMENT"; then
if test "$MOZ_ENABLE_GTK2"; then
if test "$MOZ_X11"; then
GDK_PACKAGES=gdk-x11-2.0
elif test "$MOZ_DFB"; then
PKG_CHECK_MODULES(MOZ_DFB, directfb >= 1.1.0)
GDK_PACKAGES=directfb
fi
PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
@ -5127,7 +5104,6 @@ AC_SUBST(MOZ_QT_LIBS)
AC_SUBST(MOC)
AC_SUBST(RCC)
AC_SUBST(MOZ_DFB)
AC_SUBST(MOZ_X11)
dnl ========================================================

View File

@ -584,9 +584,6 @@ PluginModuleChild::InitGraphics()
#if defined(MOZ_X11)
if (!sGtkLib)
sGtkLib = PR_LoadLibrary("libgtk-x11-2.0.so.0");
#elif defined(MOZ_DFB)
if (!sGtkLib)
sGtkLib = PR_LoadLibrary("libgtk-directfb-2.0.so.0");
#endif
if (sGtkLib) {
s_gtk_init = (_gtk_init_fn)PR_FindFunctionSymbol(sGtkLib, "gtk_init");

View File

@ -105,7 +105,6 @@ EXPORTS += \
gfxPlatformMac.h \
gfxQuartzSurface.h \
gfxQuartzImageSurface.h \
gfxQuartzPDFSurface.h \
gfxQuartzNativeDrawing.h \
$(NULL)
endif
@ -132,9 +131,6 @@ else
EXPORTS += gfxFT2Fonts.h
endif
ifdef MOZ_DFB
EXPORTS += gfxDirectFBSurface.h
endif
endif
ifeq ($(MOZ_WIDGET_TOOLKIT),os2)
@ -328,14 +324,6 @@ CPPSRCS += gfxFT2FontBase.cpp
CPPSRCS += gfxFT2Utils.cpp
CPPSRCS += nsUnicodeRange.cpp
ifdef MOZ_DFB
CSRCS = cairo-gdk-utils.c
endif
endif
ifdef MOZ_DFB
CPPSRCS += gfxDirectFBSurface.cpp
endif
ifeq ($(MOZ_WIDGET_TOOLKIT),qt)
@ -359,7 +347,6 @@ ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa)
CPPSRCS += \
gfxQuartzSurface.cpp \
gfxQuartzImageSurface.cpp \
gfxQuartzPDFSurface.cpp \
gfxPlatformMac.cpp \
gfxMacFont.cpp \
gfxCoreTextShaper.cpp \

View File

@ -1,107 +0,0 @@
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Novell code.
*
* The Initial Developer of the Original Code is Novell.
* Portions created by the Initial Developer are Copyright (C) 2006
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* rocallahan@novell.com
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "cairo-gdk-utils.h"
#include <stdlib.h>
#if HAVE_STDINT_H
#include <stdint.h>
#elif HAVE_INTTYPES_H
#include <inttypes.h>
#elif HAVE_SYS_INT_TYPES_H
#include <sys/int_types.h>
#endif
/* We have three basic strategies available:
1) 'direct': cr targets a native surface, and other conditions are met: we can
pass the underlying drawable directly to the callback
2) 'opaque': the image is opaque: we can create a temporary cairo native surface,
pass its underlying drawable to the callback, and paint the result
using cairo
3) 'default': create a temporary cairo native surface, fill with black, pass its
underlying drawable to the callback, copy the results to a cairo
image surface, repeat with a white background, update the on-black
image alpha values by comparing the two images, then paint the on-black
image using cairo
Sure would be nice to have an X extension to do 3 for us on the server...
*/
static cairo_bool_t
_convert_coord_to_short (double coord, short *v)
{
*v = (short)coord;
/* XXX allow some tolerance here? */
return *v == coord;
}
static cairo_bool_t
_convert_coord_to_unsigned_short (double coord, unsigned short *v)
{
*v = (unsigned short)coord;
/* XXX allow some tolerance here? */
return *v == coord;
}
void cairo_draw_with_gdk (cairo_t *cr,
cairo_gdk_drawing_callback callback,
void * closure,
unsigned int width, unsigned int height,
cairo_gdk_drawing_opacity_t is_opaque,
cairo_gdk_drawing_support_t capabilities,
cairo_gdk_drawing_result_t *result)
{
double device_offset_x, device_offset_y;
short offset_x = 0, offset_y = 0;
//cairo_surface_t * target = cairo_get_group_target (cr);
cairo_surface_t * target = cairo_get_target (cr);
cairo_matrix_t matrix;
cairo_surface_get_device_offset (target, &device_offset_x, &device_offset_y);
cairo_get_matrix (cr, &matrix);
_convert_coord_to_short (matrix.x0 + device_offset_x, &offset_x);
_convert_coord_to_short (matrix.y0 + device_offset_y, &offset_y);
cairo_surface_flush (target);
callback (closure, target, offset_x, offset_y, NULL, 0);
cairo_surface_mark_dirty (target);
}

View File

@ -1,119 +0,0 @@
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Novell code.
*
* The Initial Developer of the Original Code is Novell.
* Portions created by the Initial Developer are Copyright (C) 2006
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* rocallahan@novell.com
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef CAIROGDKUTILS_H_
#define CAIROGDKUTILS_H_
#include "cairo.h"
#include <gdk/gdk.h>
CAIRO_BEGIN_DECLS
/**
* This callback encapsulates GDK-based rendering. We assume that the
* execution of the callback is equivalent to compositing some RGBA image of
* size (bounds_width, bounds_height) onto the drawable at offset (offset_x,
* offset_y), clipped to the union of the clip_rects if num_rects is greater
* than zero. This includes the assumption that the same RGBA image
* is composited if you call the callback multiple times with the same closure,
* display and visual during a single cairo_draw_with_gdk call.
*
* @return True when able to draw, False otherwise
*/
typedef cairo_bool_t (* cairo_gdk_drawing_callback)
(void *closure,
cairo_surface_t *surface,
short offset_x, short offset_y,
GdkRectangle * clip_rects, unsigned int num_rects);
/**
* This type specifies whether the native drawing callback draws all pixels
* in its bounds opaquely, independent of the contents of the target drawable,
* or whether it leaves pixels transparent/translucent or depends on the
* existing contents of the target drawable in some way.
*/
typedef enum _cairo_gdk_drawing_opacity {
CAIRO_GDK_DRAWING_OPAQUE,
CAIRO_GDK_DRAWING_TRANSPARENT
} cairo_gdk_drawing_opacity_t;
/**
* This type encodes the capabilities of the native drawing callback.
*
* If CAIRO_GDK_DRAWING_SUPPORTS_CLIP_RECT is set, then 'num_rects' can be
* zero or one in the call to the callback. Otherwise 'num_rects' will be
* zero.
*/
typedef enum {
CAIRO_GDK_DRAWING_SUPPORTS_CLIP_RECT = 0x02,
} cairo_gdk_drawing_support_t;
/**
* Draw GDK output into any cairo context. All cairo transforms and effects
* are honored, including the current operator. This is equivalent to a
* cairo_set_source_surface and then cairo_paint.
* @param cr the context to draw into
* @param drawable a GDK Drawable that we're targetting
* @param callback the code to perform GDK rendering
* @param closure associated data
* @param width the width of the putative image drawn by the callback
* @param height the height of the putative image drawn by the callback
* @param is_opaque set to CAIRO_GDK_DRAWING_IS_OPAQUE to indicate
* that all alpha values of the putative image will be 1.0; the pixels drawn into
* the Drawable must not depend on the prior contents of the Drawable
* in any way
* @param capabilities the capabilities of the callback as described above.
* @param result if non-NULL, we *may* fill in the struct with information about
* the rendered image. 'surface' may be filled in with a surface representing
* the image, similar to the target of 'cr'. If 'uniform_alpha' is True then
* every pixel of the image has the same alpha value 'alpha'. If
* 'uniform_color' is True then every pixel of the image has the same RGB
* color (r, g, b). If the image has uniform color and alpha (or alpha is zero,
* in which case the color is always uniform) then we won't bother returning
* a surface for it.
*/
void cairo_draw_with_gdk (cairo_t *cr,
cairo_gdk_drawing_callback callback,
void * closure,
unsigned int width, unsigned int height,
cairo_gdk_drawing_opacity_t is_opaque,
cairo_gdk_drawing_support_t capabilities,
cairo_gdk_drawing_result_t *result);
CAIRO_END_DECLS
#endif /*CAIROGDKUTILS_H_*/

View File

@ -64,10 +64,6 @@
#include "gfxQuartzImageSurface.h"
#endif
#ifdef MOZ_DFB
#include "gfxDirectFBSurface.h"
#endif
#if defined(CAIRO_HAS_QT_SURFACE) && defined(MOZ_WIDGET_QT)
#include "gfxQPainterSurface.h"
#endif
@ -203,11 +199,6 @@ gfxASurface::Wrap (cairo_surface_t *csurf)
result = new gfxQuartzImageSurface(csurf);
}
#endif
#ifdef MOZ_DFB
else if (stype == CAIRO_SURFACE_TYPE_DIRECTFB) {
result = new gfxDirectFBSurface(csurf);
}
#endif
#if defined(CAIRO_HAS_QT_SURFACE) && defined(MOZ_WIDGET_QT)
else if (stype == CAIRO_SURFACE_TYPE_QT) {
result = new gfxQPainterSurface(csurf);
@ -579,11 +570,11 @@ static const SurfaceMemoryReporterAttrs sSurfaceMemoryReporterAttrs[] = {
"accounted for here aren't counted in vsize, resident, explicit, or any of "
"the other measurements on this page."},
{"gfx-surface-xcb", nsnull},
{"gfx-surface-glitz", nsnull},
{"gfx-surface-glitz???", nsnull}, // should never be used
{"gfx-surface-quartz", nsnull},
{"gfx-surface-win32", nsnull},
{"gfx-surface-beos", nsnull},
{"gfx-surface-directfb", nsnull},
{"gfx-surface-directfb???", nsnull}, // should never be used
{"gfx-surface-svg", nsnull},
{"gfx-surface-os2", nsnull},
{"gfx-surface-win32printing", nsnull},

View File

@ -80,11 +80,11 @@ public:
SurfaceTypePS,
SurfaceTypeXlib,
SurfaceTypeXcb,
SurfaceTypeGlitz,
SurfaceTypeGlitz, // unused, but needed for cairo parity
SurfaceTypeQuartz,
SurfaceTypeWin32,
SurfaceTypeBeOS,
SurfaceTypeDirectFB,
SurfaceTypeDirectFB, // unused, but needed for cairo parity
SurfaceTypeSVG,
SurfaceTypeOS2,
SurfaceTypeWin32Printing,

View File

@ -1,147 +0,0 @@
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Corporation code.
*
* The Initial Developer of the Original Code is Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Vladimir Vukicevic <vladimir@pobox.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "gfxDirectFBSurface.h"
#include "cairo-directfb.h"
gfxDirectFBSurface::gfxDirectFBSurface(IDirectFB *dfb, IDirectFBSurface *dfbs)
: mDFB(nsnull), mDFBSurface(nsnull)
{
dfb->AddRef( dfb );
dfbs->AddRef( dfbs );
cairo_surface_t *surf = cairo_directfb_surface_create(dfb, dfbs);
mDFB = dfb;
mDFBSurface = dfbs;
Init(surf);
}
gfxDirectFBSurface::gfxDirectFBSurface(IDirectFBSurface *dfbs)
: mDFB(nsnull), mDFBSurface(nsnull)
{
DFBResult ret;
dfbs->AddRef( dfbs );
/* Lightweight, getting singleton */
ret = DirectFBCreate( &mDFB );
if (ret) {
D_DERROR( (DirectResult) ret, "gfxDirectFBSurface: DirectFBCreate() failed!\n" );
return;
}
cairo_surface_t *surf = cairo_directfb_surface_create(mDFB, dfbs);
mDFBSurface = dfbs;
Init(surf);
}
gfxDirectFBSurface::gfxDirectFBSurface(cairo_surface_t *csurf)
{
mDFB = nsnull;
mDFBSurface = nsnull;
Init(csurf, true);
}
gfxDirectFBSurface::gfxDirectFBSurface(const gfxIntSize& size, gfxImageFormat format) :
mDFB(nsnull), mDFBSurface(nsnull)
{
DFBResult ret;
DFBSurfaceDescription desc;
if (!CheckSurfaceSize(size) || size.width <= 0 || size.height <= 0)
return;
/* Lightweight, getting singleton */
ret = DirectFBCreate( &mDFB );
if (ret) {
D_DERROR( (DirectResult) ret, "gfxDirectFBSurface: DirectFBCreate() failed!\n" );
return;
}
desc.flags = (DFBSurfaceDescriptionFlags)( DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_PIXELFORMAT );
desc.width = size.width;
desc.height = size.height;
switch (format) {
case gfxASurface::ImageFormatARGB32:
desc.pixelformat = DSPF_ARGB;
break;
case gfxASurface::ImageFormatRGB24:
desc.pixelformat = DSPF_RGB32;
break;
case gfxASurface::ImageFormatA8:
desc.pixelformat = DSPF_A8;
break;
case gfxASurface::ImageFormatA1:
desc.pixelformat = DSPF_A1;
break;
default:
D_BUG( "unknown format" );
return;
}
ret = mDFB->CreateSurface( mDFB, &desc, &mDFBSurface );
if (ret) {
D_DERROR( (DirectResult) ret, "gfxDirectFBSurface: "
"IDirectFB::CreateSurface( %dx%d ) failed!\n", desc.width, desc.height );
return;
}
cairo_surface_t *surface = cairo_directfb_surface_create(mDFB, mDFBSurface);
Init(surface);
}
gfxDirectFBSurface::~gfxDirectFBSurface()
{
if (mDFBSurface)
mDFBSurface->Release( mDFBSurface );
if (mDFB)
mDFB->Release( mDFB );
}

View File

@ -1,69 +0,0 @@
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is DirectFB Thebes code.
*
* The Initial Developer of the Original Code is Mozilla Foundation
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Vladimir Vukicevic <vladimir@pobox.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef GFX_DIRECTFBSURFACE_H
#define GFX_DIRECTFBSURFACE_H
#include "gfxASurface.h"
extern "C" {
#include "direct/messages.h"
typedef struct _IDirectFB IDirectFB;
typedef struct _IDirectFBSurface IDirectFBSurface;
}
class THEBES_API gfxDirectFBSurface : public gfxASurface {
public:
gfxDirectFBSurface(IDirectFB *dfb, IDirectFBSurface *surface);
gfxDirectFBSurface(IDirectFBSurface *surface);
gfxDirectFBSurface(cairo_surface_t *csurf);
gfxDirectFBSurface(const gfxIntSize& size, gfxImageFormat format);
virtual ~gfxDirectFBSurface();
IDirectFB* DirectFB() { return mDFB; }
IDirectFBSurface* DirectFBSurface() { return mDFBSurface; }
protected:
IDirectFB *mDFB;
IDirectFBSurface *mDFBSurface;
};
#endif /* GFX_DIRECTFBSURFACE_H */

View File

@ -93,56 +93,3 @@ gfxGdkNativeRenderer::Draw(gfxContext* ctx, nsIntSize size,
}
#endif
#ifdef MOZ_DFB
#include "cairo-gdk-utils.h"
typedef struct {
gfxGdkNativeRenderer* mRenderer;
nsresult mRV;
} NativeRenderingClosure;
static cairo_bool_t
NativeRendering(void *closure,
cairo_surface_t *surface,
short offset_x, short offset_y,
GdkRectangle * rectangles, unsigned int num_rects)
{
NativeRenderingClosure* cl = (NativeRenderingClosure*)closure;
nsRefPtr<gfxASurface> gfxSurface = gfxASurface::Wrap(surface);
GdkDrawable *drawable = gfxPlatformGtk::GetGdkDrawable(gfxSurface);
if (!drawable)
return 0;
nsresult rv = cl->mRenderer->
DrawWithGDK(drawable, offset_x, offset_y,
rectangles, num_rects);
cl->mRV = rv;
return NS_SUCCEEDED(rv);
}
void
gfxGdkNativeRenderer::Draw(gfxContext* ctx, nsIntSize size,
PRUint32 flags, GdkVisual* visual)
{
NativeRenderingClosure closure = { this, NS_OK };
cairo_gdk_drawing_result_t result;
int cairoFlags = 0;
if (flags & DRAW_SUPPORTS_CLIP_RECT) {
cairoFlags |= CAIRO_GDK_DRAWING_SUPPORTS_CLIP_RECT;
}
cairo_draw_with_gdk(ctx->GetCairo(),
NativeRendering,
&closure, size.width, size.height,
(flags & DRAW_IS_OPAQUE) ? CAIRO_GDK_DRAWING_OPAQUE : CAIRO_GDK_DRAWING_TRANSPARENT,
(cairo_gdk_drawing_support_t)cairoFlags,
NULL);
if (NS_FAILED(closure.mRV)) {
return closure.mRV;
}
return NS_OK;
}
#endif // MOZ_DFB

View File

@ -1,73 +0,0 @@
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Oracle Corporation code.
*
* The Initial Developer of the Original Code is Oracle Corporation.
* Portions created by the Initial Developer are Copyright (C) 2005
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Vladimir Vukicevic <vladimir@pobox.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef GFX_GLITZSURFACE_H
#define GFX_GLITZSURFACE_H
#include "gfxASurface.h"
#include <cairo-glitz.h>
/**
* A surface that wraps a glitz surface.
*/
class THEBES_API gfxGlitzSurface : public gfxASurface {
public:
gfxGlitzSurface(glitz_drawable_t *drawable,
glitz_surface_t *glitzSurface,
bool takeOwnership = false);
virtual ~gfxGlitzSurface();
/**
* When double-buffering is used, swaps the back and the front buffer.
*/
void SwapBuffers();
unsigned long Width();
unsigned long Height();
glitz_surface_t* GlitzSurface() { return mGlitzSurface; }
glitz_drawable_t* GlitzDrawable() { return mGlitzDrawable; }
protected:
glitz_drawable_t *mGlitzDrawable;
glitz_surface_t *mGlitzSurface;
bool mOwnsSurface;
};
#endif /* GFX_GLITZSURFACE_H */

View File

@ -72,14 +72,6 @@
#endif /* MOZ_X11 */
#ifdef MOZ_DFB
#include "gfxDirectFBSurface.h"
#endif
#ifdef MOZ_DFB
#include "gfxDirectFBSurface.h"
#endif
#include <fontconfig/fontconfig.h>
#include "nsMathUtils.h"
@ -204,13 +196,6 @@ gfxPlatformGtk::CreateOffscreenSurface(const gfxIntSize& size,
}
#endif
#ifdef MOZ_DFB
if (size.width < GDK_PIXMAP_SIZE_MAX && size.height < GDK_PIXMAP_SIZE_MAX) {
newSurface = new gfxDirectFBSurface(size, imageFormat);
}
#endif
if (!newSurface) {
// We couldn't create a native surface for whatever reason;
// e.g., no display, no RENDER, bad size, etc.

View File

@ -1,93 +0,0 @@
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Corporation code.
*
* The Initial Developer of the Original Code is Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2006
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Stuart Parmenter <stuart@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "gfxQuartzPDFSurface.h"
#include "cairo-quartz.h"
gfxQuartzPDFSurface::gfxQuartzPDFSurface(const char *filename, gfxSize aSizeInPoints)
{
mRect = CGRectMake(0.0, 0.0, aSizeInPoints.width, aSizeInPoints.height);
CFStringRef file = CFStringCreateWithCString(kCFAllocatorDefault, filename, kCFStringEncodingUTF8);
CFURLRef fileURL = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, file, kCFURLPOSIXPathStyle, false);
mCGContext = CGPDFContextCreateWithURL(fileURL, &mRect, NULL);
CFRelease(file);
CFRelease(fileURL);
Init(cairo_quartz_surface_create_for_cg_context(mCGContext, aSizeInPoints.width, aSizeInPoints.height));
}
gfxQuartzPDFSurface::~gfxQuartzPDFSurface()
{
CGContextRelease(mCGContext);
}
nsresult
gfxQuartzPDFSurface::BeginPrinting(const nsAString& aTitle, const nsAString& aPrintToFileName)
{
return NS_OK;
}
nsresult
gfxQuartzPDFSurface::EndPrinting()
{
return NS_OK;
}
nsresult
gfxQuartzPDFSurface::AbortPrinting()
{
return NS_OK;
}
nsresult
gfxQuartzPDFSurface::BeginPage()
{
CGContextBeginPage(mCGContext, &mRect);
return NS_OK;
}
nsresult
gfxQuartzPDFSurface::EndPage()
{
CGContextEndPage(mCGContext);
return NS_OK;
}

View File

@ -1,74 +0,0 @@
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Corporation code.
*
* The Initial Developer of the Original Code is Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2006
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Stuart Parmenter <stuart@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef GFX_QUARTZPDFSURFACE_H
#define GFX_QUARTZPDFSURFACE_H
#include "gfxASurface.h"
#include "gfxContext.h"
#include <Carbon/Carbon.h>
class THEBES_API gfxQuartzPDFSurface : public gfxASurface {
public:
gfxQuartzPDFSurface(const char *filename, gfxSize aSizeInPoints);
virtual ~gfxQuartzPDFSurface();
nsresult BeginPrinting(const nsAString& aTitle, const nsAString& aPrintToFileName);
nsresult EndPrinting();
nsresult AbortPrinting();
nsresult BeginPage();
nsresult EndPage();
virtual const gfxIntSize GetSize() const {
gfxIntSize size(mRect.size.width, mRect.size.height);
return size;
}
CGContextRef GetCGContext() { return mCGContext; }
virtual PRInt32 GetDefaultContextFlags() const
{
return gfxContext::FLAG_DISABLE_SNAPPING |
gfxContext::FLAG_DISABLE_COPY_BACKGROUND;
}
protected:
CGContextRef mCGContext;
CGRect mRect;
};
#endif /* GFX_QUARTZPDFSURFACE_H */

View File

@ -113,11 +113,6 @@ fusion/protocol.h
fusion/fusion.h
fusion/arena.h
fusion/object.h
directfbgl.h
directfb_version.h
directfb.h
directfb_util.h
directfb_keynames.h
dgiff.h
direct/util.h
direct/memcpy.h

View File

@ -56,9 +56,6 @@ nsBidiKeyboard::nsBidiKeyboard()
#if defined(MOZ_X11)
if (!gtklib)
gtklib = PR_LoadLibrary("libgtk-x11-2.0.so.0");
#elif defined(MOZ_DFB)
if (!gtklib)
gtklib = PR_LoadLibrary("libgtk-directfb-2.0.so.0");
#else
return;
#endif

View File

@ -45,10 +45,6 @@
#define SCREEN_MANAGER_LIBRARY_LOAD_FAILED ((PRLibrary*)1)
#ifdef MOZ_DFB
#include <directfb.h>
#endif
#ifdef MOZ_X11
#include <gdk/gdkx.h>
// prototypes from Xinerama.h
@ -85,23 +81,6 @@ root_window_event_filter(GdkXEvent *aGdkXEvent, GdkEvent *aGdkEvent,
}
#endif
#ifdef MOZ_DFB
DFBWindowEvent * dfbEvent = static_cast<DFBWindowEvent *> (aGdkXEvent);
switch (dfbEvent->type)
{
case DWET_POSITION :
case DWET_SIZE :
manager->Init();
break;
/* TODO: Need to find out PropertyNotify equivalent in
* DFB.. */
default :
break;
}
#endif
return GDK_FILTER_CONTINUE;
}

View File

@ -158,20 +158,6 @@ extern "C" {
#include "nsShmImage.h"
#ifdef MOZ_DFB
extern "C" {
#ifdef MOZ_DIRECT_DEBUG
#define DIRECT_ENABLE_DEBUG
#endif
#include <direct/debug.h>
D_DEBUG_DOMAIN( ns_Window, "nsWindow", "nsWindow" );
}
#include "gfxDirectFBSurface.h"
#define GDK_WINDOW_XWINDOW(_win) _win
#endif
using namespace mozilla;
using namespace mozilla::widget;
using mozilla::gl::GLContext;
@ -449,16 +435,6 @@ nsWindow::nsWindow()
mTransparencyBitmapWidth = 0;
mTransparencyBitmapHeight = 0;
#ifdef MOZ_DFB
mDFBCursorX = 0;
mDFBCursorY = 0;
mDFBCursorCount = 0;
mDFB = NULL;
mDFBLayer = NULL;
#endif
}
nsWindow::~nsWindow()
@ -471,14 +447,6 @@ nsWindow::~nsWindow()
delete[] mTransparencyBitmap;
mTransparencyBitmap = nsnull;
#ifdef MOZ_DFB
if (mDFBLayer)
mDFBLayer->Release( mDFBLayer );
if (mDFB)
mDFB->Release( mDFB );
#endif
Destroy();
}
@ -2256,17 +2224,6 @@ nsWindow::OnExposeEvent(cairo_t *cr)
nsRefPtr<gfxContext> ctx = new gfxContext(GetThebesSurface(cr));
#endif
#ifdef MOZ_DFB
gfxPlatformGtk::SetGdkDrawable(ctx->OriginalSurface(),
GDK_DRAWABLE(mGdkWindow));
// clip to the update region
gfxUtils::ClipToRegion(ctx, event.region);
BasicLayerManager::BufferMode layerBuffering =
BasicLayerManager::BUFFER_NONE;
#endif
#ifdef MOZ_X11
nsIntRect boundsRect; // for translucent only
@ -2598,68 +2555,6 @@ nsWindow::OnLeaveNotifyEvent(GtkWidget *aWidget, GdkEventCrossing *aEvent)
DispatchEvent(&event, status);
}
#ifdef MOZ_DFB
void
nsWindow::OnMotionNotifyEvent(GtkWidget *aWidget, GdkEventMotion *aEvent)
{
int cursorX = (int) aEvent->x_root;
int cursorY = (int) aEvent->y_root;
D_DEBUG_AT( ns_Window, "%s( %4d,%4d - [%d] )\n", __FUNCTION__, cursorX, cursorY, mDFBCursorCount );
D_ASSUME( mDFBLayer != NULL );
if (mDFBLayer)
mDFBLayer->GetCursorPosition( mDFBLayer, &cursorX, &cursorY );
mDFBCursorCount++;
#if D_DEBUG_ENABLED
if (cursorX != (int) aEvent->x_root || cursorY != (int) aEvent->y_root)
D_DEBUG_AT( ns_Window, " -> forward to %4d,%4d\n", cursorX, cursorY );
#endif
if (cursorX == mDFBCursorX && cursorY == mDFBCursorY) {
D_DEBUG_AT( ns_Window, " -> dropping %4d,%4d\n", cursorX, cursorY );
/* drop zero motion */
return;
}
mDFBCursorX = cursorX;
mDFBCursorY = cursorY;
// when we receive this, it must be that the gtk dragging is over,
// it is dropped either in or out of mozilla, clear the flag
sIsDraggingOutOf = false;
nsMouseEvent event(true, NS_MOUSE_MOVE, this, nsMouseEvent::eReal);
// should we move this into !synthEvent?
gdouble pressure = 0;
gdk_event_get_axis ((GdkEvent*)aEvent, GDK_AXIS_PRESSURE, &pressure);
// Sometime gdk generate 0 pressure value between normal values
// We have to ignore that and use last valid value
if (pressure)
mLastMotionPressure = pressure;
event.pressure = mLastMotionPressure;
event.refPoint = nsIntPoint(cursorX, cursorY) - WidgetToScreenOffset();
event.isShift = (aEvent->state & GDK_SHIFT_MASK)
? true : false;
event.isControl = (aEvent->state & GDK_CONTROL_MASK)
? true : false;
event.isAlt = (aEvent->state & GDK_MOD1_MASK)
? true : false;
event.time = aEvent->time;
nsEventStatus status;
DispatchEvent(&event, status);
}
#else
void
nsWindow::OnMotionNotifyEvent(GtkWidget *aWidget, GdkEventMotion *aEvent)
{
@ -2753,7 +2648,6 @@ nsWindow::OnMotionNotifyEvent(GtkWidget *aWidget, GdkEventMotion *aEvent)
nsEventStatus status;
DispatchEvent(&event, status);
}
#endif
// If the automatic pointer grab on ButtonPress has deactivated before
// ButtonRelease, and the mouse button is released while the pointer is not
@ -4380,22 +4274,6 @@ nsWindow::Create(nsIWidget *aParent,
}
#endif
#ifdef MOZ_DFB
if (!mDFB) {
DirectFBCreate( &mDFB );
D_ASSUME( mDFB != NULL );
if (mDFB)
mDFB->GetDisplayLayer( mDFB, DLID_PRIMARY, &mDFBLayer );
D_ASSUME( mDFBLayer != NULL );
if (mDFBLayer)
mDFBLayer->GetCursorPosition( mDFBLayer, &mDFBCursorX, &mDFBCursorY );
}
#endif
return NS_OK;
}
@ -6803,10 +6681,6 @@ nsWindow::GetThebesSurface(cairo_t *cr)
#endif
#endif
#endif
#ifdef MOZ_DFB
// not supported
mThebesSurface = nsnull;
#endif
// if the surface creation is reporting an error, then

View File

@ -58,10 +58,6 @@
#include <gdk/gdk.h>
#include <gtk/gtk.h>
#ifdef MOZ_DFB
#include <gdk/gdkdirectfb.h>
#endif /* MOZ_DFB */
#ifdef MOZ_X11
#include <gdk/gdkx.h>
#endif /* MOZ_X11 */
@ -418,14 +414,6 @@ private:
#endif
nsRefPtr<gfxASurface> mThebesSurface;
#ifdef MOZ_DFB
int mDFBCursorX;
int mDFBCursorY;
PRUint32 mDFBCursorCount;
IDirectFB *mDFB;
IDirectFBDisplayLayer *mDFBLayer;
#endif
#ifdef ACCESSIBILITY
nsRefPtr<nsAccessible> mRootAccessible;