summaryrefslogtreecommitdiff
path: root/boilerplate
diff options
context:
space:
mode:
authorEmmanuele Bassi <ebassi@gnome.org>2021-04-18 00:02:45 +0100
committerEmmanuele Bassi <ebassi@gnome.org>2022-02-25 02:09:58 +0000
commit9b9028c160a404771fe0caeecda8f4248997a808 (patch)
tree5322cc3ca71ac15fed4b5dfa684352a7c0edcc7e /boilerplate
parentfc3437128d7b45ba34007abbbeea2a81b1b126fb (diff)
downloadcairo-9b9028c160a404771fe0caeecda8f4248997a808.tar.gz
Drop cairo-vg surface
OpenVG is a failed experiment from 10 years ago, and nobody has been using the cairo-vg surface in pretty much the same amount of time.
Diffstat (limited to 'boilerplate')
-rw-r--r--boilerplate/Makefile.sources1
-rw-r--r--boilerplate/Makefile.win32.features10
-rw-r--r--boilerplate/cairo-boilerplate-vg.c364
-rw-r--r--boilerplate/meson.build1
4 files changed, 0 insertions, 376 deletions
diff --git a/boilerplate/Makefile.sources b/boilerplate/Makefile.sources
index ad96a89bc..a9bc20ccb 100644
--- a/boilerplate/Makefile.sources
+++ b/boilerplate/Makefile.sources
@@ -32,4 +32,3 @@ cairo_boilerplate_win32_sources = cairo-boilerplate-win32.c cairo-boilerplate-wi
cairo_boilerplate_xcb_sources = cairo-boilerplate-xcb.c
cairo_boilerplate_xlib_headers = cairo-boilerplate-xlib.h
cairo_boilerplate_xlib_sources = cairo-boilerplate-xlib.c
-cairo_boilerplate_vg_sources = cairo-boilerplate-vg.c
diff --git a/boilerplate/Makefile.win32.features b/boilerplate/Makefile.win32.features
index 0dc297a28..c2415afae 100644
--- a/boilerplate/Makefile.win32.features
+++ b/boilerplate/Makefile.win32.features
@@ -157,16 +157,6 @@ enabled_cairo_boilerplate_private += $(cairo_boilerplate_glesv3_private)
enabled_cairo_boilerplate_sources += $(cairo_boilerplate_glesv3_sources)
endif
-unsupported_cairo_boilerplate_headers += $(cairo_boilerplate_vg_headers)
-all_cairo_boilerplate_headers += $(cairo_boilerplate_vg_headers)
-all_cairo_boilerplate_private += $(cairo_boilerplate_vg_private)
-all_cairo_boilerplate_sources += $(cairo_boilerplate_vg_sources)
-ifeq ($(CAIRO_HAS_VG_SURFACE),1)
-enabled_cairo_boilerplate_headers += $(cairo_boilerplate_vg_headers)
-enabled_cairo_boilerplate_private += $(cairo_boilerplate_vg_private)
-enabled_cairo_boilerplate_sources += $(cairo_boilerplate_vg_sources)
-endif
-
supported_cairo_boilerplate_headers += $(cairo_boilerplate_egl_headers)
all_cairo_boilerplate_headers += $(cairo_boilerplate_egl_headers)
all_cairo_boilerplate_private += $(cairo_boilerplate_egl_private)
diff --git a/boilerplate/cairo-boilerplate-vg.c b/boilerplate/cairo-boilerplate-vg.c
deleted file mode 100644
index 4ea6ba46b..000000000
--- a/boilerplate/cairo-boilerplate-vg.c
+++ /dev/null
@@ -1,364 +0,0 @@
-/* Cairo - a vector graphics library with display and print output
- *
- * Copyright © 2009 Chris Wilson
- *
- * 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., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, 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 Chris Wilson.
- */
-
-#include "cairo-boilerplate-private.h"
-#include "cairo-malloc-private.h"
-
-#include <cairo-vg.h>
-
- /* XXX Not sure how to handle library specific context initialization */
-//#define USE_SHIVA
-//#define USE_AMANITH
-
-#if CAIRO_HAS_GLX_FUNCTIONS
-
-#include <X11/Xlib.h>
-#include <GL/glx.h>
-
-typedef struct _vg_closure {
- Display *dpy;
- int screen;
- Window win;
-
- GLXContext ctx;
- cairo_surface_t *surface;
-} vg_closure_glx_t;
-
-static void
-_cairo_boilerplate_vg_cleanup_glx (void *closure)
-{
- vg_closure_glx_t *vgc = closure;
-
-#ifdef USE_AMANITH
- vgDestroyContextAM ();
-#endif
-#ifdef USE_SHIVA
- vgDestroyContextSH ();
-#endif
-
- glXDestroyContext (vgc->dpy, vgc->ctx);
- XDestroyWindow (vgc->dpy, vgc->win);
- XCloseDisplay (vgc->dpy);
- free (vgc);
-}
-
-static cairo_surface_t *
-_cairo_boilerplate_vg_create_surface_glx (const char *name,
- cairo_content_t content,
- double width,
- double height,
- double max_width,
- double max_height,
- cairo_boilerplate_mode_t mode,
- void **closure)
-{
- int rgba_attribs[] = {
- GLX_RGBA,
- GLX_RED_SIZE, 1,
- GLX_GREEN_SIZE, 1,
- GLX_BLUE_SIZE, 1,
- GLX_ALPHA_SIZE, 1,
- GLX_DOUBLEBUFFER,
- GLX_NONE
- };
- int rgb_attribs[] = {
- GLX_RGBA,
- GLX_RED_SIZE, 1,
- GLX_GREEN_SIZE, 1,
- GLX_BLUE_SIZE, 1,
- GLX_DOUBLEBUFFER,
- GLX_NONE
- };
- XVisualInfo *vi;
- Display *dpy;
- Colormap cmap;
- XSetWindowAttributes swa;
- cairo_surface_t *surface;
- cairo_vg_context_t *context;
- vg_closure_glx_t *vgc;
-
- vgc = _cairo_malloc (sizeof (vg_closure_glx_t));
- *closure = vgc;
-
- if (width == 0)
- width = 1;
- if (height == 0)
- height = 1;
-
- dpy = XOpenDisplay (NULL);
- vgc->dpy = dpy;
- if (vgc->dpy == NULL) {
- fprintf (stderr, "Failed to open display: %s\n", XDisplayName(0));
- free (vgc);
- return NULL;
- }
-
- if (content == CAIRO_CONTENT_COLOR)
- vi = glXChooseVisual (dpy, DefaultScreen (dpy), rgb_attribs);
- else
- vi = glXChooseVisual (dpy, DefaultScreen (dpy), rgba_attribs);
-
- if (vi == NULL) {
- fprintf (stderr, "Failed to create RGB, double-buffered visual\n");
- XCloseDisplay (dpy);
- free (vgc);
- return NULL;
- }
-
- vgc->ctx = glXCreateContext (dpy, vi, NULL, True);
- cmap = XCreateColormap (dpy,
- RootWindow (dpy, vi->screen),
- vi->visual,
- AllocNone);
- swa.colormap = cmap;
- swa.border_pixel = 0;
- vgc->win = XCreateWindow (dpy, RootWindow (dpy, vi->screen),
- -1, -1, 1, 1, 0,
- vi->depth,
- InputOutput,
- vi->visual,
- CWBorderPixel | CWColormap, &swa);
- XFreeColormap (dpy, cmap);
- XFree (vi);
-
- XMapWindow (dpy, vgc->win);
-
- /* we need an active context to initialise VG */
- glXMakeContextCurrent (dpy, vgc->win, vgc->win, vgc->ctx);
-
-#ifdef USE_AMANITH
- vgInitContextAM (width, height, VG_FALSE, VG_TRUE);
-#endif
-#ifdef USE_SHIVA
- vgCreateContextSH (width, height);
-#endif
-
- context = cairo_vg_context_create_for_glx (dpy, vgc->ctx);
- vgc->surface = cairo_vg_surface_create (context, content, width, height);
- cairo_vg_context_destroy (context);
-
- surface = vgc->surface;
- if (cairo_surface_status (surface))
- _cairo_boilerplate_vg_cleanup_glx (vgc);
-
- return surface;
-}
-#endif
-
-#if CAIRO_HAS_EGL_FUNCTIONS
-typedef struct _vg_closure_egl {
- EGLDisplay *dpy;
- EGLContext *ctx;
- EGLSurface *dummy;
-} vg_closure_egl_t;
-
-static void
-_cairo_boilerplate_vg_cleanup_egl (void *closure)
-{
- vg_closure_egl_t *vgc = closure;
-
-#ifdef USE_AMANITH
- vgDestroyContextAM ();
-#endif
-#ifdef USE_SHIVA
- vgDestroyContextSH ();
-#endif
-
- eglDestroyContext (vgc->dpy, vgc->ctx);
- eglDestroySurface (vgc->dpy, vgc->dummy);
- eglTerminate (vgc->dpy);
- free (vgc);
-}
-
-static cairo_surface_t *
-_cairo_boilerplate_vg_create_surface_egl (const char *name,
- cairo_content_t content,
- double width,
- double height,
- double max_width,
- double max_height,
- cairo_boilerplate_mode_t mode,
- void **closure)
-{
- int rgba_attribs[] = {
- EGL_RED_SIZE, 8,
- EGL_GREEN_SIZE, 8,
- EGL_BLUE_SIZE, 8,
- EGL_ALPHA_SIZE, 8,
- EGL_SURFACE_TYPE, EGL_PBUFFER_BIT,
- EGL_RENDERABLE_TYPE, EGL_OPENVG_BIT,
- EGL_NONE
- };
- int rgb_attribs[] = {
- EGL_RED_SIZE, 8,
- EGL_GREEN_SIZE, 8,
- EGL_BLUE_SIZE, 8,
- EGL_ALPHA_SIZE, 8,
- EGL_VG_ALPHA_FORMAT, EGL_VG_ALPHA_FORMAT_PRE_BIT,
- EGL_SURFACE_TYPE, EGL_PBUFFER_BIT,
- EGL_RENDERABLE_TYPE, EGL_OPENVG_BIT,
- EGL_NONE
- };
- int dummy_attribs[] = {
- EGL_WIDTH, 8, EGL_HEIGHT, 8,
- EGL_NONE
- };
- EGLDisplay *dpy;
- int major, minor;
- EGLConfig config;
- int num_configs;
- EGLContext *egl_context;
- EGLSurface *dummy;
- cairo_vg_context_t *context;
- cairo_surface_t *surface;
- vg_closure_egl_t *vgc;
-
- dpy = eglGetDisplay (EGL_DEFAULT_DISPLAY);
-
- if (! eglInitialize (dpy, &major, &minor))
- return NULL;
-
- eglBindAPI (EGL_OPENVG_API);
-
- if (! eglChooseConfig (dpy,
- content == CAIRO_CONTENT_COLOR_ALPHA ?
- rgba_attribs : rgb_attribs,
- &config, 1, &num_configs) ||
- num_configs != 1)
- {
- return NULL;
- }
-
- egl_context = eglCreateContext (dpy, config, NULL, NULL);
- if (egl_context == NULL)
- return NULL;
-
- /* Create a dummy surface in order to enable a context to initialise VG */
- dummy = eglCreatePbufferSurface (dpy, config, dummy_attribs);
- if (dummy == NULL)
- return NULL;
- if (! eglMakeCurrent (dpy, dummy, dummy, egl_context))
- return NULL;
-
-#ifdef USE_AMANITH
- vgInitContextAM (width, height, VG_FALSE, VG_TRUE);
-#endif
-#ifdef USE_SHIVA
- vgCreateContextSH (width, height);
-#endif
-
- vgc = xmalloc (sizeof (vg_closure_egl_t));
- vgc->dpy = dpy;
- vgc->ctx = egl_context;
- vgc->dummy = dummy;
- *closure = vgc;
-
- context = cairo_vg_context_create_for_egl (vgc->dpy, vgc->ctx);
- surface = cairo_vg_surface_create (context, content, width, height);
- cairo_vg_context_destroy (context);
-
- if (cairo_surface_status (surface))
- _cairo_boilerplate_vg_cleanup_egl (vgc);
-
- return surface;
-}
-#endif
-
-static void
-_cairo_boilerplate_vg_synchronize (void *closure)
-{
- vgFinish ();
-}
-
-static const cairo_boilerplate_target_t targets[] = {
-#if CAIRO_HAS_GLX_FUNCTIONS
- {
- "vg-glx", "vg", NULL, NULL,
- CAIRO_SURFACE_TYPE_VG, CAIRO_CONTENT_COLOR_ALPHA, 1,
- "cairo_vg_context_create_for_glx",
- _cairo_boilerplate_vg_create_surface_glx,
- cairo_surface_create_similar,
- NULL, NULL,
- _cairo_boilerplate_get_image_surface,
- cairo_surface_write_to_png,
- _cairo_boilerplate_vg_cleanup_glx,
- _cairo_boilerplate_vg_synchronize,
- NULL,
- TRUE, FALSE, FALSE
- },
- {
- "vg-glx", "vg", NULL, NULL,
- CAIRO_SURFACE_TYPE_VG, CAIRO_CONTENT_COLOR, 1,
- "cairo_vg_context_create_for_glx",
- _cairo_boilerplate_vg_create_surface_glx,
- cairo_surface_create_similar,
- NULL, NULL,
- _cairo_boilerplate_get_image_surface,
- cairo_surface_write_to_png,
- _cairo_boilerplate_vg_cleanup_glx,
- _cairo_boilerplate_vg_synchronize,
- NULL,
- FALSE, FALSE, FALSE
- },
-#endif
-#if CAIRO_HAS_EGL_FUNCTIONS
- {
- "vg-egl", "vg", NULL, NULL,
- CAIRO_SURFACE_TYPE_VG, CAIRO_CONTENT_COLOR_ALPHA, 1,
- "cairo_vg_context_create_for_egl",
- _cairo_boilerplate_vg_create_surface_egl,
- cairo_surface_create_similar,
- NULL, NULL,
- _cairo_boilerplate_get_image_surface,
- cairo_surface_write_to_png,
- _cairo_boilerplate_vg_cleanup_egl,
- _cairo_boilerplate_vg_synchronize,
- NULL,
- TRUE, FALSE, FALSE
- },
- {
- "vg-egl", "vg", NULL, NULL,
- CAIRO_SURFACE_TYPE_VG, CAIRO_CONTENT_COLOR, 1,
- "cairo_vg_context_create_for_egl",
- _cairo_boilerplate_vg_create_surface_egl,
- cairo_surface_create_similar,
- NULL, NULL,
- _cairo_boilerplate_get_image_surface,
- cairo_surface_write_to_png,
- _cairo_boilerplate_vg_cleanup_egl,
- _cairo_boilerplate_vg_synchronize,
- NULL,
- FALSE, FALSE, FALSE
- },
-#endif
-};
-CAIRO_BOILERPLATE (vg, targets)
diff --git a/boilerplate/meson.build b/boilerplate/meson.build
index 39432fc16..7f663c273 100644
--- a/boilerplate/meson.build
+++ b/boilerplate/meson.build
@@ -12,7 +12,6 @@ cairo_boilerplate_feature_sources = {
'cairo-pdf': ['cairo-boilerplate-pdf.c'],
'cairo-ps': ['cairo-boilerplate-ps.c'],
'cairo-svg': ['cairo-boilerplate-svg.c'],
- 'cairo-vg': ['cairo-boilerplate-vg.c'],
'cairo-script': ['cairo-boilerplate-script.c'],
# All tests crash with FPE
# 'cairo-egl': ['cairo-boilerplate-egl.c'],