diff options
author | M Joonas Pihlaja <jpihlaja@cc.helsinki.fi> | 2009-02-16 14:01:43 +0200 |
---|---|---|
committer | M Joonas Pihlaja <jpihlaja@cc.helsinki.fi> | 2009-02-16 14:01:43 +0200 |
commit | e380beae5382df547a1b538de94e90c0e2339141 (patch) | |
tree | 525284338f744ac9f48dcea80313496fa440e161 | |
parent | 79a72e63585d7fce7898f2c8bd997c6d88f8895f (diff) |
[sdl] Remove new backend.
The SDL backend makes invalid assumptions about SDL_Surface locking
semantics and doesn't deal correctly with the unpremultiplied pixel
format supported by SDL. Removed as per discussion on the mailing list.
http://lists.cairographics.org/archives/cairo/2009-February/016595.html
-rw-r--r-- | boilerplate/Makefile.sources | 3 | ||||
-rw-r--r-- | boilerplate/Makefile.win32.features | 10 | ||||
-rw-r--r-- | boilerplate/cairo-boilerplate-sdl-private.h | 56 | ||||
-rw-r--r-- | boilerplate/cairo-boilerplate-sdl.c | 69 | ||||
-rw-r--r-- | boilerplate/cairo-boilerplate.c | 15 | ||||
-rw-r--r-- | build/Makefile.win32.features | 1 | ||||
-rw-r--r-- | build/Makefile.win32.features-h | 3 | ||||
-rw-r--r-- | build/configure.ac.features | 1 | ||||
-rw-r--r-- | configure.ac | 8 | ||||
-rw-r--r-- | doc/public/tmpl/cairo-surface.sgml | 1 | ||||
-rw-r--r-- | perf/Makefile.am | 4 | ||||
-rw-r--r-- | perf/cairo-perf.c | 4 | ||||
-rw-r--r-- | src/Makefile.sources | 3 | ||||
-rw-r--r-- | src/Makefile.win32.features | 14 | ||||
-rw-r--r-- | src/cairo-sdl-surface.c | 418 | ||||
-rw-r--r-- | src/cairo-sdl.h | 54 | ||||
-rw-r--r-- | src/cairo.h | 2 | ||||
-rw-r--r-- | test/Makefile.am | 4 | ||||
-rw-r--r-- | test/cairo-test-runner.c | 4 | ||||
-rw-r--r-- | test/get-clip.c | 1 |
20 files changed, 0 insertions, 675 deletions
diff --git a/boilerplate/Makefile.sources b/boilerplate/Makefile.sources index b3cea817..1b82bbda 100644 --- a/boilerplate/Makefile.sources +++ b/boilerplate/Makefile.sources @@ -43,9 +43,6 @@ cairo_boilerplate_quartz_sources = cairo-boilerplate-quartz.c cairo_boilerplate_script_private = cairo-boilerplate-script-private.h cairo_boilerplate_script_sources = cairo-boilerplate-script.c -cairo_boilerplate_sdl_private = cairo-boilerplate-sdl-private.h -cairo_boilerplate_sdl_sources = cairo-boilerplate-sdl.c - cairo_boilerplate_svg_private = cairo-boilerplate-svg-private.h cairo_boilerplate_svg_sources = cairo-boilerplate-svg.c diff --git a/boilerplate/Makefile.win32.features b/boilerplate/Makefile.win32.features index 74f1ec1e..f5ee452f 100644 --- a/boilerplate/Makefile.win32.features +++ b/boilerplate/Makefile.win32.features @@ -119,16 +119,6 @@ enabled_cairo_boilerplate_private += $(cairo_boilerplate_beos_private) enabled_cairo_boilerplate_sources += $(cairo_boilerplate_beos_sources) endif -unsupported_cairo_boilerplate_headers += $(cairo_boilerplate_sdl_headers) -all_cairo_boilerplate_headers += $(cairo_boilerplate_sdl_headers) -all_cairo_boilerplate_private += $(cairo_boilerplate_sdl_private) -all_cairo_boilerplate_sources += $(cairo_boilerplate_sdl_sources) -ifeq ($(CAIRO_HAS_SDL_SURFACE),1) -enabled_cairo_boilerplate_headers += $(cairo_boilerplate_sdl_headers) -enabled_cairo_boilerplate_private += $(cairo_boilerplate_sdl_private) -enabled_cairo_boilerplate_sources += $(cairo_boilerplate_sdl_sources) -endif - supported_cairo_boilerplate_headers += $(cairo_boilerplate_png_headers) all_cairo_boilerplate_headers += $(cairo_boilerplate_png_headers) all_cairo_boilerplate_private += $(cairo_boilerplate_png_private) diff --git a/boilerplate/cairo-boilerplate-sdl-private.h b/boilerplate/cairo-boilerplate-sdl-private.h deleted file mode 100644 index 9b5bdf79..00000000 --- a/boilerplate/cairo-boilerplate-sdl-private.h +++ /dev/null @@ -1,56 +0,0 @@ -/* Cairo - a vector graphics library with display and print output - * - * Copyright © 2008 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., 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 Chris Wilson. - */ - -#ifndef CAIRO_BOILERPLATE_SDL_PRIVATE_H -#define CAIRO_BOILERPLATE_SDL_PRIVATE_H - -#include <cairo.h> - -CAIRO_BEGIN_DECLS - -extern cairo_surface_t * -_cairo_boilerplate_sdl_create_surface (const char *name, - cairo_content_t content, - int width, - int height, - int max_width, - int max_height, - cairo_boilerplate_mode_t mode, - int id, - void **closure); - -extern void -_cairo_boilerplate_sdl_cleanup (void* closure); - -CAIRO_END_DECLS - -#endif /* CAIRO_BOILERPLATE_SDL_PRIVATE_H */ diff --git a/boilerplate/cairo-boilerplate-sdl.c b/boilerplate/cairo-boilerplate-sdl.c deleted file mode 100644 index 407c2ee4..00000000 --- a/boilerplate/cairo-boilerplate-sdl.c +++ /dev/null @@ -1,69 +0,0 @@ -/* Cairo - a vector graphics library with display and print output - * - * Copyright © 2008 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., 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 Chris Wilson. - */ - -#include "cairo-boilerplate.h" -#include "cairo-boilerplate-sdl-private.h" - -#include <cairo-sdl.h> - -void -_cairo_boilerplate_sdl_cleanup (void *closure) -{ - SDL_Quit (); -} - -cairo_surface_t * -_cairo_boilerplate_sdl_create_surface (const char *name, - cairo_content_t content, - int width, - int height, - int max_width, - int max_height, - cairo_boilerplate_mode_t mode, - int id, - void **closure) -{ - SDL_Surface *screen; - cairo_surface_t *surface; - - if (SDL_Init (SDL_INIT_VIDEO) < 0) - return NULL; - - screen = SDL_SetVideoMode (width, height, 24, SDL_SWSURFACE); - if (screen == NULL) - return NULL; - - surface = cairo_sdl_surface_create (screen); - SDL_FreeSurface (screen); - - return surface; -} diff --git a/boilerplate/cairo-boilerplate.c b/boilerplate/cairo-boilerplate.c index dd34110c..b6c2c80b 100644 --- a/boilerplate/cairo-boilerplate.c +++ b/boilerplate/cairo-boilerplate.c @@ -50,9 +50,6 @@ #if CAIRO_HAS_SCRIPT_SURFACE #include "cairo-boilerplate-script-private.h" #endif -#if CAIRO_HAS_SDL_SURFACE -#include "cairo-boilerplate-sdl-private.h" -#endif #if CAIRO_HAS_SVG_SURFACE #include "cairo-boilerplate-svg-private.h" #endif @@ -723,18 +720,6 @@ static cairo_boilerplate_target_t targets[] = _cairo_boilerplate_directfb_cleanup }, #endif - -#if CAIRO_HAS_SDL_SURFACE - { - "sdl", "sdl", NULL, - CAIRO_SURFACE_TYPE_SDL, CAIRO_CONTENT_COLOR, 0, - _cairo_boilerplate_sdl_create_surface, NULL, - NULL, - _cairo_boilerplate_get_image_surface, - cairo_surface_write_to_png, - _cairo_boilerplate_sdl_cleanup - }, -#endif }; cairo_boilerplate_target_t ** diff --git a/build/Makefile.win32.features b/build/Makefile.win32.features index aa7e56e1..f90a6ee8 100644 --- a/build/Makefile.win32.features +++ b/build/Makefile.win32.features @@ -10,7 +10,6 @@ CAIRO_HAS_WIN32_SURFACE=1 CAIRO_HAS_WIN32_FONT=1 CAIRO_HAS_OS2_SURFACE=0 CAIRO_HAS_BEOS_SURFACE=0 -CAIRO_HAS_SDL_SURFACE=0 CAIRO_HAS_PNG_FUNCTIONS=1 CAIRO_HAS_GLITZ_SURFACE=0 CAIRO_HAS_DIRECTFB_SURFACE=0 diff --git a/build/Makefile.win32.features-h b/build/Makefile.win32.features-h index 82f6121b..a468e307 100644 --- a/build/Makefile.win32.features-h +++ b/build/Makefile.win32.features-h @@ -35,9 +35,6 @@ endif ifeq ($(CAIRO_HAS_BEOS_SURFACE),1) @echo "#define CAIRO_HAS_BEOS_SURFACE 1" >> src/cairo-features.h endif -ifeq ($(CAIRO_HAS_SDL_SURFACE),1) - @echo "#define CAIRO_HAS_SDL_SURFACE 1" >> src/cairo-features.h -endif ifeq ($(CAIRO_HAS_PNG_FUNCTIONS),1) @echo "#define CAIRO_HAS_PNG_FUNCTIONS 1" >> src/cairo-features.h endif diff --git a/build/configure.ac.features b/build/configure.ac.features index a7311c18..26dbfb12 100644 --- a/build/configure.ac.features +++ b/build/configure.ac.features @@ -375,7 +375,6 @@ AC_DEFUN([CAIRO_REPORT], echo " glitz: $use_glitz" echo " BeOS: $use_beos" echo " DirectFB: $use_directfb" - echo " SDL: $use_sdl" echo "" echo "The following font backends:" echo " User: yes (always builtin)" diff --git a/configure.ac b/configure.ac index d3ed7031..229eb6aa 100644 --- a/configure.ac +++ b/configure.ac @@ -160,14 +160,6 @@ CAIRO_ENABLE_SURFACE_BACKEND(beos, BeOS/Zeta, no, [ dnl =========================================================================== -CAIRO_ENABLE_SURFACE_BACKEND(sdl, SDL, no, [ - sdl_REQUIRES="sdl >= 1.2" - PKG_CHECK_MODULES(sdl, $sdl_REQUIRES, , [AC_MSG_RESULT(no) - use_sdl="no (requires $sdl_REQUIRES http://www.libsdl.org)"]) -]) - -dnl =========================================================================== - CAIRO_ENABLE_FUNCTIONS(png, PNG, yes, [ use_png=no AC_ARG_VAR([png_REQUIRES], [module name for libpng to search for using pkg-config]) diff --git a/doc/public/tmpl/cairo-surface.sgml b/doc/public/tmpl/cairo-surface.sgml index f32dd49e..f7df8296 100644 --- a/doc/public/tmpl/cairo-surface.sgml +++ b/doc/public/tmpl/cairo-surface.sgml @@ -214,7 +214,6 @@ The Portable Network Graphics image file format (ISO/IEC 15948). Since 1.10 @CAIRO_SURFACE_TYPE_OS2: @CAIRO_SURFACE_TYPE_WIN32_PRINTING: @CAIRO_SURFACE_TYPE_QUARTZ_IMAGE: -@CAIRO_SURFACE_TYPE_SDL: @CAIRO_SURFACE_TYPE_SCRIPT: <!-- ##### FUNCTION cairo_surface_get_type ##### --> diff --git a/perf/Makefile.am b/perf/Makefile.am index 59271999..f4feed05 100644 --- a/perf/Makefile.am +++ b/perf/Makefile.am @@ -61,10 +61,6 @@ endif endif cairo_perf_LDADD = $(LDADD) -if CAIRO_HAS_SDL_SURFACE -cairo_perf_LDADD += $(sdl_LIBS) -endif - libcairoperf_la_SOURCES = \ cairo-perf-report.c \ cairo-stats.c \ diff --git a/perf/cairo-perf.c b/perf/cairo-perf.c index c66113f3..d7a7e889 100644 --- a/perf/cairo-perf.c +++ b/perf/cairo-perf.c @@ -33,10 +33,6 @@ #include "cairo-boilerplate-getopt.h" -#if CAIRO_HAS_SDL_SURFACE -#include <SDL_main.h> -#endif - /* For basename */ #ifdef HAVE_LIBGEN_H #include <libgen.h> diff --git a/src/Makefile.sources b/src/Makefile.sources index 174bb993..7305995e 100644 --- a/src/Makefile.sources +++ b/src/Makefile.sources @@ -251,8 +251,5 @@ cairo_glitz_sources = cairo-glitz-surface.c cairo_directfb_headers = cairo-directfb.h cairo_directfb_sources = cairo-directfb-surface.c -cairo_sdl_headers = cairo-sdl.h -cairo_sdl_sources = cairo-sdl-surface.c - cairo_script_headers = cairo-script.h cairo_script_sources = cairo-script-surface.c diff --git a/src/Makefile.win32.features b/src/Makefile.win32.features index 921ab2d0..94815d30 100644 --- a/src/Makefile.win32.features +++ b/src/Makefile.win32.features @@ -161,20 +161,6 @@ ifeq ($(CAIRO_HAS_BEOS_SURFACE),1) enabled_cairo_pkgconf += cairo-beos.pc endif -unsupported_cairo_headers += $(cairo_sdl_headers) -all_cairo_headers += $(cairo_sdl_headers) -all_cairo_private += $(cairo_sdl_private) -all_cairo_sources += $(cairo_sdl_sources) -ifeq ($(CAIRO_HAS_SDL_SURFACE),1) -enabled_cairo_headers += $(cairo_sdl_headers) -enabled_cairo_private += $(cairo_sdl_private) -enabled_cairo_sources += $(cairo_sdl_sources) -endif -all_cairo_pkgconf += cairo-sdl.pc -ifeq ($(CAIRO_HAS_SDL_SURFACE),1) -enabled_cairo_pkgconf += cairo-sdl.pc -endif - supported_cairo_headers += $(cairo_png_headers) all_cairo_headers += $(cairo_png_headers) all_cairo_private += $(cairo_png_private) diff --git a/src/cairo-sdl-surface.c b/src/cairo-sdl-surface.c deleted file mode 100644 index 9ab82a56..00000000 --- a/src/cairo-sdl-surface.c +++ /dev/null @@ -1,418 +0,0 @@ -/* Cairo - a vector graphics library with display and print output - * - * Copyright © 2008 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., 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 Chris Wilson. - */ - -#include "cairoint.h" - -#include "cairo-sdl.h" - -typedef struct _cairo_sdl_surface { - cairo_surface_t base; - - SDL_Surface *sdl; - cairo_image_surface_t *image; - - cairo_region_t update; -} cairo_sdl_surface_t; - -static const cairo_surface_backend_t _cairo_sdl_surface_backend; - -static cairo_surface_t * -_cairo_sdl_surface_create_internal (SDL_Surface *sdl, - cairo_surface_t *image) -{ - cairo_sdl_surface_t *surface; - - surface = malloc (sizeof (cairo_sdl_surface_t)); - if (unlikely (surface == NULL)) - return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY)); - - _cairo_surface_init (&surface->base, - &_cairo_sdl_surface_backend, - image->content); - - surface->sdl = sdl; - sdl->refcount++; - surface->image = (cairo_image_surface_t *) cairo_surface_reference (image); - - _cairo_region_init (&surface->update); - - return &surface->base; -} - -static cairo_surface_t * -_cairo_sdl_surface_create_similar (void *abstract_src, - cairo_content_t content, - int width, - int height) -{ - return _cairo_image_surface_create_with_content (content, width, height); -} - -static cairo_status_t -_cairo_sdl_surface_finish (void *abstract_surface) -{ - cairo_sdl_surface_t *surface = abstract_surface; - - cairo_surface_destroy (&surface->image->base); - SDL_FreeSurface (surface->sdl); - - _cairo_region_fini (&surface->update); - - return CAIRO_STATUS_SUCCESS; -} - -static cairo_status_t -_cairo_sdl_surface_acquire_source_image (void *abstract_surface, - cairo_image_surface_t **image_out, - void **image_extra) -{ - cairo_sdl_surface_t *surface = abstract_surface; - - SDL_LockSurface (surface->sdl); - - *image_out = surface->image; - *image_extra = NULL; - - return CAIRO_STATUS_SUCCESS; -} - -static void -_cairo_sdl_surface_release_source_image (void *abstract_surface, - cairo_image_surface_t *image, - void *image_extra) -{ - cairo_sdl_surface_t *surface = abstract_surface; - - SDL_UnlockSurface (surface->sdl); -} - -static cairo_status_t -_cairo_sdl_surface_acquire_dest_image (void *abstract_surface, - cairo_rectangle_int_t *interest_rect, - cairo_image_surface_t **image_out, - cairo_rectangle_int_t *image_rect_out, - void **image_extra) -{ - cairo_sdl_surface_t *surface = abstract_surface; - - SDL_LockSurface (surface->sdl); - - image_rect_out->x = 0; - image_rect_out->y = 0; - image_rect_out->width = surface->image->width; - image_rect_out->height = surface->image->height; - - *image_out = surface->image; - *image_extra = NULL; - - return CAIRO_STATUS_SUCCESS; -} - -static void -_cairo_sdl_surface_release_dest_image (void *abstract_surface, - cairo_rectangle_int_t *interest_rect, - cairo_image_surface_t *image, - cairo_rectangle_int_t *image_rect, - void *image_extra) -{ - cairo_sdl_surface_t *surface = abstract_surface; - cairo_status_t status; - - SDL_UnlockSurface (surface->sdl); - - status = _cairo_region_union_rect (&surface->update, - &surface->update, - interest_rect); - status = _cairo_surface_set_error (&surface->base, status); -} - -static cairo_status_t -_cairo_sdl_surface_clone_similar (void *abstract_surface, - cairo_surface_t *src, - int src_x, - int src_y, - int width, - int height, - int *clone_offset_x, - int *clone_offset_y, - cairo_surface_t **clone_out) -{ - cairo_sdl_surface_t *surface = abstract_surface; - - if (src->backend == surface->base.backend) { - *clone_offset_x = *clone_offset_y = 0; - *clone_out = cairo_surface_reference (src); - - return CAIRO_STATUS_SUCCESS; - } else if (_cairo_surface_is_image (src)) { - cairo_image_surface_t *image = (cairo_image_surface_t *) src; - cairo_format_masks_t masks; - cairo_surface_t *clone; - SDL_Surface *sdl; - - _pixman_format_to_masks (image->pixman_format, &masks); - - sdl = SDL_CreateRGBSurfaceFrom (image->data, - image->width, - image->height, - masks.bpp, - image->stride, - masks.red_mask, - masks.green_mask, - masks.blue_mask, - masks.alpha_mask); - if (sdl == NULL) - return CAIRO_INT_STATUS_UNSUPPORTED; - - clone = _cairo_sdl_surface_create_internal (sdl, &image->base); - SDL_FreeSurface (sdl); - - if (clone->status) - return clone->status; - - *clone_offset_x = *clone_offset_y = 0; - *clone_out = clone; - return CAIRO_STATUS_SUCCESS; - } - - return CAIRO_INT_STATUS_UNSUPPORTED; -} - -static cairo_int_status_t -_cairo_sdl_surface_composite (cairo_operator_t op, - const cairo_pattern_t *src_pattern, - const cairo_pattern_t *mask_pattern, - void *abstract_dst, - int src_x, - int src_y, - int mask_x, - int mask_y, - int dst_x, - int dst_y, - unsigned int width, - unsigned int height) -{ - cairo_sdl_surface_t *dst = abstract_dst; - cairo_sdl_surface_t *src; - cairo_surface_attributes_t src_attr; - cairo_bool_t is_integer_translation; - int itx, ity; - cairo_int_status_t status; - - /* under a few conditions we can perform a (hardware) blit...*/ - if (op != CAIRO_OPERATOR_SOURCE) - return CAIRO_INT_STATUS_UNSUPPORTED; - if (mask_pattern) - return CAIRO_INT_STATUS_UNSUPPORTED; - if (dst->base.current_clip_serial != 0) - return CAIRO_INT_STATUS_UNSUPPORTED; - - status = _cairo_pattern_acquire_surface (src_pattern, &dst->base, - src_x, src_y, width, height, - (cairo_surface_t **) &src, - &src_attr); - if (unlikely (status)) - return status; - - is_integer_translation = - _cairo_matrix_is_integer_translation (&src_attr.matrix, &itx, &ity); - - status = CAIRO_INT_STATUS_UNSUPPORTED; - if (is_integer_translation && - src_attr.extend == CAIRO_EXTEND_NONE && - src_attr.filter == CAIRO_FILTER_NEAREST) - { - SDL_Rect src_rect; - SDL_Rect dst_rect; - cairo_rectangle_int_t rect; - - src_rect.x = src_x + src_attr.x_offset + itx; - src_rect.y = src_y + src_attr.y_offset + ity; - src_rect.w = width; - src_rect.h = height; - - dst_rect.x = dst_x; - dst_rect.y = dst_y; - dst_rect.w = width; - dst_rect.h = height; - - SDL_BlitSurface (src->sdl, &src_rect, dst->sdl, &dst_rect); - - rect.x = dst_x; - rect.y = dst_y; - rect.width = width; - rect.height = height; - status = _cairo_region_union_rect (&dst->update, - &dst->update, - &rect); - } - - _cairo_pattern_release_surface (src_pattern, &src->base, &src_attr); - return status; -} - -static cairo_int_status_t -_cairo_sdl_surface_set_clip_region (void *abstract_surface, - cairo_region_t *region) -{ - cairo_sdl_surface_t *surface = abstract_surface; - - return _cairo_surface_set_clip_region (&surface->image->base, - region, - surface->base.current_clip_serial); -} - -static cairo_int_status_t -_cairo_sdl_surface_get_extents (void *abstract_surface, - cairo_rectangle_int_t *rectangle) -{ - cairo_sdl_surface_t *surface = abstract_surface; - - rectangle->x = 0; - rectangle->y = 0; - rectangle->width = surface->image->width; - rectangle->height = surface->image->height; - - return CAIRO_STATUS_SUCCESS; -} - -static void -_cairo_sdl_surface_get_font_options (void *abstract_surface, - cairo_font_options_t *options) -{ - cairo_sdl_surface_t *surface = abstract_surface; - - cairo_surface_get_font_options (&surface->image->base, options); -} - -static cairo_status_t -_cairo_sdl_surface_flush (void *abstract_surface) -{ - cairo_sdl_surface_t *surface = abstract_surface; - int n_boxes, i; - - n_boxes = _cairo_region_num_boxes (&surface->update); - if (n_boxes == 0) - return CAIRO_STATUS_SUCCESS; - - for (i = 0; i < n_boxes; i++) { - cairo_box_int_t box; - - _cairo_region_get_box (&surface->update, i, &box); - - SDL_UpdateRect (surface->sdl, - box.p1.x, - box.p1.y, - box.p2.x - box.p1.x, - box.p2.y - box.p1.y); - } - - _cairo_region_fini (&surface->update); - _cairo_region_init (&surface->update); - - return CAIRO_STATUS_SUCCESS; -} - -static const cairo_surface_backend_t _cairo_sdl_surface_backend = { - CAIRO_SURFACE_TYPE_SDL, - _cairo_sdl_surface_create_similar, - _cairo_sdl_surface_finish, - _cairo_sdl_surface_acquire_source_image, - _cairo_sdl_surface_release_source_image, - _cairo_sdl_surface_acquire_dest_image, - _cairo_sdl_surface_release_dest_image, - _cairo_sdl_surface_clone_similar, - _cairo_sdl_surface_composite, - NULL, /* fill rectangles */ - NULL, /* composite traps */ - NULL, /* create_span_renderer */ - NULL, /* check_span_renderer */ - NULL, /* copy_page */ - NULL, /* show_page */ - _cairo_sdl_surface_set_clip_region, - NULL, /* intersect_clip_path */ - _cairo_sdl_surface_get_extents, - NULL, /* old_show_glyphs */ - _cairo_sdl_surface_get_font_options, - _cairo_sdl_surface_flush, /* flush */ - NULL, /* mark_dirty_rectangle */ - NULL, /* font_fini */ - NULL, /* glyph_fini */ - - NULL, /* paint */ - NULL, /* mask */ - NULL, /* stroke */ - NULL, /* fill */ - NULL, /* show_glyphs */ - NULL, /* snapshot */ - NULL, /* is_similar */ - - NULL, /* reset */ -}; - -static cairo_surface_t * -_cairo_image_surface_create_for_sdl (SDL_Surface *surface) -{ - cairo_format_masks_t masks; - pixman_format_code_t format; - - masks.bpp = surface->format->BitsPerPixel; - masks.alpha_mask = surface->format->Amask; - masks.red_mask = surface->format->Rmask; - masks.green_mask = surface->format->Gmask; - masks.blue_mask = surface->format->Bmask; - - if (! _pixman_format_from_masks (&masks, &format)) - return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_INVALID_FORMAT)); - - return _cairo_image_surface_create_with_pixman_format (surface->pixels, - format, - surface->w, - surface->h, - surface->pitch); -} - -cairo_surface_t * -cairo_sdl_surface_create (SDL_Surface *sdl) -{ - cairo_surface_t *image; - cairo_surface_t *surface; - - image = _cairo_image_surface_create_for_sdl (sdl); - if (image->status) - return image; - - surface = _cairo_sdl_surface_create_internal (sdl, image); - cairo_surface_destroy (image); - - return surface; -} diff --git a/src/cairo-sdl.h b/src/cairo-sdl.h deleted file mode 100644 index c5291a76..00000000 --- a/src/cairo-sdl.h +++ /dev/null @@ -1,54 +0,0 @@ -/* Cairo - a vector graphics library with display and print output - * - * Copyright © 2008 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., 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 Chris Wilson. - */ - -#ifndef CAIRO_SDL_H -#define CAIRO_SDL_H - -#include "cairo.h" - -#if CAIRO_HAS_SDL_SURFACE - -#include <SDL.h> - -CAIRO_BEGIN_DECLS - -cairo_public cairo_surface_t * -cairo_sdl_surface_create (SDL_Surface *surface); - -CAIRO_END_DECLS - -#else /* CAIRO_HAS_SDL_SURFACE */ -# error Cairo was not compiled with support for the SDL backend -#endif /* CAIRO_HAS_SDL_SURFACE */ - -#endif /* CAIRO_SDL_H */ - diff --git a/src/cairo.h b/src/cairo.h index 856f7afc..6994b304 100644 --- a/src/cairo.h +++ b/src/cairo.h @@ -1877,7 +1877,6 @@ cairo_surface_status (cairo_surface_t *surface); * @CAIRO_SURFACE_TYPE_OS2: The surface is of type os2 * @CAIRO_SURFACE_TYPE_WIN32_PRINTING: The surface is a win32 printing surface * @CAIRO_SURFACE_TYPE_QUARTZ_IMAGE: The surface is of type quartz_image - * @CAIRO_SURFACE_TYPE_SDL: The surface is of type SDL, since 1.10 * @CAIRO_SURFACE_TYPE_SCRIPT: The surface is of type script, since 1.10 * * #cairo_surface_type_t is used to describe the type of a given @@ -1918,7 +1917,6 @@ typedef enum _cairo_surface_type { CAIRO_SURFACE_TYPE_OS2, CAIRO_SURFACE_TYPE_WIN32_PRINTING, CAIRO_SURFACE_TYPE_QUARTZ_IMAGE, - CAIRO_SURFACE_TYPE_SDL, CAIRO_SURFACE_TYPE_SCRIPT } cairo_surface_type_t; diff --git a/test/Makefile.am b/test/Makefile.am index 9c670ed3..f737fddc 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -308,10 +308,6 @@ if HAVE_PTHREAD cairo_test_suite_LDADD += -lpthread endif -if CAIRO_HAS_SDL_SURFACE -cairo_test_suite_LDADD += $(sdl_LIBS) -endif - BUILT_SOURCES += cairo-test-constructors.c noinst_SCRIPTS = make-cairo-test-constructors.pl EXTRA_DIST += $(BUILT_SOURCES) $(noinst_SCRIPTS) COPYING diff --git a/test/cairo-test-runner.c b/test/cairo-test-runner.c index 1d79c7e3..0f437c4c 100644 --- a/test/cairo-test-runner.c +++ b/test/cairo-test-runner.c @@ -33,10 +33,6 @@ #undef CAIRO_VERSION_MICRO #include "../cairo-version.h" -#if CAIRO_HAS_SDL_SURFACE -#include <SDL_main.h> -#endif - #include <pixman.h> /* for version information */ /* Coregraphics doesn't seem to like being forked and reports: diff --git a/test/get-clip.c b/test/get-clip.c index e246671a..1a07f012 100644 --- a/test/get-clip.c +++ b/test/get-clip.c @@ -129,7 +129,6 @@ draw (cairo_t *cr, int width, int height) case CAIRO_SURFACE_TYPE_WIN32: case CAIRO_SURFACE_TYPE_BEOS: case CAIRO_SURFACE_TYPE_DIRECTFB: - case CAIRO_SURFACE_TYPE_SDL: uses_clip_rects = TRUE; break; case CAIRO_SURFACE_TYPE_QUARTZ: |