From e42dacd8102a1d49193d76c4339b188e6b0e6a39435034f48a6ed2198161f74f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Lie?= Date: Sun, 4 Aug 2019 12:09:17 +0000 Subject: [PATCH 1/4] Accepting request 720831 from home:StefanBruens:branches:graphics Reduce installed build dependencies OBS-URL: https://build.opensuse.org/request/show/720831 OBS-URL: https://build.opensuse.org/package/show/graphics/gegl?expand=0&rev=76 --- fix_doc_installation.patch | 68 ++++++++++++++++++++++++++++++++++++++ gegl.changes | 8 +++++ gegl.spec | 5 ++- 3 files changed, 78 insertions(+), 3 deletions(-) create mode 100644 fix_doc_installation.patch diff --git a/fix_doc_installation.patch b/fix_doc_installation.patch new file mode 100644 index 0000000..b4a3684 --- /dev/null +++ b/fix_doc_installation.patch @@ -0,0 +1,68 @@ +--- gegl-0.4.16/docs/Makefile.am_orig 2019-08-03 21:46:35.325046055 +0200 ++++ gegl-0.4.16/docs/Makefile.am 2019-08-03 23:23:17.090023165 +0200 +@@ -27,7 +27,6 @@ + HTML_FILES += images/inheritance.png + endif + +-if HAVE_ENSCRIPT + ENSCRIPT_FILES = \ + brightness-contrast.c.html \ + gegl.h.html \ +@@ -50,7 +49,6 @@ + + HTML_FILES += $(ENSCRIPT_FILES) + GTKDOC_FILES += $(ENSCRIPT_FILES) +-endif + + if HAVE_ASCIIDOC + HTML_FILES += $(ASC_DOC) +--- gegl-0.4.16/docs/Makefile.in_orig 2019-05-07 23:50:15.000000000 +0200 ++++ gegl-0.4.16/docs/Makefile.in 2019-08-03 23:23:30.654194341 +0200 +@@ -97,8 +97,8 @@ + host_triplet = @host@ + target_triplet = @target@ + @HAVE_RUBY_TRUE@am__append_1 = images/inheritance.png +-@HAVE_ENSCRIPT_TRUE@am__append_2 = $(ENSCRIPT_FILES) +-@HAVE_ENSCRIPT_TRUE@am__append_3 = $(ENSCRIPT_FILES) ++am__append_2 = $(ENSCRIPT_FILES) ++am__append_3 = $(ENSCRIPT_FILES) + @HAVE_ASCIIDOC_TRUE@am__append_4 = $(ASC_DOC) + subdir = docs + ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +@@ -458,21 +458,21 @@ + HTML_FILES = class-hierarchy.html $(am__append_1) $(am__append_2) \ + $(am__append_4) + GTKDOC_FILES = gegl.css $(am__append_3) +-@HAVE_ENSCRIPT_TRUE@ENSCRIPT_FILES = \ +-@HAVE_ENSCRIPT_TRUE@ brightness-contrast.c.html \ +-@HAVE_ENSCRIPT_TRUE@ gegl.h.html \ +-@HAVE_ENSCRIPT_TRUE@ gegl-operation.h.html \ +-@HAVE_ENSCRIPT_TRUE@ gegl-operation-filter.h.html \ +-@HAVE_ENSCRIPT_TRUE@ gegl-operation-composer.h.html \ +-@HAVE_ENSCRIPT_TRUE@ gegl-operation-area-filter.h.html \ +-@HAVE_ENSCRIPT_TRUE@ gegl-operation-meta.h.html \ +-@HAVE_ENSCRIPT_TRUE@ gegl-operation-point-composer.h.html \ +-@HAVE_ENSCRIPT_TRUE@ gegl-operation-point-filter.h.html \ +-@HAVE_ENSCRIPT_TRUE@ gegl-operation-point-render.h.html \ +-@HAVE_ENSCRIPT_TRUE@ gegl-operation-temporal.h.html \ +-@HAVE_ENSCRIPT_TRUE@ gegl-operation-sink.h.html \ +-@HAVE_ENSCRIPT_TRUE@ gegl-operation-source.h.html \ +-@HAVE_ENSCRIPT_TRUE@ gegl-plugin.h.html ++ENSCRIPT_FILES = \ ++ brightness-contrast.c.html \ ++ gegl.h.html \ ++ gegl-operation.h.html \ ++ gegl-operation-filter.h.html \ ++ gegl-operation-composer.h.html \ ++ gegl-operation-area-filter.h.html \ ++ gegl-operation-meta.h.html \ ++ gegl-operation-point-composer.h.html \ ++ gegl-operation-point-filter.h.html \ ++ gegl-operation-point-render.h.html \ ++ gegl-operation-temporal.h.html \ ++ gegl-operation-sink.h.html \ ++ gegl-operation-source.h.html \ ++ gegl-plugin.h.html + + EXTRA_DIST = ChangeLog development.txt NEWS.txt devhelp.css gegl.css \ + images/GEGL.png images/GEGL.svg images/gaussian-blur-graph.png \ diff --git a/gegl.changes b/gegl.changes index d8d10b2..6c2d616 100644 --- a/gegl.changes +++ b/gegl.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Sat Aug 3 19:08:48 UTC 2019 - Stefan Brüns + +- Remove unused build dependencies: + - graphviz-gd is checked for, but unused: ggo#gegl/182. + - gtk-doc generation is disabled, i.e. unused. + - enscript just regenerates bundled files, add fix_doc_installation.patch + ------------------------------------------------------------------- Thu May 9 17:44:39 UTC 2019 - Bjørn Lie diff --git a/gegl.spec b/gegl.spec index cf37601..9908a69 100644 --- a/gegl.spec +++ b/gegl.spec @@ -25,14 +25,13 @@ Group: Productivity/Graphics/Other URL: http://gegl.org/ Source0: https://download.gimp.org/pub/gegl/0.4/%{name}-%{version}.tar.bz2 Source99: baselibs.conf +# PATCH-FIX-OPENSUSE -- install bundled documentation even if enscript is not installed +Patch0: fix_doc_installation.patch BuildRequires: ImageMagick BuildRequires: SDL-devel >= 1.2.0 -BuildRequires: enscript BuildRequires: gcc-c++ BuildRequires: gobject-introspection-devel >= 1.32.0 -BuildRequires: graphviz-gd -BuildRequires: gtk-doc BuildRequires: libjpeg-devel BuildRequires: libspiro-devel BuildRequires: libstdc++-devel From e2895a444b8bcff16d5c8b46f8d606db0d94980a8d8e57baf2b990b7763ab94b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Lie?= Date: Sun, 4 Aug 2019 12:11:39 +0000 Subject: [PATCH 2/4] tweak .changes OBS-URL: https://build.opensuse.org/package/show/graphics/gegl?expand=0&rev=77 --- gegl.changes | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gegl.changes b/gegl.changes index 6c2d616..298684d 100644 --- a/gegl.changes +++ b/gegl.changes @@ -2,9 +2,10 @@ Sat Aug 3 19:08:48 UTC 2019 - Stefan Brüns - Remove unused build dependencies: - - graphviz-gd is checked for, but unused: ggo#gegl/182. + - graphviz-gd is checked for, but unused: glgo#GNOME/gegl!182. - gtk-doc generation is disabled, i.e. unused. - - enscript just regenerates bundled files, add fix_doc_installation.patch + - enscript just regenerates bundled files, add + fix_doc_installation.patch to avoid the need for this. ------------------------------------------------------------------- Thu May 9 17:44:39 UTC 2019 - Bjørn Lie From 1fa7a2756ed14a9c64e6cb6820cb3104c2345adfc86c3e273430f1046e7a5e19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Lie?= Date: Wed, 14 Aug 2019 12:09:06 +0000 Subject: [PATCH 3/4] Accepting request 722945 from home:StefanBruens:branches:graphics Port to SDL2 OBS-URL: https://build.opensuse.org/request/show/722945 OBS-URL: https://build.opensuse.org/package/show/graphics/gegl?expand=0&rev=78 --- ...onfigure-checks-with-checks-for-SDL2.patch | 82 ++++++ 0002-Port-sdl-display-to-SDL2.patch | 263 ++++++++++++++++++ 0003-Port-sdl-draw-example-to-SDL2.patch | 226 +++++++++++++++ gegl.changes | 8 + gegl.spec | 10 +- 5 files changed, 588 insertions(+), 1 deletion(-) create mode 100644 0001-Extend-configure-checks-with-checks-for-SDL2.patch create mode 100644 0002-Port-sdl-display-to-SDL2.patch create mode 100644 0003-Port-sdl-draw-example-to-SDL2.patch diff --git a/0001-Extend-configure-checks-with-checks-for-SDL2.patch b/0001-Extend-configure-checks-with-checks-for-SDL2.patch new file mode 100644 index 0000000..87f20be --- /dev/null +++ b/0001-Extend-configure-checks-with-checks-for-SDL2.patch @@ -0,0 +1,82 @@ +From 825c0934a34a6627fe85f671a3086ca42ea4f73e Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Stefan=20Br=C3=BCns?= +Date: Sun, 4 Aug 2019 17:55:20 +0200 +Subject: [PATCH 1/3] Extend configure checks with checks for SDL2 + +--- + configure.ac | 34 +++++++++++++++++++++++++++++----- + 1 file changed, 29 insertions(+), 5 deletions(-) + +diff --git a/configure.ac b/configure.ac +index 974113404..6e42abd2a 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -57,6 +57,7 @@ m4_define([popplerglib_required_version], [0.71.0]) + m4_define([zlib_required_version], [1.2.0]) + m4_define([png_required_version], [1.6.0]) + m4_define([sdl_required_version], [1.2.0]) ++m4_define([sdl2_required_version], [2.0.5]) + m4_define([libtiff_required_version], [4.0.0]) + m4_define([webp_required_version], [0.5.0]) + m4_define([poly2tri-c_required_version], [0.0.0]) +@@ -948,14 +949,36 @@ AC_SUBST(OPENEXR_CFLAGS) + AC_SUBST(OPENEXR_LIBS) + + +-############### +-# Check for SDL +-############### ++###################### ++# Check for SDL2 / SDL ++###################### + ++AC_ARG_WITH(sdl, [ --without-sdl2 build without SDL2 support]) + AC_ARG_WITH(sdl, [ --without-sdl build without SDL support]) + ++have_sdl2="no" ++if test "x$with_sdl2" != "xno"; then ++ AC_PATH_PROG(SDL2_CONFIG, sdl2-config, no) ++ if test "$SDL2_CONFIG" = "no"; then ++ have_sdl2="no (SDL2 library not found)" ++ AC_MSG_RESULT([*** Check for SDL2 library failed.]) ++ else ++ have_sdl2="yes" ++ SDL2_CFLAGS=`$SDL2_CONFIG --cflags` ++ SDL2_LIBS=`$SDL2_CONFIG --libs` ++ fi ++fi ++ ++AM_CONDITIONAL(HAVE_SDL2, test "$have_sdl2" = "yes") ++ ++AC_SUBST(SDL2_CFLAGS) ++AC_SUBST(SDL2_LIBS) ++ + have_sdl="no" +-if test "x$with_sdl" != "xno"; then ++if test "$have_sdl2" = "yes"; then ++ AC_MSG_NOTICE([Skipping SDL check (SDL2 and SDL are exclusive)]) ++ have_sdl="no (skipped)" ++elif test "x$with_sdl" != "xno"; then + AC_PATH_PROG(SDL_CONFIG, sdl-config, no) + if test "$SDL_CONFIG" = "no"; then + have_sdl="no (SDL library not found)" +@@ -968,7 +991,7 @@ if test "x$with_sdl" != "xno"; then + fi + + AM_CONDITIONAL(HAVE_SDL, test "$have_sdl" = "yes") +- ++ + AC_SUBST(SDL_CFLAGS) + AC_SUBST(SDL_LIBS) + +@@ -1417,6 +1440,7 @@ Optional dependencies: + PNG: $have_libpng + OpenEXR: $have_openexr + rsvg: $have_librsvg ++ SDL2: $have_sdl2 + SDL: $have_sdl + libraw: $have_libraw + Jasper: $have_jasper +-- +2.22.0 + diff --git a/0002-Port-sdl-display-to-SDL2.patch b/0002-Port-sdl-display-to-SDL2.patch new file mode 100644 index 0000000..0da9510 --- /dev/null +++ b/0002-Port-sdl-display-to-SDL2.patch @@ -0,0 +1,263 @@ +From c07813452c658f1f441b104fbe836380a6ddd18d Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Stefan=20Br=C3=BCns?= +Date: Sun, 4 Aug 2019 01:22:01 +0200 +Subject: [PATCH 2/3] Port sdl-display to SDL2 + +The SDL2 Video API is split into several orthogonal parts, see +https://wiki.libsdl.org/MigrationGuide#Video. + +Fixes half of #184 +--- + operations/common/display.c | 1 + + operations/external/Makefile.am | 6 + + operations/external/sdl2-display.c | 209 +++++++++++++++++++++++++++++ + 3 files changed, 216 insertions(+) + create mode 100644 operations/external/sdl2-display.c + +diff --git a/operations/common/display.c b/operations/common/display.c +index 826ae4caa..9e06f1eb5 100644 +--- a/operations/common/display.c ++++ b/operations/common/display.c +@@ -60,6 +60,7 @@ set_display_handler (GeglOperation *operation) + GeglOp *self = GEGL_OP (operation); + const gchar *known_handlers[] = {"gegl-gtk3:display", + "gegl-gtk2:display", ++ "gegl:sdl2-display", + "gegl:sdl-display"}; + char *handler = NULL; + gchar **operations = NULL; +diff --git a/operations/external/Makefile.am b/operations/external/Makefile.am +index 498ffb062..719698401 100644 +--- a/operations/external/Makefile.am ++++ b/operations/external/Makefile.am +@@ -81,6 +81,12 @@ exr_save_la_LIBADD = $(op_libs) $(OPENEXR_LIBS) + exr_save_la_CXXFLAGS = $(AM_CFLAGS) $(OPENEXR_CFLAGS) + endif + ++if HAVE_SDL2 ++ops += sdl2-display.la ++sdl2_display_la_LIBADD = $(op_libs) $(SDL2_LIBS) ++sdl2_display_la_CFLAGS = $(AM_CFLAGS) $(SDL2_CFLAGS) ++endif ++ + if HAVE_SDL + ops += sdl-display.la + sdl_display_la_LIBADD = $(op_libs) $(SDL_LIBS) +diff --git a/operations/external/sdl2-display.c b/operations/external/sdl2-display.c +new file mode 100644 +index 000000000..a3bab50a5 +--- /dev/null ++++ b/operations/external/sdl2-display.c +@@ -0,0 +1,209 @@ ++/* This file is an image processing operation for GEGL ++ * ++ * GEGL is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 3 of the License, or (at your option) any later version. ++ * ++ * GEGL is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with GEGL; if not, see . ++ * ++ * Copyright 2019 Stefan Brüns ++ * ++ * Based on sdl-display.c: ++ * Copyright 2006 Øyvind Kolås ++ */ ++ ++#include "config.h" ++#include ++ ++ ++#ifdef GEGL_PROPERTIES ++ ++property_string (window_title, _("Window title"), "window_title") ++ description (_("Title to be given to output window")) ++#else ++ ++#define GEGL_OP_SINK ++#define GEGL_OP_NAME sdl2_display ++#define GEGL_OP_C_SOURCE sdl2-display.c ++ ++#include "gegl-op.h" ++#include ++ ++typedef struct { ++ SDL_Window *window; ++ SDL_Renderer *renderer; ++ SDL_Texture *texture; ++ SDL_Surface *screen; ++ gint width; ++ gint height; ++} SDLState; ++ ++static void ++init_sdl (void) ++{ ++ static int inited = 0; ++ ++ if (!inited) ++ { ++ inited = 1; ++ ++ if (SDL_Init (SDL_INIT_VIDEO) < 0) ++ { ++ fprintf (stderr, "Unable to init SDL: %s\n", SDL_GetError ()); ++ return; ++ } ++ atexit (SDL_Quit); ++ } ++} ++ ++static gboolean idle (gpointer data) ++{ ++ SDL_Event event; ++ while (SDL_PollEvent (&event)) ++ { ++ switch (event.type) ++ { ++ case SDL_QUIT: ++ exit (0); ++ } ++ } ++ return TRUE; ++} ++ ++static guint handle = 0; ++ ++static gboolean ++process (GeglOperation *operation, ++ GeglBuffer *input, ++ const GeglRectangle *result, ++ gint level) ++{ ++ GeglProperties *o = GEGL_PROPERTIES (operation); ++ SDLState *state = NULL; ++ ++ if(!o->user_data) ++ o->user_data = g_new0 (SDLState, 1); ++ state = o->user_data; ++ ++ init_sdl (); ++ ++ if (!handle) ++ handle = g_timeout_add (500, idle, NULL); ++ ++ if (!state->window || ++ state->width != result->width || ++ state->height != result->height) ++ { ++ ++ if (state->window) ++ { ++ SDL_SetWindowSize (state->window, ++ result->width, result->height); ++ } ++ else ++ { ++ if (SDL_CreateWindowAndRenderer (result->width, ++ result->height, 0, ++ &state->window, &state->renderer)) ++ { ++ fprintf (stderr, "Unable to create window: %s\n", ++ SDL_GetError ()); ++ return -1; ++ } ++ } ++ ++ SDL_FreeSurface (state->screen); ++ state->screen = SDL_CreateRGBSurfaceWithFormat (0, ++ result->width, result->height, 32, SDL_PIXELFORMAT_RGBA32); ++ if (!state->screen) ++ { ++ fprintf (stderr, "Unable to create surface: %s\n", ++ SDL_GetError ()); ++ return -1; ++ } ++ ++ if (state->texture) ++ SDL_DestroyTexture (state->texture); ++ state->texture = SDL_CreateTextureFromSurface (state->renderer, state->screen); ++ if (!state->texture) ++ { ++ fprintf (stderr, "Unable to create texture: %s\n", ++ SDL_GetError ()); ++ return -1; ++ } ++ ++ state->width = result->width ; ++ state->height = result->height; ++ } ++ ++ /* ++ * There seems to be a valid faster path to the SDL desired display format ++ * in B'G'R'A, perhaps babl should have been able to figure this out ito? ++ * ++ */ ++ gegl_buffer_get (input, ++ NULL, ++ 1.0, ++ babl_format_new (babl_model ("R'G'B'A"), ++ babl_type ("u8"), ++ babl_component ("B'"), ++ babl_component ("G'"), ++ babl_component ("R'"), ++ babl_component ("A"), ++ NULL), ++ state->screen->pixels, GEGL_AUTO_ROWSTRIDE, ++ GEGL_ABYSS_NONE); ++ ++ SDL_UpdateTexture (state->texture, NULL, state->screen->pixels, state->screen->pitch); ++ ++ SDL_RenderClear (state->renderer); ++ SDL_RenderCopy (state->renderer, state->texture, NULL, NULL); ++ SDL_RenderPresent (state->renderer); ++ SDL_SetWindowTitle (state->window, o->window_title); ++ ++ return TRUE; ++} ++ ++static void ++finalize (GObject *object) ++{ ++ GeglProperties *o = GEGL_PROPERTIES (object); ++ ++ g_clear_pointer (&o->user_data, g_free); ++ ++ G_OBJECT_CLASS (gegl_op_parent_class)->finalize (object); ++} ++ ++static void ++gegl_op_class_init (GeglOpClass *klass) ++{ ++ GObjectClass *object_class; ++ GeglOperationClass *operation_class; ++ GeglOperationSinkClass *sink_class; ++ ++ object_class = G_OBJECT_CLASS (klass); ++ operation_class = GEGL_OPERATION_CLASS (klass); ++ sink_class = GEGL_OPERATION_SINK_CLASS (klass); ++ ++ object_class->finalize = finalize; ++ ++ sink_class->process = process; ++ sink_class->needs_full = TRUE; ++ ++ gegl_operation_class_set_keys (operation_class, ++ "name", "gegl:sdl2-display", ++ "title", _("SDL2 Display"), ++ "categories", "display", ++ "description", ++ _("Displays the input buffer in an SDL2 window (restricted to one" ++ " display op/process, due to SDL2 implementation issues)."), ++ NULL); ++} ++#endif +-- +2.22.0 + diff --git a/0003-Port-sdl-draw-example-to-SDL2.patch b/0003-Port-sdl-draw-example-to-SDL2.patch new file mode 100644 index 0000000..6bc84f8 --- /dev/null +++ b/0003-Port-sdl-draw-example-to-SDL2.patch @@ -0,0 +1,226 @@ +From e93eac9f1752bee533eb4222231946bd5be56359 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Stefan=20Br=C3=BCns?= +Date: Sun, 4 Aug 2019 17:52:55 +0200 +Subject: [PATCH 3/3] Port sdl-draw example to SDL2 + +--- + examples/Makefile.am | 7 ++-- + examples/sdl-draw.c | 85 +++++++++++++++++++++++++------------------- + 2 files changed, 51 insertions(+), 41 deletions(-) + +diff --git a/examples/Makefile.am b/examples/Makefile.am +index eae72ae4f..f45b857aa 100644 +--- a/examples/Makefile.am ++++ b/examples/Makefile.am +@@ -50,12 +50,11 @@ geglbuffer_add_image_SOURCES = geglbuffer-add-image.c + geglbuffer_clock_SOURCES = geglbuffer-clock.c + hello_world_SOURCES = hello-world.c + +-if HAVE_SDL ++if HAVE_SDL2 + noinst_PROGRAMS += sdl-draw + sdl_draw_SOURCES = sdl-draw.c +-sdl_draw_LDADD = $(SDL_LIBS) +-sdl_draw_CFLAGS = $(AM_CFLAGS) $(SDL_CFLAGS) +- ++sdl_draw_LDADD = $(SDL2_LIBS) ++sdl_draw_CFLAGS = $(AM_CFLAGS) $(SDL2_CFLAGS) + endif + + if HAVE_GEXIV2 +diff --git a/examples/sdl-draw.c b/examples/sdl-draw.c +index 0ff635192..8d061dfe3 100644 +--- a/examples/sdl-draw.c ++++ b/examples/sdl-draw.c +@@ -5,7 +5,10 @@ + + typedef struct + { +- SDL_Surface *main_window; ++ SDL_Window *window; ++ SDL_Renderer *renderer; ++ SDL_Surface *surface; ++ SDL_Texture *texture; + GeglBuffer *paint_buffer; + GeglNode *graph; + GeglNode *output_node; +@@ -15,8 +18,8 @@ typedef struct + int last_y; + } MainContext; + +-int run_main_loop (SDL_Surface *main_window, MainContext *context); +-void init_main_context (SDL_Surface *main_window, MainContext *context); ++int run_main_loop (MainContext *context); ++void init_main_context (MainContext *context); + void destroy_main_context (MainContext *context); + void draw_circle (GeglBuffer *buffer, int x, int y, float r); + +@@ -25,7 +28,6 @@ const Babl *sdl_format = NULL; + int main(int argc, char *argv[]) + { + int retval; +- SDL_Surface *main_window; + MainContext context = {0, }; + + if((retval = SDL_Init (SDL_INIT_VIDEO | SDL_INIT_TIMER)) > 0) +@@ -34,15 +36,31 @@ int main(int argc, char *argv[]) + return retval; + } + +- main_window = SDL_SetVideoMode (640, 480, 24, SDL_SWSURFACE); +- +- if (!main_window) ++ if (SDL_CreateWindowAndRenderer (640, 480, 0, ++ &context.window, &context.renderer)) + { + printf("SDL failed to create a window\n"); + SDL_Quit(); + return 1; + } + ++ context.surface = SDL_CreateRGBSurfaceWithFormat (0, ++ 640, 480, 24, SDL_PIXELFORMAT_RGB24); ++ if (!context.surface) ++ { ++ fprintf (stderr, "Unable to create surface: %s\n", ++ SDL_GetError ()); ++ return 1; ++ } ++ ++ context.texture = SDL_CreateTextureFromSurface (context.renderer, context.surface); ++ if (!context.surface) ++ { ++ fprintf (stderr, "Unable to create texture: %s\n", ++ SDL_GetError ()); ++ return 1; ++ } ++ + gegl_init (NULL, NULL); + + /* We don't have a native format that matches SDL, but we can use +@@ -56,9 +74,9 @@ int main(int argc, char *argv[]) + babl_component ("R'"), + NULL); + +- init_main_context (main_window, &context); ++ init_main_context (&context); + +- run_main_loop (main_window, &context); ++ run_main_loop (&context); + + destroy_main_context (&context); + +@@ -69,13 +87,12 @@ int main(int argc, char *argv[]) + } + + /* init_main_context: +- * @main_window: The output window. + * @context: The context. + * + * Initialize the main context object that will hold our graph. + */ + void +-init_main_context (SDL_Surface *main_window, MainContext *context) ++init_main_context (MainContext *context) + { + GeglNode *ptn = gegl_node_new (); + GeglNode *background_node, *over, *buffer_src; +@@ -111,7 +128,6 @@ init_main_context (SDL_Surface *main_window, MainContext *context) + context->output_node = over; + context->paint_buffer = paint_buffer; + +- context->main_window = main_window; + } + + /* destroy_main_context: +@@ -125,6 +141,9 @@ destroy_main_context (MainContext *context) + g_object_unref (context->graph); + g_object_unref (context->paint_buffer); + ++ SDL_FreeSurface (context->surface); ++ SDL_DestroyTexture (context->texture); ++ SDL_DestroyRenderer (context->renderer); + + context->graph = NULL; + context->output_node = NULL; +@@ -140,28 +159,29 @@ destroy_main_context (MainContext *context) + * to the sdl window. + */ + static void +-invalidate_signal (GeglNode *node, GeglRectangle *rect, SDL_Surface *main_window) ++invalidate_signal (GeglNode *node, GeglRectangle *rect, MainContext *context) + { +- GeglRectangle output_rect = {0, 0, main_window->w, main_window->h}; ++ SDL_Surface *surface = context->surface; ++ GeglRectangle output_rect = {0, 0, surface->w, surface->h}; + guchar *blit_origin = NULL; + +- SDL_LockSurface (main_window); +- + gegl_rectangle_intersect (&output_rect, &output_rect, rect); + +- blit_origin = (guchar *)main_window->pixels + (output_rect.x * 3 + output_rect.y * main_window->pitch); ++ blit_origin = (guchar *)surface->pixels + (output_rect.x * surface->format->BytesPerPixel + output_rect.y * surface->pitch); + + gegl_node_blit (node, + 1.0, + &output_rect, + sdl_format, + blit_origin, +- main_window->pitch, ++ surface->pitch, + 0); + +- SDL_UnlockSurface (main_window); ++ SDL_UpdateTexture (context->texture, NULL, surface->pixels, surface->pitch); + +- SDL_UpdateRect (main_window, output_rect.x, output_rect.y, output_rect.width, output_rect.height); ++ SDL_RenderClear (context->renderer); ++ SDL_RenderCopy (context->renderer, context->texture, NULL, NULL); ++ SDL_RenderPresent (context->renderer); + } + + /* draw_circle: +@@ -247,31 +267,22 @@ draw_circle (GeglBuffer *buffer, int x, int y, float r) + } + + int +-run_main_loop (SDL_Surface *main_window, +- MainContext *context) ++run_main_loop (MainContext *context) + { +- gegl_buffer_set_extent (context->paint_buffer, GEGL_RECTANGLE (0, 0, main_window->w, main_window->h)); +- +- SDL_LockSurface (main_window); +- +- gegl_node_blit (context->output_node, +- 1.0, +- GEGL_RECTANGLE (0, 0, main_window->w, main_window->h), +- sdl_format, +- main_window->pixels, +- main_window->pitch, +- 0); ++ SDL_Surface *surface = context->surface; ++ GeglRectangle initial_rect = {0, 0, surface->w, surface->h}; + +- SDL_UnlockSurface (main_window); ++ gegl_buffer_set_extent (context->paint_buffer, GEGL_RECTANGLE (0, 0, surface->w, surface->h)); + +- SDL_UpdateRect (main_window, 0, 0, 0, 0); ++ /* initial buffers update */ ++ invalidate_signal (context->output_node, &initial_rect, context); + +- /* This signal will trigger to update main_window when the output node's ++ /* This signal will trigger to update the surface when the output node's + * contents change. Updating instantly is very inefficient but is good + * enough for this example. + */ + g_signal_connect (context->output_node, "invalidated", +- G_CALLBACK (invalidate_signal), main_window); ++ G_CALLBACK (invalidate_signal), context); + + while(1) + { +-- +2.22.0 + diff --git a/gegl.changes b/gegl.changes index 298684d..9242a50 100644 --- a/gegl.changes +++ b/gegl.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Sun Aug 4 16:56:39 UTC 2019 - Stefan Brüns + +- Port sdl-display operation to SDL2: glgo#GNOME/gegl!184. + * 0001-Extend-configure-checks-with-checks-for-SDL2.patch + * 0002-Port-sdl-display-to-SDL2.patch + * 0003-Port-sdl-draw-example-to-SDL2.patch + ------------------------------------------------------------------- Sat Aug 3 19:08:48 UTC 2019 - Stefan Brüns diff --git a/gegl.spec b/gegl.spec index 9908a69..c0b265d 100644 --- a/gegl.spec +++ b/gegl.spec @@ -27,11 +27,18 @@ Source0: https://download.gimp.org/pub/gegl/0.4/%{name}-%{version}.tar.bz Source99: baselibs.conf # PATCH-FIX-OPENSUSE -- install bundled documentation even if enscript is not installed Patch0: fix_doc_installation.patch +# PATCH-FIX-UPSTREAM -- glgo#GNOME/gegl!184 1/3 +Patch1: 0001-Extend-configure-checks-with-checks-for-SDL2.patch +# PATCH-FIX-UPSTREAM -- glgo#GNOME/gegl!184 2/3 +Patch2: 0002-Port-sdl-display-to-SDL2.patch +# PATCH-FIX-UPSTREAM -- glgo#GNOME/gegl!184 3/3 +Patch3: 0003-Port-sdl-draw-example-to-SDL2.patch BuildRequires: ImageMagick -BuildRequires: SDL-devel >= 1.2.0 +BuildRequires: autoconf BuildRequires: gcc-c++ BuildRequires: gobject-introspection-devel >= 1.32.0 +BuildRequires: libSDL2-devel BuildRequires: libjpeg-devel BuildRequires: libspiro-devel BuildRequires: libstdc++-devel @@ -144,6 +151,7 @@ input and output. %autosetup -p1 %build +./autogen.sh %configure \ --disable-static \ %{nil} From d7a6e5da39072661528103feb49aecdf07c504228aa1f7905e5d847fc0555abd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Lie?= Date: Wed, 14 Aug 2019 12:20:26 +0000 Subject: [PATCH 4/4] Accepting request 723293 from home:iznogood:branches:graphics Tweak previous checkin OBS-URL: https://build.opensuse.org/request/show/723293 OBS-URL: https://build.opensuse.org/package/show/graphics/gegl?expand=0&rev=79 --- gegl.changes | 9 ++++++--- gegl.spec | 3 ++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/gegl.changes b/gegl.changes index 9242a50..0f3b8a0 100644 --- a/gegl.changes +++ b/gegl.changes @@ -2,9 +2,12 @@ Sun Aug 4 16:56:39 UTC 2019 - Stefan Brüns - Port sdl-display operation to SDL2: glgo#GNOME/gegl!184. - * 0001-Extend-configure-checks-with-checks-for-SDL2.patch - * 0002-Port-sdl-display-to-SDL2.patch - * 0003-Port-sdl-draw-example-to-SDL2.patch + + 0001-Extend-configure-checks-with-checks-for-SDL2.patch + + 0002-Port-sdl-display-to-SDL2.patch + + 0003-Port-sdl-draw-example-to-SDL2.patch +- Add autoconf BuildRequires and pass autogen.sh call. +- Replace SDL-devel with libSDL2-devel BuildRequires: Build SDL2 + support. ------------------------------------------------------------------- Sat Aug 3 19:08:48 UTC 2019 - Stefan Brüns diff --git a/gegl.spec b/gegl.spec index c0b265d..47eca35 100644 --- a/gegl.spec +++ b/gegl.spec @@ -35,6 +35,7 @@ Patch2: 0002-Port-sdl-display-to-SDL2.patch Patch3: 0003-Port-sdl-draw-example-to-SDL2.patch BuildRequires: ImageMagick +# Needed for patches 1-3 BuildRequires: autoconf BuildRequires: gcc-c++ BuildRequires: gobject-introspection-devel >= 1.32.0 @@ -151,7 +152,7 @@ input and output. %autosetup -p1 %build -./autogen.sh +NOCONFIGURE=1 ./autogen.sh %configure \ --disable-static \ %{nil}