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
discards 7bc428fa520fa1091b43319121322378951a347d (commit)
via 36f12d07e7626a423264eca355c4000fc392dbf6 (commit)
This update added new revisions after undoing existing revisions. That is
to say, the old revision is not a strict subset of the new revision. This
situation occurs when you --force push a change and generate a repository
containing something like this:
* -- * -- B -- O -- O -- O (7bc428fa520fa1091b43319121322378951a347d)
N -- N -- N (36f12d07e7626a423264eca355c4000fc392dbf6)
When this happens we assume that you've already had alert emails for all
of the O revisions, and so we here report only the revisions in the N
branch from the common base, B.
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/36f12d07e7626a423264eca355c4000fc392…
commit 36f12d07e7626a423264eca355c4000fc392dbf6
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Tue Jan 17 12:25:28 2012 +0100
backends: Add options for SDL fulscreen && docs.
diff --git a/demos/fbshow/fbshow.c b/demos/fbshow/fbshow.c
index fe8a372..c7363fd 100644
--- a/demos/fbshow/fbshow.c
+++ b/demos/fbshow/fbshow.c
@@ -278,7 +278,12 @@ static void init_backend(const char *backend_opts)
if (!strcmp(backend_opts, "SDL")) {
fprintf(stderr, "Initalizing SDL backendn");
- backend = GP_BackendSDLInit(800, 600, 0);
+ backend = GP_BackendSDLInit(800, 600, 0, 0);
+ }
+
+ if (!strcmp(backend_opts, "SDL:FS")) {
+ fprintf(stderr, "Initalizing SDL fullscreenn");
+ backend = GP_BackendSDLInit(0, 0, 0, GP_SDL_FULLSCREEN);
}
if (backend == NULL) {
diff --git a/include/backends/GP_SDL.h b/include/backends/GP_SDL.h
index 2b3541b..bd553b9 100644
--- a/include/backends/GP_SDL.h
+++ b/include/backends/GP_SDL.h
@@ -26,11 +26,37 @@
#include <stdint.h>
#include "GP_Backend.h"
+enum GP_BackendSDLFlags {
+ GP_SDL_FULLSCREEN = 0x01,
+ GP_SDL_RESIZABLE = 0x02,
+};
+
/*
* Initalize SDL as drawing backend.
*
+ * * SDL doesn't expose file descriptors.
+ *
+ * * The backend is thread safe (the critical parts are guarded with a mutex)
+ *
+ * * The backend is singleton, you can't have two SDL backends running at the
+ * same time.
+ *
+ * * When backend is allready initalized, this function ignores it's parameters
+ * and returns pointer to allready initalized SDL backend.
+ *
+ * * The SDL backends (upon calling GP_BackendPoll()) feeds keyboard and mouse
+ * events into global GP event queue (see input/GP_Event.h).
+ *
+ *
+ * The parameters w h and bpp are directly passed to SDL_SetVideoMode().
+ *
+ * * If w, h and/or bpp are set to zero, SDL tries to do best fit.
+ *
+ * * The GP_BackendSDLFlags are converted into SDL equivalents.
+ *
* Upon failure, or if SDL wasn't compiled in, NULL is returned.
*/
-GP_Backend *GP_BackendSDLInit(GP_Size w, GP_Size h, uint8_t bpp);
+GP_Backend *GP_BackendSDLInit(GP_Size w, GP_Size h,
+ uint8_t bpp, uint8_t flags);
#endif /* BACKENDS_GP_SDL_H */
diff --git a/libs/backends/GP_SDL.c b/libs/backends/GP_SDL.c
index f50cfed..feabc9b 100644
--- a/libs/backends/GP_SDL.c
+++ b/libs/backends/GP_SDL.c
@@ -28,6 +28,7 @@
#include "core/GP_Debug.h"
#include "input/GP_InputDriverSDL.h"
#include "GP_Backend.h"
+#include "GP_SDL.h"
#ifdef HAVE_LIBSDL
@@ -60,15 +61,6 @@ static void sdl_update_rect(struct GP_Backend *self __attribute__((unused)),
SDL_mutexV(mutex);
}
-static void sdl_exit(struct GP_Backend *self __attribute__((unused)))
-{
- SDL_mutexP(mutex);
-
- SDL_Quit();
-
- SDL_DestroyMutex(mutex);
-}
-
static void sdl_poll(struct GP_Backend *self __attribute__((unused)))
{
SDL_Event ev;
@@ -81,6 +73,8 @@ static void sdl_poll(struct GP_Backend *self __attribute__((unused)))
SDL_mutexV(mutex);
}
+static void sdl_exit(struct GP_Backend *self __attribute__((unused)));
+
static struct GP_Backend backend = {
.name = "SDL",
.context = NULL,
@@ -91,6 +85,17 @@ static struct GP_Backend backend = {
.Poll = sdl_poll,
};
+static void sdl_exit(struct GP_Backend *self __attribute__((unused)))
+{
+ SDL_mutexP(mutex);
+
+ SDL_Quit();
+
+ SDL_DestroyMutex(mutex);
+
+ backend.context = NULL;
+}
+
int context_from_surface(GP_Context *context, SDL_Surface *surf)
{
/* sanity checks on the SDL surface */
@@ -129,7 +134,7 @@ int context_from_surface(GP_Context *context, SDL_Surface *surf)
return 0;
}
-GP_Backend *GP_BackendSDLInit(GP_Size w, GP_Size h, uint8_t bpp)
+GP_Backend *GP_BackendSDLInit(GP_Size w, GP_Size h, uint8_t bpp, uint8_t flags)
{
/* SDL not yet initalized */
if (backend.context == NULL) {
@@ -138,7 +143,15 @@ GP_Backend *GP_BackendSDLInit(GP_Size w, GP_Size h, uint8_t bpp)
return NULL;
}
- sdl_surface = SDL_SetVideoMode(w, h, bpp, SDL_SWSURFACE|SDL_DOUBLEBUF);
+ uint32_t sdl_flags = SDL_SWSURFACE;
+
+ if (flags & GP_SDL_FULLSCREEN)
+ sdl_flags |= SDL_FULLSCREEN;
+
+ if (flags & GP_SDL_RESIZABLE)
+ sdl_flags |= SDL_RESIZABLE;
+
+ sdl_surface = SDL_SetVideoMode(w, h, bpp, sdl_flags);
if (sdl_surface == NULL) {
GP_DEBUG(1, "ERROR: SDL_SetVideoMode: %s", SDL_GetError());
-----------------------------------------------------------------------
Summary of changes:
libs/backends/GP_SDL.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.")
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 b549f66c9fc9e0ccb125692a7a2570bbe2016cdc (commit)
from 4d4ca995c2d6ae58d85863cae26c4369d5bd0967 (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/b549f66c9fc9e0ccb125692a7a2570bbe201…
commit b549f66c9fc9e0ccb125692a7a2570bbe2016cdc
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Tue Jan 17 11:59:23 2012 +0100
backends: Make the SDL backend thread safe.
The SDL_Flip, SDL_UpdateRect, SDL_Poll and SDL_Quit
are not thread safe. If these clash while running on
xserver, asynchronous communication is detected and
the connection is aborted. Fix that by guarding these
by a mutex.
diff --git a/libs/backends/GP_SDL.c b/libs/backends/GP_SDL.c
index 0a97ada..f50cfed 100644
--- a/libs/backends/GP_SDL.c
+++ b/libs/backends/GP_SDL.c
@@ -32,39 +32,53 @@
#ifdef HAVE_LIBSDL
#include <SDL/SDL.h>
+#include <SDL/SDL_mutex.h>
static SDL_Surface *sdl_surface;
+static SDL_mutex *mutex;
static GP_Context context;
/* Backend API funcitons */
static void sdl_flip(struct GP_Backend *self __attribute__((unused)))
{
- SDL_LockSurface(sdl_surface);
+ SDL_mutexP(mutex);
+
SDL_Flip(sdl_surface);
context.pixels = sdl_surface->pixels;
- SDL_UnlockSurface(sdl_surface);
+
+ SDL_mutexV(mutex);
}
static void sdl_update_rect(struct GP_Backend *self __attribute__((unused)),
GP_Coord x1, GP_Coord y1, GP_Coord x2, GP_Coord y2)
{
- SDL_LockSurface(sdl_surface);
+ SDL_mutexP(mutex);
+
SDL_UpdateRect(sdl_surface, x1, y1, x2, y2);
- SDL_UnlockSurface(sdl_surface);
+
+ SDL_mutexV(mutex);
}
static void sdl_exit(struct GP_Backend *self __attribute__((unused)))
{
+ SDL_mutexP(mutex);
+
SDL_Quit();
+
+ SDL_DestroyMutex(mutex);
}
static void sdl_poll(struct GP_Backend *self __attribute__((unused)))
{
SDL_Event ev;
+ SDL_mutexP(mutex);
+
while (SDL_PollEvent(&ev))
GP_InputDriverSDLEventPut(&ev);
+
+ SDL_mutexV(mutex);
}
static struct GP_Backend backend = {
@@ -132,6 +146,8 @@ GP_Backend *GP_BackendSDLInit(GP_Size w, GP_Size h, uint8_t bpp)
return NULL;
}
+ mutex = SDL_CreateMutex();
+
if (context_from_surface(&context, sdl_surface)) {
GP_DEBUG(1, "ERROR: Failed to match pixel_type");
SDL_Quit();
-----------------------------------------------------------------------
Summary of changes:
libs/backends/GP_SDL.c | 24 ++++++++++++++++++++----
1 files changed, 20 insertions(+), 4 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 713e4f3f13172cb63b59ac501b54992a2309b314 (commit)
from 03dc78a368cf8724cfaf79b6e149bdbe2d709205 (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/713e4f3f13172cb63b59ac501b54992a2309…
commit 713e4f3f13172cb63b59ac501b54992a2309b314
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sat Jan 14 22:44:23 2012 +0100
input: Fix typos in comment.
diff --git a/include/input/GP_Event.h b/include/input/GP_Event.h
index cb412f1..db4166c 100644
--- a/include/input/GP_Event.h
+++ b/include/input/GP_Event.h
@@ -24,7 +24,7 @@
Gfxprim event layer.
- Events are lowlever interfaace to input devices (human interface).
+ Events are lowlevel interface to input devices (human interface).
- Events are notifications that something has changed, eg. button pressed
- Each event carries some information about global state
-----------------------------------------------------------------------
Summary of changes:
include/input/GP_Event.h | 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.")