This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project gfxprim.git.
The branch, master has been updated
via b42a87dcb2eda0fafe87007fa07ec19b6398a732 (commit)
via 7122d44b503fdf8c67ea49a43b10f8b75e809b36 (commit)
via 3de5653e6ed7557d6da57722d06da74a24652eee (commit)
via 8415a829b152c199267addf477236da77ca297f5 (commit)
from ec2f0bf1e1633bd1b8e4eae76f6c99b4ffe067a5 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://repo.or.cz/w/gfxprim.git/commit/b42a87dcb2eda0fafe87007fa07ec19b6398…
commit b42a87dcb2eda0fafe87007fa07ec19b6398a732
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Mon Dec 3 19:24:30 2012 +0100
spiv: Add -h help option, yay!
diff --git a/demos/spiv/spiv.c b/demos/spiv/spiv.c
index a569429..abe7395 100644
--- a/demos/spiv/spiv.c
+++ b/demos/spiv/spiv.c
@@ -565,6 +565,53 @@ static void init_caches(struct loader_params *params)
// params->img_orig_cache = NULL;
}
+static void print_help(void)
+{
+ printf("Usage: spiv [opts] imagesnn");
+ printf("-Intshow image info (filename and size)nn");
+ printf("-Pntshow loading progressnn");
+ printf("-fntuse floyd-steinberg ditheringnn");
+ printf("-s secntsleep interval in secondsnn");
+ printf("-cntturns on bicubic resampling (experimental)nn");
+ printf("-d levelntsets GFXprim debug levelnn");
+ printf("-e pixel_typentturns on backend type emulationn");
+ printf("tfor example -e G1 sets 1-bit grayscalenn");
+ printf("-r anglentrotate display 90,180 or 270 degreesnn");
+ printf("-bntpass backend init string to backend initn");
+ printf("tpass -b help for more infonn");
+
+ printf("Keyboard control:nn");
+ printf("I - toggle show infon");
+ printf("P - toggle show progressn");
+ printf("R - rotate by 90 degreesn");
+ printf("] - change to next resampling methodn");
+ printf("[ - change to prev resampling methodn");
+ printf(" (current method is shown in infon");
+ printf("L - toggle low pass filtern");
+ printf("D - drop image cachen");
+ printf("nEscn");
+ printf("Entern");
+ printf("Q - quit spivnn");
+ printf("PgDown - move ten image forwardn");
+ printf("PgUp - move ten image backwardn");
+ printf("nRightn");
+ printf("Upn");
+ printf("Space - move to the next imagen");
+ printf("nLeftn");
+ printf("Downn");
+ printf("BckSpc - move to the prev imagen");
+ printf("n");
+
+ printf("Some cool options to try:nn");
+ printf("spiv -e G1 -f imagesn");
+ printf("truns spiv in 1-bit bitmap mode and turns on ditheringnn");
+ printf("spiv -b 'X11:ROOT_WIN' imagesn");
+ printf("truns spiv using X root window as backend windownn");
+ printf("spiv -b 'X11:CREATE_ROOT' imagesn");
+ printf("tSame as abowe but works in KDEn");
+
+}
+
int main(int argc, char *argv[])
{
GP_Context *context = NULL;
@@ -588,7 +635,7 @@ int main(int argc, char *argv[])
.img_orig_cache = NULL,
};
- while ((opt = getopt(argc, argv, "b:cd:e:fIPs:r:")) != -1) {
+ while ((opt = getopt(argc, argv, "b:cd:e:fhIPs:r:")) != -1) {
switch (opt) {
case 'I':
params.show_info = 1;
@@ -630,8 +677,14 @@ int main(int argc, char *argv[])
case 'b':
backend_opts = optarg;
break;
+ case 'h':
+ print_help();
+ exit(0);
+ break;
default:
fprintf(stderr, "Invalid paramter '%c'n", opt);
+ print_help();
+ return 1;
}
}
http://repo.or.cz/w/gfxprim.git/commit/7122d44b503fdf8c67ea49a43b10f8b75e80…
commit 7122d44b503fdf8c67ea49a43b10f8b75e809b36
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Mon Dec 3 19:23:37 2012 +0100
backends: Add CREATE_ROOT to backend init docs.
diff --git a/libs/backends/GP_BackendInit.c b/libs/backends/GP_BackendInit.c
index 31fd3bf..0b04407 100644
--- a/libs/backends/GP_BackendInit.c
+++ b/libs/backends/GP_BackendInit.c
@@ -134,9 +134,11 @@ static void backend_x11_help(FILE *help, const char *err)
fprintf(help, "X11 backendn"
"--------------n"
- "X11:WxH:[ROOT_WIN]nn"
- "ROOT_WIN - starts the backend in the root windown"
- " (w and h, if set, are ignored)n");
+ "X11:[WxH]:[ROOT_WIN]:[CREATE_ROOT]nn"
+ "ROOT_WIN - starts the backend in the root windown"
+ " (w and h, if set, are ignored)n"
+ "CREATE_ROOT - starts the backend in newly createdn"
+ " root window (w and h, if set, are ignored)n");
}
static int x11_params_to_flags(const char *param, GP_Size *w, GP_Size *h,
http://repo.or.cz/w/gfxprim.git/commit/3de5653e6ed7557d6da57722d06da74a2465…
commit 3de5653e6ed7557d6da57722d06da74a24652eee
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Mon Dec 3 17:39:17 2012 +0100
doc: Add GP_ContextFromSurface() docs and example.
diff --git a/doc/backends.txt b/doc/backends.txt
index a471652..86d5d51 100644
--- a/doc/backends.txt
+++ b/doc/backends.txt
@@ -1,19 +1,21 @@
Drawing Backends
-----------------
+================
-Drawing backends provide means to draw into computer screen or into an window
+Drawing backends provide means to draw into computer screen or into a window
inside of running operating system. Instead of having one unified
initialization interface each backend has it's specific function and semantics
but once backend is initialized the backend structure provides unified API for
controlling the drawing.
-So far there are three backends implemented, Linux mmaped frame-buffer, libSDL
-and X11 backend.
+So far there are backends for Linux mmaped frame-buffer, libSDL and X11.
For example usage see backend link:example_backend.html[example].
Initialization functions
-~~~~~~~~~~~~~~~~~~~~~~~
+------------------------
+
+Linux Framebuffer
+~~~~~~~~~~~~~~~~~
[source,c]
-------------------------------------------------------------------------------
@@ -28,6 +30,10 @@ If flag is set console KBD driver is used to feed keystrokes into the event
queue, otherwise no events are generated and you are expected to initialize
input event driver in order to get keystrokes and/or pointer events.
+
+SDL
+~~~
+
[source,c]
-------------------------------------------------------------------------------
enum GP_BackendSDLFlags {
@@ -40,10 +46,10 @@ GP_Backend *GP_BackendSDLInit(GP_Size w, GP_Size h,
const char *caption);
-------------------------------------------------------------------------------
-Initialize SDL as an backend driver. The backend is thread safe as all the
+Initialize 'SDL' as an backend driver. The backend is thread safe as all the
operations are guarded by locks.
-You can't initialize more than one backend at a time, which is inherited SDL
+You can't initialize more than one backend at a time, which is inherited 'SDL'
limitation. If you call the initialization for a second time, you will get a
pointer to already running backend.
@@ -58,6 +64,26 @@ The caption is window caption.
And finally flags may change the SDL to go to full-screen mode or make the
window resizable.
+
+[source,c]
+-------------------------------------------------------------------------------
+#include <backends/GP_SDL_Context.h>
+
+int GP_ContextFromSurface(GP_Context *c, const SDL_Surface *surf);
+-------------------------------------------------------------------------------
+
+This function allows you to mix 'SDL' and 'GFXprim' code. The functions
+initializes the context from 'SDL' surface using the pixel buffer from surface
+as pixel buffer for the context.
+
+Function returns zero on succes and non-zero on failure (There is no GFXprim
+pixel type to match given surface).
+
+For example usage see 'SDL' glue link:example_SDL_glue.html[example].
+
+X server
+~~~~~~~~
+
[source,c]
-------------------------------------------------------------------------------
enum GP_BackendX11Flags {
@@ -73,9 +99,9 @@ GP_Backend *GP_BackendX11Init(const char *display, int x, int y,
enum GP_BackendX11Flags flags);
-------------------------------------------------------------------------------
-Returns pointer to initialized X11 backend or in case of failure NULL.
+Returns pointer to initialized X11 backend or in case of failure 'NULL'.
-When display is NULL default display is used (which is what you want most of the
+When display is 'NULL' default display is used (which is what you want most of the
time).
This backend feeds key events into global input queue.
diff --git a/doc/example_SDL_glue.txt b/doc/example_SDL_glue.txt
new file mode 100644
index 0000000..04ca2f9
--- /dev/null
+++ b/doc/example_SDL_glue.txt
@@ -0,0 +1,10 @@
+SDL Glue Example
+----------------
+
+You can easily mix SDL and GFXprim code using 'GP_ContextFromSurface()'
+function.
+
+[source,c]
+------------------------------------------------------------------
+include::../demos/c_simple/SDL_glue.c[]
+------------------------------------------------------------------
http://repo.or.cz/w/gfxprim.git/commit/8415a829b152c199267addf477236da77ca2…
commit 8415a829b152c199267addf477236da77ca297f5
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Mon Dec 3 17:23:19 2012 +0100
libs,backends: Finally remove the obsolete SDL library.
It's functionality is replaced by exporting
GP_ContextFromSurface() function from SDL backend.
diff --git a/demos/c_simple/Makefile b/demos/c_simple/Makefile
index b30fc23..e64dda7 100644
--- a/demos/c_simple/Makefile
+++ b/demos/c_simple/Makefile
@@ -1,6 +1,14 @@
TOPDIR=../..
-CSOURCES=$(shell echo *.c)
+include $(TOPDIR)/pre.mk
+
+SOURCES=$(shell echo *.c)
+
+ifneq ($(HAVE_LIBSDL),yes)
+CSOURCES=$(filter-out SDL_glue.c,$(SOURCES))
+else
+CSOURCES=$(SOURCES)
+endif
INCLUDE=
LDFLAGS+=-L$(TOPDIR)/build/
@@ -12,9 +20,12 @@ APPS=backend_example loaders_example loaders filters_symmetry gfx_koch fileview linetest randomshapetest fonttest loaders_register blittest textaligntest
+ifeq ($(HAVE_LIBSDL),yes)
+APPS+=SDL_glue
+endif
+
v4l2_show: LDLIBS+=-lGP_grabbers
v4l2_grab: LDLIBS+=-lGP_grabbers
-include $(TOPDIR)/pre.mk
include $(TOPDIR)/app.mk
include $(TOPDIR)/post.mk
diff --git a/libs/SDL/GP_SDL_Context.c b/demos/c_simple/SDL_glue.c
similarity index 56%
rename from libs/SDL/GP_SDL_Context.c
rename to demos/c_simple/SDL_glue.c
index cbe5ca4..3185b67 100644
--- a/libs/SDL/GP_SDL_Context.c
+++ b/demos/c_simple/SDL_glue.c
@@ -23,46 +23,94 @@
* *
*****************************************************************************/
-#include "GP_Core.h"
+ /*
+
+ This example shows how to mix SDL with GFXprim.
-#include "../../config.h"
+ */
-#ifdef HAVE_LIBSDL
+#include <stdio.h>
+#include <stdlib.h>
+#include <SDL/SDL.h>
+#include <GP.h>
+#include <backends/GP_SDL_Context.h>
-#include "GP_SDL.h"
+#define W 320
+#define H 240
-int GP_SDL_ContextFromSurface(GP_Context *context, SDL_Surface *surf)
+static SDL_Surface *display = NULL;
+static GP_Context context;
+
+static GP_Pixel black_pixel, darkgray_pixel;
+
+void redraw_screen(void)
{
- if (surf == NULL || surf->pixels == NULL || context == NULL)
- return 1;
+ SDL_LockSurface(display);
+
+ GP_Fill(&context, black_pixel);
+
+ GP_Line(&context, 0, 0, W-1, H-1, darkgray_pixel);
+ GP_Line(&context, 0, H-1, W-1, 0, darkgray_pixel);
+
+ SDL_UnlockSurface(display);
+}
+
+void event_loop(void)
+{
+ SDL_Event event;
+
+ while (SDL_WaitEvent(&event) > 0) {
+ switch (event.type) {
- /* sanity checks on the SDL surface */
- if (surf->format->BytesPerPixel == 0 || surf->format->BytesPerPixel > 4)
+ case SDL_VIDEOEXPOSE:
+ redraw_screen();
+ SDL_Flip(display);
+ break;
+
+ case SDL_KEYDOWN:
+ switch (event.key.keysym.sym) {
+ case SDLK_ESCAPE:
+ return;
+ default:
+ break;
+ }
+ break;
+
+ case SDL_QUIT:
+ return;
+ }
+ }
+}
+
+int main(void)
+{
+ if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) != 0) {
+ fprintf(stderr, "Could not initialize SDL: %sn", SDL_GetError());
return 1;
+ }
+
+ display = SDL_SetVideoMode(W, H, 0, SDL_SWSURFACE);
- enum GP_PixelType pixeltype = GP_PixelRGBMatch(surf->format->Rmask,
- surf->format->Gmask,
- surf->format->Bmask,
- surf->format->Ashift,
- surf->format->BitsPerPixel);
+ if (display == NULL) {
+ fprintf(stderr, "Could not open display: %sn", SDL_GetError());
+ goto fail;
+ }
- if (pixeltype == GP_PIXEL_UNKNOWN)
- return 1;
+ GP_ContextFromSurface(&context, display);
- /* basic structure and size */
- context->pixels = surf->pixels;
- context->bpp = 8 * surf->format->BytesPerPixel;
- context->pixel_type = pixeltype;
- context->bytes_per_row = surf->pitch;
- context->w = surf->w;
- context->h = surf->h;
+ black_pixel = GP_ColorToContextPixel(GP_COL_BLACK, &context);
+ darkgray_pixel = GP_ColorToContextPixel(GP_COL_GRAY_DARK, &context);
- /* orientation */
- context->axes_swap = 0;
- context->x_swap = 0;
- context->y_swap = 0;
+ redraw_screen();
+ SDL_Flip(display);
+ event_loop();
+
+ SDL_Quit();
return 0;
+
+fail:
+ SDL_Quit();
+ return 1;
}
-#endif /* HAVE_LIBSDL */
diff --git a/include/SDL/GP_SDL.h b/include/SDL/GP_SDL.h
deleted file mode 100644
index d01bd1e..0000000
--- a/include/SDL/GP_SDL.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*****************************************************************************
- * This file is part of gfxprim library. *
- * *
- * Gfxprim 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 2.1 of the License, or (at your option) any later version. *
- * *
- * Gfxprim 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 gfxprim; if not, write to the Free Software *
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
- * Boston, MA 02110-1301 USA *
- * *
- * Copyright (C) 2009-2010 Jiri "BlueBear" Dluhos *
- * <jiri.bluebear.dluhos(a)gmail.com> *
- * *
- * Copyright (C) 2009-2011 Cyril Hrubis <metan(a)ucw.cz> *
- * *
- *****************************************************************************/
-
-#ifndef GP_SDL_H
-#define GP_SDL_H
-
-#include <SDL/SDL.h>
-
-#include "GP_SDL_Context.h"
-#include "GP_SDL_VideoInit.h"
-
-#define GP_SDL_BYTES_PER_PIXEL(target) (target->format->BytesPerPixel)
-
-#define GP_SDL_BYTES_PER_LINE(target) (target->pitch)
-
-#define GP_SDL_PIXELS(target) ((uint8_t *)(target->pixels))
-
-#define GP_SDL_PIXEL_ADDR(target, x, y) ( - GP_SDL_PIXELS(target) - + y * GP_SDL_BYTES_PER_LINE(target) - + x * GP_SDL_BYTES_PER_PIXEL(target) -)
-
-#endif /* GP_SDL_H */
diff --git a/include/SDL/GP_SDL_VideoInit.h b/include/SDL/GP_SDL_VideoInit.h
deleted file mode 100644
index ad26c10..0000000
--- a/include/SDL/GP_SDL_VideoInit.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*****************************************************************************
- * This file is part of gfxprim library. *
- * *
- * Gfxprim 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 2.1 of the License, or (at your option) any later version. *
- * *
- * Gfxprim 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 gfxprim; if not, write to the Free Software *
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
- * Boston, MA 02110-1301 USA *
- * *
- * Copyright (C) 2009-2010 Jiri "BlueBear" Dluhos *
- * <jiri.bluebear.dluhos(a)gmail.com> *
- * *
- * Copyright (C) 2009-2010 Cyril Hrubis <metan(a)ucw.cz> *
- * *
- *****************************************************************************/
-
-#ifndef GP_SDL_VIDEOINIT_H
-#define GP_SDL_VIDEOINIT_H
-
-#include "GP.h"
-
-int GP_SDL_VideoInit(GP_Context *context, int width, int height,
- int argc, char **argv);
-
-#endif /* GP_SDL_VIDEOINIT_H */
diff --git a/include/SDL/README b/include/SDL/README
deleted file mode 100644
index 37680b8..0000000
--- a/include/SDL/README
+++ /dev/null
@@ -1,2 +0,0 @@
-This code/interface is deprecated and will be removed after backends are
-written.
diff --git a/include/SDL/GP_SDL_Context.h b/include/backends/GP_SDL_Context.h
similarity index 69%
rename from include/SDL/GP_SDL_Context.h
rename to include/backends/GP_SDL_Context.h
index 5f27a4a..4ed5aad 100644
--- a/include/SDL/GP_SDL_Context.h
+++ b/include/backends/GP_SDL_Context.h
@@ -16,18 +16,34 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, *
* Boston, MA 02110-1301 USA *
* *
- * Copyright (C) 2009-2010 Jiri "BlueBear" Dluhos *
- * <jiri.bluebear.dluhos(a)gmail.com> *
- * *
- * Copyright (C) 2009-2010 Cyril Hrubis <metan(a)ucw.cz> *
+ * Copyright (C) 2009-2012 Cyril Hrubis <metan(a)ucw.cz> *
* *
*****************************************************************************/
-#ifndef GP_SDL_CONTEXT_H
-#define GP_SDL_CONTEXT_H
+#ifndef BACKENDS_GP_SDL_CONTEXT_H
+#define BACKENDS_GP_SDL_CONTEXT_H
-#include "GP.h"
+#include <SDL/SDL.h>
+#include <core/GP_Context.h>
-int GP_SDL_ContextFromSurface(GP_Context *context, SDL_Surface *surf);
+/*
+ * This function lets you use GFXprim together with SDL. All you need to do
+ * is to initialize context from surface. The usage is as follows:
+ *
+ * ...
+ *
+ * GP_Context c;
+ *
+ * if (GP_ContextFromSurface(&c, surface)) {
+ * error("Failed to match PIXEL_TYPE for given surface");
+ * exit(1);
+ * }
+ *
+ * ...
+ *
+ * Now you have initialized context that shares the pixel buffer with
+ * the SDL surface.
+ */
+int GP_ContextFromSurface(GP_Context *c, const SDL_Surface *surf);
-#endif /* GP_SDL_CONTEXT_H */
+#endif /* BACKENDS_GP_SDL_CONTEXT_H */
diff --git a/libs/Makefile b/libs/Makefile
index 5fe3d19..6d4d023 100644
--- a/libs/Makefile
+++ b/libs/Makefile
@@ -1,3 +1,3 @@
TOPDIR=..
-SUBDIRS=core gfx text loaders filters input backends grabbers SDL
+SUBDIRS=core gfx text loaders filters input backends grabbers
include $(TOPDIR)/post.mk
diff --git a/libs/SDL/GP_SDL_VideoInit.c b/libs/SDL/GP_SDL_VideoInit.c
deleted file mode 100644
index b7462ff..0000000
--- a/libs/SDL/GP_SDL_VideoInit.c
+++ /dev/null
@@ -1,109 +0,0 @@
-/*****************************************************************************
- * This file is part of gfxprim library. *
- * *
- * Gfxprim 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 2.1 of the License, or (at your option) any later version. *
- * *
- * Gfxprim 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 gfxprim; if not, write to the Free Software *
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
- * Boston, MA 02110-1301 USA *
- * *
- * Copyright (C) 2009-2010 Jiri "BlueBear" Dluhos *
- * <jiri.bluebear.dluhos(a)gmail.com> *
- * *
- * Copyright (C) 2009-2012 Cyril Hrubis <metan(a)ucw.cz> *
- * *
- *****************************************************************************/
-
-#include "../../config.h"
-
-#ifdef HAVE_LIBSDL
-
-#include "GP.h"
-#include "GP_SDL.h"
-
-#include <stdio.h>
-#include <string.h>
-
-int GP_SDL_VideoInit(GP_Context *context, int width, int height,
- int argc, char **argv)
-{
- if (context == NULL)
- return 1;
-
- /* switches that can be set on the command line */
- int display_bpp = 0;
- int debug = 0;
-
- if (argc > 0) {
-
- if (argv == NULL)
- return 1;
-
- /* extract settings from the command line */
- int i;
- for (i = 1; i < argc; i++) {
- if (strcmp(argv[i], "--8bpp") == 0)
- display_bpp = 8;
- else if (strcmp(argv[i], "--16bpp") == 0)
- display_bpp = 16;
- else if (strcmp(argv[i], "--24bpp") == 0)
- display_bpp = 24;
- else if (strcmp(argv[i], "--32bpp") == 0)
- display_bpp = 32;
- else if (strcmp(argv[i], "--debug") == 0)
- debug = 1;
- }
- }
-
- if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) != 0) {
- if (debug) {
- fprintf(stderr, "Error: Could not initialize SDL: %sn",
- SDL_GetError());
- }
- return 1;
- }
-
- SDL_Surface *display = NULL;
- display = SDL_SetVideoMode(width, height, display_bpp, SDL_SWSURFACE);
- if (display == NULL) {
- if (debug) {
- fprintf(stderr, "Error: Unable to set video mode: %sn",
- SDL_GetError());
- }
- SDL_Quit();
- return 1;
- }
-
- if (debug) {
- printf("Display properties:n");
- printf(" width: %4d, height: %4d, pitch: %4dn",
- display->w, display->h, display->pitch);
- printf(" bits per pixel: %2d, bytes per pixel: %2dn",
- display->format->BitsPerPixel, display->format->BytesPerPixel);
- printf(" pixel bit masks: R=%x, G=%x, B=%x, A=%xn",
- display->format->Rmask, display->format->Gmask,
- display->format->Bmask, display->format->Amask);
- }
-
- int retcode = GP_SDL_ContextFromSurface(context, display);
- if (retcode != 0) {
- if (debug) {
- fprintf(stderr, "Error: Could not create context");
- }
- SDL_Quit();
- return retcode;
- }
-
- return 0;
-}
-
-#endif /* HAVE_LIBSDL */
diff --git a/libs/SDL/Makefile b/libs/SDL/Makefile
deleted file mode 100644
index 637277c..0000000
--- a/libs/SDL/Makefile
+++ /dev/null
@@ -1,9 +0,0 @@
-TOPDIR=../..
-CSOURCES=$(shell ls *.c)
-INCLUDE=core
-LIBNAME=SDL
-BUILDLIB=yes
-
-include $(TOPDIR)/pre.mk
-include $(TOPDIR)/lib.mk
-include $(TOPDIR)/post.mk
diff --git a/libs/backends/GP_SDL.c b/libs/backends/GP_SDL.c
index 2602a2d..0faff30 100644
--- a/libs/backends/GP_SDL.c
+++ b/libs/backends/GP_SDL.c
@@ -33,6 +33,8 @@
#include "GP_Backend.h"
#include "GP_SDL.h"
+#include "GP_SDL_Context.h"
+
#include <SDL/SDL.h>
#include <SDL/SDL_mutex.h>
@@ -97,7 +99,7 @@ static void sdl_wait(struct GP_Backend *self __attribute__((unused)))
SDL_mutexV(mutex);
}
-int context_from_surface(GP_Context *context, SDL_Surface *surf)
+static int context_from_surface(GP_Context *context, const SDL_Surface *surf)
{
/* sanity checks on the SDL surface */
if (surf->format->BytesPerPixel == 0) {
@@ -130,6 +132,11 @@ int context_from_surface(GP_Context *context, SDL_Surface *surf)
return 0;
}
+int GP_ContextFromSurface(GP_Context *c, const SDL_Surface *surf)
+{
+ return context_from_surface(c, surf);
+}
+
static int sdl_set_attributes(struct GP_Backend *self __attribute__((unused)),
uint32_t w, uint32_t h,
const char *caption)
-----------------------------------------------------------------------
Summary of changes:
demos/c_simple/Makefile | 15 +++-
.../GP_SDL_Context.c => demos/c_simple/SDL_glue.c | 104 ++++++++++++++-----
demos/spiv/spiv.c | 55 ++++++++++-
doc/backends.txt | 44 ++++++--
doc/example_SDL_glue.txt | 10 ++
include/SDL/GP_SDL.h | 46 --------
include/SDL/GP_SDL_Context.h | 33 ------
include/SDL/GP_SDL_VideoInit.h | 34 ------
include/SDL/README | 2 -
.../common.h => include/backends/GP_SDL_Context.h | 29 ++++-
libs/Makefile | 2 +-
libs/SDL/GP_SDL_VideoInit.c | 109 --------------------
libs/SDL/Makefile | 9 --
libs/backends/GP_BackendInit.c | 8 +-
libs/backends/GP_SDL.c | 9 ++-
15 files changed, 225 insertions(+), 284 deletions(-)
rename libs/SDL/GP_SDL_Context.c => demos/c_simple/SDL_glue.c (56%)
create mode 100644 doc/example_SDL_glue.txt
delete mode 100644 include/SDL/GP_SDL.h
delete mode 100644 include/SDL/GP_SDL_Context.h
delete mode 100644 include/SDL/GP_SDL_VideoInit.h
delete mode 100644 include/SDL/README
copy tests/gfx/common.h => include/backends/GP_SDL_Context.h (73%)
delete mode 100644 libs/SDL/GP_SDL_VideoInit.c
delete mode 100644 libs/SDL/Makefile
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos(a)gmail.com
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
gfxprim.git ("A simple 2D graphics library with emphasis on correctness and well-defined operation.")
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project gfxprim.git.
The branch, master has been updated
via ec2f0bf1e1633bd1b8e4eae76f6c99b4ffe067a5 (commit)
via fcfd8c99cab2abf5d47b8879f3f12832f365cd1a (commit)
from 4e80095b3f5f7da3d999465f8989979a9c2e7595 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://repo.or.cz/w/gfxprim.git/commit/ec2f0bf1e1633bd1b8e4eae76f6c99b4ffe0…
commit ec2f0bf1e1633bd1b8e4eae76f6c99b4ffe067a5
Merge: 4e80095 fcfd8c9
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sun Dec 2 16:05:08 2012 +0100
Merge 192.168.1.100:Devel/gfxprim
http://repo.or.cz/w/gfxprim.git/commit/fcfd8c99cab2abf5d47b8879f3f12832f365…
commit fcfd8c99cab2abf5d47b8879f3f12832f365cd1a
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sun Dec 2 17:43:20 2012 +0100
Fix "X Window Close Button"
This adds partially hacky support for
WM_WINDOW_DELETE event. More cleaner
solution will need a little change
in the current API and will be added
later.
diff --git a/libs/backends/GP_X11.c b/libs/backends/GP_X11.c
index 8e08476..dbe3fc8 100644
--- a/libs/backends/GP_X11.c
+++ b/libs/backends/GP_X11.c
@@ -442,7 +442,7 @@ void create_window(struct x11_priv *x11, int x, int y,
XMapWindow(x11->dpy, x11->win);
return;
}
-
+
GP_DEBUG(2, "Opening window '%s' %ix%i-%ux%u",
caption, x, y, *w, *h);
@@ -453,6 +453,17 @@ void create_window(struct x11_priv *x11, int x, int y,
/* Set window caption */
XmbSetWMProperties(x11->dpy, x11->win, caption, caption,
NULL, 0, NULL, NULL, NULL);
+
+ /* Make the window close button send event */
+ Atom xa = XInternAtom(x11->dpy, "WM_DELETE_WINDOW", True);
+
+ if (xa != None) {
+ GP_DEBUG(2, "Setting WM_DELETE_WINWOW Atom to True");
+
+ XSetWMProtocols(x11->dpy, x11->win, &xa, 1);
+ } else {
+ GP_DEBUG(2, "Failed to set WM_DELETE_WINDOW Atom to True");
+ }
/* Show window */
XMapWindow(x11->dpy, x11->win);
diff --git a/libs/input/GP_InputDriverX11.c b/libs/input/GP_InputDriverX11.c
index 5caae39..cbfb0c9 100644
--- a/libs/input/GP_InputDriverX11.c
+++ b/libs/input/GP_InputDriverX11.c
@@ -123,6 +123,19 @@ void GP_InputDriverX11EventPut(XEvent *ev)
GP_EventPushKey(key, press, NULL);
break;
+ /* events from WM */
+ case ClientMessage:
+ //TODO: We know we get WM_DELETE_WINDOW because it's the only
+ // event we requested to get but we must check anyway
+ GP_EventPush(GP_EV_SYS, GP_EV_SYS_QUIT, 0, NULL);
+#if 0
+ switch (ev->xclient.message_type) {
+ default:
+ GP_WARN("Unknown X11 ClientMessage Atom %i",
+ ev->xclient.message_type);
+ }
+#endif
+ break;
default:
GP_WARN("Unhandled X11 event type %u", ev->type);
}
-----------------------------------------------------------------------
Summary of changes:
libs/backends/GP_X11.c | 13 ++++++++++++-
libs/input/GP_InputDriverX11.c | 13 +++++++++++++
2 files changed, 25 insertions(+), 1 deletions(-)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos(a)gmail.com
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
gfxprim.git ("A simple 2D graphics library with emphasis on correctness and well-defined operation.")
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project gfxprim.git.
The branch, master has been updated
via 4e80095b3f5f7da3d999465f8989979a9c2e7595 (commit)
from ddf52c30001a3cdb93d0e6fda47e26648460e68e (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://repo.or.cz/w/gfxprim.git/commit/4e80095b3f5f7da3d999465f8989979a9c2e…
commit 4e80095b3f5f7da3d999465f8989979a9c2e7595
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Fri Nov 30 13:21:27 2012 +0100
gfx: Fix GP_Polygon.c compilation.
Add _ISOC99_SOURCE so that fminf() fmaxf() and
HUGE_VALF are exported even on older glibc.
diff --git a/libs/gfx/GP_Polygon.c b/libs/gfx/GP_Polygon.c
index 4bc9480..f2ea9cd 100644
--- a/libs/gfx/GP_Polygon.c
+++ b/libs/gfx/GP_Polygon.c
@@ -1,3 +1,28 @@
+/*****************************************************************************
+ * This file is part of gfxprim library. *
+ * *
+ * Gfxprim 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 2.1 of the License, or (at your option) any later version. *
+ * *
+ * Gfxprim 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 gfxprim; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
+ * Boston, MA 02110-1301 USA *
+ * *
+ * Copyright (C) 2012 Jiri Dluhos <jiri.bluebear.dluhos(a)gmail.com> *
+ * Copyright (C) 2012 Cyril Hrubis <metan(a)ucw.cz> *
+ * *
+ *****************************************************************************/
+
+#define _ISOC99_SOURCE
+
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
-----------------------------------------------------------------------
Summary of changes:
libs/gfx/GP_Polygon.c | 25 +++++++++++++++++++++++++
1 files changed, 25 insertions(+), 0 deletions(-)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos(a)gmail.com
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
gfxprim.git ("A simple 2D graphics library with emphasis on correctness and well-defined operation.")
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project gfxprim.git.
The branch, master has been updated
via ddf52c30001a3cdb93d0e6fda47e26648460e68e (commit)
from 0965cb83090cad3e3f2785558f17dac09f8b2b55 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://repo.or.cz/w/gfxprim.git/commit/ddf52c30001a3cdb93d0e6fda47e26648460…
commit ddf52c30001a3cdb93d0e6fda47e26648460e68e
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Mon Nov 26 00:56:11 2012 +0100
Add README.
diff --git a/README b/README
new file mode 100644
index 0000000..ecff295
--- /dev/null
+++ b/README
@@ -0,0 +1,4 @@
+GFXprim is Open-source modular 2D bitmap graphics library with emphasis on
+speed and correctness.
+
+See http://gfxprim.ucw.cz for details.
-----------------------------------------------------------------------
Summary of changes:
README | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
create mode 100644 README
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos(a)gmail.com
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
gfxprim.git ("A simple 2D graphics library with emphasis on correctness and well-defined operation.")
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project gfxprim.git.
The branch, master has been updated
via 0965cb83090cad3e3f2785558f17dac09f8b2b55 (commit)
from e34e0ac5d46c12c6e2a3e7f14bb27138fb005e1f (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://repo.or.cz/w/gfxprim.git/commit/0965cb83090cad3e3f2785558f17dac09f8b…
commit 0965cb83090cad3e3f2785558f17dac09f8b2b55
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Mon Nov 26 00:46:08 2012 +0100
gfx: Fix 'no newline at the end of the file'.
diff --git a/libs/gfx/GP_Polygon.c b/libs/gfx/GP_Polygon.c
index c1d2288..4bc9480 100644
--- a/libs/gfx/GP_Polygon.c
+++ b/libs/gfx/GP_Polygon.c
@@ -121,4 +121,4 @@ void GP_FillPolygon_Raw(GP_Context *context, int vertex_count,
GP_HLine_Raw(context, intersections[i], intersections[i + 1], y, pixel);
}
}
-}
No newline at end of file
+}
-----------------------------------------------------------------------
Summary of changes:
libs/gfx/GP_Polygon.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos(a)gmail.com
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
gfxprim.git ("A simple 2D graphics library with emphasis on correctness and well-defined operation.")