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 3bb0c27b1b845641f8e8d69a28244b2ecc028d08 (commit) via 40d352f0bb0706b29175f0dde15b33183b0868d3 (commit) via 6cd5c9a311e704e0c23fff2fdbe73ff9b60a40d4 (commit) via b1270316b77d3b03e3c43db35f20e69807e3f02c (commit) via aa0e161ecd926eadbfc894db7568b468c617b648 (commit) via 11febf3f119c7d728b7a14b912d0ad216c855545 (commit) via ed4194a59b8b1d8d28d32e51d85863e2db559c17 (commit) from 2cc8f1085bcceb34939008770bf988597a1d0d5f (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/3bb0c27b1b845641f8e8d69a28244b2ecc028...
commit 3bb0c27b1b845641f8e8d69a28244b2ecc028d08 Author: Cyril Hrubis metan@ucw.cz Date: Tue Jul 31 22:51:03 2012 +0200
demos: Port shapetest from SDL to GFXprim backends.
diff --git a/demos/c_simple/Makefile b/demos/c_simple/Makefile index 0a311ea..32adf69 100644 --- a/demos/c_simple/Makefile +++ b/demos/c_simple/Makefile @@ -8,7 +8,7 @@ LDLIBS+=-lrt `$(TOPDIR)/gfxprim-config --libs --libs-backends`
APPS=backend_example loaders_example loaders filters_symmetry gfx_koch virtual_backend_example meta_data meta_data_dump tmp_file showimage- v4l2_show v4l2_grab convolution weighted_median + v4l2_show v4l2_grab convolution weighted_median shapetest
v4l2_show: LDLIBS+=-lGP_grabbers v4l2_grab: LDLIBS+=-lGP_grabbers diff --git a/tests/SDL/shapetest.c b/demos/c_simple/shapetest.c similarity index 54% rename from tests/SDL/shapetest.c rename to demos/c_simple/shapetest.c index 0bbc4c4..3f50d5a 100644 --- a/tests/SDL/shapetest.c +++ b/demos/c_simple/shapetest.c @@ -19,34 +19,17 @@ * Copyright (C) 2009-2010 Jiri "BlueBear" Dluhos * * jiri.bluebear.dluhos@gmail.com * * * - * Copyright (C) 2009-2011 Cyril Hrubis metan@ucw.cz * + * Copyright (C) 2009-2012 Cyril Hrubis metan@ucw.cz * * * *****************************************************************************/
#include <stdio.h> #include <stdlib.h> -#include <SDL/SDL.h>
-#include "GP.h" -#include "GP_SDL.h" +#include <GP.h>
-/* The surface used as a display (in fact it is a software surface). */ -SDL_Surface *display = NULL; -GP_Context context; - -/* Timer used for refreshing the display */ -SDL_TimerID timer; - -/* An event used for signaling that the timer was triggered. */ -SDL_UserEvent timer_event; - -Uint32 timer_callback(__attribute__((unused)) Uint32 interval, - __attribute__((unused)) void * param) -{ - timer_event.type = SDL_USEREVENT; - SDL_PushEvent((SDL_Event *) &timer_event); - return 60; -} +static GP_Context *win; +static GP_Backend *backend;
/* Basic colors in display-specific format. */ static GP_Pixel black, white, yellow, green, red, gray, darkgray; @@ -79,19 +62,9 @@ static int shape = SHAPE_FIRST; /* Variants in coordinates, if applicable */ static int variant = 1;
-/* Increments added to radii in every timeframe (0 = no change). */ -static int xradius_add = 0; -static int yradius_add = 0; - -#define DISPLAY_W 640 -#define DISPLAY_H 480 - -static int display_w = DISPLAY_W; -static int display_h = DISPLAY_H; - /* center of drawing */ -static int center_x = DISPLAY_W/2; -static int center_y = DISPLAY_H/2; +static int center_x; +static int center_y;
void draw_testing_triangle(int x, int y, int xradius, int yradius) { @@ -135,61 +108,61 @@ void draw_testing_triangle(int x, int y, int xradius, int yradius) /* draw the three vertices green; they should never be visible * because the red triangle should cover them; if they are visible, * it means we don't draw to the end */ - GP_PutPixel(&context, x0, y0, green); - GP_PutPixel(&context, x1, y1, green); - GP_PutPixel(&context, x2, y2, green); + GP_PutPixel(win, x0, y0, green); + GP_PutPixel(win, x1, y1, green); + GP_PutPixel(win, x2, y2, green);
if (outline == 1) - GP_Triangle(&context, x0, y0, x1, y1, x2, y2, yellow); + GP_Triangle(win, x0, y0, x1, y1, x2, y2, yellow);
if (fill) - GP_FillTriangle(&context, x0, y0, x1, y1, x2, y2, red); + GP_FillTriangle(win, x0, y0, x1, y1, x2, y2, red);
if (outline == 2) - GP_Triangle(&context, x0, y0, x1, y1, x2, y2, white); + GP_Triangle(win, x0, y0, x1, y1, x2, y2, white); }
void draw_testing_circle(int x, int y, int xradius, __attribute__((unused)) int yradius) { if (outline == 1) - GP_Circle(&context, x, y, xradius, yellow); + GP_Circle(win, x, y, xradius, yellow);
if (fill) - GP_FillCircle(&context, x, y, xradius, red); + GP_FillCircle(win, x, y, xradius, red);
if (outline == 2) - GP_Circle(&context, x, y, xradius, white); + GP_Circle(win, x, y, xradius, white); }
void draw_testing_ring(int x, int y, int xradius, __attribute__((unused)) int yradius) { if (outline == 1) - GP_Ring(&context, x, y, xradius, yradius, yellow); + GP_Ring(win, x, y, xradius, yradius, yellow);
if (fill) - GP_FillRing(&context, x, y, xradius, yradius, red); + GP_FillRing(win, x, y, xradius, yradius, red);
if (outline == 2) - GP_Ring(&context, x, y, xradius, yradius, white); + GP_Ring(win, x, y, xradius, yradius, white); }
void draw_testing_ellipse(int x, int y, int xradius, int yradius) { if (outline == 1) - GP_Ellipse(&context, x, y, xradius, yradius, yellow); + GP_Ellipse(win, x, y, xradius, yradius, yellow);
if (fill) - GP_FillEllipse(&context, x, y, xradius, yradius, red); + GP_FillEllipse(win, x, y, xradius, yradius, red);
if (outline == 2) - GP_Ellipse(&context, x, y, xradius, yradius, white); + GP_Ellipse(win, x, y, xradius, yradius, white); }
void draw_testing_arc(int x, int y, int xradius, int yradius) { - GP_ArcSegment(&context, x, y, xradius, yradius, -1, + GP_ArcSegment(win, x, y, xradius, yradius, -1, M_PI - M_PI/8.0, M_PI/4.0, red); }
@@ -199,13 +172,13 @@ void draw_testing_rectangle(int x, int y, int xradius, int yradius) int x1 = x + xradius, y1 = y + yradius; if (outline == 1) - GP_Rect(&context, x0, y0, x1, y1, yellow); + GP_Rect(win, x0, y0, x1, y1, yellow);
if (fill) - GP_FillRect(&context, x0, y0, x1, y1, red); + GP_FillRect(win, x0, y0, x1, y1, red);
if (outline == 2) - GP_Rect(&context, x0, y0, x1, y1, white); + GP_Rect(win, x0, y0, x1, y1, white); }
void draw_testing_tetragon(int x, int y, int xradius, int yradius) @@ -216,13 +189,13 @@ void draw_testing_tetragon(int x, int y, int xradius, int yradius) int x3 = x, y3 = y + yradius;
if (outline == 1) - GP_Tetragon(&context, x0, y0, x1, y1, x2, y2, x3, y3, yellow); + GP_Tetragon(win, x0, y0, x1, y1, x2, y2, x3, y3, yellow); if (fill) - GP_FillTetragon(&context, x0, y0, x1, y1, x2, y2, x3, y3, red); + GP_FillTetragon(win, x0, y0, x1, y1, x2, y2, x3, y3, red);
if (outline == 2) - GP_Tetragon(&context, x0, y0, x1, y1, x2, y2, x3, y3, white); + GP_Tetragon(win, x0, y0, x1, y1, x2, y2, x3, y3, white); }
void redraw_screen(void) @@ -237,17 +210,16 @@ void redraw_screen(void) .pixel_yspace = 1, };
- SDL_LockSurface(display); - GP_Fill(&context, black); + GP_Fill(win, black);
/* axes */ if (show_axes) { - GP_HLine(&context, 0, display_w, center_y, gray); - GP_HLine(&context, 0, display_w, center_y-yradius, darkgray); - GP_HLine(&context, 0, display_w, center_y+yradius, darkgray); - GP_VLine(&context, center_x, 0, display_h, gray); - GP_VLine(&context, center_x-xradius, 0, display_h, darkgray); - GP_VLine(&context, center_x+xradius, 0, display_h, darkgray); + GP_HLine(win, 0, win->w, center_y, gray); + GP_HLine(win, 0, win->w, center_y-yradius, darkgray); + GP_HLine(win, 0, win->w, center_y+yradius, darkgray); + GP_VLine(win, center_x, 0, win->h, gray); + GP_VLine(win, center_x-xradius, 0, win->h, darkgray); + GP_VLine(win, center_x+xradius, 0, win->h, darkgray); }
/* the shape */ @@ -283,183 +255,156 @@ void redraw_screen(void) break; }
- GP_Text(&context, &style, 16, 16, GP_ALIGN_RIGHT|GP_VALIGN_BELOW, + GP_Text(win, &style, 16, 16, GP_ALIGN_RIGHT|GP_VALIGN_BELOW, white, black, title);
- SDL_UnlockSurface(display); + GP_BackendFlip(backend); }
-void event_loop(void) +static void xradius_add(int xradius_add) { - static bool shift_pressed = false; - static int xcenter_add = 0; - static int ycenter_add = 0; - SDL_Event event; - - while (SDL_WaitEvent(&event) > 0) { - - switch (event.type) { - case SDL_USEREVENT: + if (xradius + xradius_add > 1 && + xradius + xradius_add < (int)win->w) + xradius += xradius_add; +} +
- if (xradius + xradius_add > 1 && - xradius + xradius_add < display_w) - xradius += xradius_add; - - if (yradius + yradius_add > 1 && - yradius + yradius_add < display_h) - yradius += yradius_add; +static void yradius_add(int yradius_add) +{ + if (yradius + yradius_add > 1 && + yradius + yradius_add < (int)win->h) + yradius += yradius_add; +} - if (center_x + xcenter_add > 1 && - center_x + xcenter_add < display_w/2) - center_x += xcenter_add; +static void xcenter_add(int xcenter_add) +{ + if (center_x + xcenter_add > 1 && + center_x + xcenter_add < (int)win->w/2) + center_x += xcenter_add; +} - if (center_y + ycenter_add > 1 && - center_y + ycenter_add < display_h/2) - center_y += ycenter_add; +static void ycenter_add(int ycenter_add) +{ + if (center_y + ycenter_add > 1 && + center_y + ycenter_add < (int)win->h/2) + center_y += ycenter_add; +}
- redraw_screen(); - SDL_Flip(display); - break; +void event_loop(void) +{ + int shift_pressed;
- case SDL_KEYDOWN: - switch (event.key.keysym.sym) { - case SDLK_LSHIFT: - case SDLK_RSHIFT: - shift_pressed = true; - break; - case SDLK_x: - context.x_swap = !context.x_swap; + GP_Event ev; + + while (GP_EventGet(&ev)) { + GP_EventDump(&ev); + + shift_pressed = GP_EventGetKey(&ev, GP_KEY_LEFT_SHIFT) || + GP_EventGetKey(&ev, GP_KEY_RIGHT_SHIFT); + + switch (ev.type) { + case GP_EV_KEY: + if (ev.code != GP_EV_KEY_DOWN) + continue; + + switch (ev.val.key.key) { + case GP_KEY_X: + win->x_swap = !win->x_swap; break; - case SDLK_y: - context.y_swap = !context.y_swap; + case GP_KEY_Y: + win->y_swap = !win->y_swap; break; - case SDLK_r: - context.axes_swap = !context.axes_swap; - GP_SWAP(display_w, display_h); + case GP_KEY_R: + win->axes_swap = !win->axes_swap; + GP_SWAP(win->w, win->h); break; - case SDLK_f: + case GP_KEY_F: fill = !fill; if (!fill && !outline) outline = 1; - break; - - case SDLK_o: + break; + case GP_KEY_O: outline++; if (outline == 3) outline = 0; if (!fill && outline == 0) fill = 1; - break; - - case SDLK_a: + break; + case GP_KEY_A: show_axes = !show_axes; - break; - - case SDLK_ESCAPE: - return; - - case SDLK_LEFT: + break; + case GP_KEY_LEFT: if (shift_pressed) - xcenter_add = -1; + xcenter_add(-1); else - xradius_add = -1; - break; - - case SDLK_RIGHT: + xradius_add(-1); + break; + case GP_KEY_RIGHT: if (shift_pressed) - xcenter_add = 1; + xcenter_add(1); else - xradius_add = 1; - break; - - case SDLK_UP: + xradius_add(1); + break; + case GP_KEY_UP: if (shift_pressed) - ycenter_add = -1; + ycenter_add(-1); else - yradius_add = 1; - break; - - case SDLK_DOWN: + yradius_add(1); + break; + case GP_KEY_DOWN: if (shift_pressed) - ycenter_add = 1; + ycenter_add(1); else - yradius_add = -1; - break; - - case SDLK_PAGEUP: - xradius_add = 1; - yradius_add = 1; - break; - - case SDLK_PAGEDOWN: - xradius_add = -1; - yradius_add = -1; - break; - - case SDLK_1: - variant = 1; - break; - - case SDLK_2: - variant = 2; - break; - - case SDLK_3: - variant = 3; - break; - - case SDLK_4: - variant = 4; - break; - - case SDLK_SPACE: + yradius_add(-1); + break; + case GP_KEY_SPACE: shape++; if (shape > SHAPE_LAST) shape = SHAPE_FIRST; - break; - - case SDLK_EQUALS: + break; + case GP_KEY_EQUAL: if (xradius > yradius) yradius = xradius; else xradius = yradius; - break; - - default: - break; - } break; - case SDL_KEYUP: - switch (event.key.keysym.sym) { - case SDLK_LSHIFT: - case SDLK_RSHIFT: - shift_pressed = false; + case GP_KEY_1: + variant = 1; + break; + case GP_KEY_2: + variant = 2; + break; + case GP_KEY_3: + variant = 3; + break; + case GP_KEY_4: + variant = 4; + break; + case GP_KEY_PAGE_UP: + xradius_add(1); + yradius_add(1); + break; + case GP_KEY_PAGE_DOWN: + xradius_add(-1); + yradius_add(-1); + break; + case GP_KEY_ESC: + GP_BackendExit(backend); + exit(0); + break; + } + break; + case GP_EV_SYS: + switch(ev.code) { + case GP_EV_SYS_QUIT: + GP_BackendExit(backend); + exit(1); break; - /* Stop incrementing as soon as the key is released. */ - case SDLK_LEFT: - case SDLK_RIGHT: - xradius_add = 0; - xcenter_add = 0; - break; - case SDLK_UP: - case SDLK_DOWN: - yradius_add = 0; - ycenter_add = 0; - break; - - case SDLK_PAGEUP: - case SDLK_PAGEDOWN: - xradius_add = 0; - yradius_add = 0; - break; - - default: - break; } break; - case SDL_QUIT: - return; } + + redraw_screen(); } }
@@ -485,62 +430,40 @@ void print_instructions(void)
int main(int argc, char ** argv) { - int display_bpp = 0; - - int i; - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-16") == 0) { - display_bpp = 16; - } else if (strcmp(argv[i], "-24") == 0) { - display_bpp = 24; - } - } + const char *backend_opts = "X11";
- GP_SetDebugLevel(10); +// GP_SetDebugLevel(10);
- /* Initialize SDL */ - if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) != 0) { - fprintf(stderr, "Could not initialize SDL: %sn", SDL_GetError()); - return 1; - } + backend_opts = "SDL:320x240";
- /* Create a window with a software back surface */ - display = SDL_SetVideoMode(display_w, display_h, display_bpp, SDL_SWSURFACE); - if (display == NULL) { - fprintf(stderr, "Could not open display: %sn", SDL_GetError()); - goto fail; - } + backend = GP_BackendInit(backend_opts, "Shapetest", stderr);
- /* Set up a clipping rectangle to exercise clipping */ - SDL_Rect clip_rect = {10, 10, display_w - 10, display_h - 10}; - SDL_SetClipRect(display, &clip_rect); + if (backend == NULL) { + fprintf(stderr, "Failed to initalize backend '%s'n", + backend_opts); + return 1; + } + + win = backend->context;
- GP_SDL_ContextFromSurface(&context, display); + center_x = win->w / 2; + center_y = win->h / 2;
/* Load colors compatible with the display */ - black = GP_ColorToContextPixel(GP_COL_BLACK, &context); - white = GP_ColorToContextPixel(GP_COL_WHITE, &context); - yellow = GP_ColorToContextPixel(GP_COL_YELLOW, &context); - green = GP_ColorToContextPixel(GP_COL_GREEN, &context); - red = GP_ColorToContextPixel(GP_COL_RED, &context); - gray = GP_ColorToContextPixel(GP_COL_GRAY_LIGHT, &context); - darkgray = GP_ColorToContextPixel(GP_COL_GRAY_DARK, &context); - - /* Set up the refresh timer */ - timer = SDL_AddTimer(60, timer_callback, NULL); - if (timer == 0) { - fprintf(stderr, "Could not set up timer: %sn", SDL_GetError()); - goto fail; - } + black = GP_ColorToContextPixel(GP_COL_BLACK, win); + white = GP_ColorToContextPixel(GP_COL_WHITE, win); + yellow = GP_ColorToContextPixel(GP_COL_YELLOW, win); + green = GP_ColorToContextPixel(GP_COL_GREEN, win); + red = GP_ColorToContextPixel(GP_COL_RED, win); + gray = GP_ColorToContextPixel(GP_COL_GRAY_LIGHT, win); + darkgray = GP_ColorToContextPixel(GP_COL_GRAY_DARK, win);
print_instructions(); + + redraw_screen();
- event_loop(); - SDL_Quit(); - return 0; - -fail: - SDL_Quit(); - return 1; + for (;;) { + GP_BackendWait(backend); + event_loop(); + } } - diff --git a/tests/SDL/Makefile b/tests/SDL/Makefile index 436b8b3..26cfa60 100644 --- a/tests/SDL/Makefile +++ b/tests/SDL/Makefile @@ -7,7 +7,7 @@ LDLIBS+=-lGP -L$(TOPDIR)/build/ -lGP_SDL -lSDL ifeq ($(HAVE_LIBSDL),yes) CSOURCES=$(shell echo *.c)
-APPS=pixeltest fileview fonttest linetest randomshapetest shapetest sierpinsky+APPS=pixeltest fileview fonttest linetest randomshapetest sierpinsky symbolstest textaligntest trianglefps input blittest subcontext showimage aatest mixpixeltest endif
http://repo.or.cz/w/gfxprim.git/commit/40d352f0bb0706b29175f0dde15b33183b086...
commit 40d352f0bb0706b29175f0dde15b33183b0868d3 Author: Cyril Hrubis metan@ucw.cz Date: Tue Jul 31 22:36:30 2012 +0200
backends: SDL: Make use of GP_WARN().
diff --git a/libs/backends/GP_SDL.c b/libs/backends/GP_SDL.c index a391b2e..2602a2d 100644 --- a/libs/backends/GP_SDL.c +++ b/libs/backends/GP_SDL.c @@ -101,12 +101,12 @@ int context_from_surface(GP_Context *context, SDL_Surface *surf) { /* sanity checks on the SDL surface */ if (surf->format->BytesPerPixel == 0) { - GP_DEBUG(1, "ERROR: Surface->BytesPerPixel == 0"); + GP_WARN("Surface->BytesPerPixel == 0"); return 1; }
if (surf->format->BytesPerPixel > 4) { - GP_DEBUG(1, "ERROR: Surface->BytesPerPixel > 4"); + GP_WARN("Surface->BytesPerPixel > 4"); return 1; }
@@ -182,7 +182,7 @@ GP_Backend *GP_BackendSDLInit(GP_Size w, GP_Size h, uint8_t bpp, uint8_t flags, return &backend;
if (SDL_Init(SDL_INIT_VIDEO)) { - GP_DEBUG(1, "ERROR: SDL_Init: %s", SDL_GetError()); + GP_WARN("SDL_Init: %s", SDL_GetError()); return NULL; }
@@ -198,7 +198,7 @@ GP_Backend *GP_BackendSDLInit(GP_Size w, GP_Size h, uint8_t bpp, uint8_t flags, SDL_WM_SetCaption(caption, caption);
if (sdl_surface == NULL) { - GP_DEBUG(1, "ERROR: SDL_SetVideoMode: %s", SDL_GetError()); + GP_WARN("SDL_SetVideoMode: %s", SDL_GetError()); SDL_Quit(); return NULL; } @@ -206,7 +206,7 @@ GP_Backend *GP_BackendSDLInit(GP_Size w, GP_Size h, uint8_t bpp, uint8_t flags, mutex = SDL_CreateMutex();
if (context_from_surface(&context, sdl_surface)) { - GP_DEBUG(1, "ERROR: Failed to match pixel_type"); + GP_WARN("Failed to match pixel_type"); SDL_Quit(); return NULL; } @@ -229,7 +229,7 @@ GP_Backend *GP_BackendSDLInit(GP_Size w __attribute__((unused)), uint8_t flags __attribute__((unused)), const char *caption __attribute__((unused))) { - GP_DEBUG(0, "FATAL: SDL support not compiled in."); + GP_WARN("SDL support not compiled in."); return NULL; }
http://repo.or.cz/w/gfxprim.git/commit/6cd5c9a311e704e0c23fff2fdbe73ff9b60a4...
commit 6cd5c9a311e704e0c23fff2fdbe73ff9b60a40d4 Author: Cyril Hrubis metan@ucw.cz Date: Tue Jul 31 22:34:34 2012 +0200
backends: SDL: Enable key repeat by default.
diff --git a/libs/backends/GP_SDL.c b/libs/backends/GP_SDL.c index 0f8a600..a391b2e 100644 --- a/libs/backends/GP_SDL.c +++ b/libs/backends/GP_SDL.c @@ -210,7 +210,10 @@ GP_Backend *GP_BackendSDLInit(GP_Size w, GP_Size h, uint8_t bpp, uint8_t flags, SDL_Quit(); return NULL; } - + + SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, + SDL_DEFAULT_REPEAT_INTERVAL); + backend.context = &context; return &backend;
http://repo.or.cz/w/gfxprim.git/commit/b1270316b77d3b03e3c43db35f20e69807e3f...
commit b1270316b77d3b03e3c43db35f20e69807e3f02c Author: Cyril Hrubis metan@ucw.cz Date: Tue Jul 31 22:33:18 2012 +0200
backends: SDL: simplify init code.
* This just shuffles some code * No functional changes are done
diff --git a/libs/backends/GP_SDL.c b/libs/backends/GP_SDL.c index d487dd6..0f8a600 100644 --- a/libs/backends/GP_SDL.c +++ b/libs/backends/GP_SDL.c @@ -177,41 +177,42 @@ static void sdl_exit(struct GP_Backend *self __attribute__((unused))) GP_Backend *GP_BackendSDLInit(GP_Size w, GP_Size h, uint8_t bpp, uint8_t flags, const char *caption) { - /* SDL not yet initalized */ - if (backend.context == NULL) { - if (SDL_Init(SDL_INIT_VIDEO)) { - GP_DEBUG(1, "ERROR: SDL_Init: %s", SDL_GetError()); - return NULL; - } + /* SDL was already initalized */ + if (backend.context != NULL) + return &backend;
- if (flags & GP_SDL_FULLSCREEN) - sdl_flags |= SDL_FULLSCREEN; - - if (flags & GP_SDL_RESIZABLE) - sdl_flags |= SDL_RESIZABLE; + if (SDL_Init(SDL_INIT_VIDEO)) { + GP_DEBUG(1, "ERROR: SDL_Init: %s", SDL_GetError()); + return NULL; + }
- sdl_surface = SDL_SetVideoMode(w, h, bpp, sdl_flags); + if (flags & GP_SDL_FULLSCREEN) + sdl_flags |= SDL_FULLSCREEN;
- if (caption != NULL) - SDL_WM_SetCaption(caption, caption); + if (flags & GP_SDL_RESIZABLE) + sdl_flags |= SDL_RESIZABLE;
- if (sdl_surface == NULL) { - GP_DEBUG(1, "ERROR: SDL_SetVideoMode: %s", SDL_GetError()); - SDL_Quit(); - return NULL; - } + sdl_surface = SDL_SetVideoMode(w, h, bpp, sdl_flags);
- mutex = SDL_CreateMutex(); + if (caption != NULL) + SDL_WM_SetCaption(caption, caption);
- if (context_from_surface(&context, sdl_surface)) { - GP_DEBUG(1, "ERROR: Failed to match pixel_type"); - SDL_Quit(); - return NULL; - } - - backend.context = &context; + if (sdl_surface == NULL) { + GP_DEBUG(1, "ERROR: SDL_SetVideoMode: %s", SDL_GetError()); + SDL_Quit(); + return NULL; }
+ mutex = SDL_CreateMutex(); + + if (context_from_surface(&context, sdl_surface)) { + GP_DEBUG(1, "ERROR: Failed to match pixel_type"); + SDL_Quit(); + return NULL; + } + + backend.context = &context; + return &backend; }
http://repo.or.cz/w/gfxprim.git/commit/aa0e161ecd926eadbfc894db7568b468c617b...
commit aa0e161ecd926eadbfc894db7568b468c617b648 Author: Cyril Hrubis metan@ucw.cz Date: Tue Jul 31 22:24:07 2012 +0200
demos: Fix the backend includes.
diff --git a/demos/c_simple/backend_example.c b/demos/c_simple/backend_example.c index 3f5c199..063da75 100644 --- a/demos/c_simple/backend_example.c +++ b/demos/c_simple/backend_example.c @@ -27,7 +27,6 @@ */
#include <GP.h> -#include <backends/GP_Backends.h>
int main(int argc, char *argv[]) { diff --git a/demos/c_simple/showimage.c b/demos/c_simple/showimage.c index 9abbb6d..9b1741b 100644 --- a/demos/c_simple/showimage.c +++ b/demos/c_simple/showimage.c @@ -30,8 +30,7 @@ #include <errno.h> #include <string.h>
-#include "GP.h" -#include "backends/GP_X11.h" +#include <GP.h>
int main(int argc, char *argv[]) { diff --git a/demos/c_simple/v4l2_show.c b/demos/c_simple/v4l2_show.c index 681f30a..c7f5cbb 100644 --- a/demos/c_simple/v4l2_show.c +++ b/demos/c_simple/v4l2_show.c @@ -30,7 +30,6 @@ #include <string.h>
#include <GP.h> -#include <backends/GP_X11.h>
int main(int argc, char *argv[]) { diff --git a/demos/c_simple/virtual_backend_example.c b/demos/c_simple/virtual_backend_example.c index 523a826..448c72c 100644 --- a/demos/c_simple/virtual_backend_example.c +++ b/demos/c_simple/virtual_backend_example.c @@ -30,7 +30,6 @@ */
#include <GP.h> -#include <backends/GP_Backends.h>
int main(int argc, char *argv[]) {
http://repo.or.cz/w/gfxprim.git/commit/11febf3f119c7d728b7a14b912d0ad216c855...
commit 11febf3f119c7d728b7a14b912d0ad216c855545 Author: Cyril Hrubis metan@ucw.cz Date: Tue Jul 31 22:12:56 2012 +0200
include: Fix GP_Backend.h vs GP_Backends.h include.
This fixes miscompilations on 64 bit hardware.
diff --git a/include/GP.h b/include/GP.h index 4b622e6..eb1ad7c 100644 --- a/include/GP.h +++ b/include/GP.h @@ -36,7 +36,7 @@ #include "text/GP_Text.h"
/* backends */ -#include "backends/GP_Backend.h" +#include "backends/GP_Backends.h"
/* input and events */ #include "input/GP_Input.h"
http://repo.or.cz/w/gfxprim.git/commit/ed4194a59b8b1d8d28d32e51d85863e2db559...
commit ed4194a59b8b1d8d28d32e51d85863e2db559c17 Author: Cyril Hrubis metan@ucw.cz Date: Tue Jul 31 19:11:57 2012 +0200
demos: spiv: make use of the mouse wheel.
diff --git a/demos/spiv/spiv.c b/demos/spiv/spiv.c index aad96a9..a569429 100644 --- a/demos/spiv/spiv.c +++ b/demos/spiv/spiv.c @@ -680,9 +680,20 @@ int main(int argc, char *argv[])
while (GP_EventGet(&ev)) {
- // GP_EventDump(&ev); + GP_EventDump(&ev); switch (ev.type) { + case GP_EV_REL: + switch (ev.code) { + case GP_EV_REL_WHEEL: + if (ev.val.val > 0) + goto next; + + if (ev.val.val < 0) + goto prev; + break; + } + break; case GP_EV_KEY: if (ev.code != GP_EV_KEY_DOWN) continue; @@ -775,6 +786,7 @@ int main(int argc, char *argv[]) params.show_progress_once = 1; show_image(¶ms, argv[argn]); break; + next: case GP_KEY_RIGHT: case GP_KEY_UP: case GP_KEY_SPACE: @@ -785,6 +797,7 @@ int main(int argc, char *argv[]) params.show_progress_once = 1; show_image(¶ms, argv[argn]); break; + prev: case GP_KEY_BACKSPACE: case GP_KEY_LEFT: case GP_KEY_DOWN:
-----------------------------------------------------------------------
Summary of changes: demos/c_simple/Makefile | 2 +- demos/c_simple/backend_example.c | 1 - {tests/SDL => demos/c_simple}/shapetest.c | 415 ++++++++++++----------------- demos/c_simple/showimage.c | 3 +- demos/c_simple/v4l2_show.c | 1 - demos/c_simple/virtual_backend_example.c | 1 - demos/spiv/spiv.c | 15 +- include/GP.h | 2 +- libs/backends/GP_SDL.c | 62 +++-- tests/SDL/Makefile | 2 +- 10 files changed, 220 insertions(+), 284 deletions(-) rename {tests/SDL => demos/c_simple}/shapetest.c (54%)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos@gmail.com if you want to unsubscribe, or site admin admin@repo.or.cz if you receive no reply.