Gfxprim
Threads by month
- ----- 2026 -----
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- 929 discussions
[repo.or.cz] gfxprim.git branch generate updated: 3223defa8a39310a0b60f6ce933e0cca072068d8
by metan 20 Aug '11
by metan 20 Aug '11
20 Aug '11
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, generate has been updated
via 3223defa8a39310a0b60f6ce933e0cca072068d8 (commit)
via b384b2242443491008ebbda84b8d2aa06d9faf75 (commit)
via e8932538556c9864d5f0cd4e2a1b113a66282a58 (commit)
from 2cd6436b86198dce6fbbbfa48c9b8831144ea4ea (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/3223defa8a39310a0b60f6ce933e0cca0720…
commit 3223defa8a39310a0b60f6ce933e0cca072068d8
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sat Aug 20 20:32:36 2011 +0200
Cleaned up the blittest code.
diff --git a/tests/SDL/blittest.c b/tests/SDL/blittest.c
index fe92757..2e34564 100644
--- a/tests/SDL/blittest.c
+++ b/tests/SDL/blittest.c
@@ -27,13 +27,15 @@
#include <stdlib.h>
#include <SDL/SDL.h>
+#include "GP.h"
#include "GP_SDL.h"
static GP_Pixel black;
+static GP_Pixel white;
SDL_Surface *display = NULL;
GP_Context context;
-GP_Context *bitmap;
+GP_Context *bitmap, *bitmap_raw, *bitmap_conv;
SDL_TimerID timer;
@@ -51,6 +53,7 @@ Uint32 timer_callback(__attribute__((unused)) Uint32 interval,
return 10;
}
+static char text_buf[255];
void redraw_screen(void)
{
@@ -82,13 +85,29 @@ void redraw_screen(void)
SDL_LockSurface(display);
+ GP_Text(&context, NULL, 20, 20, GP_ALIGN_RIGHT|GP_VALIGN_BOTTOM, text_buf, white);
GP_Blit_Naive(bitmap, 0, 0, bitmap->w, bitmap->h, &context, bitmap_x, bitmap_y);
SDL_UpdateRect(display, bitmap_x, bitmap_y, bitmap->w, bitmap->h);
+ SDL_UpdateRect(display, 20, 20, 300, 50);
SDL_UnlockSurface(display);
}
+static void change_bitmap(void)
+{
+ if (bitmap == bitmap_raw)
+ bitmap = bitmap_conv;
+ else
+ bitmap = bitmap_raw;
+
+ snprintf(text_buf, sizeof(text_buf), "Blitting '%s' -> '%s'",
+ GP_PixelTypes[bitmap->pixel_type].name,
+ GP_PixelTypes[context.pixel_type].name);
+
+ GP_FillRectXYWH(&context, 20, 20, 300, 50, black);
+}
+
void event_loop(void)
{
SDL_Event event;
@@ -100,12 +119,14 @@ void event_loop(void)
case SDL_USEREVENT:
redraw_screen();
break;
-
case SDL_KEYDOWN:
switch (event.key.keysym.sym) {
case SDLK_p:
pause_flag = !pause_flag;
break;
+ case SDLK_SPACE:
+ change_bitmap();
+ break;
case SDLK_ESCAPE:
return;
@@ -143,11 +164,11 @@ int main(int argc, char *argv[])
GP_RetCode ret;
- if (ret = GP_LoadPGM("ball.pgm", &bitmap)) {
- fprintf(stderr, "Failed to load fractal: %sn", GP_RetCodeName(ret));
+ if ((ret = GP_LoadPGM("ball.pgm", &bitmap_raw))) {
+ fprintf(stderr, "Failed to load bitmap: %sn", GP_RetCodeName(ret));
return 1;
}
-
+
/* Initialize SDL */
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) != 0) {
fprintf(stderr, "Could not initialize SDL: %sn", SDL_GetError());
@@ -162,8 +183,12 @@ int main(int argc, char *argv[])
}
GP_SDL_ContextFromSurface(&context, display);
+
+ bitmap_conv = GP_ContextConvert(bitmap_raw, context.pixel_type);
+ change_bitmap();
black = GP_ColorToPixel(&context, GP_COL_BLACK);
+ white = GP_ColorToPixel(&context, GP_COL_WHITE);
/* Set up the refresh timer */
timer = SDL_AddTimer(60, timer_callback, NULL);
http://repo.or.cz/w/gfxprim.git/commit/b384b2242443491008ebbda84b8d2aa06d9f…
commit b384b2242443491008ebbda84b8d2aa06d9faf75
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sat Aug 20 20:31:51 2011 +0200
Added loaders into GP.h.
diff --git a/include/GP.h b/include/GP.h
index 14acffc..2d72546 100644
--- a/include/GP.h
+++ b/include/GP.h
@@ -41,4 +41,7 @@
/* input and events */
#include "input/GP_Event.h"
+/* bitmap loaders */
+#include "loaders/GP_Loaders.h"
+
#endif /* GP_H */
http://repo.or.cz/w/gfxprim.git/commit/e8932538556c9864d5f0cd4e2a1b113a6628…
commit e8932538556c9864d5f0cd4e2a1b113a66282a58
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sat Aug 20 20:31:32 2011 +0200
Added naive context conversion (based on blit).
diff --git a/include/core/GP_Context.h b/include/core/GP_Context.h
index cf65432..4c620b8 100644
--- a/include/core/GP_Context.h
+++ b/include/core/GP_Context.h
@@ -102,6 +102,14 @@ GP_Context *GP_ContextAlloc(uint32_t w, uint32_t h, GP_PixelType type);
GP_Context *GP_ContextCopy(GP_Context *context, int flag);
/*
+ * Converts context to different pixel type.
+ *
+ * This is naive implementation that doesn't do any ditherings or error
+ * diffusions.
+ */
+GP_Context *GP_ContextConvert(const GP_Context *context, GP_PixelType res_type);
+
+/*
* Free context.
*/
void GP_ContextFree(GP_Context *context);
diff --git a/libs/core/GP_Context.c b/libs/core/GP_Context.c
index 58c6a0b..af6ef26 100644
--- a/libs/core/GP_Context.c
+++ b/libs/core/GP_Context.c
@@ -24,6 +24,7 @@
*****************************************************************************/
#include "GP_Core.h"
+#include "GP_Blit.h"
#include <string.h>
@@ -99,6 +100,18 @@ GP_Context *GP_ContextAlloc(uint32_t w, uint32_t h, GP_PixelType type)
return context;
}
+GP_Context *GP_ContextConvert(const GP_Context *context, GP_PixelType res_type)
+{
+ GP_Context *ret = GP_ContextAlloc(context->w, context->h, res_type);
+
+ if (ret == NULL)
+ return NULL;
+
+ GP_Blit_Naive(context, 0, 0, context->w, context->h, ret, 0, 0);
+
+ return ret;
+}
+
void GP_ContextFree(GP_Context *context)
{
free(context->pixels);
-----------------------------------------------------------------------
Summary of changes:
include/GP.h | 3 +++
include/core/GP_Context.h | 8 ++++++++
libs/core/GP_Context.c | 13 +++++++++++++
tests/SDL/blittest.c | 35 ++++++++++++++++++++++++++++++-----
4 files changed, 54 insertions(+), 5 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.")
1
0
[repo.or.cz] gfxprim.git branch generate updated: 2cd6436b86198dce6fbbbfa48c9b8831144ea4ea
by metan 20 Aug '11
by metan 20 Aug '11
20 Aug '11
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, generate has been updated
via 2cd6436b86198dce6fbbbfa48c9b8831144ea4ea (commit)
from 1a194b0be00177f64b07ebc7b37f474c1625d12d (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/2cd6436b86198dce6fbbbfa48c9b8831144e…
commit 2cd6436b86198dce6fbbbfa48c9b8831144ea4ea
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sat Aug 20 19:34:03 2011 +0200
Fixed PGM loader, added blittest.
diff --git a/include/loaders/GP_Loaders.h b/include/loaders/GP_Loaders.h
index 44d1405..e7ac305 100644
--- a/include/loaders/GP_Loaders.h
+++ b/include/loaders/GP_Loaders.h
@@ -19,7 +19,7 @@
* 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-2011 Cyril Hrubis <metan(a)ucw.cz> *
* *
*****************************************************************************/
@@ -35,4 +35,6 @@
#include "GP_PBM.h"
#include "GP_PGM.h"
+struct GP_Context *GP_Load(const char *src_path);
+
#endif /* GP_LOADERS_H */
diff --git a/include/loaders/GP_PBM.h b/include/loaders/GP_PBM.h
index 19c52a4..46b8c3e 100644
--- a/include/loaders/GP_PBM.h
+++ b/include/loaders/GP_PBM.h
@@ -19,7 +19,7 @@
* 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-2011 Cyril Hrubis <metan(a)ucw.cz> *
* *
*****************************************************************************/
@@ -28,8 +28,8 @@
#include "core/GP_Context.h"
-GP_RetCode GP_LoadPBM(const char *src, GP_Context **res);
+GP_RetCode GP_LoadPBM(const char *src_path, GP_Context **res);
-GP_RetCode GP_SavePBM(const char *res, GP_Context *src);
+GP_RetCode GP_SavePBM(const char *res_path, GP_Context *src);
#endif /* GP_PBM_H */
diff --git a/include/loaders/GP_PGM.h b/include/loaders/GP_PGM.h
index 272c50c..e3420f9 100644
--- a/include/loaders/GP_PGM.h
+++ b/include/loaders/GP_PGM.h
@@ -28,8 +28,8 @@
#include "core/GP_Context.h"
-GP_RetCode GP_LoadPGM(const char *src, GP_Context **res);
+GP_RetCode GP_LoadPGM(const char *src_path, GP_Context **res);
-GP_RetCode GP_SavePGM(const char *res, GP_Context *src);
+GP_RetCode GP_SavePGM(const char *res_path, GP_Context *src);
#endif /* GP_PGM_H */
diff --git a/libs/loaders/GP_PBM.c b/libs/loaders/GP_PBM.c
index 623b873..a90ed8b 100644
--- a/libs/loaders/GP_PBM.c
+++ b/libs/loaders/GP_PBM.c
@@ -48,9 +48,9 @@
#include "GP_PXMCommon.h"
#include "GP_PBM.h"
-GP_RetCode GP_LoadPBM(const char *src, GP_Context **res)
+GP_RetCode GP_LoadPBM(const char *src_path, GP_Context **res)
{
- FILE *f = fopen(src, "r");
+ FILE *f = fopen(src_path, "r");
uint32_t w, h;
if (f == NULL)
@@ -62,7 +62,7 @@ GP_RetCode GP_LoadPBM(const char *src, GP_Context **res)
if (fscanf(f, "%"PRIu32"%"PRIu32, &w, &h) < 2)
goto err1;
- *res = GP_ContextAlloc(w, h, GP_PIXEL_G1);
+ *res = GP_ContextAlloc(w, h, GP_PIXEL_V1);
if (*res == NULL) {
fclose(f);
@@ -81,14 +81,14 @@ err1:
return GP_EBADFILE;
}
-GP_RetCode GP_SavePBM(const char *res, GP_Context *src)
+GP_RetCode GP_SavePBM(const char *res_path, GP_Context *src)
{
FILE *f;
- if (src->pixel_type != GP_PIXEL_G1)
+ if (src->pixel_type != GP_PIXEL_V1)
return GP_ENOIMPL;
- f = fopen(res, "w");
+ f = fopen(res_path, "w");
if (f == NULL)
return GP_EBADFILE;
diff --git a/libs/loaders/GP_PGM.c b/libs/loaders/GP_PGM.c
index 77d8051..6612e2a 100644
--- a/libs/loaders/GP_PGM.c
+++ b/libs/loaders/GP_PGM.c
@@ -19,7 +19,7 @@
* 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-2011 Cyril Hrubis <metan(a)ucw.cz> *
* *
*****************************************************************************/
@@ -45,37 +45,88 @@
#include <stdio.h>
#include <stdint.h>
#include <inttypes.h>
+#include <errno.h>
+#include <string.h>
+#include <ctype.h>
+
+#include <GP_Debug.h>
#include "GP_PXMCommon.h"
#include "GP_PGM.h"
-GP_RetCode GP_LoadPGM(const char *src, GP_Context **res)
+static void try_read_comments(FILE *f)
{
- FILE *f = fopen(src, "r");
+ char c1, c2;
+
+ while (isspace(c1 = fgetc(f)));
+
+ ungetc(c1, f);
+
+ while ((c1 = fgetc(f)) == '#') {
+ do {
+ c2 = fgetc(f);
+ } while (c2 != 'n' && c2 != EOF);
+ }
+
+ ungetc(c1, f);
+}
+
+GP_RetCode GP_LoadPGM(const char *src_path, GP_Context **res)
+{
+ FILE *f = fopen(src_path, "r");
uint32_t w, h, gray;
GP_PixelType type;
+ char h1, h2;
- if (f == NULL)
+ if (f == NULL) {
+ GP_DEBUG(1, "Failed to open file '%s': %s",
+ src_path, strerror(errno));
return GP_EBADFILE;
+ }
- if (fgetc(f) != 'P' || fgetc(f) != '2')
+ h1 = fgetc(f);
+ h2 = fgetc(f);
+
+ if (h1 != 'P' || h2 != '2') {
+ GP_DEBUG(1, "Invalid PGM header '%c%c' (0x%2x 0x%2x)",
+ isprint(h1) ? h1 : ' ', isprint(h2) ? h2 : ' ',
+ h1, h2);
goto err1;
+ }
+
+ try_read_comments(f);
+
+ if (fscanf(f, "%"PRIu32, &w) < 1) {
+ GP_DEBUG(1, "Failed to read PGM header width");
+ goto err1;
+ }
+
+ try_read_comments(f);
+
+ if (fscanf(f, "%"PRIu32, &h) < 1) {
+ GP_DEBUG(1, "Failed to read PGM header height");
+ goto err1;
+ }
+
+ try_read_comments(f);
- if (fscanf(f, "%"PRIu32"%"PRIu32"%"PRIu32, &w, &h, &gray) < 3)
+ if (fscanf(f, "%"PRIu32, &gray) < 1) {
+ GP_DEBUG(1, "Failed to read PGM header gray");
goto err1;
+ }
switch (gray) {
case 1:
- type = GP_PIXEL_G1;
+ type = GP_PIXEL_V1;
break;
case 3:
- type = GP_PIXEL_G2;
+ type = GP_PIXEL_V2;
break;
case 15:
- type = GP_PIXEL_G4;
+ type = GP_PIXEL_V4;
break;
case 255:
- type = GP_PIXEL_G8;
+ type = GP_PIXEL_V8;
break;
default:
goto err1;
@@ -83,6 +134,9 @@ GP_RetCode GP_LoadPGM(const char *src, GP_Context **res)
*res = GP_ContextAlloc(w, h, type);
+ if (res == NULL)
+ goto err1;
+
switch (gray) {
case 1:
if (GP_PXMLoad1bpp(f, *res))
@@ -111,32 +165,35 @@ err1:
return GP_EBADFILE;
}
-GP_RetCode GP_SavePGM(const char *res, GP_Context *src)
+GP_RetCode GP_SavePGM(const char *res_path, GP_Context *src)
{
FILE *f;
uint32_t gray;
switch (src->pixel_type) {
- case GP_PIXEL_G1:
+ case GP_PIXEL_V1:
gray = 1;
break;
- case GP_PIXEL_G2:
+ case GP_PIXEL_V2:
gray = 3;
break;
- case GP_PIXEL_G4:
+ case GP_PIXEL_V4:
gray = 15;
break;
- case GP_PIXEL_G8:
+ case GP_PIXEL_V8:
gray = 255;
break;
default:
return GP_ENOIMPL;
}
- f = fopen(res, "w");
+ f = fopen(res_path, "w");
- if (f == NULL)
+ if (f == NULL) {
+ GP_DEBUG(1, "Failed to open file '%s': %s",
+ res_path, strerror(errno));
return GP_EBADFILE;
+ }
if (fprintf(f, "P2n%u %un%un# Generated by gfxprimn",
(unsigned int) src->w, (unsigned int) src->h, gray) < 3)
diff --git a/libs/loaders/Makefile b/libs/loaders/Makefile
index e753f5c..5d037b7 100644
--- a/libs/loaders/Makefile
+++ b/libs/loaders/Makefile
@@ -1,5 +1,6 @@
TOPDIR=../..
-#CSOURCES=$(shell ls *.c)
+CSOURCES=$(shell ls *.c)
+INCLUDE=core
LIBNAME=loaders
include $(TOPDIR)/include.mk
include $(TOPDIR)/lib.mk
diff --git a/tests/SDL/Makefile b/tests/SDL/Makefile
index 0c908f2..22292e5 100644
--- a/tests/SDL/Makefile
+++ b/tests/SDL/Makefile
@@ -6,7 +6,7 @@ INCLUDE=core gfx SDL backends
LDLIBS+=-lGP -L$(TOPDIR)/build/ -lGP_SDL -lSDL
APPS=pixeltest fileview fonttest linetest randomshapetest shapetest sierpinsky- symbolstest textaligntest trianglefps input
+ symbolstest textaligntest trianglefps input blittest
include $(TOPDIR)/include.mk
include $(TOPDIR)/app.mk
diff --git a/tests/SDL/ball.pgm b/tests/SDL/ball.pgm
new file mode 100644
index 0000000..9f9487f
--- /dev/null
+++ b/tests/SDL/ball.pgm
@@ -0,0 +1,10004 @@
+P2
+# CREATOR: GIMP PNM Filter Version 1.1
+100 100
+255
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
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
+27
+26
+25
+23
+22
+20
+17
+14
+12
+10
+6
+4
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+3
+6
+10
+13
+16
+18
+21
+23
+26
+28
+30
+32
+33
+34
+36
+36
+37
+36
+37
+37
+37
+36
+35
+34
+33
+32
+30
+28
+26
+24
+22
+19
+16
+13
+10
+6
+3
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+1
+6
+9
+12
+16
+19
+22
+25
+28
+30
+32
+35
+37
+38
+40
+42
+43
+43
+43
+44
+44
+44
+44
+43
+42
+41
+40
+39
+36
+35
+33
+30
+27
+25
+22
+19
+16
+13
+9
+6
+2
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+3
+7
+12
+15
+19
+23
+25
+29
+31
+34
+37
+39
+41
+43
+45
+46
+48
+49
+50
+50
+51
+51
+51
+51
+50
+49
+48
+47
+45
+43
+42
+39
+37
+34
+32
+29
+26
+23
+19
+15
+11
+7
+4
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+4
+9
+13
+17
+21
+25
+29
+31
+35
+38
+41
+43
+46
+48
+50
+52
+53
+55
+56
+57
+57
+59
+58
+58
+58
+57
+56
+55
+53
+52
+50
+48
+46
+44
+41
+38
+35
+32
+29
+25
+21
+17
+13
+9
+5
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+1
+5
+10
+14
+19
+23
+27
+31
+34
+38
+41
+44
+48
+50
+52
+54
+57
+59
+61
+62
+63
+64
+64
+65
+66
+65
+64
+64
+63
+62
+61
+59
+57
+55
+53
+50
+47
+44
+41
+38
+34
+31
+27
+23
+19
+14
+10
+6
+1
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+2
+7
+11
+16
+20
+24
+29
+33
+37
+41
+44
+47
+51
+54
+57
+59
+62
+63
+66
+67
+69
+70
+71
+72
+72
+72
+72
+71
+71
+70
+69
+68
+66
+64
+62
+59
+57
+54
+51
+47
+44
+40
+36
+33
+29
+25
+20
+15
+11
+7
+1
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+1
+6
+11
+16
+21
+26
+30
+35
+38
+43
+46
+50
+53
+56
+60
+63
+66
+68
+70
+72
+75
+76
+77
+78
+79
+80
+80
+79
+78
+78
+77
+76
+74
+72
+70
+68
+66
+63
+60
+56
+53
+50
+46
+43
+39
+34
+30
+25
+21
+16
+12
+7
+1
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+1
+7
+12
+16
+21
+26
+30
+36
+40
+44
+48
+52
+56
+59
+63
+66
+69
+72
+75
+78
+79
+81
+82
+84
+85
+86
+86
+86
+86
+86
+85
+84
+83
+81
+79
+77
+75
+72
+69
+67
+64
+60
+56
+52
+48
+44
+40
+35
+30
+26
+21
+16
+11
+6
+1
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+6
+11
+16
+21
+27
+31
+36
+40
+45
+50
+54
+58
+62
+65
+70
+73
+76
+78
+81
+84
+86
+88
+90
+91
+92
+92
+93
+93
+93
+93
+92
+91
+89
+88
+86
+84
+81
+79
+76
+72
+70
+65
+62
+58
+54
+50
+46
+41
+36
+31
+26
+22
+16
+11
+6
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+5
+10
+16
+21
+26
+31
+37
+41
+46
+51
+56
+60
+64
+68
+72
+75
+79
+82
+85
+87
+90
+93
+94
+97
+98
+99
+100
+101
+100
+101
+100
+99
+98
+96
+95
+93
+90
+88
+85
+82
+79
+75
+72
+68
+64
+60
+55
+51
+46
+41
+36
+31
+26
+21
+16
+10
+5
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+3
+9
+15
+20
+25
+31
+36
+41
+46
+52
+56
+61
+65
+69
+74
+78
+81
+85
+89
+91
+95
+97
+99
+101
+103
+104
+106
+106
+107
+107
+107
+107
+106
+104
+104
+101
+99
+97
+94
+91
+88
+85
+81
+78
+73
+70
+65
+60
+55
+51
+46
+42
+36
+31
+25
+20
+15
+9
+4
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+1
+8
+14
+18
+24
+30
+36
+41
+46
+52
+57
+61
+66
+71
+75
+80
+83
+87
+91
+95
+98
+100
+103
+106
+108
+110
+112
+113
+114
+114
+114
+114
+114
+113
+112
+110
+108
+106
+104
+101
+98
+94
+92
+87
+84
+80
+75
+71
+66
+61
+56
+51
+46
+41
+35
+29
+24
+18
+13
+8
+2
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+5
+11
+17
+22
+29
+34
+40
+46
+51
+56
+61
+66
+71
+75
+80
+84
+89
+93
+97
+101
+104
+107
+110
+113
+115
+117
+119
+120
+121
+121
+121
+121
+121
+120
+118
+117
+115
+112
+110
+108
+104
+100
+97
+93
+89
+85
+81
+76
+71
+66
+61
+56
+51
+45
+40
+35
+28
+23
+17
+11
+6
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+3
+9
+15
+21
+27
+33
+39
+44
+50
+55
+60
+66
+71
+77
+81
+85
+90
+95
+99
+103
+107
+110
+113
+116
+119
+122
+124
+126
+127
+128
+128
+129
+128
+128
+127
+126
+123
+122
+119
+116
+114
+110
+107
+103
+99
+95
+90
+86
+81
+76
+71
+65
+61
+55
+49
+44
+39
+33
+26
+21
+15
+9
+3
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+7
+13
+19
+25
+31
+37
+42
+48
+54
+60
+65
+70
+75
+81
+86
+91
+96
+100
+104
+108
+112
+116
+120
+122
+126
+128
+130
+132
+133
+134
+135
+135
+136
+134
+133
+132
+131
+129
+125
+123
+120
+116
+112
+109
+105
+100
+95
+91
+86
+81
+75
+70
+65
+60
+53
+48
+42
+37
+30
+25
+19
+13
+6
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+3
+10
+16
+22
+28
+34
+40
+46
+52
+58
+64
+69
+75
+80
+85
+91
+96
+101
+106
+110
+115
+119
+122
+126
+130
+132
+135
+137
+139
+141
+141
+142
+143
+142
+142
+140
+140
+137
+135
+132
+130
+126
+122
+119
+115
+110
+106
+100
+96
+91
+86
+81
+75
+69
+64
+58
+52
+46
+40
+34
+28
+23
+16
+10
+4
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+7
+13
+19
+25
+31
+38
+44
+50
+56
+62
+68
+73
+79
+85
+91
+96
+101
+106
+111
+116
+119
+124
+129
+132
+136
+139
+141
+144
+146
+148
+148
+149
+150
+149
+148
+148
+146
+144
+141
+139
+135
+132
+128
+125
+120
+115
+111
+106
+101
+96
+90
+85
+79
+73
+68
+62
+56
+50
+44
+37
+32
+26
+20
+13
+7
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+3
+9
+16
+22
+29
+35
+41
+47
+53
+60
+66
+72
+78
+83
+90
+95
+100
+105
+111
+116
+121
+125
+130
+134
+138
+141
+144
+148
+150
+152
+154
+156
+156
+157
+156
+156
+154
+152
+151
+148
+145
+142
+138
+134
+130
+125
+120
+115
+111
+105
+100
+95
+89
+84
+78
+71
+66
+60
+54
+47
+41
+35
+29
+22
+16
+10
+3
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+6
+12
+19
+25
+31
+38
+44
+51
+56
+63
+70
+75
+82
+88
+94
+99
+105
+110
+116
+120
+125
+130
+135
+140
+144
+147
+151
+154
+157
+159
+161
+163
+163
+164
+164
+162
+161
+160
+157
+154
+151
+148
+144
+140
+135
+131
+126
+121
+116
+110
+105
+99
+93
+88
+81
+76
+69
+63
+57
+51
+44
+38
+32
+25
+19
+12
+6
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+1
+8
+14
+21
+27
+35
+40
+47
+54
+60
+67
+73
+78
+85
+91
+97
+103
+109
+114
+120
+125
+131
+136
+141
+145
+149
+153
+157
+161
+164
+166
+168
+170
+171
+170
+170
+169
+168
+166
+164
+161
+158
+154
+150
+145
+140
+135
+131
+126
+120
+115
+109
+103
+97
+91
+85
+79
+72
+66
+60
+54
+47
+40
+35
+28
+21
+15
+8
+1
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+3
+11
+17
+23
+30
+37
+44
+50
+57
+63
+69
+76
+82
+89
+95
+100
+106
+113
+118
+125
+130
+135
+141
+146
+150
+155
+159
+163
+167
+170
+173
+175
+177
+177
+178
+177
+177
+175
+172
+170
+167
+163
+159
+155
+151
+145
+141
+135
+130
+124
+119
+112
+107
+101
+95
+88
+82
+75
+69
+63
+57
+50
+44
+37
+31
+24
+17
+10
+4
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+6
+12
+20
+26
+33
+39
+46
+53
+59
+66
+72
+79
+85
+91
+97
+104
+110
+116
+122
+128
+134
+140
+145
+150
+155
+160
+164
+169
+173
+176
+180
+182
+184
+184
+185
+184
+183
+181
+179
+177
+173
+169
+165
+160
+155
+150
+145
+139
+134
+129
+123
+116
+110
+104
+98
+91
+85
+79
+72
+66
+60
+53
+46
+40
+32
+26
+19
+13
+6
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+1
+7
+15
+21
+28
+35
+41
+48
+55
+61
+68
+75
+82
+88
+95
+100
+108
+114
+120
+126
+132
+138
+144
+150
+155
+161
+166
+170
+175
+179
+182
+186
+188
+190
+191
+191
+191
+190
+189
+186
+183
+179
+175
+170
+165
+160
+155
+149
+144
+138
+132
+126
+119
+114
+107
+100
+94
+88
+81
+75
+69
+61
+55
+48
+42
+35
+28
+21
+15
+8
+1
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+2
+10
+17
+23
+30
+36
+43
+50
+57
+64
+71
+77
+83
+90
+98
+104
+110
+116
+123
+129
+136
+142
+147
+153
+160
+165
+171
+175
+180
+185
+189
+192
+195
+197
+199
+199
+199
+197
+195
+192
+189
+185
+180
+176
+171
+165
+159
+153
+148
+141
+135
+129
+123
+117
+110
+103
+97
+91
+84
+77
+70
+64
+57
+50
+44
+37
+30
+23
+17
+9
+2
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+4
+11
+18
+25
+32
+39
+45
+53
+59
+66
+73
+79
+86
+93
+100
+106
+112
+119
+126
+132
+138
+145
+151
+158
+164
+169
+175
+181
+186
+191
+195
+199
+201
+204
+205
+206
+205
+204
+201
+199
+194
+190
+185
+180
+175
+169
+163
+157
+151
+145
+139
+132
+126
+119
+113
+106
+99
+93
+86
+79
+73
+65
+59
+52
+45
+38
+31
+25
+18
+11
+4
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+5
+13
+20
+26
+33
+40
+47
+54
+60
+67
+74
+81
+87
+95
+102
+108
+115
+121
+128
+134
+142
+148
+155
+161
+167
+173
+179
+184
+190
+196
+200
+204
+207
+210
+212
+213
+212
+210
+208
+204
+200
+195
+190
+184
+179
+173
+167
+161
+155
+148
+141
+134
+128
+122
+115
+108
+101
+94
+88
+82
+74
+67
+60
+54
+47
+40
+33
+26
+19
+12
+5
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+7
+13
+20
+28
+34
+41
+49
+55
+61
+69
+76
+83
+90
+97
+103
+110
+117
+124
+131
+137
+144
+150
+157
+164
+170
+176
+182
+189
+194
+200
+205
+210
+214
+217
+219
+220
+219
+217
+214
+210
+205
+200
+194
+188
+183
+176
+170
+164
+157
+150
+144
+137
+130
+124
+117
+110
+103
+96
+90
+83
+75
+69
+62
+55
+49
+42
+35
+28
+20
+14
+7
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+7
+14
+21
+29
+36
+42
+49
+56
+63
+70
+77
+84
+91
+98
+104
+112
+118
+125
+132
+139
+146
+153
+159
+166
+173
+179
+185
+192
+198
+205
+210
+215
+220
+224
+226
+227
+226
+223
+220
+216
+210
+204
+198
+192
+186
+179
+172
+166
+159
+153
+146
+139
+132
+125
+119
+111
+105
+98
+91
+84
+77
+70
+63
+56
+49
+42
+35
+28
+22
+14
+7
+1
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+1
+8
+15
+22
+29
+36
+43
+50
+57
+64
+71
+78
+85
+92
+99
+106
+113
+120
+126
+133
+141
+148
+154
+161
+168
+175
+182
+188
+195
+201
+208
+214
+220
+225
+230
+232
+234
+233
+230
+225
+220
+214
+208
+202
+195
+189
+182
+175
+169
+161
+154
+147
+141
+134
+126
+120
+113
+105
+99
+92
+85
+78
+71
+64
+57
+50
+43
+36
+29
+22
+15
+8
+1
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+1
+9
+16
+23
+30
+37
+44
+51
+57
+65
+71
+79
+85
+93
+100
+107
+114
+121
+127
+135
+141
+148
+155
+163
+169
+176
+183
+190
+197
+204
+210
+217
+223
+230
+235
+239
+241
+240
+235
+230
+223
+217
+211
+204
+197
+191
+184
+176
+169
+162
+156
+149
+142
+135
+127
+120
+114
+107
+99
+92
+85
+79
+72
+65
+57
+50
+44
+36
+30
+23
+16
+8
+1
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+2
+9
+16
+23
+30
+37
+44
+51
+58
+65
+73
+79
+86
+93
+100
+108
+114
+121
+128
+135
+143
+149
+157
+164
+171
+177
+184
+191
+198
+205
+212
+219
+226
+233
+239
+245
+248
+245
+239
+233
+226
+219
+212
+205
+198
+192
+184
+178
+170
+163
+157
+149
+143
+135
+128
+122
+114
+107
+100
+93
+86
+79
+72
+65
+58
+51
+44
+37
+30
+23
+15
+9
+2
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+2
+9
+16
+23
+30
+37
+44
+51
+58
+65
+72
+79
+86
+93
+101
+107
+115
+121
+129
+135
+143
+149
+157
+163
+170
+178
+184
+192
+199
+206
+213
+219
+227
+234
+241
+248
+255
+248
+241
+234
+226
+220
+213
+206
+198
+192
+184
+178
+171
+163
+157
+149
+143
+135
+129
+122
+115
+108
+101
+93
+86
+79
+72
+66
+59
+51
+44
+37
+30
+23
+16
+9
+2
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+2
+9
+16
+23
+29
+36
+44
+51
+58
+65
+72
+79
+87
+93
+100
+107
+114
+121
+128
+135
+142
+150
+156
+164
+170
+177
+184
+191
+199
+205
+213
+220
+226
+233
+240
+245
+248
+245
+239
+233
+226
+219
+212
+205
+198
+192
+185
+177
+170
+163
+157
+150
+142
+136
+129
+121
+114
+107
+100
+93
+86
+80
+73
+65
+58
+51
+44
+37
+30
+23
+16
+9
+2
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+2
+8
+16
+22
+30
+37
+43
+51
+57
+64
+72
+79
+86
+92
+100
+106
+114
+121
+128
+135
+142
+149
+156
+163
+169
+176
+183
+190
+197
+204
+210
+217
+223
+229
+235
+240
+241
+239
+235
+230
+223
+217
+211
+204
+197
+190
+183
+176
+169
+162
+156
+149
+142
+135
+128
+121
+114
+106
+100
+93
+86
+78
+72
+65
+58
+50
+44
+37
+29
+23
+16
+8
+2
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+1
+8
+15
+22
+29
+36
+43
+50
+57
+64
+71
+78
+85
+92
+99
+106
+113
+120
+126
+134
+141
+148
+154
+161
+168
+174
+181
+189
+195
+201
+208
+214
+220
+226
+230
+233
+234
+232
+229
+225
+220
+214
+208
+201
+195
+189
+182
+175
+168
+161
+155
+147
+140
+134
+127
+120
+113
+106
+98
+92
+85
+78
+71
+64
+57
+50
+43
+36
+29
+22
+15
+8
+1
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+1
+8
+14
+21
+29
+36
+42
+50
+56
+64
+70
+77
+84
+91
+98
+105
+111
+119
+125
+132
+139
+146
+153
+159
+166
+173
+180
+185
+192
+198
+204
+210
+216
+220
+223
+226
+227
+226
+224
+220
+215
+210
+204
+199
+192
+186
+179
+173
+166
+159
+153
+146
+139
+132
+126
+119
+111
+105
+98
+91
+84
+77
+70
+63
+56
+50
+42
+36
+29
+21
+15
+7
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+6
+13
+21
+27
+34
+41
+48
+55
+62
+69
+75
+82
+90
+97
+103
+110
+117
+123
+131
+137
+143
+151
+158
+163
+170
+176
+183
+189
+194
+200
+206
+210
+214
+217
+219
+219
+219
+217
+214
+210
+205
+200
+195
+189
+183
+176
+170
+164
+157
+151
+144
+138
+131
+124
+117
+110
+103
+97
+90
+82
+75
+69
+62
+55
+48
+41
+35
+27
+21
+13
+6
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+5
+12
+20
+26
+33
+40
+47
+54
+61
+68
+74
+81
+88
+95
+102
+109
+115
+122
+128
+135
+141
+148
+154
+161
+167
+173
+179
+184
+190
+195
+200
+205
+208
+211
+212
+213
+212
+211
+208
+204
+200
+196
+190
+184
+179
+173
+167
+161
+154
+148
+142
+135
+128
+121
+115
+108
+101
+95
+87
+81
+74
+68
+61
+53
+47
+39
+33
+26
+20
+13
+5
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+4
+11
+18
+25
+31
+39
+45
+53
+58
+66
+72
+79
+86
+93
+99
+106
+113
+120
+125
+132
+139
+145
+151
+157
+163
+169
+175
+181
+185
+190
+194
+198
+202
+204
+205
+206
+205
+204
+201
+199
+194
+190
+186
+180
+175
+170
+163
+158
+151
+145
+139
+132
+126
+119
+113
+106
+100
+93
+86
+80
+73
+65
+59
+52
+45
+39
+31
+25
+18
+11
+4
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+3
+10
+17
+23
+30
+37
+44
+50
+57
+64
+70
+77
+83
+90
+97
+103
+110
+116
+123
+129
+135
+142
+147
+154
+160
+165
+170
+176
+180
+185
+189
+192
+195
+197
+199
+199
+198
+197
+195
+192
+189
+185
+180
+175
+170
+165
+159
+154
+148
+142
+135
+129
+123
+116
+110
+103
+97
+90
+84
+77
+70
+64
+57
+50
+44
+36
+30
+23
+16
+9
+3
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+1
+8
+15
+22
+29
+35
+42
+48
+55
+61
+69
+75
+81
+88
+95
+101
+107
+114
+119
+126
+132
+138
+144
+149
+155
+160
+165
+170
+175
+179
+183
+186
+188
+190
+191
+192
+191
+190
+189
+186
+182
+179
+175
+170
+166
+160
+155
+149
+144
+138
+132
+126
+119
+113
+108
+101
+95
+88
+81
+75
+68
+62
+55
+48
+41
+35
+29
+21
+15
+7
+1
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+6
+13
+20
+26
+32
+39
+46
+52
+60
+65
+73
+79
+85
+92
+97
+104
+111
+117
+122
+128
+134
+140
+145
+151
+156
+160
+165
+169
+173
+177
+179
+182
+183
+184
+185
+184
+183
+182
+179
+176
+173
+169
+165
+161
+156
+150
+146
+140
+134
+128
+122
+117
+111
+104
+98
+91
+86
+79
+72
+66
+59
+52
+46
+39
+32
+26
+19
+12
+6
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+3
+10
+18
+24
+30
+36
+44
+50
+57
+63
+69
+76
+82
+88
+95
+101
+107
+113
+119
+125
+129
+135
+140
+146
+150
+155
+159
+163
+167
+170
+173
+174
+177
+178
+177
+177
+176
+175
+173
+170
+167
+163
+159
+155
+151
+146
+141
+136
+130
+124
+118
+112
+107
+100
+95
+88
+82
+76
+70
+63
+57
+50
+44
+37
+31
+24
+17
+11
+4
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+2
+8
+15
+21
+28
+34
+41
+47
+54
+60
+67
+73
+79
+85
+91
+97
+103
+108
+115
+120
+125
+131
+136
+141
+146
+150
+154
+158
+161
+163
+166
+169
+169
+170
+171
+170
+169
+168
+166
+164
+161
+158
+153
+150
+145
+141
+136
+131
+125
+120
+114
+109
+102
+97
+91
+85
+78
+72
+66
+60
+54
+47
+40
+35
+28
+21
+14
+8
+1
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+5
+13
+18
+25
+32
+38
+45
+51
+57
+63
+69
+75
+81
+88
+93
+99
+104
+110
+115
+121
+126
+130
+135
+140
+144
+148
+151
+154
+157
+159
+161
+163
+163
+164
+163
+162
+161
+160
+157
+155
+151
+147
+143
+139
+135
+131
+126
+120
+115
+110
+104
+99
+93
+87
+82
+76
+69
+63
+57
+51
+45
+38
+32
+25
+18
+12
+5
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+3
+9
+16
+22
+29
+35
+41
+47
+53
+60
+66
+72
+78
+83
+89
+95
+100
+105
+111
+116
+121
+126
+130
+134
+138
+142
+145
+147
+151
+152
+154
+156
+156
+156
+157
+156
+154
+153
+151
+148
+145
+141
+138
+134
+130
+125
+121
+116
+111
+105
+100
+95
+89
+83
+78
+72
+65
+60
+53
+48
+41
+35
+29
+23
+15
+9
+3
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+7
+13
+19
+25
+32
+38
+44
+50
+57
+62
+68
+73
+79
+85
+91
+96
+100
+105
+111
+115
+120
+124
+128
+132
+135
+138
+142
+143
+146
+147
+149
+150
+149
+150
+149
+148
+146
+144
+141
+139
+136
+133
+128
+124
+120
+115
+111
+106
+100
+95
+90
+85
+79
+74
+68
+62
+56
+50
+44
+38
+32
+25
+19
+12
+6
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+3
+10
+16
+22
+29
+35
+41
+47
+52
+58
+63
+70
+75
+80
+85
+91
+96
+101
+106
+110
+115
+119
+123
+126
+129
+132
+135
+137
+139
+140
+142
+142
+143
+142
+142
+141
+139
+137
+135
+133
+129
+126
+123
+118
+114
+110
+105
+101
+96
+91
+85
+81
+75
+70
+64
+58
+52
+46
+40
+34
+29
+22
+16
+10
+3
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+1
+6
+13
+18
+24
+31
+36
+42
+48
+54
+59
+65
+70
+76
+81
+86
+91
+96
+100
+105
+109
+113
+116
+120
+123
+126
+128
+130
+132
+134
+134
+135
+136
+135
+135
+133
+132
+130
+128
+126
+123
+119
+116
+113
+109
+105
+100
+95
+91
+86
+81
+76
+70
+65
+60
+54
+49
+43
+36
+31
+25
+19
+12
+7
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+3
+9
+15
+21
+27
+33
+39
+44
+50
+55
+60
+66
+71
+76
+81
+85
+90
+94
+99
+103
+107
+110
+113
+116
+119
+122
+124
+125
+127
+128
+128
+129
+128
+128
+127
+126
+124
+122
+119
+116
+113
+110
+106
+103
+99
+95
+91
+86
+81
+76
+71
+66
+61
+56
+50
+44
+39
+32
+27
+21
+15
+9
+3
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+5
+11
+17
+22
+29
+34
+40
+46
+51
+56
+61
+66
+71
+76
+81
+85
+89
+93
+97
+101
+104
+107
+110
+113
+114
+117
+118
+120
+121
+121
+122
+121
+121
+120
+119
+117
+115
+113
+110
+107
+105
+100
+97
+94
+89
+85
+80
+76
+71
+66
+61
+56
+50
+46
+40
+34
+29
+23
+17
+11
+5
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+1
+7
+13
+19
+24
+30
+35
+41
+46
+51
+56
+61
+66
+71
+75
+79
+83
+87
+91
+94
+98
+101
+104
+106
+108
+110
+112
+113
+114
+114
+114
+114
+114
+113
+111
+110
+108
+106
+104
+101
+98
+95
+92
+87
+83
+79
+75
+71
+66
+61
+56
+52
+46
+41
+36
+30
+24
+18
+13
+7
+2
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+4
+9
+15
+20
+25
+31
+36
+41
+46
+51
+56
+61
+65
+69
+73
+78
+81
+85
+88
+91
+94
+97
+100
+101
+103
+104
+106
+106
+107
+108
+107
+106
+106
+105
+103
+101
+100
+97
+94
+91
+88
+84
+82
+77
+74
+69
+65
+61
+56
+51
+46
+41
+36
+30
+25
+20
+15
+9
+3
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+4
+10
+16
+21
+26
+31
+37
+41
+46
+50
+55
+59
+64
+68
+72
+75
+79
+82
+85
+88
+91
+93
+95
+97
+98
+99
+100
+100
+100
+100
+100
+99
+98
+96
+94
+93
+91
+88
+85
+82
+79
+75
+71
+68
+64
+59
+56
+50
+46
+41
+36
+31
+26
+21
+15
+10
+4
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+6
+11
+16
+21
+26
+31
+36
+41
+45
+50
+54
+58
+62
+66
+70
+72
+75
+79
+81
+84
+86
+88
+90
+91
+92
+93
+93
+93
+93
+93
+91
+91
+90
+88
+85
+84
+81
+78
+75
+72
+70
+66
+62
+58
+54
+50
+46
+41
+36
+31
+26
+21
+16
+11
+6
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+1
+6
+11
+17
+22
+27
+31
+36
+39
+44
+49
+53
+56
+59
+63
+66
+69
+72
+75
+77
+79
+81
+82
+84
+85
+86
+86
+86
+86
+86
+84
+84
+83
+81
+79
+77
+74
+72
+70
+66
+63
+59
+56
+52
+48
+45
+40
+35
+31
+26
+21
+16
+11
+6
+1
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+2
+6
+12
+16
+21
+26
+30
+34
+38
+42
+46
+50
+54
+57
+60
+63
+65
+68
+70
+73
+75
+76
+77
+78
+79
+80
+79
+79
+78
+78
+77
+76
+74
+72
+70
+68
+66
+63
+60
+57
+54
+50
+46
+43
+38
+34
+30
+26
+21
+16
+11
+6
+1
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+1
+6
+11
+16
+20
+24
+28
+33
+37
+41
+44
+48
+51
+54
+56
+59
+61
+63
+66
+67
+68
+70
+71
+71
+72
+72
+72
+71
+71
+70
+69
+67
+66
+64
+62
+59
+57
+54
+51
+47
+44
+41
+37
+33
+29
+24
+20
+15
+11
+6
+1
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+1
+5
+10
+15
+19
+23
+27
+31
+35
+38
+41
+45
+47
+51
+52
+55
+57
+59
+61
+62
+63
+64
+64
+65
+65
+65
+64
+64
+63
+62
+60
+58
+57
+55
+53
+51
+47
+44
+41
+38
+34
+31
+27
+23
+19
+14
+10
+5
+1
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+5
+9
+13
+17
+21
+25
+29
+32
+35
+38
+41
+44
+46
+48
+50
+52
+53
+55
+56
+58
+58
+58
+58
+58
+58
+57
+56
+55
+54
+52
+50
+48
+46
+44
+41
+38
+35
+31
+29
+25
+21
+17
+13
+9
+4
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+4
+8
+12
+15
+18
+22
+25
+28
+32
+35
+37
+40
+41
+44
+46
+47
+48
+49
+50
+51
+51
+51
+51
+51
+50
+49
+48
+47
+45
+43
+41
+39
+37
+34
+32
+29
+25
+22
+19
+15
+11
+7
+4
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0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0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
diff --git a/tests/SDL/blittest.c b/tests/SDL/blittest.c
new file mode 100644
index 0000000..fe92757
--- /dev/null
+++ b/tests/SDL/blittest.c
@@ -0,0 +1,186 @@
+/*****************************************************************************
+ * 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> *
+ * *
+ *****************************************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <SDL/SDL.h>
+
+#include "GP_SDL.h"
+
+static GP_Pixel black;
+
+SDL_Surface *display = NULL;
+GP_Context context;
+GP_Context *bitmap;
+
+SDL_TimerID timer;
+
+SDL_UserEvent timer_event;
+
+static int pause_flag = 0;
+
+static int bitmap_x, bitmap_y, bitmap_vx = -3, bitmap_vy = -3;
+
+Uint32 timer_callback(__attribute__((unused)) Uint32 interval,
+ __attribute__((unused)) void *param)
+{
+ timer_event.type = SDL_USEREVENT;
+ SDL_PushEvent((SDL_Event *) &timer_event);
+ return 10;
+}
+
+
+void redraw_screen(void)
+{
+ if (pause_flag)
+ return;
+
+ bitmap_x += bitmap_vx;
+ bitmap_y += bitmap_vy;
+
+ if (bitmap_x + bitmap->w > context.w) {
+ bitmap_vx = -bitmap_vx;
+ bitmap_x += bitmap_vx;
+ }
+
+ if (bitmap_x < 0) {
+ bitmap_vx = -bitmap_vx;
+ bitmap_x += bitmap_vx;
+ }
+
+ if (bitmap_y + bitmap->h > context.h) {
+ bitmap_vy = -bitmap_vy;
+ bitmap_y += bitmap_vy;
+ }
+
+ if (bitmap_y < 0) {
+ bitmap_vy = -bitmap_vy;
+ bitmap_y += bitmap_vy;
+ }
+
+ SDL_LockSurface(display);
+
+ GP_Blit_Naive(bitmap, 0, 0, bitmap->w, bitmap->h, &context, bitmap_x, bitmap_y);
+
+ SDL_UpdateRect(display, bitmap_x, bitmap_y, bitmap->w, bitmap->h);
+
+ SDL_UnlockSurface(display);
+}
+
+void event_loop(void)
+{
+ SDL_Event event;
+
+ while (SDL_WaitEvent(&event) > 0) {
+
+ switch (event.type) {
+
+ case SDL_USEREVENT:
+ redraw_screen();
+ break;
+
+ case SDL_KEYDOWN:
+ switch (event.key.keysym.sym) {
+ case SDLK_p:
+ pause_flag = !pause_flag;
+ break;
+ case SDLK_ESCAPE:
+ return;
+
+ default:
+ break;
+ }
+ break;
+ case SDL_QUIT:
+ return;
+ default:
+ break;
+ }
+ }
+}
+
+int main(int argc, char *argv[])
+{
+ /* Bits per pixel to be set for the display surface. */
+ 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;
+ }
+ else if (strcmp(argv[i], "-32") == 0) {
+ display_bpp = 32;
+ }
+ }
+
+ GP_SetDebugLevel(10);
+
+ GP_RetCode ret;
+
+ if (ret = GP_LoadPGM("ball.pgm", &bitmap)) {
+ fprintf(stderr, "Failed to load fractal: %sn", GP_RetCodeName(ret));
+ return 1;
+ }
+
+ /* Initialize SDL */
+ if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) != 0) {
+ fprintf(stderr, "Could not initialize SDL: %sn", SDL_GetError());
+ return 1;
+ }
+
+ /* Create a window with a software back surface */
+ display = SDL_SetVideoMode(640, 480, display_bpp, SDL_SWSURFACE);
+ if (display == NULL) {
+ fprintf(stderr, "Could not open display: %sn", SDL_GetError());
+ goto fail;
+ }
+
+ GP_SDL_ContextFromSurface(&context, display);
+
+ black = GP_ColorToPixel(&context, GP_COL_BLACK);
+
+ /* 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;
+ }
+
+ /* Enter the event loop */
+ event_loop();
+
+ /* We're done */
+ SDL_Quit();
+ return 0;
+
+fail:
+ SDL_Quit();
+ return 1;
+}
+
-----------------------------------------------------------------------
Summary of changes:
include/loaders/GP_Loaders.h | 4 +-
include/loaders/GP_PBM.h | 6 +-
include/loaders/GP_PGM.h | 4 +-
libs/loaders/GP_PBM.c | 12 +-
libs/loaders/GP_PGM.c | 91 +-
libs/loaders/Makefile | 3 +-
tests/SDL/Makefile | 2 +-
tests/SDL/ball.pgm |10004 +++++++++++++++++++++++++++++++
tests/SDL/{symbolstest.c => blittest.c} | 87 +-
9 files changed, 10134 insertions(+), 79 deletions(-)
create mode 100644 tests/SDL/ball.pgm
copy tests/SDL/{symbolstest.c => blittest.c} (75%)
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.")
1
0
[repo.or.cz] gfxprim.git branch generate updated: 1a194b0be00177f64b07ebc7b37f474c1625d12d
by metan 20 Aug '11
by metan 20 Aug '11
20 Aug '11
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, generate has been updated
via 1a194b0be00177f64b07ebc7b37f474c1625d12d (commit)
via fefd3418defdf1a85898c8718927e4edde8fedec (commit)
via f172f952d6cd25be836e5c3f353246ae49e95b89 (commit)
via 13152d697784f7cd03f92396f17ad3c98452b9b5 (commit)
from 6d5f5d2abd2ff4494d7c38418e4bdf686acb3f89 (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/1a194b0be00177f64b07ebc7b37f474c1625…
commit 1a194b0be00177f64b07ebc7b37f474c1625d12d
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sat Aug 20 18:00:39 2011 +0200
Fix wrong parameters order (first pixel then pixel_type).
diff --git a/include/core/GP_Convert.h b/include/core/GP_Convert.h
index d33d417..8b5fb6a 100644
--- a/include/core/GP_Convert.h
+++ b/include/core/GP_Convert.h
@@ -113,7 +113,7 @@ static inline GP_Pixel GP_ConvertContextPixel(GP_Pixel pixel,
const GP_Context *from,
const GP_Context *to)
{
- return GP_RGBA8888ToPixel(GP_PixelToRGBA8888(from->pixel_type, pixel),
+ return GP_RGBA8888ToPixel(GP_PixelToRGBA8888(pixel, from->pixel_type),
to->pixel_type);
}
http://repo.or.cz/w/gfxprim.git/commit/fefd3418defdf1a85898c8718927e4edde8f…
commit fefd3418defdf1a85898c8718927e4edde8fedec
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sat Aug 20 17:54:35 2011 +0200
Minor coding style fix.
diff --git a/libs/core/GP_Convert.gen.c.t b/libs/core/GP_Convert.gen.c.t
index 2969066..86560b5 100644
--- a/libs/core/GP_Convert.gen.c.t
+++ b/libs/core/GP_Convert.gen.c.t
@@ -14,7 +14,7 @@
GP_Pixel GP_{{ pt.name }}ToPixel(GP_Pixel pixel, GP_PixelType type)
{
GP_Pixel p = 0;
- switch(type) {
+ switch (type) {
%% for tf in pixeltypes
%% if tf.is_unknown()
case GP_PIXEL_UNKNOWN:
@@ -40,7 +40,7 @@ GP_Pixel GP_{{ pt.name }}ToPixel(GP_Pixel pixel, GP_PixelType type)
GP_Pixel GP_PixelTo{{ pt.name }}(GP_Pixel pixel, GP_PixelType type)
{
GP_Pixel p = 0;
- switch(type) {
+ switch (type) {
%% for sf in pixeltypes
%% if sf.is_unknown()
case GP_PIXEL_UNKNOWN:
http://repo.or.cz/w/gfxprim.git/commit/f172f952d6cd25be836e5c3f353246ae49e9…
commit f172f952d6cd25be836e5c3f353246ae49e95b89
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sat Aug 20 17:24:18 2011 +0200
Pixel matching now uses debug interface.
diff --git a/libs/core/GP_Pixel.c b/libs/core/GP_Pixel.c
index 0132c7a..bd9f463 100644
--- a/libs/core/GP_Pixel.c
+++ b/libs/core/GP_Pixel.c
@@ -19,12 +19,13 @@
* 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-2011 Cyril Hrubis <metan(a)ucw.cz> *
* *
*****************************************************************************/
#include <string.h>
+#include "GP_Debug.h"
#include "GP_Pixel.h"
static const GP_PixelTypeChannel *get_channel(const GP_PixelTypeDescription *desc,
@@ -42,7 +43,7 @@ static const GP_PixelTypeChannel *get_channel(const GP_PixelTypeDescription *des
static int match(const GP_PixelTypeChannel *channel, GP_Pixel mask)
{
if (channel == NULL) {
- printf("%s gen %08x pass %08xn", channel->name, 0, mask);
+ GP_DEBUG(3, "%s gen %08x pass %08x", channel->name, 0, mask);
return !mask;
}
@@ -50,8 +51,7 @@ static int match(const GP_PixelTypeChannel *channel, GP_Pixel mask)
chmask >>= (GP_PIXEL_BITS - channel->size);
chmask <<= channel->offset;
-
- printf("%s gen %08x pass %08xn", channel->name, chmask, mask);
+ GP_DEBUG(3, "%s gen %08x pass %08x", channel->name, chmask, mask);
return (chmask == mask);
}
@@ -62,6 +62,9 @@ GP_PixelType GP_PixelRGBMatch(GP_Pixel rmask, GP_Pixel gmask,
{
unsigned int i;
+ GP_DEBUG(1, "Matching Pixel R %08x G %08x B %08x A %08x size %u",
+ rmask, gmask, bmask, amask, pixel_size);
+
for (i = 0; i < GP_PIXEL_MAX; i++) {
int res;
@@ -75,25 +78,29 @@ GP_PixelType GP_PixelRGBMatch(GP_Pixel rmask, GP_Pixel gmask,
b = get_channel(&GP_PixelTypes[i], "B");
a = get_channel(&GP_PixelTypes[i], "A");
- printf("------------------------ %s %un", GP_PixelTypes[i].name, pixel_size);
+ GP_DEBUG(2, "Trying Pixel %s %u",
+ GP_PixelTypes[i].name, pixel_size);
if (r)
- printf("Matching R %i %in", r->size, r->offset);
+ GP_DEBUG(3, "Matching R %i %i", r->size, r->offset);
if (g)
- printf("Matching G %i %in", g->size, g->offset);
+ GP_DEBUG(3, "Matching G %i %i", g->size, g->offset);
if (b)
- printf("Matching B %i %in", b->size, b->offset);
+ GP_DEBUG(3, "Matching B %i %i", b->size, b->offset);
if (a)
- printf("Matching A %i %in", a->size, a->offset);
+ GP_DEBUG(3, "Matching A %i %i", a->size, a->offset);
res = match(r, rmask) && match(g, gmask) &&
match(b, bmask) && match(a, amask);
- if (res)
+ if (res) {
+ GP_DEBUG(1, "Pixel found type id %u name '%s'",
+ GP_PixelTypes[i].type, GP_PixelTypes[i].name);
return GP_PixelTypes[i].type;
+ }
}
return GP_PIXEL_UNKNOWN;
http://repo.or.cz/w/gfxprim.git/commit/13152d697784f7cd03f92396f17ad3c98452…
commit 13152d697784f7cd03f92396f17ad3c98452b9b5
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sat Aug 20 17:12:18 2011 +0200
Added simple debug print functionality.
diff --git a/include/core/GP_Core.h b/include/core/GP_Core.h
index f4d8e46..705ceb3 100644
--- a/include/core/GP_Core.h
+++ b/include/core/GP_Core.h
@@ -50,4 +50,7 @@
/* Individual pixel access */
#include "core/GP_GetPutPixel.h"
+/* Debug and debug level */
+#include "core/GP_Debug.h"
+
#endif /* GP_CORE_H */
diff --git a/include/core/GP_Core.h b/include/core/GP_Debug.h
similarity index 57%
copy from include/core/GP_Core.h
copy to include/core/GP_Debug.h
index f4d8e46..2c935ee 100644
--- a/include/core/GP_Core.h
+++ b/include/core/GP_Debug.h
@@ -16,38 +16,45 @@
* 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-2011 Cyril Hrubis <metan(a)ucw.cz> *
* *
*****************************************************************************/
-/*
+ /*
+
+ Debug messages and debug level. Debug level is an unsigned integer.
+
+ Messages with debug level 0 are always printed (you should generally avoid
+ using them unless you wan't user to see the message.)
- This is header file for public core API.
+ Debug level 1 should be used on object initalization and generally rare and
+ important events.
- */
+ Debug level > 1 is intended for more verbose reporting, like inner cycles
+ or loop debugging.
-#ifndef GP_CORE_H
-#define GP_CORE_H
+ */
-/* Common building blocks */
-#include "core/GP_Common.h"
+#ifndef GP_DEBUG_H
+#define GP_DEBUG_H
-/* Context ... */
-#include "core/GP_Context.h"
+#include <stdio.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <unistd.h>
-/* ... and it's trasformations */
-#include "core/GP_Transform.h"
+#define GP_DEFAULT_DEBUG_LEVEL 0
-/* Pixeltypes */
-#include "core/GP_Pixel.h"
+#define GP_DEBUG(level, ...) do { + if (level <= GP_GetDebugLevel()) { + fprintf(stderr, "%s:%s():%u: ", __FILE__, __FUNCTION__, __LINE__); + fprintf(stderr, __VA_ARGS__); + fputc('n', stderr); + } +} while (0)
-/* Pixel conversions */
-#include "core/GP_Convert.h"
+void GP_SetDebugLevel(unsigned int level);
-/* Individual pixel access */
-#include "core/GP_GetPutPixel.h"
+unsigned int GP_GetDebugLevel(void);
-#endif /* GP_CORE_H */
+#endif /* GP_DEBUG_H */
diff --git a/include/core/GP_Core.h b/libs/core/GP_Debug.c
similarity index 68%
copy from include/core/GP_Core.h
copy to libs/core/GP_Debug.c
index f4d8e46..d3b8cbe 100644
--- a/include/core/GP_Core.h
+++ b/libs/core/GP_Debug.c
@@ -16,38 +16,20 @@
* 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-2011 Cyril Hrubis <metan(a)ucw.cz> *
* *
*****************************************************************************/
-/*
-
- This is header file for public core API.
-
- */
-
-#ifndef GP_CORE_H
-#define GP_CORE_H
-
-/* Common building blocks */
-#include "core/GP_Common.h"
-
-/* Context ... */
-#include "core/GP_Context.h"
-
-/* ... and it's trasformations */
-#include "core/GP_Transform.h"
-
-/* Pixeltypes */
-#include "core/GP_Pixel.h"
+#include "GP_Debug.h"
-/* Pixel conversions */
-#include "core/GP_Convert.h"
+static unsigned int GP_debug_level = GP_DEFAULT_DEBUG_LEVEL;
-/* Individual pixel access */
-#include "core/GP_GetPutPixel.h"
+void GP_SetDebugLevel(unsigned int level)
+{
+ GP_debug_level = level;
+}
-#endif /* GP_CORE_H */
+unsigned int GP_GetDebugLevel(void)
+{
+ return GP_debug_level;
+}
-----------------------------------------------------------------------
Summary of changes:
include/core/GP_Convert.h | 2 +-
include/core/GP_Core.h | 3 +
.../{input/GP_InputDriverSDL.h => core/GP_Debug.h} | 41 +++++++++++++++-----
libs/core/GP_Convert.gen.c.t | 4 +-
include/core/GP_Types.h => libs/core/GP_Debug.c | 20 +++++-----
libs/core/GP_Pixel.c | 27 ++++++++-----
6 files changed, 64 insertions(+), 33 deletions(-)
copy include/{input/GP_InputDriverSDL.h => core/GP_Debug.h} (60%)
copy include/core/GP_Types.h => libs/core/GP_Debug.c (86%)
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.")
1
0
[repo.or.cz] gfxprim.git branch generate updated: 6d5f5d2abd2ff4494d7c38418e4bdf686acb3f89
by metan 18 Aug '11
by metan 18 Aug '11
18 Aug '11
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, generate has been updated
via 6d5f5d2abd2ff4494d7c38418e4bdf686acb3f89 (commit)
from 7d194009dcecc9c2d668bdd6f7add3cbf8bdd680 (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/6d5f5d2abd2ff4494d7c38418e4bdf686acb…
commit 6d5f5d2abd2ff4494d7c38418e4bdf686acb3f89
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Thu Aug 18 23:08:11 2011 +0200
Remove the unconsistent check for zero size.
The zero size check in XYW, XYH and XYWH primitives
makes them unconsistent with the rest of the code.
Eg.
GP_HLine(c, x, y, x, p) draws one pixel.
GP_HLineXYW(c, x, y, 0, p) wasn't drawing anything.
diff --git a/libs/gfx/GP_HLine.c b/libs/gfx/GP_HLine.c
index 9154b45..b19a146 100644
--- a/libs/gfx/GP_HLine.c
+++ b/libs/gfx/GP_HLine.c
@@ -34,8 +34,8 @@ DEF_HLINE_BU_FN(GP_HLine_Raw_1BPP_LE, GP_Context*, GP_Pixel, GP_PIXEL_ADDR, GP_W
DEF_HLINE_BU_FN(GP_HLine_Raw_1BPP_BE, GP_Context*, GP_Pixel, GP_PIXEL_ADDR, GP_WritePixels1bpp)
DEF_HLINE_BU_FN(GP_HLine_Raw_2BPP_LE, GP_Context*, GP_Pixel, GP_PIXEL_ADDR, GP_WritePixels2bpp)
DEF_HLINE_BU_FN(GP_HLine_Raw_2BPP_BE, GP_Context*, GP_Pixel, GP_PIXEL_ADDR, GP_WritePixels2bpp)
-DEF_HLINE_BU_FN(GP_HLine_Raw_4BPP_LE, GP_Context*, GP_Pixel, GP_PIXEL_ADDR, GP_WritePixels2bpp)
-DEF_HLINE_BU_FN(GP_HLine_Raw_4BPP_BE, GP_Context*, GP_Pixel, GP_PIXEL_ADDR, GP_WritePixels2bpp)
+DEF_HLINE_BU_FN(GP_HLine_Raw_4BPP_LE, GP_Context*, GP_Pixel, GP_PIXEL_ADDR, GP_WritePixels4bpp)
+DEF_HLINE_BU_FN(GP_HLine_Raw_4BPP_BE, GP_Context*, GP_Pixel, GP_PIXEL_ADDR, GP_WritePixels4bpp)
DEF_HLINE_FN(GP_HLine_Raw_8BPP, GP_Context *, GP_Pixel, GP_PIXEL_ADDR, GP_WritePixels8bpp)
DEF_HLINE_FN(GP_HLine_Raw_16BPP, GP_Context *, GP_Pixel, GP_PIXEL_ADDR, GP_WritePixels16bpp)
@@ -54,11 +54,7 @@ void GP_HLineXXY_Raw(GP_Context *context, GP_Coord x0, GP_Coord x1,
void GP_HLineXYW_Raw(GP_Context *context, GP_Coord x, GP_Coord y, GP_Size w,
GP_Pixel pixel)
{
- /* zero width: do not draw anything */
- if (w == 0)
- return;
-
- GP_HLineXXY_Raw(context, x, x + w - 1, y, pixel);
+ GP_HLineXXY_Raw(context, x, x + w, y, pixel);
}
void GP_HLineXXY(GP_Context *context, GP_Coord x0, GP_Coord x1, GP_Coord y,
@@ -82,9 +78,5 @@ void GP_HLineXXY(GP_Context *context, GP_Coord x0, GP_Coord x1, GP_Coord y,
void GP_HLineXYW(GP_Context *context, GP_Coord x, GP_Coord y, GP_Size w,
GP_Pixel pixel)
{
- /* zero width: do not draw anything */
- if (w == 0)
- return;
-
- GP_HLineXXY(context, x, x + w - 1, y, pixel);
+ GP_HLineXXY(context, x, x + w, y, pixel);
}
diff --git a/libs/gfx/GP_Rect.c b/libs/gfx/GP_Rect.c
index eee96f5..f6a303e 100644
--- a/libs/gfx/GP_Rect.c
+++ b/libs/gfx/GP_Rect.c
@@ -76,11 +76,7 @@ void GP_FillRectXYXY_Raw(GP_Context *context, GP_Coord x0, GP_Coord y0,
void GP_FillRectXYWH_Raw(GP_Context *context, GP_Coord x, GP_Coord y,
GP_Size w, GP_Size h, GP_Pixel pixel)
{
- /* zero width/height: draw nothing */
- if (w == 0 || h == 0)
- return;
-
- GP_FillRectXYXY_Raw(context, x, y, x + w - 1, y + h - 1, pixel);
+ GP_FillRectXYXY_Raw(context, x, y, x + w, y + h, pixel);
}
void GP_FillRectXYXY(GP_Context *context, GP_Coord x0, GP_Coord y0,
@@ -97,9 +93,5 @@ void GP_FillRectXYXY(GP_Context *context, GP_Coord x0, GP_Coord y0,
void GP_FillRectXYWH(GP_Context *context, GP_Coord x, GP_Coord y,
GP_Size w, GP_Size h, GP_Pixel pixel)
{
- /* zero width/height: draw nothing */
- if (w == 0 || h == 0)
- return;
-
- GP_FillRectXYXY(context, x, y, x + w - 1, y + h - 1, pixel);
+ GP_FillRectXYXY(context, x, y, x + w, y + h, pixel);
}
diff --git a/libs/gfx/GP_VLine.c b/libs/gfx/GP_VLine.c
index e6d7f01..2af65f7 100644
--- a/libs/gfx/GP_VLine.c
+++ b/libs/gfx/GP_VLine.c
@@ -43,11 +43,7 @@ void GP_VLineXYY_Raw(GP_Context *context, GP_Coord x, GP_Coord y0,
void GP_VLineXYH_Raw(GP_Context *context, GP_Coord x, GP_Coord y, GP_Size h,
GP_Pixel pixel)
{
- /* zero height: do not draw anything */
- if (h == 0)
- return;
-
- GP_VLineXYY(context, x, y, y + h - 1, pixel);
+ GP_VLineXYY(context, x, y, y + h, pixel);
}
void GP_VLineXYY(GP_Context *context, GP_Coord x, GP_Coord y0,
@@ -71,9 +67,5 @@ void GP_VLineXYY(GP_Context *context, GP_Coord x, GP_Coord y0,
void GP_VLineXYH(GP_Context *context, GP_Coord x, GP_Coord y, GP_Size h,
GP_Pixel pixel)
{
- /* zero height: do not draw anything */
- if (h == 0)
- return;
-
- GP_VLineXYY(context, x, y, y + h - 1, pixel);
+ GP_VLineXYY(context, x, y, y + h, pixel);
}
-----------------------------------------------------------------------
Summary of changes:
libs/gfx/GP_HLine.c | 16 ++++------------
libs/gfx/GP_Rect.c | 12 ++----------
libs/gfx/GP_VLine.c | 12 ++----------
3 files changed, 8 insertions(+), 32 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.")
1
0
[repo.or.cz] gfxprim.git branch generate updated: 7d194009dcecc9c2d668bdd6f7add3cbf8bdd680
by gavento 17 Aug '11
by gavento 17 Aug '11
17 Aug '11
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, generate has been updated
via 7d194009dcecc9c2d668bdd6f7add3cbf8bdd680 (commit)
from 72f38ee0793386a9c792698c6f4b3a4a79ee1352 (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/7d194009dcecc9c2d668bdd6f7add3cbf8bd…
commit 7d194009dcecc9c2d668bdd6f7add3cbf8bdd680
Author: Tomas Gavenciak <gavento(a)ucw.cz>
Date: Wed Aug 17 12:12:09 2011 +0200
Added docs for pixel size and type
diff --git a/doc/pixel_types.txt b/doc/pixel_types.txt
new file mode 100644
index 0000000..bf5acd8
--- /dev/null
+++ b/doc/pixel_types.txt
@@ -0,0 +1,56 @@
+Supported pixel sizes
+---------------------
+
+The default maximum size of a single pixel is 32 bits. The limitations would
+be analoguous for other settings (8, 16 and 64).
+
+Pixel sizes 8, 16 and 32 are supported on all systems and generally very efficient
+(assigment is used for all operations). 24 bpp is supported, but the operations may be
+slightly slower.
+
+Pixel sizes 1, 2 and 4 depend on bit-endian setting and are supported on all systems.
+Subcontext operations and blits may be slower in case of a different subpixel alignment.
+
+Pixel sizes not divisible by 8 and between 9 and 23 depend on the bit endian -
+the endianity of the system must match the bit-endianity. The other combination
+is not supported at all - it would be too complicated and probably very inefficient
+to decode/encode.
+
+Pixel sizes between 25 and 31 are not supported at all, as these pixels might not fit
+into a 32-bit byte-aligned window.
+
+The pixel sizes to be supported must be explicitely listed in the configuration file,
+each including the bit-endian if required (see below).
+
+Supported pixel types
+---------------------
+
+The supported files are declared in the configuration file and must use only the declared
+pixel sizes with bit-endians. RGB, monochrome and palette formats are supported,
+all with optional alpha channel (the alpha support level for palette types is not decided yet).
+
+The pixel type
+
+System endianity
+----------------
+
+The library should work on both little-endian and big-endian systems.
+Other variants than the standard (0123 and 3210) are not supported.
+
+In case of pixel sizes between 9 and 23 (except for 16), the system endianity must match the
+selected bit endianity. It is safe to build the library with the disallowed combination
+format, as long as it is not used (compile-time warning is generated).
+
+Bit-endianity
+-------------
+
+With 1, 2 and 4 bpp formats, there are two possible orders of pixels within a byte,
+both seen in the wild. The two are enumerated in `GP_BIT_ENDIAN`:
+
+`GP_BIT_ENDIAN_LE`::
+ Less significant bits contain pixels with lower indices.
+ Also used for irrelevant bit-endian (8, 15, 24, 32bpp).
+`GP_BIT_ENDIAN_BE`::
+ More significant bits contain pixels with lower indices.
+
+
-----------------------------------------------------------------------
Summary of changes:
doc/pixel_types.txt | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 56 insertions(+), 0 deletions(-)
create mode 100644 doc/pixel_types.txt
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.")
1
0
[repo.or.cz] gfxprim.git branch generate updated: 72f38ee0793386a9c792698c6f4b3a4a79ee1352
by gavento 16 Aug '11
by gavento 16 Aug '11
16 Aug '11
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, generate has been updated
via 72f38ee0793386a9c792698c6f4b3a4a79ee1352 (commit)
via 0c844829becd157cf17399680c5ff58ae5d5f6a0 (commit)
from 8880f10fb3be9e8518ae73b26e4c3723a148aba9 (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/72f38ee0793386a9c792698c6f4b3a4a79ee…
commit 72f38ee0793386a9c792698c6f4b3a4a79ee1352
Author: Tomas Gavenciak <gavento(a)ucw.cz>
Date: Tue Aug 16 17:45:29 2011 +0200
Remove most of the "owerflow" warnings, remove make flag
diff --git a/include/core/GP_GetPutPixel.gen.h.t b/include/core/GP_GetPutPixel.gen.h.t
index 26a73d7..c29ae57 100644
--- a/include/core/GP_GetPutPixel.gen.h.t
+++ b/include/core/GP_GetPutPixel.gen.h.t
@@ -45,8 +45,13 @@ struct GP_Context;
*/
static inline GP_Pixel GP_GetPixel_Raw_{{ ps.suffix }}(const GP_Context *c, int x, int y)
{
+{# Special case to prevent some of the "overflow" warnings -#}
+%% if ps.size == config.pixel_size
+ return *(GP_PIXEL_ADDR_{{ ps.suffix}}(c, x, y));
+%% else
return GP_GET_BITS(GP_PIXEL_ADDR_OFFSET_{{ ps.suffix }}(x), {{ ps.size }},
*(GP_PIXEL_ADDR_{{ ps.suffix}}(c, x, y)));
+%% endif
}
/*
@@ -54,8 +59,13 @@ static inline GP_Pixel GP_GetPixel_Raw_{{ ps.suffix }}(const GP_Context *c, int
*/
static inline void GP_PutPixel_Raw_{{ ps.suffix }}(GP_Context *c, int x, int y, GP_Pixel p)
{
+{# Special case to prevent some of the "overflow" warnings -#}
+%% if ps.size == config.pixel_size
+ *(GP_PIXEL_ADDR_{{ ps.suffix}}(c, x, y)) = p;
+%% else
GP_SET_BITS(GP_PIXEL_ADDR_OFFSET_{{ ps.suffix }}(x), {{ ps.size }},
*(GP_PIXEL_ADDR_{{ ps.suffix}}(c, x, y)), p);
+%% endif
}
%% endfor
diff --git a/libs/core/Makefile b/libs/core/Makefile
index 5bcadca..b8c7cf7 100644
--- a/libs/core/Makefile
+++ b/libs/core/Makefile
@@ -3,7 +3,6 @@ GENSOURCES=GP_Pixel.gen.c GP_Blit.gen.c GP_Convert.gen.c
GENHEADERS=GP_Convert_Scale.gen.h GP_Blit.gen.h GP_Pixel.gen.h GP_GetPutPixel.gen.h GP_Convert.gen.h
CSOURCES=$(filter-out $(wildcard *.gen.c),$(wildcard *.c))
LIBNAME=core
-CFLAGS+=-Wno-overflow
include $(TOPDIR)/gen.mk
include $(TOPDIR)/include.mk
http://repo.or.cz/w/gfxprim.git/commit/0c844829becd157cf17399680c5ff58ae5d5…
commit 0c844829becd157cf17399680c5ff58ae5d5f6a0
Author: Tomas Gavenciak <gavento(a)ucw.cz>
Date: Tue Aug 16 17:42:42 2011 +0200
Fix a type-cast warning
diff --git a/libs/core/GP_Blit.gen.c.t b/libs/core/GP_Blit.gen.c.t
index 39f839d..cccf961 100644
--- a/libs/core/GP_Blit.gen.c.t
+++ b/libs/core/GP_Blit.gen.c.t
@@ -44,10 +44,10 @@ void GP_Blit_{{ ps.suffix }}(const GP_Context *c1, GP_Coord x1, GP_Coord y1, GP_
GP_ASSERT(({{ ps.size }} * w - al1 - end_al) % 8 == 0);
int copy_size = ({{ ps.size }} * w - al1 - end_al) / 8;
/* First and last byte incident to the line */
- uint8_t *p1 = GP_PIXEL_ADDR_{{ ps.suffix }}(c1, x1, y1);
- uint8_t *p2 = GP_PIXEL_ADDR_{{ ps.suffix }}(c2, x2, y2);
- uint8_t *end_p1 = GP_PIXEL_ADDR_{{ ps.suffix }}(c1, x1 + w - 1, y1);
- uint8_t *end_p2 = GP_PIXEL_ADDR_{{ ps.suffix }}(c2, x2 + w - 1, y2);
+ uint8_t *p1 = (uint8_t *) GP_PIXEL_ADDR_{{ ps.suffix }}(c1, x1, y1);
+ uint8_t *p2 = (uint8_t *) GP_PIXEL_ADDR_{{ ps.suffix }}(c2, x2, y2);
+ uint8_t *end_p1 = (uint8_t *) GP_PIXEL_ADDR_{{ ps.suffix }}(c1, x1 + w - 1, y1);
+ uint8_t *end_p2 = (uint8_t *) GP_PIXEL_ADDR_{{ ps.suffix }}(c2, x2 + w - 1, y2);
for (GP_Size i = 0; i < h; i++) {
if (al1 != 0)
GP_SET_BITS(al1, 8-al1, *p2, GP_GET_BITS(al1, 8-al1, *p1));
-----------------------------------------------------------------------
Summary of changes:
include/core/GP_GetPutPixel.gen.h.t | 10 ++++++++++
libs/core/GP_Blit.gen.c.t | 8 ++++----
libs/core/Makefile | 1 -
3 files changed, 14 insertions(+), 5 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.")
1
0
[repo.or.cz] gfxprim.git branch generate updated: 8880f10fb3be9e8518ae73b26e4c3723a148aba9
by metan 16 Aug '11
by metan 16 Aug '11
16 Aug '11
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, generate has been updated
via 8880f10fb3be9e8518ae73b26e4c3723a148aba9 (commit)
via d6a28af5ee112a717db36b0e4fa1b1fab3268a05 (commit)
from a76e111f516303a55c27a14782055770637c764a (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/8880f10fb3be9e8518ae73b26e4c3723a148…
commit 8880f10fb3be9e8518ae73b26e4c3723a148aba9
Merge: a76e111 d6a28af
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Tue Aug 16 17:44:16 2011 +0200
Merge /home/metan/gfxprim into generate
http://repo.or.cz/w/gfxprim.git/commit/d6a28af5ee112a717db36b0e4fa1b1fab326…
commit d6a28af5ee112a717db36b0e4fa1b1fab3268a05
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Tue Apr 2 16:59:51 2013 +0200
Fix compatibility with older python and jinja by Tomas.
diff --git a/include/core/GP_Convert.gen.h.t b/include/core/GP_Convert.gen.h.t
index 2b4681a..05a5606 100644
--- a/include/core/GP_Convert.gen.h.t
+++ b/include/core/GP_Convert.gen.h.t
@@ -49,9 +49,9 @@
#include "GP_Context.h"
#include "GP_Pixel.h"
-##
-## Loop around "central" pixel types
-##
+{#
+ # Loop around "central" pixel types
+-#}
%% for pt in [pixeltypes_dict['RGB888'], pixeltypes_dict['RGBA8888']]
%% for i in pixeltypes
%% if not i.is_unknown()
diff --git a/libs/core/GP_Convert.gen.c.t b/libs/core/GP_Convert.gen.c.t
index 8b65a75..2969066 100644
--- a/libs/core/GP_Convert.gen.c.t
+++ b/libs/core/GP_Convert.gen.c.t
@@ -6,9 +6,9 @@
#include "GP_Convert.h"
-##
-## Loop around "central" pixel types
-##
+{#
+ # Loop around pixel types central for the conversion.
+-#}
%% for pt in [pixeltypes_dict['RGB888'], pixeltypes_dict['RGBA8888']]
GP_Pixel GP_{{ pt.name }}ToPixel(GP_Pixel pixel, GP_PixelType type)
@@ -62,9 +62,6 @@ GP_Pixel GP_PixelTo{{ pt.name }}(GP_Pixel pixel, GP_PixelType type)
return p;
}
-##
-## Loop arpund "central" pixel types
-##
%% endfor
%% endblock body
diff --git a/pylib/gfxprim/render_utils.py b/pylib/gfxprim/render_utils.py
index 12e2472..2c71b50 100644
--- a/pylib/gfxprim/render_utils.py
+++ b/pylib/gfxprim/render_utils.py
@@ -14,7 +14,6 @@ def template_error(s, *args):
def create_environment(config, template_dir):
env = jinja2.Environment(
line_statement_prefix = "%%",
- line_comment_prefix = "##",
undefined = jinja2.StrictUndefined,
loader = jinja2.FileSystemLoader(template_dir))
env.globals['undefined'] = jinja2.StrictUndefined()
-----------------------------------------------------------------------
Summary of changes:
include/core/GP_Convert.gen.h.t | 6 +++---
libs/core/GP_Convert.gen.c.t | 9 +++------
pylib/gfxprim/render_utils.py | 1 -
3 files changed, 6 insertions(+), 10 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.")
1
0
[repo.or.cz] gfxprim.git branch generate updated: a76e111f516303a55c27a14782055770637c764a
by metan 16 Aug '11
by metan 16 Aug '11
16 Aug '11
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, generate has been updated
via a76e111f516303a55c27a14782055770637c764a (commit)
from cc8d797431865afe675e257b7f06513adcb7fac4 (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/a76e111f516303a55c27a14782055770637c…
commit a76e111f516303a55c27a14782055770637c764a
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Tue Aug 16 16:10:06 2011 +0200
Move the key name down.
diff --git a/tests/SDL/input.c b/tests/SDL/input.c
index b956e62..ebc7820 100644
--- a/tests/SDL/input.c
+++ b/tests/SDL/input.c
@@ -66,8 +66,8 @@ void draw_event(GP_Event *ev)
if (ev->type != GP_EV_KEY)
return;
- GP_FillRect(&context, 0, 0, 200, 20, black_pixel);
- GP_Text(&context, NULL, 0, 0, GP_ALIGN_RIGHT|GP_VALIGN_BOTTOM,
+ GP_FillRect(&context, 0, 0, 150, 35, black_pixel);
+ GP_Text(&context, NULL, 20, 20, GP_ALIGN_RIGHT|GP_VALIGN_BOTTOM,
GP_EventKeyName(ev->val.key.key), white_pixel);
SDL_Flip(display);
}
-----------------------------------------------------------------------
Summary of changes:
tests/SDL/input.c | 4 ++--
1 files changed, 2 insertions(+), 2 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.")
1
0
[repo.or.cz] gfxprim.git branch generate updated: cc8d797431865afe675e257b7f06513adcb7fac4
by metan 16 Aug '11
by metan 16 Aug '11
16 Aug '11
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, generate has been updated
via cc8d797431865afe675e257b7f06513adcb7fac4 (commit)
via 90cc2e75e5a3c5f7e2f4d007313bb998b9117406 (commit)
from 64255c5b0947d3e9153a8e157b41c1ceb0de3a2b (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/cc8d797431865afe675e257b7f06513adcb7…
commit cc8d797431865afe675e257b7f06513adcb7fac4
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Tue Aug 16 15:55:27 2011 +0200
Fix the exit to call SDL_Exit() and show keys.
diff --git a/tests/SDL/input.c b/tests/SDL/input.c
index 509bc54..b956e62 100644
--- a/tests/SDL/input.c
+++ b/tests/SDL/input.c
@@ -41,7 +41,7 @@ SDL_TimerID timer;
SDL_UserEvent timer_event;
/* Values for color pixels in display format. */
-GP_Pixel red_pixel, green_pixel, blue_pixel, white_pixel;
+GP_Pixel black_pixel, red_pixel, green_pixel, blue_pixel, white_pixel;
Uint32 timer_callback(__attribute__((unused)) Uint32 interval,
__attribute__((unused)) void *param)
@@ -57,30 +57,19 @@ void draw_pixel(void)
int x = random() % 320;
int y = random() % 240;
-// pixel = GP_GetPixel(&context, x, y);
GP_PutPixel(&context, x, y, green_pixel);
+}
- /* TODO: we cannot switch like this
- we need either to convert blue
- and others into Context format
- at the very beginning, or make
- a copy to convert it and match
- agains what we get from GP_GetPixel
+void draw_event(GP_Event *ev)
+{
+ if (ev->type != GP_EV_KEY)
+ return;
- if (pixel == blue) {
- GP_PutPixel(&context, x, y, green);
- }
- else if (pixel == red) {
- GP_PutPixel(&context, x, y, white);
- }
- else {
- if (x < 160) {
- GP_PutPixel(&context, x, y, blue);
- } else {
- GP_PutPixel(&context, x, y, red);
- }
- } */
+ GP_FillRect(&context, 0, 0, 200, 20, black_pixel);
+ GP_Text(&context, NULL, 0, 0, GP_ALIGN_RIGHT|GP_VALIGN_BOTTOM,
+ GP_EventKeyName(ev->val.key.key), white_pixel);
+ SDL_Flip(display);
}
void draw_pixels(void)
@@ -110,9 +99,13 @@ void event_loop(void)
switch (ev.type) {
case GP_EV_KEY:
+ draw_event(&ev);
+
switch (ev.val.key.key) {
case GP_KEY_ESC:
+ SDL_Quit();
exit(0);
+ break;
case GP_BTN_LEFT:
GP_PutPixel(&context, ev.cursor_x,
ev.cursor_y, red_pixel);
@@ -158,13 +151,13 @@ int main(int argc, char **argv)
}
/* Create a window with a software back surface */
- display = SDL_SetVideoMode(320, 240, display_bpp, SDL_SWSURFACE);
+ display = SDL_SetVideoMode(480, 640, display_bpp, SDL_SWSURFACE);
if (display == NULL) {
fprintf(stderr, "Could not open display: %sn", SDL_GetError());
goto fail;
}
- GP_EventSetScreenSize(320, 240);
+ GP_EventSetScreenSize(480, 640);
/* Print basic information about the surface */
printf("Display surface properties:n");
@@ -184,6 +177,7 @@ int main(int argc, char **argv)
green_pixel = GP_ColorToPixel(&context, GP_COL_GREEN);
blue_pixel = GP_ColorToPixel(&context, GP_COL_BLUE);
white_pixel = GP_ColorToPixel(&context, GP_COL_WHITE);
+ black_pixel = GP_ColorToPixel(&context, GP_COL_BLACK);
/* Set up the refresh timer */
timer = SDL_AddTimer(30, timer_callback, NULL);
http://repo.or.cz/w/gfxprim.git/commit/90cc2e75e5a3c5f7e2f4d007313bb998b911…
commit 90cc2e75e5a3c5f7e2f4d007313bb998b9117406
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Tue Aug 16 15:54:48 2011 +0200
Move the asserts in text where they belong.
diff --git a/libs/text/GP_Text.c b/libs/text/GP_Text.c
index 43bf6ed..073561d 100644
--- a/libs/text/GP_Text.c
+++ b/libs/text/GP_Text.c
@@ -39,13 +39,14 @@ GP_RetCode GP_Text_Raw(GP_Context *context, const GP_TextStyle *style,
const char *str, GP_Pixel pixel)
{
GP_CHECK_CONTEXT(context);
- GP_CHECK_TEXT_STYLE(style);
if (str == NULL)
return GP_ENULLPTR;
if (style == NULL)
style = &DefaultStyle;
+
+ GP_CHECK_TEXT_STYLE(style);
int width = GP_TextWidth(style, str);
int height = GP_TextHeight(style);
@@ -94,13 +95,14 @@ GP_RetCode GP_Text(GP_Context *context, const GP_TextStyle *style,
const char *str, GP_Pixel pixel)
{
GP_CHECK_CONTEXT(context);
- GP_CHECK_TEXT_STYLE(style);
if (str == NULL)
return GP_ENULLPTR;
if (style == NULL)
style = &DefaultStyle;
+
+ GP_CHECK_TEXT_STYLE(style);
int width = GP_TextWidth(style, str);
int height = GP_TextHeight(style);
@@ -145,13 +147,14 @@ GP_RetCode GP_BoxCenteredText_Raw(GP_Context *context, const GP_TextStyle *style
const char *str, GP_Pixel pixel)
{
GP_CHECK_CONTEXT(context);
- GP_CHECK_TEXT_STYLE(style);
if (str == NULL)
return GP_ENULLPTR;
if (style == NULL)
style = &DefaultStyle;
+
+ GP_CHECK_TEXT_STYLE(style);
const int mid_x = x + w/2;
const int mid_y = y + h/2;
@@ -168,13 +171,14 @@ GP_RetCode GP_BoxCenteredText(GP_Context *context, const GP_TextStyle *style,
const char *str, GP_Pixel pixel)
{
GP_CHECK_CONTEXT(context);
- GP_CHECK_TEXT_STYLE(style);
if (str == NULL)
return GP_ENULLPTR;
if (style == NULL)
style = &DefaultStyle;
+
+ GP_CHECK_TEXT_STYLE(style);
const int mid_x = x + w/2;
const int mid_y = y + h/2;
-----------------------------------------------------------------------
Summary of changes:
libs/text/GP_Text.c | 12 ++++++++----
tests/SDL/input.c | 40 +++++++++++++++++-----------------------
2 files changed, 25 insertions(+), 27 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.")
1
0
[repo.or.cz] gfxprim.git branch generate updated: 64255c5b0947d3e9153a8e157b41c1ceb0de3a2b
by metan 16 Aug '11
by metan 16 Aug '11
16 Aug '11
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, generate has been updated
via 64255c5b0947d3e9153a8e157b41c1ceb0de3a2b (commit)
from 62a9833d1129677535724b6ec7c6f0e89a97abdd (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/64255c5b0947d3e9153a8e157b41c1ceb0de…
commit 64255c5b0947d3e9153a8e157b41c1ceb0de3a2b
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Tue Aug 16 12:23:57 2011 +0200
Fixed bug in setting key bitmap.
diff --git a/include/input/GP_Event.h b/include/input/GP_Event.h
index dff17af..126c0c2 100644
--- a/include/input/GP_Event.h
+++ b/include/input/GP_Event.h
@@ -334,13 +334,13 @@ static inline void GP_EventSetKey(struct GP_Event *ev,
static inline int GP_EventGetKey(struct GP_Event *ev,
uint32_t key)
{
- return !!(ev->keys_pressed[(key)/8] & ~(1<<((key)%8)));
+ return !!(ev->keys_pressed[(key)/8] & (1<<((key)%8)));
}
static inline void GP_EventResetKey(struct GP_Event *ev,
uint32_t key)
{
- ev->keys_pressed[(key)/8] |= 1<<((key)%8);
+ ev->keys_pressed[(key)/8] &= ~(1<<((key)%8));
}
#endif /* GP_EVENT_H */
diff --git a/libs/input/GP_Event.c b/libs/input/GP_Event.c
index 5e87a04..e5beb2e 100644
--- a/libs/input/GP_Event.c
+++ b/libs/input/GP_Event.c
@@ -127,7 +127,7 @@ const char *GP_EventKeyName(enum GP_EventKeyValue key)
static void dump_rel(struct GP_Event *ev)
{
- printf("EVENT REL ");
+ printf("REL ");
switch (ev->code) {
case GP_EV_REL_POS:
@@ -146,13 +146,15 @@ static void dump_key(struct GP_Event *ev)
if (ev->val.key.key < key_names_size)
name = key_names[ev->val.key.key];
- printf("EVENT KEY %i (Key%s) %sn",
+ printf("KEY %i (Key%s) %sn",
ev->val.key.key, name, ev->code ? "down" : "up");
}
void GP_EventDump(struct GP_Event *ev)
{
+ printf("EVENT (%u) ", (unsigned int)ev->time.tv_sec % 10000);
+
switch (ev->type) {
case GP_EV_KEY:
dump_key(ev);
diff --git a/libs/input/GP_InputDriverSDL.c b/libs/input/GP_InputDriverSDL.c
index 3e7f5d1..967fdac 100644
--- a/libs/input/GP_InputDriverSDL.c
+++ b/libs/input/GP_InputDriverSDL.c
@@ -126,8 +126,6 @@ void GP_InputDriverSDLEventPut(SDL_Event *ev)
return;
}
- printf("*** KEYSYM %u KEY %un", keysym, key);
-
GP_EventPushKey(key, ev->key.state, NULL);
break;
case SDL_VIDEORESIZE:
diff --git a/tests/SDL/input.c b/tests/SDL/input.c
index 7ff2dc5..509bc54 100644
--- a/tests/SDL/input.c
+++ b/tests/SDL/input.c
@@ -108,9 +108,32 @@ void event_loop(void)
GP_EventGet(&ev);
GP_EventDump(&ev);
- if (ev.type == GP_EV_KEY &&
- ev.val.key.key == GP_KEY_ESC)
- exit(0);
+ switch (ev.type) {
+ case GP_EV_KEY:
+ switch (ev.val.key.key) {
+ case GP_KEY_ESC:
+ exit(0);
+ case GP_BTN_LEFT:
+ GP_PutPixel(&context, ev.cursor_x,
+ ev.cursor_y, red_pixel);
+ SDL_Flip(display);
+ break;
+ default:
+ break;
+ }
+ break;
+ case GP_EV_REL:
+ switch (ev.code) {
+ case GP_EV_REL_POS:
+ if (GP_EventGetKey(&ev, GP_BTN_LEFT)) {
+ GP_PutPixel(&context, ev.cursor_x,
+ ev.cursor_y, green_pixel);
+ SDL_Flip(display);
+ }
+ break;
+ }
+ break;
+ }
}
}
}
-----------------------------------------------------------------------
Summary of changes:
include/input/GP_Event.h | 4 ++--
libs/input/GP_Event.c | 6 ++++--
libs/input/GP_InputDriverSDL.c | 2 --
tests/SDL/input.c | 29 ++++++++++++++++++++++++++---
4 files changed, 32 insertions(+), 9 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.")
1
0