mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-09 08:28:03 +02:00
build: Remove glitz surface
glitz is unmaintained and the GL surface is far superior anyway.
This commit is contained in:
parent
17ddb1598b
commit
58980b4ad6
28 changed files with 3 additions and 3624 deletions
8
README
8
README
|
|
@ -6,8 +6,8 @@ What is cairo
|
|||
Cairo is a 2D graphics library with support for multiple output
|
||||
devices. Currently supported output targets include the X Window
|
||||
System, quartz, win32, and image buffers, as well as PDF, PostScript,
|
||||
and SVG file output. Experimental backends include OpenGL (through
|
||||
glitz), XCB, BeOS, OS/2, and DirectFB.
|
||||
and SVG file output. Experimental backends include OpenGL, XCB, BeOS,
|
||||
OS/2, and DirectFB.
|
||||
|
||||
Cairo is designed to produce consistent output on all output media
|
||||
while taking advantage of display hardware acceleration when available
|
||||
|
|
@ -163,10 +163,6 @@ Font backends (required to have at least one)
|
|||
|
||||
Experimental surface backends
|
||||
-----------------------------
|
||||
glitz
|
||||
-------------
|
||||
glitz >= 0.4.4 http://freedesktop.org/Software/glitz
|
||||
|
||||
xcb backend
|
||||
-----------
|
||||
XCB http://xcb.freedesktop.org
|
||||
|
|
|
|||
|
|
@ -32,19 +32,6 @@ if CAIRO_HAS_BEOS_SURFACE
|
|||
AM_CPPFLAGS += -Wno-multichar
|
||||
endif
|
||||
|
||||
if CAIRO_CAN_TEST_GLITZ_AGL_SURFACE
|
||||
libcairoboilerplate_la_LIBADD += $(GLITZ_AGL_LIBS)
|
||||
endif
|
||||
if CAIRO_CAN_TEST_GLITZ_EGL_SURFACE
|
||||
libcairoboilerplate_la_LIBADD += $(GLITZ_EGL_LIBS)
|
||||
endif
|
||||
if CAIRO_CAN_TEST_GLITZ_GLX_SURFACE
|
||||
libcairoboilerplate_la_LIBADD += $(GLITZ_GLX_LIBS)
|
||||
endif
|
||||
if CAIRO_CAN_TEST_GLITZ_WGL_SURFACE
|
||||
libcairoboilerplate_la_LIBADD += $(GLITZ_WGL_LIBS)
|
||||
endif
|
||||
|
||||
if CAIRO_HAS_WIN32_SURFACE
|
||||
libcairoboilerplate_la_LIBADD += -lwinspool
|
||||
endif
|
||||
|
|
|
|||
|
|
@ -26,11 +26,6 @@ cairo_boilerplate_private = \
|
|||
cairo_boilerplate_directfb_sources = cairo-boilerplate-directfb.c
|
||||
cairo_boilerplate_drm_sources = cairo-boilerplate-drm.c
|
||||
cairo_boilerplate_gl_sources = cairo-boilerplate-gl.c
|
||||
cairo_boilerplate_glitz_sources = \
|
||||
cairo-boilerplate-glitz-agl.c \
|
||||
cairo-boilerplate-glitz-glx.c \
|
||||
cairo-boilerplate-glitz-wgl.c \
|
||||
$(NULL)
|
||||
cairo_boilerplate_pdf_sources = cairo-boilerplate-pdf.c
|
||||
cairo_boilerplate_ps_sources = cairo-boilerplate-ps.c
|
||||
cairo_boilerplate_qt_sources = cairo-boilerplate-qt.cpp
|
||||
|
|
|
|||
|
|
@ -209,16 +209,6 @@ enabled_cairo_boilerplate_private += $(cairo_boilerplate_gl_private)
|
|||
enabled_cairo_boilerplate_sources += $(cairo_boilerplate_gl_sources)
|
||||
endif
|
||||
|
||||
unsupported_cairo_boilerplate_headers += $(cairo_boilerplate_glitz_headers)
|
||||
all_cairo_boilerplate_headers += $(cairo_boilerplate_glitz_headers)
|
||||
all_cairo_boilerplate_private += $(cairo_boilerplate_glitz_private)
|
||||
all_cairo_boilerplate_sources += $(cairo_boilerplate_glitz_sources)
|
||||
ifeq ($(CAIRO_HAS_GLITZ_SURFACE),1)
|
||||
enabled_cairo_boilerplate_headers += $(cairo_boilerplate_glitz_headers)
|
||||
enabled_cairo_boilerplate_private += $(cairo_boilerplate_glitz_private)
|
||||
enabled_cairo_boilerplate_sources += $(cairo_boilerplate_glitz_sources)
|
||||
endif
|
||||
|
||||
unsupported_cairo_boilerplate_headers += $(cairo_boilerplate_directfb_headers)
|
||||
all_cairo_boilerplate_headers += $(cairo_boilerplate_directfb_headers)
|
||||
all_cairo_boilerplate_private += $(cairo_boilerplate_directfb_private)
|
||||
|
|
|
|||
|
|
@ -1,191 +0,0 @@
|
|||
/* -*- Mode: c; c-basic-offset: 4; indent-tabs-mode: t; tab-width: 8; -*- */
|
||||
/*
|
||||
* Copyright © 2004,2006 Red Hat, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software
|
||||
* and its documentation for any purpose is hereby granted without
|
||||
* fee, provided that the above copyright notice appear in all copies
|
||||
* and that both that copyright notice and this permission notice
|
||||
* appear in supporting documentation, and that the name of
|
||||
* Red Hat, Inc. not be used in advertising or publicity pertaining to
|
||||
* distribution of the software without specific, written prior
|
||||
* permission. Red Hat, Inc. makes no representations about the
|
||||
* suitability of this software for any purpose. It is provided "as
|
||||
* is" without express or implied warranty.
|
||||
*
|
||||
* RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL,
|
||||
* INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
|
||||
* RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
* IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
* Author: Carl D. Worth <cworth@cworth.org>
|
||||
*/
|
||||
|
||||
#include "cairo-boilerplate-private.h"
|
||||
|
||||
#if CAIRO_CAN_TEST_GLITZ_AGL_SURFACE
|
||||
#include <cairo-glitz.h>
|
||||
#include <glitz-agl.h>
|
||||
|
||||
static const cairo_user_data_key_t glitz_closure_key;
|
||||
|
||||
typedef struct _glitz_agl_target_closure {
|
||||
glitz_target_closure_base_t base;
|
||||
} glitz_agl_target_closure_t;
|
||||
|
||||
static glitz_surface_t *
|
||||
_cairo_boilerplate_glitz_agl_create_surface_internal (glitz_format_name_t formatname,
|
||||
int width,
|
||||
int height,
|
||||
glitz_agl_target_closure_t *closure)
|
||||
{
|
||||
glitz_drawable_format_t *dformat;
|
||||
glitz_drawable_format_t templ;
|
||||
glitz_drawable_t *gdraw;
|
||||
glitz_format_t *format;
|
||||
glitz_surface_t *sr = NULL;
|
||||
unsigned long mask;
|
||||
|
||||
memset(&templ, 0, sizeof(templ));
|
||||
templ.color.red_size = 8;
|
||||
templ.color.green_size = 8;
|
||||
templ.color.blue_size = 8;
|
||||
templ.color.alpha_size = 8;
|
||||
templ.color.fourcc = GLITZ_FOURCC_RGB;
|
||||
templ.samples = 1;
|
||||
|
||||
mask = GLITZ_FORMAT_SAMPLES_MASK | GLITZ_FORMAT_FOURCC_MASK |
|
||||
GLITZ_FORMAT_RED_SIZE_MASK | GLITZ_FORMAT_GREEN_SIZE_MASK |
|
||||
GLITZ_FORMAT_BLUE_SIZE_MASK;
|
||||
if (formatname == GLITZ_STANDARD_ARGB32)
|
||||
mask |= GLITZ_FORMAT_ALPHA_SIZE_MASK;
|
||||
|
||||
dformat = glitz_agl_find_pbuffer_format (mask, &templ, 0);
|
||||
if (!dformat) {
|
||||
fprintf (stderr, "Glitz failed to find pbuffer format for template.");
|
||||
goto FAIL;
|
||||
}
|
||||
|
||||
gdraw = glitz_agl_create_pbuffer_drawable (dformat, width, height);
|
||||
if (!gdraw) {
|
||||
fprintf (stderr, "Glitz failed to create pbuffer drawable.");
|
||||
goto FAIL;
|
||||
}
|
||||
|
||||
format = glitz_find_standard_format (gdraw, formatname);
|
||||
if (!format) {
|
||||
fprintf (stderr, "Glitz failed to find standard format for drawable.");
|
||||
goto DESTROY_DRAWABLE;
|
||||
}
|
||||
|
||||
sr = glitz_surface_create (gdraw, format, width, height, 0, NULL);
|
||||
if (!sr) {
|
||||
fprintf (stderr, "Glitz failed to create a surface.");
|
||||
goto DESTROY_DRAWABLE;
|
||||
}
|
||||
|
||||
glitz_surface_attach (sr, gdraw, GLITZ_DRAWABLE_BUFFER_FRONT_COLOR);
|
||||
|
||||
DESTROY_DRAWABLE:
|
||||
glitz_drawable_destroy (gdraw);
|
||||
return sr;
|
||||
|
||||
FAIL:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static cairo_surface_t *
|
||||
_cairo_boilerplate_glitz_agl_create_surface (const char *name,
|
||||
cairo_content_t content,
|
||||
double width,
|
||||
double height,
|
||||
double max_width,
|
||||
double max_height,
|
||||
cairo_boilerplate_mode_t mode,
|
||||
int id,
|
||||
void **closure)
|
||||
{
|
||||
glitz_surface_t *glitz_surface;
|
||||
cairo_surface_t *surface = NULL;
|
||||
glitz_agl_target_closure_t *aglc;
|
||||
int status;
|
||||
|
||||
glitz_agl_init ();
|
||||
|
||||
*closure = aglc = xmalloc (sizeof (glitz_agl_target_closure_t));
|
||||
|
||||
switch (content) {
|
||||
case CAIRO_CONTENT_COLOR:
|
||||
glitz_surface = _cairo_boilerplate_glitz_agl_create_surface_internal (GLITZ_STANDARD_RGB24, width, height, NULL);
|
||||
break;
|
||||
case CAIRO_CONTENT_COLOR_ALPHA:
|
||||
glitz_surface = _cairo_boilerplate_glitz_agl_create_surface_internal (GLITZ_STANDARD_ARGB32, width, height, NULL);
|
||||
break;
|
||||
case CAIRO_CONTENT_ALPHA:
|
||||
default:
|
||||
fprintf (stderr, "Invalid content for glitz-agl test: %d\n", content);
|
||||
goto FAIL;
|
||||
}
|
||||
|
||||
if (!glitz_surface)
|
||||
goto FAIL;
|
||||
|
||||
surface = cairo_glitz_surface_create (glitz_surface);
|
||||
glitz_surface_destroy (glitz_surface);
|
||||
|
||||
if (cairo_surface_status (surface))
|
||||
goto FAIL;
|
||||
|
||||
aglc->base.width = width;
|
||||
aglc->base.height = height;
|
||||
aglc->base.content = content;
|
||||
status = cairo_surface_set_user_data (surface,
|
||||
&glitz_closure_key, aglc, NULL);
|
||||
if (status == CAIRO_STATUS_SUCCESS)
|
||||
return surface;
|
||||
|
||||
cairo_surface_destroy (surface);
|
||||
surface = cairo_boilerplate_surface_create_in_error (status);
|
||||
|
||||
FAIL:
|
||||
glitz_agl_fini ();
|
||||
return surface;
|
||||
}
|
||||
|
||||
static void
|
||||
_cairo_boilerplate_glitz_agl_cleanup (void *closure)
|
||||
{
|
||||
free (closure);
|
||||
glitz_agl_fini ();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static const cairo_boilerplate_target_t targets[] = {
|
||||
#if CAIRO_CAN_TEST_GLITZ_AGL_SURFACE
|
||||
{
|
||||
"glitz-agl", "glitz", NULL, NULL,
|
||||
CAIRO_SURFACE_TYPE_GLITZ, CAIRO_CONTENT_COLOR_ALPHA, 0,
|
||||
"cairo_glitz_surface_create",
|
||||
_cairo_boilerplate_glitz_agl_create_surface,
|
||||
NULL, NULL,
|
||||
_cairo_boilerplate_get_image_surface,
|
||||
cairo_surface_write_to_png,
|
||||
_cairo_boilerplate_glitz_agl_cleanup
|
||||
},
|
||||
{
|
||||
"glitz-agl", "glitz", NULL, NULL,
|
||||
CAIRO_SURFACE_TYPE_GLITZ, CAIRO_CONTENT_COLOR, 0,
|
||||
"cairo_glitz_surface_create",
|
||||
_cairo_boilerplate_glitz_agl_create_surface,
|
||||
NULL, NULL,
|
||||
_cairo_boilerplate_get_image_surface,
|
||||
cairo_surface_write_to_png,
|
||||
_cairo_boilerplate_glitz_agl_cleanup
|
||||
},
|
||||
#endif
|
||||
};
|
||||
CAIRO_BOILERPLATE (glitz_agl, targets)
|
||||
|
|
@ -1,265 +0,0 @@
|
|||
/* -*- Mode: c; c-basic-offset: 4; indent-tabs-mode: t; tab-width: 8; -*- */
|
||||
/*
|
||||
* Copyright © 2004,2006 Red Hat, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software
|
||||
* and its documentation for any purpose is hereby granted without
|
||||
* fee, provided that the above copyright notice appear in all copies
|
||||
* and that both that copyright notice and this permission notice
|
||||
* appear in supporting documentation, and that the name of
|
||||
* Red Hat, Inc. not be used in advertising or publicity pertaining to
|
||||
* distribution of the software without specific, written prior
|
||||
* permission. Red Hat, Inc. makes no representations about the
|
||||
* suitability of this software for any purpose. It is provided "as
|
||||
* is" without express or implied warranty.
|
||||
*
|
||||
* RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL,
|
||||
* INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
|
||||
* RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
* IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
* Author: Carl D. Worth <cworth@cworth.org>
|
||||
*/
|
||||
|
||||
#include "cairo-boilerplate-private.h"
|
||||
|
||||
#if CAIRO_CAN_TEST_GLITZ_GLX_SURFACE
|
||||
#include <cairo-glitz.h>
|
||||
#include <glitz-glx.h>
|
||||
|
||||
static const cairo_user_data_key_t glitz_closure_key;
|
||||
|
||||
typedef struct _glitz_glx_target_closure {
|
||||
Display *dpy;
|
||||
int scr;
|
||||
Window win;
|
||||
} glitz_glx_target_closure_t;
|
||||
|
||||
static glitz_surface_t *
|
||||
_cairo_boilerplate_glitz_glx_create_surface_internal (glitz_format_name_t formatname,
|
||||
int width,
|
||||
int height,
|
||||
glitz_glx_target_closure_t *closure)
|
||||
{
|
||||
Display * dpy = closure->dpy;
|
||||
int scr = closure->scr;
|
||||
glitz_drawable_format_t templ;
|
||||
glitz_drawable_format_t * dformat = NULL;
|
||||
unsigned long mask;
|
||||
glitz_drawable_t * drawable = NULL;
|
||||
glitz_format_t * format;
|
||||
glitz_surface_t * sr;
|
||||
|
||||
XSizeHints xsh;
|
||||
XSetWindowAttributes xswa;
|
||||
XVisualInfo * vinfo;
|
||||
|
||||
memset(&templ, 0, sizeof(templ));
|
||||
templ.color.red_size = 8;
|
||||
templ.color.green_size = 8;
|
||||
templ.color.blue_size = 8;
|
||||
templ.color.alpha_size = 8;
|
||||
templ.color.fourcc = GLITZ_FOURCC_RGB;
|
||||
templ.samples = 1;
|
||||
|
||||
glitz_glx_init (NULL);
|
||||
|
||||
mask = GLITZ_FORMAT_SAMPLES_MASK | GLITZ_FORMAT_FOURCC_MASK |
|
||||
GLITZ_FORMAT_RED_SIZE_MASK | GLITZ_FORMAT_GREEN_SIZE_MASK |
|
||||
GLITZ_FORMAT_BLUE_SIZE_MASK;
|
||||
if (formatname == GLITZ_STANDARD_ARGB32)
|
||||
mask |= GLITZ_FORMAT_ALPHA_SIZE_MASK;
|
||||
|
||||
/* Try for a pbuffer first */
|
||||
if (!getenv("CAIRO_TEST_FORCE_GLITZ_WINDOW"))
|
||||
dformat = glitz_glx_find_pbuffer_format (dpy, scr, mask, &templ, 0);
|
||||
|
||||
if (dformat) {
|
||||
closure->win = None;
|
||||
|
||||
drawable = glitz_glx_create_pbuffer_drawable (dpy, scr, dformat,
|
||||
width, height);
|
||||
if (!drawable)
|
||||
goto FAIL;
|
||||
} else {
|
||||
/* No pbuffer, try window */
|
||||
dformat = glitz_glx_find_window_format (dpy, scr, mask, &templ, 0);
|
||||
|
||||
if (!dformat)
|
||||
goto FAIL;
|
||||
|
||||
vinfo = glitz_glx_get_visual_info_from_format(dpy,
|
||||
DefaultScreen(dpy),
|
||||
dformat);
|
||||
|
||||
if (!vinfo)
|
||||
goto FAIL;
|
||||
|
||||
xsh.flags = PSize;
|
||||
xsh.x = 0;
|
||||
xsh.y = 0;
|
||||
xsh.width = width;
|
||||
xsh.height = height;
|
||||
|
||||
xswa.colormap = XCreateColormap (dpy, RootWindow(dpy, scr),
|
||||
vinfo->visual, AllocNone);
|
||||
closure->win = XCreateWindow (dpy, RootWindow(dpy, scr),
|
||||
xsh.x, xsh.y, xsh.width, xsh.height,
|
||||
0, vinfo->depth, CopyFromParent,
|
||||
vinfo->visual, CWColormap, &xswa);
|
||||
XFree (vinfo);
|
||||
|
||||
drawable =
|
||||
glitz_glx_create_drawable_for_window (dpy, scr,
|
||||
dformat, closure->win,
|
||||
width, height);
|
||||
|
||||
if (!drawable)
|
||||
goto DESTROY_WINDOW;
|
||||
}
|
||||
|
||||
format = glitz_find_standard_format (drawable, formatname);
|
||||
if (!format)
|
||||
goto DESTROY_DRAWABLE;
|
||||
|
||||
sr = glitz_surface_create (drawable, format, width, height, 0, NULL);
|
||||
if (!sr)
|
||||
goto DESTROY_DRAWABLE;
|
||||
|
||||
if (closure->win == None || dformat->doublebuffer) {
|
||||
glitz_surface_attach (sr, drawable, GLITZ_DRAWABLE_BUFFER_BACK_COLOR);
|
||||
} else {
|
||||
XMapWindow (closure->dpy, closure->win);
|
||||
glitz_surface_attach (sr, drawable, GLITZ_DRAWABLE_BUFFER_FRONT_COLOR);
|
||||
}
|
||||
|
||||
glitz_drawable_destroy (drawable);
|
||||
|
||||
return sr;
|
||||
|
||||
DESTROY_DRAWABLE:
|
||||
glitz_drawable_destroy (drawable);
|
||||
DESTROY_WINDOW:
|
||||
if (closure->win)
|
||||
XDestroyWindow (dpy, closure->win);
|
||||
FAIL:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static cairo_surface_t *
|
||||
_cairo_boilerplate_glitz_glx_create_surface (const char *name,
|
||||
cairo_content_t content,
|
||||
double width,
|
||||
double height,
|
||||
double max_width,
|
||||
double max_height,
|
||||
cairo_boilerplate_mode_t mode,
|
||||
int id,
|
||||
void **closure)
|
||||
{
|
||||
glitz_glx_target_closure_t *gxtc;
|
||||
glitz_surface_t * glitz_surface;
|
||||
cairo_surface_t * surface = NULL;
|
||||
cairo_status_t status;
|
||||
|
||||
*closure = gxtc = xmalloc (sizeof (glitz_glx_target_closure_t));
|
||||
|
||||
if (width == 0)
|
||||
width = 1;
|
||||
if (height == 0)
|
||||
height = 1;
|
||||
|
||||
gxtc->dpy = XOpenDisplay (getenv("CAIRO_TEST_GLITZ_DISPLAY"));
|
||||
if (!gxtc->dpy) {
|
||||
fprintf (stderr, "Failed to open display: %s\n", XDisplayName(0));
|
||||
goto FAIL;
|
||||
}
|
||||
|
||||
XSynchronize (gxtc->dpy, 1);
|
||||
|
||||
gxtc->scr = DefaultScreen(gxtc->dpy);
|
||||
|
||||
switch (content) {
|
||||
case CAIRO_CONTENT_COLOR:
|
||||
glitz_surface = _cairo_boilerplate_glitz_glx_create_surface_internal (GLITZ_STANDARD_RGB24, width, height, gxtc);
|
||||
break;
|
||||
case CAIRO_CONTENT_COLOR_ALPHA:
|
||||
glitz_surface = _cairo_boilerplate_glitz_glx_create_surface_internal (GLITZ_STANDARD_ARGB32, width, height, gxtc);
|
||||
break;
|
||||
case CAIRO_CONTENT_ALPHA:
|
||||
default:
|
||||
fprintf (stderr, "Invalid content for glitz-glx test: %d\n", content);
|
||||
goto FAIL_CLOSE_DISPLAY;
|
||||
}
|
||||
if (!glitz_surface) {
|
||||
fprintf (stderr, "Failed to create glitz-glx surface\n");
|
||||
goto FAIL_CLOSE_DISPLAY;
|
||||
}
|
||||
|
||||
surface = cairo_glitz_surface_create (glitz_surface);
|
||||
glitz_surface_destroy (glitz_surface);
|
||||
|
||||
if (cairo_surface_status (surface))
|
||||
goto FAIL_CLOSE_DISPLAY;
|
||||
|
||||
status = cairo_surface_set_user_data (surface,
|
||||
&glitz_closure_key, gxtc, NULL);
|
||||
if (status == CAIRO_STATUS_SUCCESS)
|
||||
return surface;
|
||||
|
||||
cairo_surface_destroy (surface);
|
||||
surface = cairo_boilerplate_surface_create_in_error (status);
|
||||
|
||||
FAIL_CLOSE_DISPLAY:
|
||||
glitz_glx_fini ();
|
||||
XCloseDisplay (gxtc->dpy);
|
||||
FAIL:
|
||||
free (gxtc);
|
||||
return surface;
|
||||
}
|
||||
|
||||
static void
|
||||
_cairo_boilerplate_glitz_glx_cleanup (void *closure)
|
||||
{
|
||||
glitz_glx_target_closure_t *gxtc = closure;
|
||||
|
||||
glitz_glx_fini ();
|
||||
|
||||
if (gxtc->win)
|
||||
XDestroyWindow (gxtc->dpy, gxtc->win);
|
||||
|
||||
XCloseDisplay (gxtc->dpy);
|
||||
|
||||
free (gxtc);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static const cairo_boilerplate_target_t targets[] = {
|
||||
#if CAIRO_CAN_TEST_GLITZ_GLX_SURFACE
|
||||
{
|
||||
"glitz-glx", "glitz", NULL, NULL,
|
||||
CAIRO_SURFACE_TYPE_GLITZ,CAIRO_CONTENT_COLOR_ALPHA, 0,
|
||||
"cairo_glitz_surface_create",
|
||||
_cairo_boilerplate_glitz_glx_create_surface,
|
||||
NULL, NULL,
|
||||
_cairo_boilerplate_get_image_surface,
|
||||
cairo_surface_write_to_png,
|
||||
_cairo_boilerplate_glitz_glx_cleanup
|
||||
},
|
||||
{
|
||||
"glitz-glx", "glitz", NULL, NULL,
|
||||
CAIRO_SURFACE_TYPE_GLITZ, CAIRO_CONTENT_COLOR, 0,
|
||||
"cairo_glitz_surface_create",
|
||||
_cairo_boilerplate_glitz_glx_create_surface,
|
||||
NULL, NULL,
|
||||
_cairo_boilerplate_get_image_surface,
|
||||
cairo_surface_write_to_png,
|
||||
_cairo_boilerplate_glitz_glx_cleanup
|
||||
},
|
||||
#endif
|
||||
};
|
||||
CAIRO_BOILERPLATE (glitz_glx, targets)
|
||||
|
|
@ -1,188 +0,0 @@
|
|||
/* -*- Mode: c; c-basic-offset: 4; indent-tabs-mode: t; tab-width: 8; -*- */
|
||||
/*
|
||||
* Copyright © 2004,2006 Red Hat, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software
|
||||
* and its documentation for any purpose is hereby granted without
|
||||
* fee, provided that the above copyright notice appear in all copies
|
||||
* and that both that copyright notice and this permission notice
|
||||
* appear in supporting documentation, and that the name of
|
||||
* Red Hat, Inc. not be used in advertising or publicity pertaining to
|
||||
* distribution of the software without specific, written prior
|
||||
* permission. Red Hat, Inc. makes no representations about the
|
||||
* suitability of this software for any purpose. It is provided "as
|
||||
* is" without express or implied warranty.
|
||||
*
|
||||
* RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL,
|
||||
* INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
|
||||
* RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
* IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
* Author: Carl D. Worth <cworth@cworth.org>
|
||||
*/
|
||||
|
||||
#include "cairo-boilerplate-private.h"
|
||||
|
||||
#if CAIRO_CAN_TEST_GLITZ_WGL_SURFACE
|
||||
#include <cairo-glitz.h>
|
||||
#include <glitz-wgl.h>
|
||||
|
||||
static const cairo_user_data_key_t glitz_closure_key;
|
||||
|
||||
typedef struct _glitz_wgl_target_closure {
|
||||
glitz_target_closure_base_t base;
|
||||
} glitz_wgl_target_closure_t;
|
||||
|
||||
static glitz_surface_t *
|
||||
_cairo_boilerplate_glitz_wgl_create_surface_internal (glitz_format_name_t formatname,
|
||||
int width,
|
||||
int height,
|
||||
glitz_wgl_target_closure_t *closure)
|
||||
{
|
||||
glitz_drawable_format_t *dformat;
|
||||
glitz_drawable_format_t templ;
|
||||
glitz_drawable_t *gdraw;
|
||||
glitz_format_t *format;
|
||||
glitz_surface_t *sr = NULL;
|
||||
unsigned long mask;
|
||||
|
||||
memset(&templ, 0, sizeof(templ));
|
||||
templ.color.red_size = 8;
|
||||
templ.color.green_size = 8;
|
||||
templ.color.blue_size = 8;
|
||||
templ.color.alpha_size = 8;
|
||||
templ.color.fourcc = GLITZ_FOURCC_RGB;
|
||||
templ.samples = 1;
|
||||
|
||||
mask = GLITZ_FORMAT_SAMPLES_MASK | GLITZ_FORMAT_FOURCC_MASK |
|
||||
GLITZ_FORMAT_RED_SIZE_MASK | GLITZ_FORMAT_GREEN_SIZE_MASK |
|
||||
GLITZ_FORMAT_BLUE_SIZE_MASK;
|
||||
if (formatname == GLITZ_STANDARD_ARGB32)
|
||||
mask |= GLITZ_FORMAT_ALPHA_SIZE_MASK;
|
||||
|
||||
dformat = glitz_wgl_find_pbuffer_format (mask, &templ, 0);
|
||||
if (!dformat) {
|
||||
fprintf (stderr, "Glitz failed to find pbuffer format for template.");
|
||||
goto FAIL;
|
||||
}
|
||||
|
||||
gdraw = glitz_wgl_create_pbuffer_drawable (dformat, width, height);
|
||||
if (!gdraw) {
|
||||
fprintf (stderr, "Glitz failed to create pbuffer drawable.");
|
||||
goto FAIL;
|
||||
}
|
||||
|
||||
format = glitz_find_standard_format (gdraw, formatname);
|
||||
if (!format) {
|
||||
fprintf (stderr, "Glitz failed to find standard format for drawable.");
|
||||
goto DESTROY_DRAWABLE;
|
||||
}
|
||||
|
||||
sr = glitz_surface_create (gdraw, format, width, height, 0, NULL);
|
||||
if (!sr) {
|
||||
fprintf (stderr, "Glitz failed to create a surface.");
|
||||
goto DESTROY_DRAWABLE;
|
||||
}
|
||||
|
||||
glitz_surface_attach (sr, gdraw, GLITZ_DRAWABLE_BUFFER_FRONT_COLOR);
|
||||
|
||||
DESTROY_DRAWABLE:
|
||||
glitz_drawable_destroy (gdraw);
|
||||
|
||||
FAIL:
|
||||
return sr; /* will be NULL unless we create it and attach */
|
||||
}
|
||||
|
||||
static cairo_surface_t *
|
||||
_cairo_boilerplate_glitz_wgl_create_surface (const char *name,
|
||||
cairo_content_t content,
|
||||
double width,
|
||||
double height,
|
||||
double max_width,
|
||||
double max_height,
|
||||
cairo_boilerplate_mode_t mode,
|
||||
int id,
|
||||
void **closure)
|
||||
{
|
||||
glitz_surface_t *glitz_surface;
|
||||
cairo_surface_t *surface = NULL;
|
||||
glitz_wgl_target_closure_t *wglc;
|
||||
|
||||
glitz_wgl_init (NULL);
|
||||
|
||||
*closure = wglc = xmalloc (sizeof (glitz_wgl_target_closure_t));
|
||||
|
||||
switch (content) {
|
||||
case CAIRO_CONTENT_COLOR:
|
||||
glitz_surface = _cairo_boilerplate_glitz_wgl_create_surface_internal (GLITZ_STANDARD_RGB24, width, height, NULL);
|
||||
break;
|
||||
case CAIRO_CONTENT_COLOR_ALPHA:
|
||||
glitz_surface = _cairo_boilerplate_glitz_wgl_create_surface_internal (GLITZ_STANDARD_ARGB32, width, height, NULL);
|
||||
break;
|
||||
default:
|
||||
fprintf (stderr, "Invalid content for glitz-wgl test: %d\n", content);
|
||||
goto FAIL;
|
||||
}
|
||||
|
||||
if (!glitz_surface)
|
||||
goto FAIL;
|
||||
|
||||
surface = cairo_glitz_surface_create (glitz_surface);
|
||||
glitz_surface_destroy (glitz_surface);
|
||||
|
||||
if (cairo_surface_status (surface))
|
||||
goto FAIL;
|
||||
|
||||
wglc->base.width = width;
|
||||
wglc->base.height = height;
|
||||
wglc->base.content = content;
|
||||
status = cairo_surface_set_user_data (surface,
|
||||
&glitz_closure_key, wglc, NULL);
|
||||
if (status == CAIRO_STATUS_SUCCESS)
|
||||
return surface;
|
||||
|
||||
cairo_surface_destroy (surface);
|
||||
surface = cairo_boilerplate_surface_create_in_error (status);
|
||||
|
||||
FAIL:
|
||||
glitz_wgl_fini ();
|
||||
free (wglc);
|
||||
return surface;
|
||||
}
|
||||
|
||||
static void
|
||||
_cairo_boilerplate_glitz_wgl_cleanup (void *closure)
|
||||
{
|
||||
free (closure);
|
||||
glitz_wgl_fini ();
|
||||
}
|
||||
#endif
|
||||
|
||||
static const cairo_boilerplate_target_t targets[] = {
|
||||
#if CAIRO_CAN_TEST_GLITZ_WGL_SURFACE
|
||||
{
|
||||
"glitz-wgl", "glitz", NULL, NULL,
|
||||
CAIRO_SURFACE_TYPE_GLITZ, CAIRO_CONTENT_COLOR_ALPHA, 0,
|
||||
"cairo_glitz_surface_create",
|
||||
_cairo_boilerplate_glitz_wgl_create_surface,
|
||||
NULL, NULL,
|
||||
_cairo_boilerplate_get_image_surface,
|
||||
cairo_surface_write_to_png,
|
||||
_cairo_boilerplate_glitz_wgl_cleanup
|
||||
},
|
||||
{
|
||||
"glitz-wgl", "glitz", NULL, NULL,
|
||||
CAIRO_SURFACE_TYPE_GLITZ, CAIRO_CONTENT_COLOR, 0,
|
||||
"cairo_glitz_surface_create",
|
||||
_cairo_boilerplate_glitz_wgl_create_surface,
|
||||
NULL, NULL,
|
||||
_cairo_boilerplate_get_image_surface,
|
||||
cairo_surface_write_to_png,
|
||||
_cairo_boilerplate_glitz_wgl_cleanup
|
||||
},
|
||||
#endif
|
||||
};
|
||||
CAIRO_BOILERPLATE (glitz_wgl, targets)
|
||||
|
|
@ -19,7 +19,6 @@ CAIRO_HAS_GALLIUM_SURFACE=0
|
|||
CAIRO_HAS_XCB_DRM_FUNCTIONS=0
|
||||
CAIRO_HAS_PNG_FUNCTIONS=1
|
||||
CAIRO_HAS_GL_SURFACE=0
|
||||
CAIRO_HAS_GLITZ_SURFACE=0
|
||||
CAIRO_HAS_DIRECTFB_SURFACE=0
|
||||
CAIRO_HAS_VG_SURFACE=0
|
||||
CAIRO_HAS_EAGLE_FUNCTIONS=0
|
||||
|
|
|
|||
|
|
@ -62,9 +62,6 @@ endif
|
|||
ifeq ($(CAIRO_HAS_GL_SURFACE),1)
|
||||
@echo "#define CAIRO_HAS_GL_SURFACE 1" >> src/cairo-features.h
|
||||
endif
|
||||
ifeq ($(CAIRO_HAS_GLITZ_SURFACE),1)
|
||||
@echo "#define CAIRO_HAS_GLITZ_SURFACE 1" >> src/cairo-features.h
|
||||
endif
|
||||
ifeq ($(CAIRO_HAS_DIRECTFB_SURFACE),1)
|
||||
@echo "#define CAIRO_HAS_DIRECTFB_SURFACE 1" >> src/cairo-features.h
|
||||
endif
|
||||
|
|
|
|||
|
|
@ -374,7 +374,6 @@ AC_DEFUN([CAIRO_REPORT],
|
|||
echo " PDF: $use_pdf"
|
||||
echo " SVG: $use_svg"
|
||||
echo " OpenGL: $use_gl"
|
||||
echo " glitz: $use_glitz"
|
||||
echo " BeOS: $use_beos"
|
||||
echo " DirectFB: $use_directfb"
|
||||
echo " OpenVG: $use_vg"
|
||||
|
|
|
|||
38
configure.ac
38
configure.ac
|
|
@ -336,44 +336,6 @@ CAIRO_ENABLE_SURFACE_BACKEND(gl, OpenGL, no, [
|
|||
|
||||
dnl ===========================================================================
|
||||
|
||||
GLITZ_MIN_VERSION=0.5.1
|
||||
CAIRO_ENABLE_SURFACE_BACKEND(glitz, glitz, no, [
|
||||
glitz_REQUIRES="glitz >= $GLITZ_MIN_VERSION"
|
||||
PKG_CHECK_MODULES(glitz, $glitz_REQUIRES, , [AC_MSG_RESULT(no)
|
||||
use_glitz="no (requires $glitz_REQUIRES http://freedesktop.org/Software/glitz)"])
|
||||
])
|
||||
|
||||
if test "x$use_glitz" = "xyes";then
|
||||
PKG_CHECK_MODULES(GLITZ_AGL, glitz-agl >= $GLITZ_MIN_VERSION,
|
||||
[have_glitz_agl=yes], [have_glitz_agl=no; AC_MSG_RESULT(no)])
|
||||
PKG_CHECK_MODULES(GLITZ_EGL, glitz-egl >= $GLITZ_MIN_VERSION,
|
||||
[have_glitz_egl=yes], [have_glitz_egl=no; AC_MSG_RESULT(no)])
|
||||
PKG_CHECK_MODULES(GLITZ_GLX, glitz-glx >= $GLITZ_MIN_VERSION,
|
||||
[have_glitz_glx=yes], [have_glitz_glx=no; AC_MSG_RESULT(no)])
|
||||
PKG_CHECK_MODULES(GLITZ_WGL, glitz-wgl >= $GLITZ_MIN_VERSION,
|
||||
[have_glitz_wgl=yes], [have_glitz_wgl=no; AC_MSG_RESULT(no)])
|
||||
|
||||
if test "x$have_glitz_agl" = "xyes";then
|
||||
AC_DEFINE(CAIRO_CAN_TEST_GLITZ_AGL_SURFACE, 1, [define if glitz backend can be tested against agl])
|
||||
fi
|
||||
if test "x$have_glitz_egl" = "xyes";then
|
||||
AC_DEFINE(CAIRO_CAN_TEST_GLITZ_EGL_SURFACE, 1, [define if glitz backend can be tested against egl])
|
||||
fi
|
||||
if test "x$have_glitz_glx" = "xyes";then
|
||||
AC_DEFINE(CAIRO_CAN_TEST_GLITZ_GLX_SURFACE, 1, [define if glitz backend can be tested against glx])
|
||||
fi
|
||||
if test "x$have_glitz_wgl" = "xyes";then
|
||||
AC_DEFINE(CAIRO_CAN_TEST_GLITZ_WGL_SURFACE, 1, [define if glitz backend can be tested against wgl])
|
||||
fi
|
||||
fi
|
||||
|
||||
AM_CONDITIONAL(CAIRO_CAN_TEST_GLITZ_AGL_SURFACE, test "x$have_glitz_agl" = "xyes")
|
||||
AM_CONDITIONAL(CAIRO_CAN_TEST_GLITZ_EGL_SURFACE, test "x$have_glitz_egl" = "xyes")
|
||||
AM_CONDITIONAL(CAIRO_CAN_TEST_GLITZ_GLX_SURFACE, test "x$have_glitz_glx" = "xyes")
|
||||
AM_CONDITIONAL(CAIRO_CAN_TEST_GLITZ_WGL_SURFACE, test "x$have_glitz_wgl" = "xyes")
|
||||
|
||||
dnl ===========================================================================
|
||||
|
||||
CAIRO_ENABLE_SURFACE_BACKEND(directfb, directfb, no, [
|
||||
directfb_REQUIRES=directfb
|
||||
PKG_CHECK_MODULES(directfb, $directfb_REQUIRES, , AC_MSG_RESULT(no)
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@
|
|||
<title>Surfaces</title>
|
||||
<xi:include href="xml/cairo-surface.xml"/>
|
||||
<xi:include href="xml/cairo-image.xml"/>
|
||||
<!--xi:include href="xml/cairo-glitz.xml"/-->
|
||||
<xi:include href="xml/cairo-pdf.xml"/>
|
||||
<xi:include href="xml/cairo-png.xml"/>
|
||||
<xi:include href="xml/cairo-ps.xml"/>
|
||||
|
|
|
|||
|
|
@ -559,7 +559,6 @@ cairo_matrix_destroy
|
|||
cairo_matrix_copy
|
||||
cairo_matrix_get_affine
|
||||
cairo_set_target_surface
|
||||
cairo_set_target_glitz
|
||||
cairo_set_target_image
|
||||
cairo_set_target_pdf
|
||||
cairo_set_target_png
|
||||
|
|
|
|||
|
|
@ -1,22 +0,0 @@
|
|||
<!-- ##### SECTION Title ##### -->
|
||||
Glitz Surfaces
|
||||
|
||||
<!-- ##### SECTION Short_Description ##### -->
|
||||
OpenGL accelerated rendering using the Glitz library
|
||||
|
||||
<!-- ##### SECTION Long_Description ##### -->
|
||||
<para>
|
||||
The Glitz surface is used to render cairo graphics targeting the
|
||||
OpenGL hardware using the Glitz library.
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION See_Also ##### -->
|
||||
<para>
|
||||
<itemizedlist>
|
||||
<listitem>#cairo_surface_t</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION Stability_Level ##### -->
|
||||
|
||||
|
||||
|
|
@ -318,10 +318,6 @@ cairo_gl_sources = cairo-gl-surface.c cairo-gl-glyphs.c cairo-gl-shaders.c
|
|||
cairo_glx_sources += cairo-glx-context.c
|
||||
cairo_eagle_sources += cairo-eagle-context.c
|
||||
|
||||
cairo_glitz_headers = cairo-glitz.h
|
||||
cairo_glitz_private = cairo-glitz-private.h
|
||||
cairo_glitz_sources = cairo-glitz-surface.c
|
||||
|
||||
cairo_directfb_headers = cairo-directfb.h
|
||||
cairo_directfb_sources = cairo-directfb-surface.c
|
||||
|
||||
|
|
|
|||
|
|
@ -287,20 +287,6 @@ ifeq ($(CAIRO_HAS_GL_SURFACE),1)
|
|||
enabled_cairo_pkgconf += cairo-gl.pc
|
||||
endif
|
||||
|
||||
unsupported_cairo_headers += $(cairo_glitz_headers)
|
||||
all_cairo_headers += $(cairo_glitz_headers)
|
||||
all_cairo_private += $(cairo_glitz_private)
|
||||
all_cairo_sources += $(cairo_glitz_sources)
|
||||
ifeq ($(CAIRO_HAS_GLITZ_SURFACE),1)
|
||||
enabled_cairo_headers += $(cairo_glitz_headers)
|
||||
enabled_cairo_private += $(cairo_glitz_private)
|
||||
enabled_cairo_sources += $(cairo_glitz_sources)
|
||||
endif
|
||||
all_cairo_pkgconf += cairo-glitz.pc
|
||||
ifeq ($(CAIRO_HAS_GLITZ_SURFACE),1)
|
||||
enabled_cairo_pkgconf += cairo-glitz.pc
|
||||
endif
|
||||
|
||||
unsupported_cairo_headers += $(cairo_directfb_headers)
|
||||
all_cairo_headers += $(cairo_directfb_headers)
|
||||
all_cairo_private += $(cairo_directfb_private)
|
||||
|
|
|
|||
|
|
@ -123,7 +123,6 @@
|
|||
#define cairo_matrix_copy cairo_matrix_copy_DEPRECATED_BY_cairo_matrix_t
|
||||
#define cairo_matrix_get_affine cairo_matrix_get_affine_DEPRECATED_BY_cairo_matrix_t
|
||||
#define cairo_set_target_surface cairo_set_target_surface_DEPRECATED_BY_cairo_create
|
||||
#define cairo_set_target_glitz cairo_set_target_glitz_DEPRECATED_BY_cairo_glitz_surface_create
|
||||
#define cairo_set_target_image cairo_set_target_image_DEPRECATED_BY_cairo_image_surface_create_for_data
|
||||
#define cairo_set_target_pdf cairo_set_target_pdf_DEPRECATED_BY_cairo_pdf_surface_create
|
||||
#define cairo_set_target_png cairo_set_target_png_DEPRECATED_BY_cairo_surface_write_to_png
|
||||
|
|
|
|||
|
|
@ -1,41 +0,0 @@
|
|||
/* Cairo - a vector graphics library with display and print output
|
||||
*
|
||||
* Copyright © 2005 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it either under the terms of the GNU Lesser General Public
|
||||
* License version 2.1 as published by the Free Software Foundation
|
||||
* (the "LGPL") or, at your option, under the terms of the Mozilla
|
||||
* Public License Version 1.1 (the "MPL"). If you do not alter this
|
||||
* notice, a recipient may use your version of this file under either
|
||||
* the MPL or the LGPL.
|
||||
*
|
||||
* You should have received a copy of the LGPL along with this library
|
||||
* in the file COPYING-LGPL-2.1; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* You should have received a copy of the MPL along with this library
|
||||
* in the file COPYING-MPL-1.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/
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
|
||||
* OF ANY KIND, either express or implied. See the LGPL or the MPL for
|
||||
* the specific language governing rights and limitations.
|
||||
*
|
||||
* The Original Code is the cairo graphics library.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Red Hat, Inc.
|
||||
*/
|
||||
|
||||
#ifndef CAIRO_GLITZ_PRIVATE_H
|
||||
#define CAIRO_GLITZ_PRIVATE_H
|
||||
|
||||
#include "cairoint.h"
|
||||
#include "cairo-glitz.h"
|
||||
|
||||
slim_hidden_proto (cairo_glitz_surface_create);
|
||||
|
||||
#endif /* CAIRO_GLITZ_PRIVATE_H */
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,57 +0,0 @@
|
|||
/* cairo - a vector graphics library with display and print output
|
||||
*
|
||||
* Copyright © 2002 University of Southern California
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it either under the terms of the GNU Lesser General Public
|
||||
* License version 2.1 as published by the Free Software Foundation
|
||||
* (the "LGPL") or, at your option, under the terms of the Mozilla
|
||||
* Public License Version 1.1 (the "MPL"). If you do not alter this
|
||||
* notice, a recipient may use your version of this file under either
|
||||
* the MPL or the LGPL.
|
||||
*
|
||||
* You should have received a copy of the LGPL along with this library
|
||||
* in the file COPYING-LGPL-2.1; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* You should have received a copy of the MPL along with this library
|
||||
* in the file COPYING-MPL-1.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/
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
|
||||
* OF ANY KIND, either express or implied. See the LGPL or the MPL for
|
||||
* the specific language governing rights and limitations.
|
||||
*
|
||||
* The Original Code is the cairo graphics library.
|
||||
*
|
||||
* The Initial Developer of the Original Code is University of Southern
|
||||
* California.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Carl D. Worth <cworth@cworth.org>
|
||||
*/
|
||||
|
||||
#ifndef CAIRO_GLITZ_H
|
||||
#define CAIRO_GLITZ_H
|
||||
|
||||
#include "cairo.h"
|
||||
|
||||
#if CAIRO_HAS_GLITZ_SURFACE
|
||||
|
||||
#include <glitz.h>
|
||||
|
||||
CAIRO_BEGIN_DECLS
|
||||
|
||||
cairo_public cairo_surface_t *
|
||||
cairo_glitz_surface_create (glitz_surface_t *surface);
|
||||
|
||||
CAIRO_END_DECLS
|
||||
|
||||
#else /* CAIRO_HAS_GLITZ_SURFACE */
|
||||
# error Cairo was not compiled with support for the glitz backend
|
||||
#endif /* CAIRO_HAS_GLITZ_SURFACE */
|
||||
|
||||
#endif /* CAIRO_GLITZ_H */
|
||||
|
|
@ -21,10 +21,6 @@ if CAIRO_HAS_QUARTZ_SURFACE
|
|||
test_sources += $(quartz_surface_test_sources)
|
||||
endif
|
||||
|
||||
if CAIRO_HAS_GLITZ_SURFACE
|
||||
test_sources += $(glitz_surface_test_sources)
|
||||
endif
|
||||
|
||||
if CAIRO_HAS_PDF_SURFACE
|
||||
test_sources += $(pdf_surface_test_sources)
|
||||
endif
|
||||
|
|
@ -524,10 +520,6 @@ REFERENCE_IMAGES = \
|
|||
ft-text-vertical-layout-type3.svg.ref.png \
|
||||
ft-text-vertical-layout-type3.xlib.ref.png \
|
||||
get-group-target.ref.png \
|
||||
glitz-surface-source.argb32.ref.png \
|
||||
glitz-surface-source.rgb24.ref.png \
|
||||
glitz-surface-source.ps2.ref.png \
|
||||
glitz-surface-source.ps3.ref.png \
|
||||
glyph-cache-pressure.ps2.ref.png \
|
||||
glyph-cache-pressure.ps3.ref.png \
|
||||
glyph-cache-pressure.quartz.ref.png \
|
||||
|
|
|
|||
|
|
@ -266,8 +266,6 @@ ft_font_test_sources = \
|
|||
|
||||
quartz_surface_test_sources = quartz-surface-source.c
|
||||
|
||||
glitz_surface_test_sources = glitz-surface-source.c
|
||||
|
||||
pdf_surface_test_sources = \
|
||||
pdf-features.c \
|
||||
pdf-mime-data.c \
|
||||
|
|
|
|||
Binary file not shown.
|
Before Width: | Height: | Size: 377 B |
|
|
@ -1,293 +0,0 @@
|
|||
/*
|
||||
* Copyright © 2008 Chris Wilson
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software
|
||||
* and its documentation for any purpose is hereby granted without
|
||||
* fee, provided that the above copyright notice appear in all copies
|
||||
* and that both that copyright notice and this permission notice
|
||||
* appear in supporting documentation, and that the name of
|
||||
* Chris Wilson not be used in advertising or publicity pertaining to
|
||||
* distribution of the software without specific, written prior
|
||||
* permission. Chris Wilson makes no representations about the
|
||||
* suitability of this software for any purpose. It is provided "as
|
||||
* is" without express or implied warranty.
|
||||
*
|
||||
* CHRIS WILSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS, IN NO EVENT SHALL CHRIS WILSON BE LIABLE FOR ANY SPECIAL,
|
||||
* INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
|
||||
* RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
* IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
* Author: Chris Wilson <chris@chris-wilson.co.uk>
|
||||
*/
|
||||
|
||||
#include "cairo-test.h"
|
||||
#include <cairo-glitz.h>
|
||||
|
||||
#define NAME "glitz"
|
||||
#include "surface-source.c"
|
||||
|
||||
static cairo_user_data_key_t closure_key;
|
||||
|
||||
#if CAIRO_CAN_TEST_GLITZ_GLX_SURFACE
|
||||
#include <cairo-xlib.h>
|
||||
#include <cairo-xlib-xrender.h>
|
||||
#include <glitz-glx.h>
|
||||
|
||||
struct closure {
|
||||
Display *dpy;
|
||||
Window win;
|
||||
};
|
||||
|
||||
static void
|
||||
cleanup (void *data)
|
||||
{
|
||||
struct closure *closure = data;
|
||||
|
||||
glitz_glx_fini ();
|
||||
|
||||
if (closure->win)
|
||||
XDestroyWindow (closure->dpy, closure->win);
|
||||
|
||||
XCloseDisplay (closure->dpy);
|
||||
|
||||
free (closure);
|
||||
}
|
||||
|
||||
static glitz_surface_t *
|
||||
_glitz_glx_create_surface (glitz_format_name_t formatname,
|
||||
int width,
|
||||
int height,
|
||||
struct closure *closure)
|
||||
{
|
||||
Display * dpy = closure->dpy;
|
||||
int scr = DefaultScreen(dpy);
|
||||
glitz_drawable_format_t templ;
|
||||
glitz_drawable_format_t * dformat = NULL;
|
||||
unsigned long mask;
|
||||
glitz_drawable_t * drawable = NULL;
|
||||
glitz_format_t * format;
|
||||
glitz_surface_t * sr;
|
||||
|
||||
XSizeHints xsh;
|
||||
XSetWindowAttributes xswa;
|
||||
XVisualInfo * vinfo;
|
||||
|
||||
memset(&templ, 0, sizeof(templ));
|
||||
templ.color.red_size = 8;
|
||||
templ.color.green_size = 8;
|
||||
templ.color.blue_size = 8;
|
||||
templ.color.alpha_size = 8;
|
||||
templ.color.fourcc = GLITZ_FOURCC_RGB;
|
||||
templ.samples = 1;
|
||||
|
||||
glitz_glx_init (NULL);
|
||||
|
||||
mask = GLITZ_FORMAT_SAMPLES_MASK |
|
||||
GLITZ_FORMAT_FOURCC_MASK |
|
||||
GLITZ_FORMAT_RED_SIZE_MASK |
|
||||
GLITZ_FORMAT_GREEN_SIZE_MASK |
|
||||
GLITZ_FORMAT_BLUE_SIZE_MASK;
|
||||
if (formatname == GLITZ_STANDARD_ARGB32)
|
||||
mask |= GLITZ_FORMAT_ALPHA_SIZE_MASK;
|
||||
|
||||
/* Try for a pbuffer first */
|
||||
if (!getenv("CAIRO_TEST_FORCE_GLITZ_WINDOW"))
|
||||
dformat = glitz_glx_find_pbuffer_format (dpy, scr, mask, &templ, 0);
|
||||
|
||||
if (dformat) {
|
||||
closure->win = None;
|
||||
|
||||
drawable = glitz_glx_create_pbuffer_drawable (dpy, scr, dformat,
|
||||
width, height);
|
||||
if (!drawable)
|
||||
goto FAIL;
|
||||
} else {
|
||||
/* No pbuffer, try window */
|
||||
dformat = glitz_glx_find_window_format (dpy, scr, mask, &templ, 0);
|
||||
|
||||
if (!dformat)
|
||||
goto FAIL;
|
||||
|
||||
vinfo = glitz_glx_get_visual_info_from_format(dpy,
|
||||
DefaultScreen(dpy),
|
||||
dformat);
|
||||
|
||||
if (!vinfo)
|
||||
goto FAIL;
|
||||
|
||||
xsh.flags = PSize;
|
||||
xsh.x = 0;
|
||||
xsh.y = 0;
|
||||
xsh.width = width;
|
||||
xsh.height = height;
|
||||
|
||||
xswa.colormap = XCreateColormap (dpy, RootWindow(dpy, scr),
|
||||
vinfo->visual, AllocNone);
|
||||
closure->win = XCreateWindow (dpy, RootWindow(dpy, scr),
|
||||
xsh.x, xsh.y, xsh.width, xsh.height,
|
||||
0, vinfo->depth, CopyFromParent,
|
||||
vinfo->visual, CWColormap, &xswa);
|
||||
XFree (vinfo);
|
||||
|
||||
drawable =
|
||||
glitz_glx_create_drawable_for_window (dpy, scr,
|
||||
dformat, closure->win,
|
||||
width, height);
|
||||
|
||||
if (!drawable)
|
||||
goto DESTROY_WINDOW;
|
||||
}
|
||||
|
||||
format = glitz_find_standard_format (drawable, formatname);
|
||||
if (!format)
|
||||
goto DESTROY_DRAWABLE;
|
||||
|
||||
sr = glitz_surface_create (drawable, format, width, height, 0, NULL);
|
||||
if (!sr)
|
||||
goto DESTROY_DRAWABLE;
|
||||
|
||||
if (closure->win == None || dformat->doublebuffer) {
|
||||
glitz_surface_attach (sr, drawable, GLITZ_DRAWABLE_BUFFER_BACK_COLOR);
|
||||
} else {
|
||||
XMapWindow (closure->dpy, closure->win);
|
||||
glitz_surface_attach (sr, drawable, GLITZ_DRAWABLE_BUFFER_FRONT_COLOR);
|
||||
}
|
||||
|
||||
glitz_drawable_destroy (drawable);
|
||||
|
||||
return sr;
|
||||
DESTROY_DRAWABLE:
|
||||
glitz_drawable_destroy (drawable);
|
||||
DESTROY_WINDOW:
|
||||
if (closure->win)
|
||||
XDestroyWindow (dpy, closure->win);
|
||||
FAIL:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static cairo_surface_t *
|
||||
create_source_surface (int size)
|
||||
{
|
||||
struct closure *closure;
|
||||
glitz_surface_t *glitz_surface;
|
||||
cairo_surface_t *surface;
|
||||
|
||||
closure = xcalloc (1, sizeof (struct closure));
|
||||
|
||||
closure->dpy = XOpenDisplay (getenv("CAIRO_TEST_GLITZ_DISPLAY"));
|
||||
if (closure->dpy == NULL) {
|
||||
free (closure);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
glitz_surface = _glitz_glx_create_surface (GLITZ_STANDARD_ARGB32,
|
||||
size, size,
|
||||
closure);
|
||||
if (glitz_surface == NULL) {
|
||||
XCloseDisplay (closure->dpy);
|
||||
free (closure);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
surface = cairo_glitz_surface_create (glitz_surface);
|
||||
|
||||
cairo_surface_set_user_data (surface, &closure_key, closure, cleanup);
|
||||
|
||||
return surface;
|
||||
}
|
||||
|
||||
#elif CAIRO_CAN_TEST_GLITZ_AGL_SURFACE
|
||||
#include <glitz-agl.h>
|
||||
|
||||
static void
|
||||
cleanup (void *data)
|
||||
{
|
||||
glitz_agl_fini ();
|
||||
}
|
||||
|
||||
static glitz_surface_t *
|
||||
_glitz_agl_create_surface (glitz_format_name_t formatname,
|
||||
int width,
|
||||
int height)
|
||||
{
|
||||
glitz_drawable_format_t * dformat = NULL;
|
||||
glitz_drawable_t * drawable = NULL;
|
||||
glitz_format_t * format;
|
||||
glitz_format_t templ;
|
||||
glitz_surface_t * sr;
|
||||
int i;
|
||||
int alpha_size;
|
||||
|
||||
glitz_agl_init ();
|
||||
|
||||
/* Find a reasonably lame window format and use it to create a pbuffer. */
|
||||
i = 0;
|
||||
alpha_size = (formatname == GLITZ_STANDARD_ARGB32) ? 8 : 0;
|
||||
while ((dformat = glitz_agl_find_window_format (0, 0, i)) != NULL
|
||||
&& !(dformat->doublebuffer == 0
|
||||
&& dformat->stencil_size == 0
|
||||
&& dformat->depth_size == 0
|
||||
&& dformat->color.fourcc == GLITZ_FOURCC_RGB
|
||||
&& dformat->color.alpha_size == alpha_size))
|
||||
i++;
|
||||
|
||||
if (!dformat)
|
||||
goto FAIL;
|
||||
|
||||
/* Try for a pbuffer first */
|
||||
drawable = glitz_agl_create_pbuffer_drawable (dformat, width, height);
|
||||
if (!drawable)
|
||||
goto FAIL;
|
||||
|
||||
templ.color = dformat->color;
|
||||
format = glitz_find_format (drawable,
|
||||
GLITZ_FORMAT_FOURCC_MASK |
|
||||
GLITZ_FORMAT_RED_SIZE_MASK |
|
||||
GLITZ_FORMAT_GREEN_SIZE_MASK |
|
||||
GLITZ_FORMAT_BLUE_SIZE_MASK |
|
||||
GLITZ_FORMAT_ALPHA_SIZE_MASK,
|
||||
&templ,
|
||||
0);
|
||||
if (!format) {
|
||||
fprintf (stderr, "Error: couldn't find surface format\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
sr = glitz_surface_create (drawable, format, width, height, 0, NULL);
|
||||
if (!sr)
|
||||
goto DESTROY_DRAWABLE;
|
||||
|
||||
glitz_surface_attach (sr, drawable, GLITZ_DRAWABLE_BUFFER_FRONT_COLOR);
|
||||
glitz_drawable_destroy (drawable);
|
||||
|
||||
return sr;
|
||||
DESTROY_DRAWABLE:
|
||||
glitz_drawable_destroy (drawable);
|
||||
FAIL:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static cairo_surface_t *
|
||||
create_source_surface (int size)
|
||||
{
|
||||
glitz_surface_t *glitz_surface;
|
||||
cairo_surface_t *surface;
|
||||
|
||||
glitz_surface = _glitz_agl_create_surface (GLITZ_STANDARD_ARGB32,
|
||||
size, size);
|
||||
|
||||
surface = cairo_glitz_surface_create (glitz_surface);
|
||||
cairo_surface_set_user_data (surface, &closure_key, NULL, cleanup);
|
||||
return surface;
|
||||
}
|
||||
#endif
|
||||
|
||||
CAIRO_TEST (glitz_surface_source,
|
||||
"Test using a Glitz surface as the source",
|
||||
"source", /* keywords */
|
||||
NULL, /* requirements */
|
||||
SIZE, SIZE,
|
||||
preamble, draw)
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 376 B |
Binary file not shown.
|
Before Width: | Height: | Size: 376 B |
Binary file not shown.
|
Before Width: | Height: | Size: 301 B |
|
|
@ -6,20 +6,12 @@
|
|||
|
||||
<repository type="git" name="git.freedesktop.org" href="git://anongit.freedesktop.org/git/"/>
|
||||
|
||||
<autotools id="glitz">
|
||||
<branch repo="git.freedesktop.org" module="glitz"/>
|
||||
<dependencies>
|
||||
<dep package="libGL"/>
|
||||
</dependencies>
|
||||
</autotools>
|
||||
|
||||
<autotools id="cairo" autogenargs="--enable-gl --enable-glitz">
|
||||
<autotools id="cairo" autogenargs="--enable-gl">
|
||||
<branch repo="git.freedesktop.org" module="cairo"/>
|
||||
<dependencies>
|
||||
<dep package="pixman"/>
|
||||
<dep package="fontconfig"/>
|
||||
<dep package="libGL"/>
|
||||
<dep package="glitz"/>
|
||||
</dependencies>
|
||||
<after>
|
||||
<dep package="libXrender"/>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue