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 5e1cf45920d28673d7e1245b9709b65c1724084d (commit) via a4788df1092827ba940a1ffe30d56a13b7511bdc (commit) via a1fcf54f181d9449202b06a78d15ed2e46adc48e (commit) via 21bff8ae3a18cadfc1b4da2dfe70f686083a40d6 (commit) via 9d70f761d257857c896cff683236def3bf1133b3 (commit) via ed742c11ffda92c31b8fd354d96ff2b07e9a61bf (commit) via c06d997dec540789eee858038b0e0f64c40328b3 (commit) via 45b543a87a205f931395839e32415a0ca76b0978 (commit) via da0b966559ef04b7d53d080fefe9b99ddd7097a0 (commit) via ca86f291356ade62df38c8059f7f0eecebfe0991 (commit) via cc61bfdb1d208cdc21b01d7335604049a94db9ca (commit) via 3cefa3907f68f96ec6e2e7ecc4ecf1fb26b96cdb (commit) via 6dee12b408a53004c3f5a74d265696d8ce3edd47 (commit) via d984c76e6650ed7d005745e36ccb6e029eb634d3 (commit) via cbe54b1ef522cf97d90f0d4e7c909884e96ffde6 (commit) via 3814872780477efda3b924604c52c6583f77ecce (commit) via 0cfb5e91e793cb577881a8bfc1c5c61e5353422b (commit) via 44de9a46432c45949764964d3c49e65e2bb9701b (commit) via f553db48b5df795253902ce74770f57217b642ab (commit) via ff4fe6a3deedee19d4472c17568f13c3a029475b (commit) via dfefe1528e754ca7f9908dafb4544c08a78f6e6c (commit) via cf69cb4b75d228a01a4d7b803e6dfd2d32efbef3 (commit) via 3e29dc184eff61f987adb9bbab4c223a9b07ff5f (commit) via e3dfb3d477878b7ae70682ef12aefb91d9a17dba (commit) via 852d0d3925acf658dd96979bfbaef0dabb45e81b (commit) via 266c6d21983c196e2071c65d6b5d14d201d9392c (commit) via 983969d8fad548991c47cf81e7e013308fcf6a70 (commit) via ab15bc2a2e7b7636d7e0481251615c360de17c3f (commit) via 94a7d269628a94cf585ed33951bac25b370f20cc (commit) via 48a02d9f6947b24c9b1ea70effaeee5191bf454a (commit) via 3e089f991eb2a1946964b6d42357db197d3be099 (commit) via c3b33c14d2263d443554d1b3ac5f43430e148698 (commit) via 6722436c25bf3899cc2c3c2b44ed0382e04a7fff (commit) via d5cdf89dd42290ce846e29309879a9263aa9e023 (commit) via 037f2ffabeabd1a2522169b7b766333a64680762 (commit) via 21f013df6c1f9ff561304ef0543589baefd79a9b (commit) via 8cfcfcb548e810bf75dd41fa38391a96b18b8907 (commit) via b0f09bfef85c7a22ed6feba890e085634a6517e2 (commit) via e72092bb7d6f87d5d739cc1697da79cd69c6a2a7 (commit) via 50ac1f21f85e66b3d2a8a0a6047971c474c250a4 (commit) via 2274cefa956331bb30fc65f72522f7a4d4ec0e28 (commit) via 582174a303ed68281404b7f09beeba72d8d80a17 (commit) via 16a50bf6b0c956641c452653bd38621d668aef66 (commit) via 1ee71956ba9e5ca2cd298fa3702e4036bbf59225 (commit) via 4fd5560abf4f40f8436fd4af18d604ceff3d64b8 (commit) via 4d97054a669a9060142863a6004144d993270c13 (commit) via 4df5151ae9400f76567697fd5c88917d9ee79229 (commit) via 31bfb14e08456f70a7823efa3832ad4e3ffbb9d3 (commit) via 5815d26c3a7e2a3be30f5d075c4ca064092734a3 (commit) via d45e568685703f9a6b74bff7d25392f3a2f9b417 (commit) via 83881d075d4d203f6949641c09d45d7f4ab6b6c0 (commit) via e57fbf5bbbc9b4618c8ac015ac9986bd928f797c (commit) via e1b16f55b51c64ae4e2c5755e4e1633e579164f0 (commit) via a15037c925ea8b6b995b3fd765e86978e6430dcd (commit) via c4107c1c47c062cb836f0dc0269b7479acc03de6 (commit) via 231bb15ee44ff8cb70008eb11e25241e07c8e693 (commit) via da9aaa9bac5aa0db09a184b718b60ff089316b42 (commit) via 7d1b48ec4f4c4f73b46ede4785131cb431f2ac30 (commit) via 571600efa81d0dddf7ecb637119291f8632635d0 (commit) via 1f275d3bbb03491c03943f5661a3b4d627213121 (commit) via 6597f082e58619947cdc34a05d008a786910bb11 (commit) via 09df1ce6c6cb1b860555326cbadc581ba885c839 (commit) via 32dd244ed5673a96c86c34430fbfbd4574900f5d (commit) via 689eed1ceaa4407932ae557b389ff0fbf01715d4 (commit) via faee6e47752b868e830f56b14af54798b559afe7 (commit) via 8edfb8c8c31d5a39be06c4f82760b7af2fbf696b (commit) via 47786e2ac0576f3807142e29c1b0c5d930b8b3b1 (commit) via dff0057435e267886b3ab76d62e37dfa0bfbd481 (commit) via dff8cea876a4c7b585c88beb18423631def57946 (commit) via ef185c24c13d6b6b65ad276a1f894af3d8288f4a (commit) via 4e59064f36aafdc2e7cd90ab765e94c649b48e13 (commit) via fce92553224cc36cb387d6581e68160c559a5e69 (commit) via 1fd107c16aaafd19b603a3adb5a92e20aaf9fed9 (commit) via 07637417375c72f3016b80e1191b5e43e66bbe94 (commit) via 70a10c5b2f60f9580c0ad734ad2902e2c61802e8 (commit) via d2b5a02db8e3a4f27c108e0b60f947d560d99de9 (commit) via f364349752582a08c589f7c6788634505ae2334e (commit) via 248ca0b50c775fd21a6bbc7a84267d24e4603238 (commit) via 288182835aeafe92a9ee3e965985709a0784d2ca (commit) via ba5d7661e9707e44c1db947feabdcefbeda5c89c (commit) via 089cf8c4f64083f121955cb21cc724ffb7073e5a (commit) via d7cceddf8e7c963cd6db8dc11cae641c4c0e3f2e (commit) via ea3b5b87735179113af713d1d12002629a559379 (commit) via d8973e04d58e1e2d70073624ff4e8d11fe1d8473 (commit) via dac445e4561fcea0c8e73da90218c8c436d1af16 (commit) via dc9cbe7bf75dfa499c3f9bddaa3c1d0576e11c3f (commit) via 57721fc6a318d3fa9183e0e1a621a8cf642b5b43 (commit) via 916c9af7680ff98ff79a5bfca5d4ead8c9c56336 (commit) via b77a4182193f1c0f6223dd997aa17fb85a0d7834 (commit) via 9771ff1a54b004327cf9c82cc7e44b2071cc415f (commit) via 0a67965e5e61bf57c22a975d910ac2fb7a4f6e44 (commit) via 5b4e605c17c3734690054cc7459388e3e2a693c8 (commit) via 2445c17c5ef46920b04e732e2792844ca26567fc (commit) via 116d00c687a9b06a22c1de0e21e219315ad82796 (commit) via ee08b37cc676a5f1b57a1b0292384cf317ef7492 (commit) via 84c2e00d1de47903ee2c3d8724de108ef5e6f0ee (commit) via f99d4bbefef6c942e9f3588314981cb3b90a52d3 (commit) from 62b806d63d5e37b8001e7de7cf5a128467e75eef (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/5e1cf45920d28673d7e1245b9709b65c17240...
commit 5e1cf45920d28673d7e1245b9709b65c1724084d Author: Tomas Gavenciak gavento@ucw.cz Date: Mon May 23 21:56:56 2011 +0200
Post-merge moves
diff --git a/core/GP_Counter.h b/include/core/GP_Counter.h similarity index 100% rename from core/GP_Counter.h rename to include/core/GP_Counter.h diff --git a/core/GP_Counter.c b/libs/core/GP_Counter.c similarity index 100% rename from core/GP_Counter.c rename to libs/core/GP_Counter.c diff --git a/core/gen/README b/libs/core/gen/README similarity index 100% rename from core/gen/README rename to libs/core/gen/README diff --git a/core/gen/defs.py b/libs/core/gen/defs.py similarity index 100% rename from core/gen/defs.py rename to libs/core/gen/defs.py diff --git a/core/gen/gen_blit.py b/libs/core/gen/gen_blit.py similarity index 100% rename from core/gen/gen_blit.py rename to libs/core/gen/gen_blit.py diff --git a/core/gen/gen_pixeltype.py b/libs/core/gen/gen_pixeltype.py similarity index 100% rename from core/gen/gen_pixeltype.py rename to libs/core/gen/gen_pixeltype.py diff --git a/core/gen/gen_utils.py b/libs/core/gen/gen_utils.py similarity index 100% rename from core/gen/gen_utils.py rename to libs/core/gen/gen_utils.py diff --git a/core/gen/make_GP_Blit.py b/libs/core/gen/make_GP_Blit.py similarity index 100% rename from core/gen/make_GP_Blit.py rename to libs/core/gen/make_GP_Blit.py diff --git a/core/gen/make_GP_Pixel.py b/libs/core/gen/make_GP_Pixel.py similarity index 100% rename from core/gen/make_GP_Pixel.py rename to libs/core/gen/make_GP_Pixel.py diff --git a/core/gen/make_GP_Pixel_Scale.py b/libs/core/gen/make_GP_Pixel_Scale.py similarity index 100% rename from core/gen/make_GP_Pixel_Scale.py rename to libs/core/gen/make_GP_Pixel_Scale.py diff --git a/core/gen/pixeltype.py b/libs/core/gen/pixeltype.py similarity index 100% rename from core/gen/pixeltype.py rename to libs/core/gen/pixeltype.py diff --git a/core/tests/GP_Counter.test.c b/tests/core/GP_Counter.test.c similarity index 100% rename from core/tests/GP_Counter.test.c rename to tests/core/GP_Counter.test.c
http://repo.or.cz/w/gfxprim.git/commit/a4788df1092827ba940a1ffe30d56a13b7511...
commit a4788df1092827ba940a1ffe30d56a13b7511bdc Merge: a1fcf54 45b543a Author: Tomas Gavenciak gavento@ucw.cz Date: Mon May 23 21:48:41 2011 +0200
Merge branch 'master' into generate
Conflicts: core/Makefile include/core/GP_Context.h include/gfx/GP_Gfx.h
diff --cc include/gfx/GP_Gfx.h index cd9f74d,19bad4e..149f26e --- a/include/gfx/GP_Gfx.h +++ b/include/gfx/GP_Gfx.h @@@ -58,16 -54,4 +54,14 @@@ #include "GP_Polygon.h" #include "GP_Symbol.h"
- /* fonts */ - #include "GP_Font.h" - #include "GP_TextStyle.h" - #include "GP_TextMetric.h" - #include "GP_Text.h" + #endif /* GP_GFX_H */ + +/* backends */ +#include "GP_Backend.h" + +#define typeof __typeof__ + +#endif /* GP_H */ ++======= ++#endif /* GP_GFX_H */ ++>>>>>>> master:include/gfx/GP_Gfx.h diff --cc libs/core/GP_Pixel.c index e7f4b80,0ed154e..eedd94a --- a/libs/core/GP_Pixel.c +++ b/libs/core/GP_Pixel.c @@@ -23,213 -23,228 +23,213 @@@ * * *****************************************************************************/
- #include "GP.h" + #include "GP_Core.h"
-struct PixelTypeInfo { - const char *type_name; /* human-readable name */ - GP_ColorType color_type; /* color type used for this pixel type */ - unsigned int bits; /* how many bits the pixel occupies */ -}; - -/* This table shows relations of pixel types to color types, their names - * and bits per pixel. - */ -static struct PixelTypeInfo pixel_type_infos[] = { - { "Unknown pixel type", GP_NOCOLOR, 0 }, - { "Palette 4bit", GP_PAL4, 4 }, - { "Palette 8bit", GP_PAL8, 8 }, - { "Grayscale 1bit", GP_G1, 1 }, - { "Grayscale 2bits", GP_G2, 2 }, - { "Grayscale 4bits", GP_G4, 4 }, - { "Grayscale 8bits", GP_G8, 8 }, - { "RGB 555", GP_RGB555, 16 }, - { "BGR 555", GP_RGB555, 16 }, - { "RGB 565", GP_RGB565, 16 }, - { "BGR 565", GP_RGB565, 16 }, - { "RGB 888", GP_RGB888, 24 }, - { "BGR 888", GP_RGB888, 24 }, - { "XRGB 8888", GP_RGB888, 32 }, - { "RGBX 8888", GP_RGB888, 32 }, - { "XBGR 8888", GP_RGB888, 32 }, - { "BGRX 8888", GP_RGB888, 32 }, - { "ARGB 8888", GP_RGBA8888, 32 }, - { "RGBA 8888", GP_RGBA8888, 32 }, - { "ABGR 8888", GP_RGBA8888, 32 }, - { "BGRA 8888", GP_RGBA8888, 32 } -}; - -const char *GP_PixelTypeName(GP_PixelType type) -{ - if (type >= GP_PIXEL_MAX) - return "INVALID TYPE"; - - return pixel_type_infos[type].type_name; -} - -uint32_t GP_PixelSize(GP_PixelType type) -{ - if (type >= GP_PIXEL_MAX) - return 0; - - return pixel_type_infos[type].bits; -} - -GP_ColorType GP_PixelTypeToColorType(GP_PixelType type) -{ - if (type >= GP_PIXEL_MAX) - return GP_COLMAX; - - return pixel_type_infos[type].color_type; -} - -#define CHECK_RET(ret) if (ret != GP_ESUCCESS && ret != GP_EUNPRECISE) return ret; - -GP_RetCode GP_ColorToPixelType(GP_PixelType pixel_type, GP_Color color, GP_Pixel *pixel) -{ - if (pixel == NULL) - return GP_ENULLPTR; - - GP_RetCode ret; - - switch (pixel_type) { - case GP_PIXEL_PAL4: - ret = GP_ColorConvert(&color, GP_PAL4); - CHECK_RET(ret); - *pixel = color.pal4.index; - return ret; - break; - case GP_PIXEL_PAL8: - ret = GP_ColorConvert(&color, GP_PAL8); - CHECK_RET(ret); - *pixel = color.pal8.index; - return ret; - break; - case GP_PIXEL_G1: - ret = GP_ColorConvert(&color, GP_G1); - CHECK_RET(ret); - *pixel = color.g1.gray; - return ret; - break; - case GP_PIXEL_G2: - ret = GP_ColorConvert(&color, GP_G2); - CHECK_RET(ret); - *pixel = color.g2.gray; - return ret; - break; - case GP_PIXEL_G4: - ret = GP_ColorConvert(&color, GP_G4); - CHECK_RET(ret); - *pixel = color.g4.gray; - return ret; - break; - case GP_PIXEL_G8: - ret = GP_ColorConvert(&color, GP_G8); - CHECK_RET(ret); - *pixel = color.g8.gray; - return ret; - break; - case GP_PIXEL_RGB565: - ret = GP_ColorConvert(&color, GP_RGB565); - CHECK_RET(ret); - *pixel = color.rgb565.red << 0x0b | - color.rgb565.green << 0x05 | - color.rgb565.blue; - case GP_PIXEL_RGB888: - case GP_PIXEL_XRGB8888: - ret = GP_ColorConvert(&color, GP_RGB888); - CHECK_RET(ret); - *pixel = color.rgb888.red << 0x10 | - color.rgb888.green << 0x08 | - color.rgb888.blue; - return ret; - break; - case GP_PIXEL_BGR888: - case GP_PIXEL_XBGR8888: - ret = GP_ColorConvert(&color, GP_RGB888); - CHECK_RET(ret); - *pixel = color.rgb888.red | - color.rgb888.green << 0x08 | - color.rgb888.blue << 0x10; - return ret; - break; - case GP_PIXEL_RGBX8888: - ret = GP_ColorConvert(&color, GP_RGB888); - CHECK_RET(ret); - *pixel = color.rgb888.red << 0x18 | - color.rgb888.green << 0x10 | - color.rgb888.blue << 0x8; - return ret; - break; - case GP_PIXEL_BGRX8888: - ret = GP_ColorConvert(&color, GP_RGB888); - CHECK_RET(ret); - *pixel = color.rgb888.red << 0x08 | - color.rgb888.green << 0x10 | - color.rgb888.blue << 0x18; - return ret; - break; - case GP_PIXEL_ARGB8888: - ret = GP_ColorConvert(&color, GP_RGBA8888); - CHECK_RET(ret); - *pixel = color.rgba8888.red << 0x10 | - color.rgba8888.green << 0x08 | - color.rgba8888.blue | - color.rgba8888.alpha << 0x18; - return ret; - break; - case GP_PIXEL_RGBA8888: - ret = GP_ColorConvert(&color, GP_RGBA8888); - CHECK_RET(ret); - *pixel = color.rgba8888.red << 0x18 | - color.rgba8888.green << 0x10 | - color.rgba8888.blue << 0x08 | - color.rgba8888.alpha; - return ret; - break; - case GP_PIXEL_ABGR8888: - ret = GP_ColorConvert(&color, GP_RGBA8888); - CHECK_RET(ret); - *pixel = color.rgba8888.red | - color.rgba8888.green << 0x08 | - color.rgba8888.blue << 0x10 | - color.rgba8888.alpha << 0x18; - return ret; - break; - case GP_PIXEL_BGRA8888: - ret = GP_ColorConvert(&color, GP_RGBA8888); - CHECK_RET(ret); - *pixel = color.rgba8888.red << 0x08 | - color.rgba8888.green << 0x10 | - color.rgba8888.blue << 0x18 | - color.rgba8888.alpha; - return ret; - break; - case GP_PIXEL_MAX: - break; - } - - if (pixel_type >= GP_PIXEL_MAX) - return GP_EINVAL; - else - return GP_ENOIMPL; -} - -GP_RetCode GP_ColorToPixel(GP_Context *context, GP_Color color, GP_Pixel *pixel) -{ - if (context == NULL || pixel == NULL) - return GP_ENULLPTR; - - return GP_ColorToPixelType(context->pixel_type, color, pixel); -} - -GP_RetCode GP_ColorNameToPixel(GP_Context *context, GP_ColorName name, GP_Pixel *pixel) -{ - if (context == NULL || pixel == NULL) - return GP_ENULLPTR; - - GP_Color color = GP_COLNAME_PACK(name); - return GP_ColorToPixelType(context->pixel_type, color, pixel); -} - -GP_RetCode GP_ColorNameToPixelType(GP_PixelType pixel_type, GP_ColorName name, GP_Pixel *pixel) -{ - if (pixel == NULL) - return GP_ENULLPTR; - - GP_Color color = GP_COLNAME_PACK(name); - return GP_ColorToPixelType(pixel_type, color, pixel); -} - -GP_RetCode GP_RGBToPixel(GP_Context *context, uint8_t r, uint8_t g, uint8_t b, GP_Pixel *pixel) -{ - if (pixel == NULL) - return GP_ENULLPTR; - - GP_Color color = GP_RGB888_PACK(r, g, b); - return GP_ColorToPixelType(context->pixel_type, color, pixel); -} +/////// removed by gavento +// struct PixelTypeInfo { +// const char *type_name; /* human-readable name */ +// GP_ColorType color_type; /* color type used for this pixel type */ +// unsigned int bits; /* how many bits the pixel occupies */ +// }; +// +// /* This table shows relations of pixel types to color types, their names +// * and bits per pixel. +// */ +// static struct PixelTypeInfo pixel_type_infos[] = { +// { "Unknown pixel type", GP_NOCOLOR, 0 }, +// { "Palette 4bit", GP_PAL4, 4 }, +// { "Palette 8bit", GP_PAL8, 8 }, +// { "Grayscale 1bit", GP_G1, 1 }, +// { "Grayscale 2bits", GP_G2, 2 }, +// { "Grayscale 4bits", GP_G4, 4 }, +// { "Grayscale 8bits", GP_G8, 8 }, +// { "RGB 555", GP_RGB555, 16 }, +// { "BGR 555", GP_RGB555, 16 }, +// { "RGB 565", GP_RGB565, 16 }, +// { "BGR 565", GP_RGB565, 16 }, +// { "RGB 888", GP_RGB888, 24 }, +// { "BGR 888", GP_RGB888, 24 }, +// { "XRGB 8888", GP_RGB888, 32 }, +// { "RGBX 8888", GP_RGB888, 32 }, +// { "XBGR 8888", GP_RGB888, 32 }, +// { "BGRX 8888", GP_RGB888, 32 }, +// { "ARGB 8888", GP_RGBA8888, 32 }, +// { "RGBA 8888", GP_RGBA8888, 32 }, +// { "ABGR 8888", GP_RGBA8888, 32 }, +// { "BGRA 8888", GP_RGBA8888, 32 } +// }; +// +// GP_ColorType GP_PixelTypeToColorType(GP_PixelType type) +// { +// if (type >= GP_PIXEL_MAX) +// return GP_COLMAX; +// +// return pixel_type_infos[type].color_type; +// } +// +// #define CHECK_RET(ret) if (ret != GP_ESUCCESS && ret != GP_EUNPRECISE) return ret; +// +// GP_RetCode GP_ColorToPixelType(GP_PixelType pixel_type, GP_Color color, GP_Pixel *pixel) +// { +// if (pixel == NULL) +// return GP_ENULLPTR; +// +// GP_RetCode ret; +// +// switch (pixel_type) { +// case GP_PIXEL_PAL4: +// ret = GP_ColorConvert(&color, GP_PAL4); +// CHECK_RET(ret); +// *pixel = color.pal4.index; +// return ret; +// break; +// case GP_PIXEL_PAL8: +// ret = GP_ColorConvert(&color, GP_PAL8); +// CHECK_RET(ret); +// *pixel = color.pal8.index; +// return ret; +// break; +// case GP_PIXEL_G1: +// ret = GP_ColorConvert(&color, GP_G1); +// CHECK_RET(ret); +// *pixel = color.g1.gray; +// return ret; +// break; +// case GP_PIXEL_G2: +// ret = GP_ColorConvert(&color, GP_G2); +// CHECK_RET(ret); +// *pixel = color.g2.gray; +// return ret; +// break; +// case GP_PIXEL_G4: +// ret = GP_ColorConvert(&color, GP_G4); +// CHECK_RET(ret); +// *pixel = color.g4.gray; +// return ret; +// break; +// case GP_PIXEL_G8: +// ret = GP_ColorConvert(&color, GP_G8); +// CHECK_RET(ret); +// *pixel = color.g8.gray; +// return ret; +// break; +// case GP_PIXEL_RGB565: +// ret = GP_ColorConvert(&color, GP_RGB565); +// CHECK_RET(ret); +// *pixel = color.rgb565.red << 0x0b | +// color.rgb565.green << 0x05 | +// color.rgb565.blue; +// case GP_PIXEL_RGB888: +// case GP_PIXEL_XRGB8888: +// ret = GP_ColorConvert(&color, GP_RGB888); +// CHECK_RET(ret); +// *pixel = color.rgb888.red << 0x10 | +// color.rgb888.green << 0x08 | +// color.rgb888.blue; +// return ret; +// break; +// case GP_PIXEL_BGR888: +// case GP_PIXEL_XBGR8888: +// ret = GP_ColorConvert(&color, GP_RGB888); +// CHECK_RET(ret); +// *pixel = color.rgb888.red | +// color.rgb888.green << 0x08 | +// color.rgb888.blue << 0x10; +// return ret; +// break; +// case GP_PIXEL_RGBX8888: +// ret = GP_ColorConvert(&color, GP_RGB888); +// CHECK_RET(ret); +// *pixel = color.rgb888.red << 0x18 | +// color.rgb888.green << 0x10 | +// color.rgb888.blue << 0x8; +// return ret; +// break; +// case GP_PIXEL_BGRX8888: +// ret = GP_ColorConvert(&color, GP_RGB888); +// CHECK_RET(ret); +// *pixel = color.rgb888.red << 0x08 | +// color.rgb888.green << 0x10 | +// color.rgb888.blue << 0x18; +// return ret; +// break; +// case GP_PIXEL_ARGB8888: +// ret = GP_ColorConvert(&color, GP_RGBA8888); +// CHECK_RET(ret); +// *pixel = color.rgba8888.red << 0x10 | +// color.rgba8888.green << 0x08 | +// color.rgba8888.blue | +// color.rgba8888.alpha << 0x18; +// return ret; +// break; +// case GP_PIXEL_RGBA8888: +// ret = GP_ColorConvert(&color, GP_RGBA8888); +// CHECK_RET(ret); +// *pixel = color.rgba8888.red << 0x18 | +// color.rgba8888.green << 0x10 | +// color.rgba8888.blue << 0x08 | +// color.rgba8888.alpha; +// return ret; +// break; +// case GP_PIXEL_ABGR8888: +// ret = GP_ColorConvert(&color, GP_RGBA8888); +// CHECK_RET(ret); +// *pixel = color.rgba8888.red | +// color.rgba8888.green << 0x08 | +// color.rgba8888.blue << 0x10 | +// color.rgba8888.alpha << 0x18; +// return ret; +// break; +// case GP_PIXEL_BGRA8888: +// ret = GP_ColorConvert(&color, GP_RGBA8888); +// CHECK_RET(ret); +// *pixel = color.rgba8888.red << 0x08 | +// color.rgba8888.green << 0x10 | +// color.rgba8888.blue << 0x18 | +// color.rgba8888.alpha; +// return ret; +// break; +// case GP_PIXEL_MAX: +// break; +// } +// +// if (pixel_type >= GP_PIXEL_MAX) +// return GP_EINVAL; +// else +// return GP_ENOIMPL; +// } +// +// GP_RetCode GP_ColorToPixel(GP_Context *context, GP_Color color, GP_Pixel *pixel) +// { +// if (context == NULL || pixel == NULL) +// return GP_ENULLPTR; +// +// return GP_ColorToPixelType(context->pixel_type, color, pixel); +// } +// +// GP_RetCode GP_ColorNameToPixel(GP_Context *context, GP_ColorName name, GP_Pixel *pixel) +// { +// if (context == NULL || pixel == NULL) +// return GP_ENULLPTR; +// +// GP_Color color = GP_COLNAME_PACK(name); +// return GP_ColorToPixelType(context->pixel_type, color, pixel); +// } +// +// GP_RetCode GP_ColorNameToPixelType(GP_PixelType pixel_type, GP_ColorName name, GP_Pixel *pixel) +// { +// if (pixel == NULL) +// return GP_ENULLPTR; +// +// GP_Color color = GP_COLNAME_PACK(name); +// return GP_ColorToPixelType(pixel_type, color, pixel); +// } +// +// GP_RetCode GP_RGBToPixel(GP_Context *context, uint8_t r, uint8_t g, uint8_t b, GP_Pixel *pixel) +// { +// if (pixel == NULL) +// return GP_ENULLPTR; +// +// GP_Color color = GP_RGB888_PACK(r, g, b); +// return GP_ColorToPixelType(context->pixel_type, color, pixel); +// } diff --cc libs/gfx/GP_Line.c index f85eb0b,42a6cbc..21066b1 --- a/libs/gfx/GP_Line.c +++ b/libs/gfx/GP_Line.c @@@ -23,17 -23,14 +23,17 @@@ * * *****************************************************************************/
- #include "GP.h" + #include "GP_Gfx.h" #include "algo/Line.algo.h" - #include "GP_FnPerBpp.h" + #include "core/GP_FnPerBpp.h"
/* Generate drawing functions for various bit depths. */ -DEF_LINE_FN(GP_Line1bpp, GP_Context *, GP_Pixel, GP_PutPixel1bpp) -DEF_LINE_FN(GP_Line2bpp, GP_Context *, GP_Pixel, GP_PutPixel2bpp) -DEF_LINE_FN(GP_Line4bpp, GP_Context *, GP_Pixel, GP_PutPixel4bpp) +DEF_LINE_FN(GP_Line1bpp_LE, GP_Context *, GP_Pixel, GP_PutPixel1bpp_LE) +DEF_LINE_FN(GP_Line2bpp_LE, GP_Context *, GP_Pixel, GP_PutPixel2bpp_LE) +DEF_LINE_FN(GP_Line4bpp_LE, GP_Context *, GP_Pixel, GP_PutPixel4bpp_LE) +DEF_LINE_FN(GP_Line1bpp_BE, GP_Context *, GP_Pixel, GP_PutPixel1bpp_BE) +DEF_LINE_FN(GP_Line2bpp_BE, GP_Context *, GP_Pixel, GP_PutPixel2bpp_BE) +DEF_LINE_FN(GP_Line4bpp_BE, GP_Context *, GP_Pixel, GP_PutPixel4bpp_BE) DEF_LINE_FN(GP_Line8bpp, GP_Context *, GP_Pixel, GP_PutPixel8bpp) DEF_LINE_FN(GP_Line16bpp, GP_Context *, GP_Pixel, GP_PutPixel16bpp) DEF_LINE_FN(GP_Line24bpp, GP_Context *, GP_Pixel, GP_PutPixel24bpp)
http://repo.or.cz/w/gfxprim.git/commit/a1fcf54f181d9449202b06a78d15ed2e46adc...
commit a1fcf54f181d9449202b06a78d15ed2e46adc48e Author: Tomas Gavenciak gavento@ucw.cz Date: Mon May 23 21:42:32 2011 +0200
Add typeof definition (C99)
diff --git a/core/GP.h b/core/GP.h index 77ba1b0..cd9f74d 100644 --- a/core/GP.h +++ b/core/GP.h @@ -68,4 +68,6 @@ /* backends */ #include "GP_Backend.h"
+#define typeof __typeof__ + #endif /* GP_H */
http://repo.or.cz/w/gfxprim.git/commit/21bff8ae3a18cadfc1b4da2dfe70f686083a4...
commit 21bff8ae3a18cadfc1b4da2dfe70f686083a40d6 Author: Tomas Gavenciak gavento@ucw.cz Date: Mon May 23 21:38:51 2011 +0200
Fix GP_Blit generation
diff --git a/core/gen/gen_blit.py b/core/gen/gen_blit.py index df9c4b4..519bfb2 100644 --- a/core/gen/gen_blit.py +++ b/core/gen/gen_blit.py @@ -61,7 +61,7 @@ def gen_blit_same_t(size, size_suffix, header, code): " if (al1 != 0)n" " GP_SET_BITS(al1, 8-al1, *p2, GP_GET_BITS(al1, 8-al1, *p1));n" " memcpy(p2+(al1!=0), p1+(al1!=0), copy_size);n" - " if (end_al != 0) {n" + " if (end_al != 0)n" " GP_SET_BITS(0, end_al, *end_p2, GP_GET_BITS(0, end_al, *end_p1));n" " p1 += c1->bytes_per_row;n" " end_p1 += c1->bytes_per_row;n" diff --git a/core/gen/make_GP_Blit.py b/core/gen/make_GP_Blit.py index 22f3f82..9d103ac 100644 --- a/core/gen/make_GP_Blit.py +++ b/core/gen/make_GP_Blit.py @@ -21,6 +21,7 @@ gen_headers(h, c, c.append('#include <stdio.h>n') c.append('#include <string.h>n') c.append('#include "GP_Pixel.h"n') +c.append('#include "GP.h"n') c.append('#include "GP_Context.h"n') c.append('#include "GP_Blit.gen.h"n')
http://repo.or.cz/w/gfxprim.git/commit/9d70f761d257857c896cff683236def3bf113...
commit 9d70f761d257857c896cff683236def3bf1133b3 Author: Tomas Gavenciak gavento@ucw.cz Date: Mon May 23 21:36:38 2011 +0200
Tweak PixelType definitons
diff --git a/core/GP_Pixel.h b/core/GP_Pixel.h index 5171d47..feb7eac 100644 --- a/core/GP_Pixel.h +++ b/core/GP_Pixel.h @@ -56,6 +56,18 @@ typedef uint32_t GP_Pixel; #include "GP_Pixel.gen.h"
/* + * Information about ordering of pixels in byte for 1, 2 and 4 bpp + * used in a one bit variable in GP_Context + */ + +typedef enum { + /* less significant bits contain pixels with lower indices */ + GP_BIT_ENDIAN_LE = 0, + /* more significant bits contain pixels with lower indices */ + GP_BIT_ENDIAN_BE, +} GP_BIT_ENDIAN; + +/* * Description of one channel * Assumes all the channel names to be at most 7 chars long * @@ -68,45 +80,41 @@ typedef uint32_t GP_Pixel;
typedef struct { char name[8]; /* Channel name */ - int offset; /* Offset in bits */ - int size; /* Bit-size */ + uint8_t offset; /* Offset in bits */ + uint8_t size; /* Bit-size */ } GP_PixelTypeChannel;
/* + * Maximum number of channels in a PixelType + */ + +#define GP_PIXELTYPE_MAX_CHANNELS 8 + +/* * Description of one PixelType * Assumes name with at most 15 chars * Assumes at most 8 channels */
typedef struct { - GP_PixelType type; /* Number of the type */ - const char name[16]; /* Name */ - int size; /* Size in bits */ - int bit_endian; /* Order of pixels in a byte */ /**TODO : add proper type !! */ - int numchannels; /* Number of channels */ - const char bitmap[36]; /* String describing the bit-representaton (as in "RRRRRGGGGGGBBBBB")*/ - const GP_PixelTypeChannel channels[8]; /* Individual channels */ + GP_PixelType type; /* Number of the type */ + const char name[16]; /* Name */ + uint8_t size; /* Size in bits */ + GP_BIT_ENDIAN bit_endian; /* Order of pixels in a byte */ + uint8_t numchannels; /* Number of channels */ + /* String describing the bit-representaton (as in "RRRRRGGGGGGBBBBB")*/ + const char bitmap[sizeof(GP_Pixel) * 8 + 1]; + /* Individual channels */ + const GP_PixelTypeChannel channels[GP_PIXELTYPE_MAX_CHANNELS]; } GP_PixelTypeDescription;
/* - * Array of GP_PIXEL_MAX entries + * Array of size GP_PIXEL_MAX describing known pixel types */
extern const GP_PixelTypeDescription const GP_PixelTypes[];
/* - * Information about ordering of pixels in byte for 1, 2 and 4 bpp - * used in a one bit variable in GP_Context - */ - -typedef enum { - /* less significant bits contain pixels with lower indices */ - GP_BIT_ENDIAN_LE = 0, - /* more significant bits contain pixels with lower indices */ - GP_BIT_ENDIAN_BE, -} GP_BIT_ENDIAN; - -/* * Convert pixel type to name. */
http://repo.or.cz/w/gfxprim.git/commit/ed742c11ffda92c31b8fd354d96ff2b07e9a6...
commit ed742c11ffda92c31b8fd354d96ff2b07e9a61bf Author: Tomas Gavenciak gavento@ucw.cz Date: Mon May 23 21:35:13 2011 +0200
Fix transform bugs, add docs to GP_Transform.h
diff --git a/core/GP_Transform.h b/core/GP_Transform.h index 935b771..152253d 100644 --- a/core/GP_Transform.h +++ b/core/GP_Transform.h @@ -21,32 +21,49 @@ * * * Copyright (C) 2009-2010 Cyril Hrubis metan@ucw.cz * * * + * Copyright (C) 2011 Tomas Gavenciak gavento@ucw.cz * + * * *****************************************************************************/
#ifndef GP_TRANSFORM_H #define GP_TRANSFORM_H
+/* + * Flip a coordinate within context according to context transformation. + */ #define GP_TRANSFORM_X(context, x) do { if ((context)->x_swap) - x = (context)->w - x; + x = (context)->w - x - 1; } while (0)
#define GP_TRANSFORM_Y(context, y) do { if ((context)->y_swap) - y = (context)->h - y; + y = (context)->h - y - 1; } while (0)
+/* + * Swap coordinates (axes) according to context transformation. + */ #define GP_TRANSFORM_SWAP(context, x, y) do { if ((context)->axes_swap) GP_SWAP(x, y); } while (0)
+/* + * Transform "user"-coordinates to "real"-coordinates according to context + * transformation. + */ #define GP_TRANSFORM_POINT(context, x, y) do { GP_TRANSFORM_SWAP(context, x, y); GP_TRANSFORM_X(context, x); GP_TRANSFORM_Y(context, y); } while (0)
+/* + * Transform "user"-coordinates to "real"-coordinates of a rectangle corner + * according to context transformation. Corner with min-coordinates is + * transformed to (different) corner with min-coordinates etc. + */ #define GP_TRANSFORM_RECT(context, x, y, rw, rh) do { GP_TRANSFORM_SWAP(context, x, y); GP_TRANSFORM_SWAP(context, w, h); @@ -59,8 +76,8 @@ } while (0)
/* - * Inverse transformation. Use for translating mouse pointer coordinates to - * coordinates on context. + * Inverse transformation to GP_TRANSFORM_POINT. + * Use for translating mouse pointer coordinates to coordinates on context. */ #define GP_RETRANSFORM_POINT(context, x, y) do { GP_TRANSFORM_X(context, x); http://repo.or.cz/w/gfxprim.git/commit/c06d997dec540789eee858038b0e0f64c4032...
commit c06d997dec540789eee858038b0e0f64c40328b3 Author: Tomas Gavenciak gavento@ucw.cz Date: Mon May 23 21:34:34 2011 +0200
Cleanup and minor edits of core code
diff --git a/core/GP_Common.h b/core/GP_Common.h index d077f33..cbfaf9b 100644 --- a/core/GP_Common.h +++ b/core/GP_Common.h @@ -146,8 +146,10 @@
#define GP_SET_BITS_OR(offset, dest, val) ( (dest) |= ((val)<<(offset)) )
-#define GP_SET_BITS(offset, count, dest, val) (GP_CLEAR_BITS(offset, count, dest), - GP_SET_BITS_OR(offset, dest, val) ) +#define GP_SET_BITS(offset, count, dest, val) do { + GP_CLEAR_BITS(offset, count, dest); + GP_SET_BITS_OR(offset, dest, val); + } while (0)
/* Determines the sign of the integer value; it is +1 if value is positive, diff --git a/core/GP_Context.c b/core/GP_Context.c index faaa64c..efe9ed3 100644 --- a/core/GP_Context.c +++ b/core/GP_Context.c @@ -27,11 +27,6 @@
#include <string.h>
-inline GP_PixelType GP_GetContextPixelType(const GP_Context *context) -{ - return context->pixel_type; -} - GP_Context *GP_ContextCopy(GP_Context *context, int flag) { GP_Context *new; diff --git a/core/GP_Context.h b/core/GP_Context.h index e5b5220..b356c59 100644 --- a/core/GP_Context.h +++ b/core/GP_Context.h @@ -32,6 +32,10 @@ #include "GP_Common.h" #include "GP_Pixel.h"
+/* Integer type for coordinates: x, y, width, height, ... + * Should be signed to hold negative values as well. */ +typedef int GP_Coord; + /* This structure holds all information needed for drawing into an image. */ typedef struct GP_Context { uint8_t *pixels; /* pointer to image pixels */ @@ -58,7 +62,10 @@ typedef struct GP_Context { } GP_Context;
/* Returns the pixel type used by the context. */ -inline GP_PixelType GP_GetContextPixelType(const GP_Context *context); +static inline GP_PixelType GP_GetContextPixelType(const GP_Context *context) +{ + return context->pixel_type; +}
/* Determines the address of a pixel within the context's image. * Rows and columns are specified in the image's orientation @@ -136,23 +143,13 @@ void GP_ContextFlagsRotateCCW(GP_Context *context); */ static inline uint32_t GP_ContextW(GP_Context *context) { - return context->w; -} - -static inline uint32_t GP_ContextH(GP_Context *context) -{ - return context->h; -} - -static inline uint32_t GP_TContextW(GP_Context *context) -{ if (context->axes_swap) return context->h; else return context->w; }
-static inline uint32_t GP_TContextH(GP_Context *context) +static inline uint32_t GP_ContextH(GP_Context *context) { if (context->axes_swap) return context->w; diff --git a/core/GP_Pixel.h b/core/GP_Pixel.h index 31c6400..5171d47 100644 --- a/core/GP_Pixel.h +++ b/core/GP_Pixel.h @@ -30,6 +30,7 @@ #include <stdint.h>
#include "GP_Color.h" +#include "GP_Common.h" #include "GP_RetCode.h"
struct GP_Context;
http://repo.or.cz/w/gfxprim.git/commit/45b543a87a205f931395839e32415a0ca76b0...
commit 45b543a87a205f931395839e32415a0ca76b0978 Author: Tomas Gavenciak gavento@ucw.cz Date: Mon May 23 00:15:36 2011 +0200
Fix up tests (issue with aliasing remains)
diff --git a/tests/core/GP_Comon.test.c b/tests/core/GP_Comon.test.c index e99cf3d..0fe2b1f 100644 --- a/tests/core/GP_Comon.test.c +++ b/tests/core/GP_Comon.test.c @@ -23,6 +23,7 @@ #include "GP_Tests.h"
#include <GP_Common.h> +#include <unistd.h>
/* * Demo ("testing" ;-) tests for GP_Common.h @@ -52,7 +53,7 @@ GP_ENDTEST GP_TEST(set_bits) { uint32_t x = 0x89ABC; - uint16_t *y = (uint16_t*) &x; + uint16_t *y = (uint16_t*) &x; GP_CLEAR_BITS(3, 4, x); fail_unless(x == 0x89A84); GP_SET_BITS_OR(10, x, 0x0000000); @@ -61,12 +62,21 @@ GP_TEST(set_bits) fail_unless(x == 0xF1089A84); /* Check that only uint16_t is affected */ GP_SET_BITS(0, 24, *y, 0x100F000LL); +# if __BYTE_ORDER == __BIG_ENDIAN fail_unless(x == 0xF108F000); +# else + fail_unless(x == 0x100F9A84); +# endif } GP_ENDTEST
-GP_TEST(abort_check_assert, "loop_start=0, loop_end=9, expect_exit=1") +GP_TEST(abort_check_assert, "loop_start=0, loop_end=9, expect_signal=6") { + /* Prevent output during testing */ +# ifdef stderr +# undef stderr +# endif +# define stderr stdin if (_i==0) GP_ABORT(); if (_i==1) GP_ABORT("MSG"); if (_i==2) GP_ABORT("FORMAT %d", _i); diff --git a/tests/core/Makefile b/tests/core/Makefile index b1da0ed..2911629 100644 --- a/tests/core/Makefile +++ b/tests/core/Makefile @@ -14,11 +14,11 @@ include $(TOPDIR)/app.mk
TEST_SRCS=$(wildcard *.test.c) TEST_OBJS=$(patsubst %.c,%.o,$(TEST_SRCS)) - +TESTS=core_tests CLEAN+=core_tests.gen.c
run: $(TESTS) - for test in $(TESTS); do LD_LIBRARY_PATH=../ ./"$$test" -v ; done + for test in $(TESTS); do LD_LIBRARY_PATH=../../build ./"$$test" -v ; done
core_tests.gen.c: $(TEST_SRCS) find_tests.py ifdef VERBOSE
http://repo.or.cz/w/gfxprim.git/commit/da0b966559ef04b7d53d080fefe9b99ddd709...
commit da0b966559ef04b7d53d080fefe9b99ddd7097a0 Merge: cc61bfd ca86f29 Author: Tomas Gavenciak gavento@ucw.cz Date: Sun May 22 23:32:51 2011 +0200
Merge branch 'master' of git://repo.or.cz/gfxprim
http://repo.or.cz/w/gfxprim.git/commit/cc61bfdb1d208cdc21b01d7335604049a94db...
commit cc61bfdb1d208cdc21b01d7335604049a94db9ca Merge: 6dee12b 3cefa39 Author: Tomas Gavenciak gavento@ucw.cz Date: Sun May 22 22:35:05 2011 +0200
Merge branch 'master' of git://repo.or.cz/gfxprim
http://repo.or.cz/w/gfxprim.git/commit/6dee12b408a53004c3f5a74d265696d8ce3ed...
commit 6dee12b408a53004c3f5a74d265696d8ce3edd47 Author: Tomas Gavenciak gavento@ucw.cz Date: Sun May 22 20:37:45 2011 +0200
Stop %'s in GP_ASSERT() from breaking printf format
A bit ugly (extra internal macro + extra parameter) Also added spaces to avoid "empty printf format" warning
diff --git a/core/GP_Common.h b/core/GP_Common.h index d077f33..8560a7f 100644 --- a/core/GP_Common.h +++ b/core/GP_Common.h @@ -63,33 +63,42 @@ #endif
/* - * Aborts and prints the message along with the location in code - * to stderr. Used for fatal errors. + * Internal macros with common code for GP_ABORT, GP_ASSERT and GP_CHECK. + * GP_INTERNAL_ABORT takes a message that may contain % (e.g. assert condition) + * and prints: + * "*** gfxprim: __FILE__:__LINE__: in __FUNCTION__: str_abort_msg_" format(__VA_ARGS__) "n" * - * Use as either GP_ABORT(), GP_ABORT(msg) or GP_ABORT(format, params...) where - * msg and format must be string constants. + * GP_GENERAL_CHECK is a check with specified message prefix (for assert and check) */ -#define GP_ABORT(...) do { - fprintf(stderr, "*** gfxprim: %s:%d: in %s: ", - __FILE__, __LINE__, __FUNCTION__); - fprintf(stderr, "" __VA_ARGS__); + +#define GP_INTERNAL_ABORT(str_abort_msg_, ...) do { + fprintf(stderr, "*** gfxprim: %s:%d: in %s: %s", + __FILE__, __LINE__, __FUNCTION__, str_abort_msg_); if (! (#__VA_ARGS__ [0])) fprintf(stderr, "abort()"); + else + fprintf(stderr, " " __VA_ARGS__); fprintf(stderr, "n"); abort(); } while (0)
+#define GP_GENERAL_CHECK(check_cond_, check_message_, ...) do { + if (unlikely(!(check_cond_))) { + if (#__VA_ARGS__ [0]) + GP_INTERNAL_ABORT(check_message_ #check_cond_, "n" __VA_ARGS__); + else + GP_INTERNAL_ABORT(check_message_ #check_cond_, " "); + } + } while (0) + /* - * Internal macro with common code for GP_ASSERT and GP_CHECK. + * Aborts and prints the message along with the location in code + * to stderr. Used for fatal errors. + * + * Use as either GP_ABORT(), GP_ABORT(msg) or GP_ABORT(format, params...) where + * msg and format must be string constants. */ -#define GP_GENERAL_CHECK(check_cond_, check_message_, ...) do { - if (unlikely(!(check_cond_))) { - if (#__VA_ARGS__ [0]) - GP_ABORT(check_message_ #check_cond_ "n" __VA_ARGS__); - else - GP_ABORT(check_message_ #check_cond_); - } -} while (0) +#define GP_ABORT(...) GP_INTERNAL_ABORT("", ##__VA_ARGS__)
/* * Checks the condition and aborts immediately if it is not satisfied, diff --git a/core/tests/GP_Comon.test.c b/core/tests/GP_Comon.test.c index 7cdc22e..e99cf3d 100644 --- a/core/tests/GP_Comon.test.c +++ b/core/tests/GP_Comon.test.c @@ -77,13 +77,14 @@ GP_TEST(abort_check_assert, "loop_start=0, loop_end=9, expect_exit=1") if (_i==7) GP_CHECK(1==0, "MSG"); if (_i==8) GP_CHECK(1==0, "FORMAT %d", _i); } -END_TEST +GP_ENDTEST
GP_TEST(assert_check_nop) { - GP_ASSERT(1); - GP_ASSERT(1, "MSG"); - GP_CHECK(1); - GP_CHECK(1, "MSG"); + /* Also tests % in conditon */ + GP_ASSERT(7 % 3 == 1); + GP_ASSERT(7 % 3 == 1, "MSG"); + GP_CHECK(7 % 3 == 1); + GP_CHECK(7 % 3 == 1, "MSG"); } GP_ENDTEST
http://repo.or.cz/w/gfxprim.git/commit/d984c76e6650ed7d005745e36ccb6e029eb63...
commit d984c76e6650ed7d005745e36ccb6e029eb634d3 Author: Tomas Gavenciak gavento@ucw.cz Date: Sun May 22 20:01:49 2011 +0200
Minor extension to testing
doc comment, example and special END_TEST macro
diff --git a/core/tests/GP_Comon.test.c b/core/tests/GP_Comon.test.c index 9faa290..7cdc22e 100644 --- a/core/tests/GP_Comon.test.c +++ b/core/tests/GP_Comon.test.c @@ -38,7 +38,7 @@ GP_TEST(min_max) fail_unless(GP_MAX(x++, ++y) == 1); fail_unless(x == 1 && y == 1); } -END_TEST +GP_ENDTEST
GP_TEST(get_bits) { @@ -47,7 +47,7 @@ GP_TEST(get_bits) fail_unless(GP_GET_BITS(16, 16, 0x1234) == 0); fail_unless(GP_GET_BITS(1, 32, 0x12345678ULL) == 0x091A2B3CULL); } -END_TEST +GP_ENDTEST
GP_TEST(set_bits) { @@ -63,7 +63,7 @@ GP_TEST(set_bits) GP_SET_BITS(0, 24, *y, 0x100F000LL); fail_unless(x == 0xF108F000); } -END_TEST +GP_ENDTEST
GP_TEST(abort_check_assert, "loop_start=0, loop_end=9, expect_exit=1") { @@ -86,4 +86,4 @@ GP_TEST(assert_check_nop) GP_CHECK(1); GP_CHECK(1, "MSG"); } -END_TEST +GP_ENDTEST diff --git a/core/tests/GP_Tests.h b/core/tests/GP_Tests.h index 1735f60..d24b5f6 100644 --- a/core/tests/GP_Tests.h +++ b/core/tests/GP_Tests.h @@ -20,6 +20,26 @@ * * *****************************************************************************/
+/* + * Wrappers around check.h unit-test library + * + * Create a .test.c file with (example): + * + * GP_SUITE(suite_name) + * + * GP_TEST(test1) + * { + * fail_unless(1 == 1); + * fail_if(1 < 0, "Impossible!"); + * int i = 3; + * if (1 + 1 == i) fail("Arrgh, 1 + 1 is %d", i); + * } + * GP_ENDTEST + * + * The tests are collected automatically by find_tests.py. + * See below for more options. + */ + #include <check.h>
/* @@ -46,6 +66,8 @@ void GP_TEST_##name(int i) {name(i);} START_TEST(name)
+#define GP_ENDTEST END_TEST + /* * Helper macro to allow auto-generation of suites. * Defines suite from this point until EOF or redefinition. diff --git a/core/tests/font.test.c b/core/tests/font.test.c index b368454..7775ab8 100644 --- a/core/tests/font.test.c +++ b/core/tests/font.test.c @@ -54,5 +54,5 @@ GP_TEST(load_save) /* cleanup */ fail_unless(unlink(FONT_FILE) == 0); } -END_TEST +GP_ENDTEST
http://repo.or.cz/w/gfxprim.git/commit/cbe54b1ef522cf97d90f0d4e7c909884e96ff...
commit cbe54b1ef522cf97d90f0d4e7c909884e96ffde6 Author: Tomas Gavenciak gavento@ucw.cz Date: Sun May 22 19:58:09 2011 +0200
Adapt gen/ for bit-endianness
diff --git a/core/gen/gen_blit.py b/core/gen/gen_blit.py index 78de911..df9c4b4 100644 --- a/core/gen/gen_blit.py +++ b/core/gen/gen_blit.py @@ -7,29 +7,30 @@ from gen_utils import * ## all generated direct blits, for generating GP_Blit() and others generated_blits = []
-# TODO: adapt for both bit-endianness +# TODO: adapt for both bit-endianness (in-byte prefix and suffix) # WARN: assuming little-endian in sub-byte pixels order (probably) -def gen_blit_same_t(size, header, code): - "Generate a function blitting the same type of pixel" - "Only depends on bpp (bit size)" +def gen_blit_same_t(size, size_suffix, header, code): + "Generate a function blitting the same type of pixel." + "Only depends on bpp (bit size), size_suffix must be" + "of form 8BPP, 2BPP_LE and the like."
header.append(r( - "n/*** Blit preserving type, variant for {{ size }}bpp ***n" + "n/*** Blit preserving type, variant for {{ size_suffix }} ***n" " * Assumes the contexts to be of the right types and sizesn" " * Ignores transformations and clipping */nn" - "void GP_Blit_{{ size }}bpp(const GP_Context *c1, int x1, int y1, int w, int h,n" + "void GP_Blit_{{ size_suffix }}(const GP_Context *c1, int x1, int y1, int w, int h,n" " GP_Context *c2, int x2, int y2);n", - size=size)) + size=size, size_suffix=size_suffix))
code.append(r( - "n/*** Blit preservimg type, variant for {{ size }} bpp ***/n" - "void GP_Blit_{{ size }}bpp(const GP_Context *c1, int x1, int y1, int w, int h,n" + "n/*** Blit preservimg type, variant for {{ size_suffix }} ***/n" + "void GP_Blit_{{ size_suffix }}(const GP_Context *c1, int x1, int y1, int w, int h,n" " GP_Context *c2, int x2, int y2)n" "{n" " if (unlikely(w == 0 || h == 0)) return;nn" " /* Special case - copy whole line-block with one memcpy() */n" - " if (x1 == 0 && x2 == 0 && w == c1->w && c1->w == c2->w &&n" - " c1->bytes_per_row == c2->bytes_per_row) {n" + " if ((x1 == 0) && (x2 == 0) && (w == c1->w) && (c1->w == c2->w) &&n" + " (c1->bytes_per_row == c2->bytes_per_row)) {n" " memcpy(c2->pixels + c2->bytes_per_row * y2,n" " c1->pixels + c1->bytes_per_row * y1,n" " c1->bytes_per_row * h);n" @@ -38,24 +39,25 @@ def gen_blit_same_t(size, header, code): "{% if size>=8 %}" " /* General case - memcpy() each horizontal line */n" " for (int i=0; i<h; i++)n" - " memcpy(GP_PIXEL_ADDR_{{ size }}bpp(c2, x2, y2 + i), n" - " GP_PIXEL_ADDR_{{ size }}bpp(c1, x2, y2 + i),n" + " memcpy(GP_PIXEL_ADDR_{{ size_suffix }}(c2, x2, y2 + i), n" + " GP_PIXEL_ADDR_{{ size_suffix }}(c1, x2, y2 + i),n" " {{ size/8 }} * w);n" "{% else %}" # subtle - rectangles may not be byte aligned in the same way - " /* Number of bits in the first byte */n" - " int al1 = GP_PIXEL_ADDR_OFFSET(x1);n" - " int al2 = GP_PIXEL_ADDR_OFFSET(x2);n" - " if (al1 == al2) {n" - " /* Number of bits in the last byte */n" - " int end_al = GP_PIXEL_ADDR_OFFSET(x1 + w);n" - " assert((w - al1 - end_al) % {{ ppb }} == 0);n" - " int copy_size = (w - al1 - end_al) / {{ ppb }};n" + " /* Alignment (index) of first bits in the first byte */n" + " int al1 = GP_PIXEL_ADDR_OFFSET_{{ size_suffix }}(x1);n" + " int al2 = GP_PIXEL_ADDR_OFFSET_{{ size_suffix }}(x2);n" + " /* Special case of the same alignment and width >=2 bytes */n" + " if ((al1 == al2) && (w * {{ size }} >= 16)) {n" + " /* Number of bits in the last partial byte */n" + " int end_al = GP_PIXEL_ADDR_OFFSET_{{ size_suffix }}(x1 + w);n" + " GP_ASSERT(({{ size }} * w - al1 - end_al) % 8 == 0);n" + " int copy_size = ({{ size }} * w - al1 - end_al) / 8;n" " /* First and last byte incident to the line */n" - " uint8_t *p1 = GP_PIXEL_ADDR_{{ size }}bpp(c1, x1, y1);n" - " uint8_t *p2 = GP_PIXEL_ADDR_{{ size }}bpp(c2, x2, y2);n" - " uint8_t *end_p1 = GP_PIXEL_ADDR_{{ size }}bpp(c1, x1 + w - 1, y1);n" - " uint8_t *end_p2 = GP_PIXEL_ADDR_{{ size }}bpp(c2, x2 + w - 1, y2);n" - " for (int i=0; i<h; i++) {n" + " uint8_t *p1 = GP_PIXEL_ADDR_{{ size_suffix }}(c1, x1, y1);n" + " uint8_t *p2 = GP_PIXEL_ADDR_{{ size_suffix }}(c2, x2, y2);n" + " uint8_t *end_p1 = GP_PIXEL_ADDR_{{ size_suffix }}(c1, x1 + w - 1, y1);n" + " uint8_t *end_p2 = GP_PIXEL_ADDR_{{ size_suffix }}(c2, x2 + w - 1, y2);n" + " for (int i = 0; i < h; i++) {n" " if (al1 != 0)n" " GP_SET_BITS(al1, 8-al1, *p2, GP_GET_BITS(al1, 8-al1, *p1));n" " memcpy(p2+(al1!=0), p1+(al1!=0), copy_size);n" @@ -66,20 +68,10 @@ def gen_blit_same_t(size, header, code): " p2 += c2->bytes_per_row;n" " end_p2 += c2->bytes_per_row;n" " }n" -# " /* Check for source strip inside just one byte */n" -# " if (x1 / {{ ppb }} == (x1 + w - 1) / {{ ppb }}) {n" -# " int bwidth = w * {{ size }};n" -# " uint8_t v1 = ((* GP_PIXEL_ADDR_{{ size }}bpp(c1, x1, y1)) <<n" -# " GP_PIXEL_ADDR_OFFSET_{{ size }}bpp(x1)) >>n" -# " GP_PIXEL_ADDR_OFFSET_{{ size }}bpp(x2);n" -# " uint8_t *p2 = GP_PIXEL_ADDR_{{ size }}bpp(c2, x2, y2);n" -# " " -# " GP_SET_BITS( -# " /// TODO: CHECK for narrow lines, these are special-case " } else /* Different bit-alignment, can't use memcpy() */n" - " GP_Blit_V{{ size }}(c1, x1, y1, w, h, c2, x2, y2);n" + " GP_Blit_Naive(c1, x1, y1, w, h, c2, x2, y2);n" "{% endif %}" - "}n", size=size, ppb=8/size)) + "}n", size=size, size_suffix=size_suffix))
def gen_blit_t(f1, f2, header, code): diff --git a/core/gen/gen_pixeltype.py b/core/gen/gen_pixeltype.py index b677d45..683fe87 100644 --- a/core/gen/gen_pixeltype.py +++ b/core/gen/gen_pixeltype.py @@ -21,7 +21,7 @@ def str_description(ptype): return r( "/* Automatically generated code for pixel type {{ f.name }}n" " *n" - " * Size (bpp): {{ f.size }}n" + " * Size (bpp): {{ f.size }} ({{ f.size_suffix }})n" "{% if f.size<8 %} * Bit endian: {{ f.bit_endian }}n{% endif %}" " * Pixel structure: {{ ''.join(f.bits) }}n" " * Channels: n" @@ -148,35 +148,31 @@ def gen_get_pixel_addr(ptype, header, code): "Generate GP_PIXEL_ADDR_<TYPE> and _OFFSET_<TYPE> macros" header.append(r( "/* macro to get address of pixel {{ f.name }} in a context */n" - "#define GP_PIXEL_ADDR_{{ f.name }}(context, x, y) GP_PIXEL_ADDR_{{ f.size }}bpp(context, x, y)n" + "#define GP_PIXEL_ADDR_{{ f.name }}(context, x, y) GP_PIXEL_ADDR_{{ f.size_suffix }}(context, x, y)n" "/* macro to get bit-offset of pixel {{ f.name }} */n" - "{% if f.size<8 %}" - "#define GP_PIXEL_ADDR_OFFSET_{{ f.name }}(x) " - " GP_PIXEL_ADDR_OFFSET_{{ f.size }}bpp(x)n" - "{% else %}" # bit_endian matters - "#define GP_PIXEL_ADDR_OFFSET_{{ f.name }}(x) " - " GP_PIXEL_ADDR_OFFSET_{{ f.size }}bpp_{{ f.bit_endian }}(x)n" - "{% endif %}", + "#define GP_PIXEL_ADDR_OFFSET_{{ f.name }}(x) " + " GP_PIXEL_ADDR_OFFSET_{{ f.size_suffix }}(x)n", f=ptype))
-def gen_get_pixel_addr_bpp(size, bit_endian, header, code): - "Generate GP_PIXEL_ADDR_<SIZE>bpp and _OFFSET_<SIZE>bpp macros" - assert bit_endian in ['BE','LE'] +def gen_get_pixel_addr_bpp(size, size_suffix, header, code): + "Generate GP_PIXEL_ADDR_<size_suffix> and _OFFSET_<size_suffix> macros" + bit_endian = size_suffix[-2:] + if size < 8: + assert bit_endian in ['LE', 'BE'] header.append(r( - "/* macro to get address of pixel in a {{ size }}bpp context */n" - "#define GP_PIXEL_ADDR_{{ size }}bpp(context, x, y) " + "/* macro to get address of pixel in a {{ size_suffix }} context */n" + "#define GP_PIXEL_ADDR_{{ size_suffix }}(context, x, y) " " ((context)->pixels + (context)->bytes_per_row * (y) + {{ size//8 }} * (x))n" - "/* macro to get bit-offset of pixel in {{ size }}bpp context */n" - "{% if size>=8 %}" - "#define GP_PIXEL_ADDR_OFFSET_{{ size }}bpp(x) (0)n" + "/* macro to get bit-offset of pixel in {{ size_suffix }} context */n" + "{% if size >= 8 %}" + "#define GP_PIXEL_ADDR_OFFSET_{{ size_suffix }}(x) (0)n" "{% else %}" # bit_endian matters "{% if bit_endian=='LE' %}" - "#define GP_PIXEL_ADDR_OFFSET_{{ size }}bpp(x) " + "#define GP_PIXEL_ADDR_OFFSET_{{ size_suffix }}(x) " " (((x) % {{ 8//size }}) * {{ size }})n" "{% else %}" - "#define GP_PIXEL_ADDR_OFFSET_{{ size }}bpp(x) " + "#define GP_PIXEL_ADDR_OFFSET_{{ size_suffix }}(x) " " ({{ 8-size }} - ((x) % {{ 8//size }}) * {{ size }})n" "{% endif %}" "{% endif %}", - size=size, bit_endian=bit_endian)) - + size=size, size_suffix=size_suffix, bit_endian=bit_endian)) diff --git a/core/gen/make_GP_Blit.py b/core/gen/make_GP_Blit.py index a439898..22f3f82 100644 --- a/core/gen/make_GP_Blit.py +++ b/core/gen/make_GP_Blit.py @@ -19,12 +19,15 @@ gen_headers(h, c, hdef = "GP_PIXEL_BLIT_GEN_H")
c.append('#include <stdio.h>n') +c.append('#include <string.h>n') c.append('#include "GP_Pixel.h"n') c.append('#include "GP_Context.h"n') c.append('#include "GP_Blit.gen.h"n')
for bpp in bitsizes: - gen_blit_same_t(bpp, h, c) + for bit_endian in bit_endians: + if (bpp < 8) or (bit_endian == bit_endians[0]): + gen_blit_same_t(bpp, get_size_suffix(bpp, bit_endian), h, c)
## Close the files
diff --git a/core/gen/make_GP_Pixel.py b/core/gen/make_GP_Pixel.py index e09ba13..a0be576 100644 --- a/core/gen/make_GP_Pixel.py +++ b/core/gen/make_GP_Pixel.py @@ -19,6 +19,7 @@ gen_headers(h, c, hdef = "GP_PIXEL_GEN_H")
c.append('#include <stdio.h>n') +c.append('#include <GP.h>n') c.append('#include "GP_Pixel.h"n')
## Enum of types @@ -44,11 +45,9 @@ for t in pixeltypes.values():
# Per-bpp macros for bpp in bitsizes: - if bpp>=8: - gen_get_pixel_addr_bpp(bpp, 'LE', h, c) - else: # bit_endian matters - for be in bit_endians: - gen_get_pixel_addr_bpp(bpp, be, h, c) + for bit_endian in bit_endians: + if (bpp < 8) or (bit_endian == bit_endians[0]): + gen_get_pixel_addr_bpp(bpp, get_size_suffix(bpp, bit_endian), h, c)
## Conversion macros
diff --git a/core/gen/pixeltype.py b/core/gen/pixeltype.py index 677ca52..3e85dfe 100644 --- a/core/gen/pixeltype.py +++ b/core/gen/pixeltype.py @@ -25,13 +25,22 @@ bitsizes = [1,2,4,8,16,24,32] ## bit_endian values bit_endians = ['LE', 'BE']
+## Create pixel-size suffix (16BPP or 4BPP_LE) +def get_size_suffix(bpp, bit_endian): + assert bpp in bitsizes + assert bit_endian in bit_endians + size_suffix = '%dBPP' % (bpp) + if bpp < 8: + size_suffix += '_' + bit_endian + return size_suffix +
class PixelType(object): """Representation of one GP_PixelType""" def __init__(self, name, size, chanslist, number=None, bit_endian=None): """`name` must be a valid C identifier `size` is in bits, allowed are 1, 2, 4, 8, 16, 24, 32 - `bit_endian` is order of 1,2,4bpp pixels in a byte, either 'BE' or 'LE' + `bit_endian` is order of 1,2,4BPP pixels in a byte, either 'BE' or 'LE' `chanslist` is a list of triplets describing individual channels as [ (`chan_name`, `bit_offset`, `bit_size`) ] `chan_name` is usually one of: R, G, B, V (value, used for grayscale), A (opacity) @@ -52,6 +61,11 @@ class PixelType(object): assert bit_endian in bit_endians self.bit_endian = bit_endian
+ if self.size == 0: + self.size_suffix = "INVALID" + else: + self.size_suffix = get_size_suffix(self.size, self.bit_endian) + # Numbering from 1 if number is not None: self.number = number
http://repo.or.cz/w/gfxprim.git/commit/3814872780477efda3b924604c52c6583f77e...
commit 3814872780477efda3b924604c52c6583f77ecce Author: Tomas Gavenciak gavento@ucw.cz Date: Sun May 22 16:36:27 2011 +0200
Fix type warning
diff --git a/core/GP_Counter.c b/core/GP_Counter.c index 0f0d26b..a7809d3 100644 --- a/core/GP_Counter.c +++ b/core/GP_Counter.c @@ -54,12 +54,12 @@ void GP_PrintCounters(struct FILE *f) int i; GP_CHECK(f != NULL); if (GP_used_counters == 0) - fprintf(f, "[ no counters defined ]n"); + fprintf((FILE *) f, "[ no counters defined ]n"); for (i = 0; i < GP_used_counters; i++) - fprintf(f, "%*s : %lldn", -GP_COUNTER_NAME_LEN, GP_counter_list[i].name, - *(GP_counter_list[i].counter)); + fprintf((FILE *) f, "%*s : %lldn", -GP_COUNTER_NAME_LEN, + GP_counter_list[i].name, *(GP_counter_list[i].counter)); if (GP_counter_list_overflow > 0) - fprintf(f, "[ unable to allocate new counter %lld times ]n", + fprintf((FILE *) f, "[ unable to allocate new counter %lld times ]n", GP_counter_list_overflow); #endif /* GP_IMPLEMENT_COUNTERS */ }
http://repo.or.cz/w/gfxprim.git/commit/0cfb5e91e793cb577881a8bfc1c5c61e53534...
commit 0cfb5e91e793cb577881a8bfc1c5c61e5353422b Merge: 83881d0 44de9a4 Author: Tomas Gavenciak gavento@ucw.cz Date: Sun May 22 15:17:27 2011 +0200
Merge branch 'master' into generate
Conflicts: core/GP_Common.h
diff --cc core/GP_FnPerBpp.h index e97d54b,2a745e7..cad977c --- a/core/GP_FnPerBpp.h +++ b/core/GP_FnPerBpp.h @@@ -30,38 -30,18 +30,33 @@@ * of the specified function depending on the bit depth of the context. * Extra arguments are arguments to be passed to the function. * Returns GP_ENOIMPL if the bit depth is unknown. - * - * Note: Relying on existing context variable is ugly and broken, I know... - * But I hate doing just another GP_FN_PER_BPP macro for functions - * that takes context as it's only argument. Or passing the context - * twice or whatever else. */ - #define GP_FN_PER_BPP(FN_NAME, ...) + #define GP_FN_PER_BPP(FN_NAME, bpp, ...) - switch (context->bpp) { + switch (bpp) { case 1: - FN_NAME##1bpp(__VA_ARGS__); + { + if (context->bit_endian==GP_BIT_ENDIAN_LE) + FN_NAME##1bpp_LE(__VA_ARGS__); + else + FN_NAME##1bpp_BE(__VA_ARGS__); + } break; case 2: - FN_NAME##2bpp(__VA_ARGS__); + { + if (context->bit_endian==GP_BIT_ENDIAN_LE) + FN_NAME##2bpp_LE(__VA_ARGS__); + else + FN_NAME##2bpp_BE(__VA_ARGS__); + } break; case 4: - FN_NAME##4bpp(__VA_ARGS__); + { + if (context->bit_endian==GP_BIT_ENDIAN_LE) + FN_NAME##4bpp_LE(__VA_ARGS__); + else + FN_NAME##4bpp_BE(__VA_ARGS__); + } break; case 8: FN_NAME##8bpp(__VA_ARGS__); @@@ -76,35 -56,18 +71,33 @@@ FN_NAME##32bpp(__VA_ARGS__); break; default: - return GP_ENOIMPL; + break; } - - return GP_ESUCCESS;
- #define GP_FN_RET_PER_BPP(FN_NAME, ...) + #define GP_FN_RET_PER_BPP(FN_NAME, bpp, ...) - switch (context->bpp) { + switch (bpp) { case 1: - return FN_NAME##1bpp(__VA_ARGS__); + { + if (context->bit_endian==GP_BIT_ENDIAN_LE) + return FN_NAME##1bpp_LE(__VA_ARGS__); + else + return FN_NAME##1bpp_BE(__VA_ARGS__); + } case 2: - return FN_NAME##2bpp(__VA_ARGS__); + { + if (context->bit_endian==GP_BIT_ENDIAN_LE) + return FN_NAME##2bpp_LE(__VA_ARGS__); + else + return FN_NAME##2bpp_BE(__VA_ARGS__); + } case 4: - return FN_NAME##4bpp(__VA_ARGS__); + { + if (context->bit_endian==GP_BIT_ENDIAN_LE) + return FN_NAME##4bpp_LE(__VA_ARGS__); + else + return FN_NAME##4bpp_BE(__VA_ARGS__); + } case 8: return FN_NAME##8bpp(__VA_ARGS__); case 16: diff --cc core/Makefile index 59d9a7e,b23dad4..cb2a01c --- a/core/Makefile +++ b/core/Makefile @@@ -32,23 -33,6 +33,24 @@@ $(LIBRARY).so: $(OBJECTS clean: rm -f $(LIBRARY).a $(LIBRARY).so $(LIBRARY).so.0 rm -f *.o + rm -f ../backends/*.o cd tests && $(MAKE) clean + rm -f $(GENERATED) + + +GENERATORS=$(wildcard gen/*.py) +GENERATED=GP_Pixel_Scale.gen.h + GP_Pixel.gen.c GP_Pixel.gen.h + GP_Blit.gen.h GP_Blit.gen.c + +GP_Pixel_Scale.gen.h: $(GENERATORS) + python gen/make_GP_Pixel_Scale.py GP_Pixel_Scale.gen.h + +GP_Pixel.gen.c GP_Pixel.gen.h: $(GENERATORS) + python gen/make_GP_Pixel.py GP_Pixel.gen.h GP_Pixel.gen.c + +GP_Blit.gen.c GP_Blit.gen.h: $(GENERATORS) + python gen/make_GP_Blit.py GP_Blit.gen.h GP_Blit.gen.c + +generated: $(GENERATED)
http://repo.or.cz/w/gfxprim.git/commit/83881d075d4d203f6949641c09d45d7f4ab6b...
commit 83881d075d4d203f6949641c09d45d7f4ab6b6c0 Author: Tomas Gavenciak gavento@ucw.cz Date: Tue Apr 5 02:45:22 2011 +0200
Fixed, extended and tested GP_Counter
Fixed bug in GetCounter Finished writing tests Added GP_SetCounter
diff --git a/core/GP_Counter.c b/core/GP_Counter.c index e5922d0..0f0d26b 100644 --- a/core/GP_Counter.c +++ b/core/GP_Counter.c @@ -21,6 +21,7 @@ *****************************************************************************/
#include <string.h> +#include <stdio.h> #include "GP_Common.h" #include "GP_Counter.h"
@@ -47,10 +48,11 @@ static GP_Counter_t GP_counter_list_overflow = 0;
#endif /* GP_IMPLEMENT_COUNTERS */
-void GP_PrintCounters(FILE *f) +void GP_PrintCounters(struct FILE *f) { #ifdef GP_IMPLEMENT_COUNTERS int i; + GP_CHECK(f != NULL); if (GP_used_counters == 0) fprintf(f, "[ no counters defined ]n"); for (i = 0; i < GP_used_counters; i++) @@ -73,7 +75,7 @@ GP_Counter GP_GetCounter(const char *name)
/* Bisect GP_counter_list to find either the counter or a place for it * interval [l, r) (not incl. r) */ - while(r > l + 1) { + while(r > l) { int med = (r + l) / 2; /* Here never equal to r, might be l */ int cmp = strcmp(GP_counter_list[med].name, name); if (cmp == 0) @@ -94,7 +96,7 @@ GP_Counter GP_GetCounter(const char *name) }
/* Move the counter records up and initialize a new one */ - memmove(GP_counter_list + l, GP_counter_list + l + 1, + memmove(GP_counter_list + l + 1, GP_counter_list + l, sizeof(struct GP_CounterRecord) * GP_used_counters - l); strcpy(GP_counter_list[l].name, name); GP_counter_list[l].counter = GP_counters + GP_used_counters; diff --git a/core/GP_Counter.h b/core/GP_Counter.h index 3c0358b..f9e501e 100644 --- a/core/GP_Counter.h +++ b/core/GP_Counter.h @@ -20,6 +20,9 @@ * * *****************************************************************************/
+#ifndef GP_COUNTER_H +#define GP_COUNTER_H + /* * Simple global named 64-bit counters. * @@ -52,7 +55,7 @@ typedef GP_Counter_t *GP_Counter; * Increase a counter by 1. */
-inline void GP_IncCounter(GP_Counter counter) +static inline void GP_IncCounter(GP_Counter counter) { #ifdef GP_IMPLEMENT_COUNTERS if (!counter) return; @@ -65,7 +68,7 @@ inline void GP_IncCounter(GP_Counter counter) * No checks for underflow. */
-inline void GP_AddCounter(GP_Counter counter, GP_Counter_t delta) +static inline void GP_AddCounter(GP_Counter counter, GP_Counter_t delta) { #ifdef GP_IMPLEMENT_COUNTERS if (!counter) return; @@ -74,6 +77,18 @@ inline void GP_AddCounter(GP_Counter counter, GP_Counter_t delta) }
/* + * Set counter to given value. + */ + +static inline void GP_SetCounter(GP_Counter counter, GP_Counter_t value) +{ +#ifdef GP_IMPLEMENT_COUNTERS + if (!counter) return; + (*counter) = value; +#endif /* GP_IMPLEMENT_COUNTERS */ +} + +/* * Return counter value */
@@ -92,7 +107,8 @@ inline GP_Counter_t GP_CounterVal(GP_Counter counter) * Includes info about counter-list overflow */
-void GP_PrintCounters(FILE *f); +struct FILE; +void GP_PrintCounters(struct FILE *f);
/* * Lookup a counter by name, possibly creating a new one. @@ -106,3 +122,4 @@ void GP_PrintCounters(FILE *f);
GP_Counter GP_GetCounter(const char *name);
+#endif /* GP_COUNTER_H */ diff --git a/core/tests/GP_Counter.test.c b/core/tests/GP_Counter.test.c index a334106..8f8ddd3 100644 --- a/core/tests/GP_Counter.test.c +++ b/core/tests/GP_Counter.test.c @@ -21,49 +21,60 @@ *****************************************************************************/
#include <string.h> +#include <stdio.h>
-#include "GP_Test.h" +#include "GP_Tests.h" #include "GP_Counter.h"
GP_SUITE(GP_Counter)
GP_TEST(Smoke) { - fail_unless(GP_CounterVal(NULL) == 0); - GP_IncCounter(NULL); - GP_AddCounter(NULL, -10); - fail_unless(GP_GetCounter("") != NULL); + fail_unless(GP_CounterVal(NULL) == 0); + GP_IncCounter(NULL); + GP_AddCounter(NULL, -10); + fail_unless(GP_GetCounter("") != NULL);
- GP_IncCounter(GP_GetCounter("a")); - fail_unless(GP_CounterVal(GP_GetCounter("a")) == 1); + GP_IncCounter(GP_GetCounter("a")); + fail_unless(GP_CounterVal(GP_GetCounter("a")) == 1); + + GP_PrintCounters(fopen("/dev/null","wt")); } +END_TEST
GP_TEST(Allocation) { - GP_IncCounter(GP_GetCounter("a")); - GP_AddCounter(GP_GetCounter("e"), -42); - GP_AddCounter(GP_GetCounter("b"), -8); - GP_IncCounter(GP_GetCounter("a")); - GP_IncCounter(GP_GetCounter("d")); - GP_Counter b = GP_GetCounter("b"); - GP_AddCounter(GP_GetCounter("c"), 21); - GP_IncCounter(GP_GetCounter("b")); - GP_IncCounter(b); - - fail_unless(GP_CounterVal(GP_GetCounter("a")) == 2); - fail_unless(GP_CounterVal(GP_GetCounter("b")) == -6); - fail_unless(GP_CounterVal(GP_GetCounter("c")) == 21); - fail_unless(GP_CounterVal(GP_GetCounter("d")) == 1); - fail_unless(GP_CounterVal(GP_GetCounter("e")) == -42); + /* random-like operations with counters, + * should test reasonably many combinations */ + GP_SetCounter(GP_GetCounter("a"), 11); + GP_AddCounter(GP_GetCounter("e"), -42); + GP_Counter b = GP_GetCounter("b"); + GP_IncCounter(GP_GetCounter("a")); + GP_GetCounter("d"); + GP_AddCounter(GP_GetCounter("c"), 21); + GP_IncCounter(GP_GetCounter("b")); + GP_AddCounter(GP_GetCounter("b"), -8); + GP_IncCounter(b); + GP_SetCounter(GP_GetCounter("f"), 91); + GP_SetCounter(GP_GetCounter("f"), -1); + + fail_unless(GP_CounterVal(GP_GetCounter("a")) == 12); + fail_unless(GP_CounterVal(GP_GetCounter("b")) == -6); + fail_unless(GP_CounterVal(GP_GetCounter("c")) == 21); + fail_unless(GP_CounterVal(GP_GetCounter("d")) == 0); + fail_unless(GP_CounterVal(GP_GetCounter("e")) == -42); + fail_unless(GP_CounterVal(GP_GetCounter("f")) == -1); } +END_TEST
GP_TEST(Overflow) { - char buf[8]; - for (int i = 0; i < GP_COUNTER_MAX + 10; i++) { - sprintf(buf, "%d", i); - GP_GetCounter(buf); - } - fail_unless(GP_GetCounter("") == NULL); + char buf[8]; + for (int i = 0; i < GP_COUNTER_MAX; i++) { + sprintf(buf, "%d", i); + fail_if(GP_GetCounter(buf) == NULL); + } + fail_unless(GP_GetCounter("next") == NULL); } +END_TEST
http://repo.or.cz/w/gfxprim.git/commit/e57fbf5bbbc9b4618c8ac015ac9986bd928f7...
commit e57fbf5bbbc9b4618c8ac015ac9986bd928f797c Author: Tomas Gavenciak gavento@ucw.cz Date: Tue Apr 5 02:42:53 2011 +0200
Remove code to be replaced
minor updates after bitendian merge tests still compile only with lots of hacks
diff --git a/core/GP_Pixel.c b/core/GP_Pixel.c index 79386c1..e7f4b80 100644 --- a/core/GP_Pixel.c +++ b/core/GP_Pixel.c @@ -25,230 +25,211 @@
#include "GP.h"
-struct PixelTypeInfo { - const char *type_name; /* human-readable name */ - GP_ColorType color_type; /* color type used for this pixel type */ - unsigned int bits; /* how many bits the pixel occupies */ -}; - -/* This table shows relations of pixel types to color types, their names - * and bits per pixel. - */ -static struct PixelTypeInfo pixel_type_infos[] = { - { "Unknown pixel type", GP_NOCOLOR, 0 }, - { "Palette 4bit", GP_PAL4, 4 }, - { "Palette 8bit", GP_PAL8, 8 }, - { "Grayscale 1bit", GP_G1, 1 }, - { "Grayscale 2bits", GP_G2, 2 }, - { "Grayscale 4bits", GP_G4, 4 }, - { "Grayscale 8bits", GP_G8, 8 }, - { "RGB 555", GP_RGB555, 16 }, - { "BGR 555", GP_RGB555, 16 }, - { "RGB 565", GP_RGB565, 16 }, - { "BGR 565", GP_RGB565, 16 }, - { "RGB 888", GP_RGB888, 24 }, - { "BGR 888", GP_RGB888, 24 }, - { "XRGB 8888", GP_RGB888, 32 }, - { "RGBX 8888", GP_RGB888, 32 }, - { "XBGR 8888", GP_RGB888, 32 }, - { "BGRX 8888", GP_RGB888, 32 }, - { "ARGB 8888", GP_RGBA8888, 32 }, - { "RGBA 8888", GP_RGBA8888, 32 }, - { "ABGR 8888", GP_RGBA8888, 32 }, - { "BGRA 8888", GP_RGBA8888, 32 } -}; - -const char *GP_PixelTypeName(GP_PixelType type) -{ - if (type >= GP_PIXEL_MAX) - return "INVALID TYPE"; - - return pixel_type_infos[type].type_name; -} - -uint32_t GP_PixelSize(GP_PixelType type) -{ - if (type >= GP_PIXEL_MAX) - return 0; - - return pixel_type_infos[type].bits; -} - -GP_ColorType GP_PixelTypeToColorType(GP_PixelType type) -{ - if (type >= GP_PIXEL_MAX) - return GP_COLMAX; - - return pixel_type_infos[type].color_type; -} - -#define CHECK_RET(ret) if (ret != GP_ESUCCESS && ret != GP_EUNPRECISE) return ret; - -GP_RetCode GP_ColorToPixelType(GP_PixelType pixel_type, GP_Color color, GP_Pixel *pixel) -{ - if (pixel == NULL) - return GP_ENULLPTR; - - GP_RetCode ret; - - switch (pixel_type) { - case GP_PIXEL_PAL4_LE: - case GP_PIXEL_PAL4_BE: - ret = GP_ColorConvert(&color, GP_PAL4); - CHECK_RET(ret); - *pixel = color.pal4.index; - return ret; - break; - case GP_PIXEL_PAL8: - ret = GP_ColorConvert(&color, GP_PAL8); - CHECK_RET(ret); - *pixel = color.pal8.index; - return ret; - break; - case GP_PIXEL_G1_LE: - case GP_PIXEL_G1_BE: - ret = GP_ColorConvert(&color, GP_G1); - CHECK_RET(ret); - *pixel = color.g1.gray; - return ret; - break; - case GP_PIXEL_G2_LE: - case GP_PIXEL_G2_BE: - ret = GP_ColorConvert(&color, GP_G2); - CHECK_RET(ret); - *pixel = color.g2.gray; - return ret; - break; - case GP_PIXEL_G4_LE: - case GP_PIXEL_G4_BE: - ret = GP_ColorConvert(&color, GP_G4); - CHECK_RET(ret); - *pixel = color.g4.gray; - return ret; - break; - case GP_PIXEL_G8: - ret = GP_ColorConvert(&color, GP_G8); - CHECK_RET(ret); - *pixel = color.g8.gray; - return ret; - break; - case GP_PIXEL_RGB565: - ret = GP_ColorConvert(&color, GP_RGB565); - CHECK_RET(ret); - *pixel = color.rgb565.red << 0x0b | - color.rgb565.green << 0x05 | - color.rgb565.blue; - case GP_PIXEL_RGB888: - case GP_PIXEL_XRGB8888: - ret = GP_ColorConvert(&color, GP_RGB888); - CHECK_RET(ret); - *pixel = color.rgb888.red << 0x10 | - color.rgb888.green << 0x08 | - color.rgb888.blue; - return ret; - break; - case GP_PIXEL_BGR888: - case GP_PIXEL_XBGR8888: - ret = GP_ColorConvert(&color, GP_RGB888); - CHECK_RET(ret); - *pixel = color.rgb888.red | - color.rgb888.green << 0x08 | - color.rgb888.blue << 0x10; - return ret; - break; - case GP_PIXEL_RGBX8888: - ret = GP_ColorConvert(&color, GP_RGB888); - CHECK_RET(ret); - *pixel = color.rgb888.red << 0x18 | - color.rgb888.green << 0x10 | - color.rgb888.blue << 0x8; - return ret; - break; - case GP_PIXEL_BGRX8888: - ret = GP_ColorConvert(&color, GP_RGB888); - CHECK_RET(ret); - *pixel = color.rgb888.red << 0x08 | - color.rgb888.green << 0x10 | - color.rgb888.blue << 0x18; - return ret; - break; - case GP_PIXEL_ARGB8888: - ret = GP_ColorConvert(&color, GP_RGBA8888); - CHECK_RET(ret); - *pixel = color.rgba8888.red << 0x10 | - color.rgba8888.green << 0x08 | - color.rgba8888.blue | - color.rgba8888.alpha << 0x18; - return ret; - break; - case GP_PIXEL_RGBA8888: - ret = GP_ColorConvert(&color, GP_RGBA8888); - CHECK_RET(ret); - *pixel = color.rgba8888.red << 0x18 | - color.rgba8888.green << 0x10 | - color.rgba8888.blue << 0x08 | - color.rgba8888.alpha; - return ret; - break; - case GP_PIXEL_ABGR8888: - ret = GP_ColorConvert(&color, GP_RGBA8888); - CHECK_RET(ret); - *pixel = color.rgba8888.red | - color.rgba8888.green << 0x08 | - color.rgba8888.blue << 0x10 | - color.rgba8888.alpha << 0x18; - return ret; - break; - case GP_PIXEL_BGRA8888: - ret = GP_ColorConvert(&color, GP_RGBA8888); - CHECK_RET(ret); - *pixel = color.rgba8888.red << 0x08 | - color.rgba8888.green << 0x10 | - color.rgba8888.blue << 0x18 | - color.rgba8888.alpha; - return ret; - break; - case GP_PIXEL_MAX: - break; - } - - if (pixel_type >= GP_PIXEL_MAX) - return GP_EINVAL; - else - return GP_ENOIMPL; -} - -GP_RetCode GP_ColorToPixel(GP_Context *context, GP_Color color, GP_Pixel *pixel) -{ - if (context == NULL || pixel == NULL) - return GP_ENULLPTR; - - return GP_ColorToPixelType(context->pixel_type, color, pixel); -} - -GP_RetCode GP_ColorNameToPixel(GP_Context *context, GP_ColorName name, GP_Pixel *pixel) -{ - if (context == NULL || pixel == NULL) - return GP_ENULLPTR; - - GP_Color color = GP_COLNAME_PACK(name); - return GP_ColorToPixelType(context->pixel_type, color, pixel); -} - -GP_RetCode GP_ColorNameToPixelType(GP_PixelType pixel_type, GP_ColorName name, GP_Pixel *pixel) -{ - if (pixel == NULL) - return GP_ENULLPTR; - - GP_Color color = GP_COLNAME_PACK(name); - return GP_ColorToPixelType(pixel_type, color, pixel); -} - -GP_RetCode GP_RGBToPixel(GP_Context *context, uint8_t r, uint8_t g, uint8_t b, GP_Pixel *pixel) -{ - if (pixel == NULL) - return GP_ENULLPTR; - - GP_Color color = GP_RGB888_PACK(r, g, b); - return GP_ColorToPixelType(context->pixel_type, color, pixel); -} +/////// removed by gavento +// struct PixelTypeInfo { +// const char *type_name; /* human-readable name */ +// GP_ColorType color_type; /* color type used for this pixel type */ +// unsigned int bits; /* how many bits the pixel occupies */ +// }; +// +// /* This table shows relations of pixel types to color types, their names +// * and bits per pixel. +// */ +// static struct PixelTypeInfo pixel_type_infos[] = { +// { "Unknown pixel type", GP_NOCOLOR, 0 }, +// { "Palette 4bit", GP_PAL4, 4 }, +// { "Palette 8bit", GP_PAL8, 8 }, +// { "Grayscale 1bit", GP_G1, 1 }, +// { "Grayscale 2bits", GP_G2, 2 }, +// { "Grayscale 4bits", GP_G4, 4 }, +// { "Grayscale 8bits", GP_G8, 8 }, +// { "RGB 555", GP_RGB555, 16 }, +// { "BGR 555", GP_RGB555, 16 }, +// { "RGB 565", GP_RGB565, 16 }, +// { "BGR 565", GP_RGB565, 16 }, +// { "RGB 888", GP_RGB888, 24 }, +// { "BGR 888", GP_RGB888, 24 }, +// { "XRGB 8888", GP_RGB888, 32 }, +// { "RGBX 8888", GP_RGB888, 32 }, +// { "XBGR 8888", GP_RGB888, 32 }, +// { "BGRX 8888", GP_RGB888, 32 }, +// { "ARGB 8888", GP_RGBA8888, 32 }, +// { "RGBA 8888", GP_RGBA8888, 32 }, +// { "ABGR 8888", GP_RGBA8888, 32 }, +// { "BGRA 8888", GP_RGBA8888, 32 } +// }; +// +// GP_ColorType GP_PixelTypeToColorType(GP_PixelType type) +// { +// if (type >= GP_PIXEL_MAX) +// return GP_COLMAX; +// +// return pixel_type_infos[type].color_type; +// } +// +// #define CHECK_RET(ret) if (ret != GP_ESUCCESS && ret != GP_EUNPRECISE) return ret; +// +// GP_RetCode GP_ColorToPixelType(GP_PixelType pixel_type, GP_Color color, GP_Pixel *pixel) +// { +// if (pixel == NULL) +// return GP_ENULLPTR; +// +// GP_RetCode ret; +// +// switch (pixel_type) { +// case GP_PIXEL_PAL4: +// ret = GP_ColorConvert(&color, GP_PAL4); +// CHECK_RET(ret); +// *pixel = color.pal4.index; +// return ret; +// break; +// case GP_PIXEL_PAL8: +// ret = GP_ColorConvert(&color, GP_PAL8); +// CHECK_RET(ret); +// *pixel = color.pal8.index; +// return ret; +// break; +// case GP_PIXEL_G1: +// ret = GP_ColorConvert(&color, GP_G1); +// CHECK_RET(ret); +// *pixel = color.g1.gray; +// return ret; +// break; +// case GP_PIXEL_G2: +// ret = GP_ColorConvert(&color, GP_G2); +// CHECK_RET(ret); +// *pixel = color.g2.gray; +// return ret; +// break; +// case GP_PIXEL_G4: +// ret = GP_ColorConvert(&color, GP_G4); +// CHECK_RET(ret); +// *pixel = color.g4.gray; +// return ret; +// break; +// case GP_PIXEL_G8: +// ret = GP_ColorConvert(&color, GP_G8); +// CHECK_RET(ret); +// *pixel = color.g8.gray; +// return ret; +// break; +// case GP_PIXEL_RGB565: +// ret = GP_ColorConvert(&color, GP_RGB565); +// CHECK_RET(ret); +// *pixel = color.rgb565.red << 0x0b | +// color.rgb565.green << 0x05 | +// color.rgb565.blue; +// case GP_PIXEL_RGB888: +// case GP_PIXEL_XRGB8888: +// ret = GP_ColorConvert(&color, GP_RGB888); +// CHECK_RET(ret); +// *pixel = color.rgb888.red << 0x10 | +// color.rgb888.green << 0x08 | +// color.rgb888.blue; +// return ret; +// break; +// case GP_PIXEL_BGR888: +// case GP_PIXEL_XBGR8888: +// ret = GP_ColorConvert(&color, GP_RGB888); +// CHECK_RET(ret); +// *pixel = color.rgb888.red | +// color.rgb888.green << 0x08 | +// color.rgb888.blue << 0x10; +// return ret; +// break; +// case GP_PIXEL_RGBX8888: +// ret = GP_ColorConvert(&color, GP_RGB888); +// CHECK_RET(ret); +// *pixel = color.rgb888.red << 0x18 | +// color.rgb888.green << 0x10 | +// color.rgb888.blue << 0x8; +// return ret; +// break; +// case GP_PIXEL_BGRX8888: +// ret = GP_ColorConvert(&color, GP_RGB888); +// CHECK_RET(ret); +// *pixel = color.rgb888.red << 0x08 | +// color.rgb888.green << 0x10 | +// color.rgb888.blue << 0x18; +// return ret; +// break; +// case GP_PIXEL_ARGB8888: +// ret = GP_ColorConvert(&color, GP_RGBA8888); +// CHECK_RET(ret); +// *pixel = color.rgba8888.red << 0x10 | +// color.rgba8888.green << 0x08 | +// color.rgba8888.blue | +// color.rgba8888.alpha << 0x18; +// return ret; +// break; +// case GP_PIXEL_RGBA8888: +// ret = GP_ColorConvert(&color, GP_RGBA8888); +// CHECK_RET(ret); +// *pixel = color.rgba8888.red << 0x18 | +// color.rgba8888.green << 0x10 | +// color.rgba8888.blue << 0x08 | +// color.rgba8888.alpha; +// return ret; +// break; +// case GP_PIXEL_ABGR8888: +// ret = GP_ColorConvert(&color, GP_RGBA8888); +// CHECK_RET(ret); +// *pixel = color.rgba8888.red | +// color.rgba8888.green << 0x08 | +// color.rgba8888.blue << 0x10 | +// color.rgba8888.alpha << 0x18; +// return ret; +// break; +// case GP_PIXEL_BGRA8888: +// ret = GP_ColorConvert(&color, GP_RGBA8888); +// CHECK_RET(ret); +// *pixel = color.rgba8888.red << 0x08 | +// color.rgba8888.green << 0x10 | +// color.rgba8888.blue << 0x18 | +// color.rgba8888.alpha; +// return ret; +// break; +// case GP_PIXEL_MAX: +// break; +// } +// +// if (pixel_type >= GP_PIXEL_MAX) +// return GP_EINVAL; +// else +// return GP_ENOIMPL; +// } +// +// GP_RetCode GP_ColorToPixel(GP_Context *context, GP_Color color, GP_Pixel *pixel) +// { +// if (context == NULL || pixel == NULL) +// return GP_ENULLPTR; +// +// return GP_ColorToPixelType(context->pixel_type, color, pixel); +// } +// +// GP_RetCode GP_ColorNameToPixel(GP_Context *context, GP_ColorName name, GP_Pixel *pixel) +// { +// if (context == NULL || pixel == NULL) +// return GP_ENULLPTR; +// +// GP_Color color = GP_COLNAME_PACK(name); +// return GP_ColorToPixelType(context->pixel_type, color, pixel); +// } +// +// GP_RetCode GP_ColorNameToPixelType(GP_PixelType pixel_type, GP_ColorName name, GP_Pixel *pixel) +// { +// if (pixel == NULL) +// return GP_ENULLPTR; +// +// GP_Color color = GP_COLNAME_PACK(name); +// return GP_ColorToPixelType(pixel_type, color, pixel); +// } +// +// GP_RetCode GP_RGBToPixel(GP_Context *context, uint8_t r, uint8_t g, uint8_t b, GP_Pixel *pixel) +// { +// if (pixel == NULL) +// return GP_ENULLPTR; +// +// GP_Color color = GP_RGB888_PACK(r, g, b); +// return GP_ColorToPixelType(context->pixel_type, color, pixel); +// } diff --git a/core/GP_Pixel.h b/core/GP_Pixel.h index beaa22c..31c6400 100644 --- a/core/GP_Pixel.h +++ b/core/GP_Pixel.h @@ -81,6 +81,7 @@ typedef struct { GP_PixelType type; /* Number of the type */ const char name[16]; /* Name */ int size; /* Size in bits */ + int bit_endian; /* Order of pixels in a byte */ /**TODO : add proper type !! */ int numchannels; /* Number of channels */ const char bitmap[36]; /* String describing the bit-representaton (as in "RRRRRGGGGGGBBBBB")*/ const GP_PixelTypeChannel channels[8]; /* Individual channels */ @@ -110,6 +111,7 @@ typedef enum {
static inline const char *GP_PixelTypeName(GP_PixelType type) { + GP_CHECK(type < GP_PIXEL_MAX); return GP_PixelTypes[type].name; }
@@ -119,6 +121,7 @@ static inline const char *GP_PixelTypeName(GP_PixelType type)
static inline uint32_t GP_PixelSize(GP_PixelType type) { + GP_CHECK(type < GP_PIXEL_MAX); return GP_PixelTypes[type].size; }
http://repo.or.cz/w/gfxprim.git/commit/e1b16f55b51c64ae4e2c5755e4e1633e57916...
commit e1b16f55b51c64ae4e2c5755e4e1633e579164f0 Merge: a15037c d2b5a02 Author: Tomas Gavenciak gavento@ucw.cz Date: Tue Apr 5 02:01:39 2011 +0200
Merge branch 'bitendian' of git://repo.or.cz/gfxprim into generate
Conflicts: core/GP_Pixel.h
diff --cc core/GP_Pixel.h index a47424a,02ffa14..beaa22c --- a/core/GP_Pixel.h +++ b/core/GP_Pixel.h @@@ -51,67 -81,24 +51,79 @@@ struct GP_Context
typedef uint32_t GP_Pixel;
-/* information about ordering of pixels in byte for 1, 2 and 4 bpp */ -/* used in a one bit variable in GP_Context */ +/* Generated header */ +#include "GP_Pixel.gen.h" + +/* + * Description of one channel + * Assumes all the channel names to be at most 7 chars long + * + * The common channel names are: + * R, G, B - as usual + * V - value, for grayscale + * A - opacity (0=transparent) + * P - palette (index) + */ + +typedef struct { + char name[8]; /* Channel name */ + int offset; /* Offset in bits */ + int size; /* Bit-size */ +} GP_PixelTypeChannel; + +/* + * Description of one PixelType + * Assumes name with at most 15 chars + * Assumes at most 8 channels + */ + +typedef struct { + GP_PixelType type; /* Number of the type */ + const char name[16]; /* Name */ + int size; /* Size in bits */ + int numchannels; /* Number of channels */ + const char bitmap[36]; /* String describing the bit-representaton (as in "RRRRRGGGGGGBBBBB")*/ + const GP_PixelTypeChannel channels[8]; /* Individual channels */ +} GP_PixelTypeDescription; + +/* + * Array of GP_PIXEL_MAX entries + */ + +extern const GP_PixelTypeDescription const GP_PixelTypes[]; + +/* ++ * Information about ordering of pixels in byte for 1, 2 and 4 bpp ++ * used in a one bit variable in GP_Context ++ */ ++ + typedef enum { + /* less significant bits contain pixels with lower indices */ + GP_BIT_ENDIAN_LE = 0, + /* more significant bits contain pixels with lower indices */ + GP_BIT_ENDIAN_BE, + } GP_BIT_ENDIAN; + + /* * Convert pixel type to name. */ -const char *GP_PixelTypeName(GP_PixelType type); + - inline const char *GP_PixelTypeName(GP_PixelType type) ++static inline const char *GP_PixelTypeName(GP_PixelType type) +{ + return GP_PixelTypes[type].name; +}
/* * Returns number of bits per pixel. */ -uint32_t GP_PixelSize(GP_PixelType type); + - inline uint32_t GP_PixelSize(GP_PixelType type) ++static inline uint32_t GP_PixelSize(GP_PixelType type) +{ + return GP_PixelTypes[type].size; +} + + +/* Below -- TODO sync with new pixel type */
/* * Returns GP_PixelType to GP_ColorType mapping.
http://repo.or.cz/w/gfxprim.git/commit/a15037c925ea8b6b995b3fd765e86978e6430...
commit a15037c925ea8b6b995b3fd765e86978e6430dcd Merge: c4107c1 da9aaa9 Author: Tomas Gavenciak gavento@ucw.cz Date: Tue Apr 5 01:15:09 2011 +0200
Merge branch 'master' into generate
Conflicts: core/GP_Common.h
diff --cc core/GP_Common.h index 5e2a2c9,6f06121..f863dc3 --- a/core/GP_Common.h +++ b/core/GP_Common.h @@@ -34,6 -34,6 +34,7 @@@ /* * Returns a minimum of the two numbers. */ ++ #define GP_MIN(a, b) ({ typeof(a) _a = (a); typeof(b) _b = (b); @@@ -43,6 -43,6 +44,7 @@@ /* * Returns a maximum of the two numbers. */ ++ #define GP_MAX(a, b) ({ typeof(a) _a = (a); typeof(b) _b = (b); @@@ -52,18 -52,19 +54,21 @@@ /* * Abort and print abort location to stderr */ ++ #define GP_ABORT(msg) do { - fprintf(stderr, "*** gfxprim: aborted: %s: %sn", __FUNCTION__, #msg); + fprintf(stderr, "*** gfxprim: aborted: %s:%d: in %s: %sn", + __FILE__, __LINE__, __FUNCTION__, #msg); abort(); } while (0)
/* * Perform a runtime check, on failure abort and print a message */ ++ #define GP_CHECK(cond) do { if (!(cond)) { - fprintf(stderr, "*** gfxprim: runtime check failed: %s: %sn", - __FUNCTION__, #cond); + fprintf(stderr, "*** gfxprim: check failed: %s:%d: in %s: %sn", + __FILE__, __LINE__, __FUNCTION__, #cond); abort(); } } while (0) @@@ -72,6 -73,6 +77,7 @@@ * The standard likely() and unlikely() used in Kernel * TODO: Define as no-op for non-GCC compilers */ ++ #ifndef likely #define likely(x) __builtin_expect((x),1) #define unlikely(x) __builtin_expect((x),0) @@@ -80,6 -81,6 +86,7 @@@ /* * Swap a and b using an intermediate variable */ ++ #define GP_SWAP(a, b) do { typeof(a) tmp = b; b = a; @@@ -92,7 -93,7 +99,8 @@@ * Return (shifted) count bits at offset of value * Note: operates with value types same as val */ - #define GP_GET_BITS(offset, count, val) ( ( (val)>>(offset) ) & ( (((typeof(val)1)<<(count)) - 1) ) ) ++ + #define GP_GET_BITS(offset, count, val) ( ( (val)>>(offset) ) & ( ((((typeof(val))1)<<(count)) - 1) ) )
/* * Set count bits of dest at ofset to val (shifted by offset) @@@ -105,12 -106,20 +113,23 @@@ * GP_CLEAR_BITS sets the target bits to zero * GP_SET_BITS does both */ ++ #define GP_CLEAR_BITS(offset, count, dest) ( (dest) &= ~(((((typeof(dest))1) << (count)) - 1) << (offset)) )
#define GP_SET_BITS_OR(offset, dest, val) ( (dest) |= ((val)<<(offset)) )
#define GP_SET_BITS(offset, count, dest, val) (GP_CLEAR_BITS(offset, count, dest), - SET_BITS_OR(offset, dest, val) ) + GP_SET_BITS_OR(offset, dest, val) ) +
-/* Determines the sign of the integer value; it is +1 if value is positive, ++/* ++ * Determines the sign of the integer value; it is +1 if value is positive, + * -1 if negative, and 0 if it is zero. + */ ++ + #define GP_SIGN(a) ({ + typeof(a) _a = a; + (_a > 0) ? 1 : ((_a < 0) ? -1 : 0); + })
#endif /* GP_COMMON_H */
http://repo.or.cz/w/gfxprim.git/commit/c4107c1c47c062cb836f0dc0269b7479acc03...
commit c4107c1c47c062cb836f0dc0269b7479acc03de6 Author: Tomas Gavenciak gavento@ucw.cz Date: Tue Apr 5 01:09:23 2011 +0200
Added simple counters (+tests)
For accounting arvitrary operations As "quantitative warnings"
diff --git a/core/GP_Counter.c b/core/GP_Counter.c new file mode 100644 index 0000000..e5922d0 --- /dev/null +++ b/core/GP_Counter.c @@ -0,0 +1,107 @@ +/***************************************************************************** + * 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) 2011 Tomas Gavenciak gavento@ucw.cz * + * * + *****************************************************************************/ + +#include <string.h> +#include "GP_Common.h" +#include "GP_Counter.h" + +/* + * Internal struct used in counter list + */ + +struct GP_CounterRecord { + char name[GP_COUNTER_NAME_LEN]; + GP_Counter counter; +}; + + +/* + * variables local to module (static) + */ + +#ifdef GP_IMPLEMENT_COUNTERS + +static GP_Counter_t GP_counters[GP_COUNTER_MAX]; +static int GP_used_counters = 0; +static struct GP_CounterRecord GP_counter_list[GP_COUNTER_MAX]; +static GP_Counter_t GP_counter_list_overflow = 0; + +#endif /* GP_IMPLEMENT_COUNTERS */ + +void GP_PrintCounters(FILE *f) +{ +#ifdef GP_IMPLEMENT_COUNTERS + int i; + if (GP_used_counters == 0) + fprintf(f, "[ no counters defined ]n"); + for (i = 0; i < GP_used_counters; i++) + fprintf(f, "%*s : %lldn", -GP_COUNTER_NAME_LEN, GP_counter_list[i].name, + *(GP_counter_list[i].counter)); + if (GP_counter_list_overflow > 0) + fprintf(f, "[ unable to allocate new counter %lld times ]n", + GP_counter_list_overflow); +#endif /* GP_IMPLEMENT_COUNTERS */ +} + +GP_Counter GP_GetCounter(const char *name) +{ +#ifdef GP_IMPLEMENT_COUNTERS + int l = 0; + int r = GP_used_counters; + + GP_CHECK(name != NULL); + GP_CHECK(strlen(name) + 1 <= GP_COUNTER_NAME_LEN); + + /* Bisect GP_counter_list to find either the counter or a place for it + * interval [l, r) (not incl. r) */ + while(r > l + 1) { + int med = (r + l) / 2; /* Here never equal to r, might be l */ + int cmp = strcmp(GP_counter_list[med].name, name); + if (cmp == 0) + return GP_counter_list[med].counter; + if (cmp < 0) + l = med + 1; + else + r = med; + } + GP_CHECK(l == r); + if ((l < GP_used_counters) && (strcmp(GP_counter_list[l].name, name) == 0)) + return GP_counter_list[l].counter; + + /* Add a new counter */ + if (GP_used_counters >= GP_COUNTER_MAX) { + GP_counter_list_overflow ++; + return NULL; + } + + /* Move the counter records up and initialize a new one */ + memmove(GP_counter_list + l, GP_counter_list + l + 1, + sizeof(struct GP_CounterRecord) * GP_used_counters - l); + strcpy(GP_counter_list[l].name, name); + GP_counter_list[l].counter = GP_counters + GP_used_counters; + + GP_used_counters ++; + return GP_counter_list[l].counter; +#else /* GP_IMPLEMENT_COUNTERS */ + return NULL; +#endif /* GP_IMPLEMENT_COUNTERS */ +} diff --git a/core/GP_Counter.h b/core/GP_Counter.h new file mode 100644 index 0000000..3c0358b --- /dev/null +++ b/core/GP_Counter.h @@ -0,0 +1,108 @@ +/***************************************************************************** + * 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) 2011 Tomas Gavenciak gavento@ucw.cz * + * * + *****************************************************************************/ + +/* + * Simple global named 64-bit counters. + * + * Intended for accounting of expensive operations ("quantitative warnings"). + * All operations accept NULL as GP_Counter. + * + * If GP_IMPLEMENT_COUNTERS is undefined, all operations are NOP and + * no memory is allocated. + */ + +#define GP_IMPLEMENT_COUNTERS + +/* + * Maximum length of counter name, + * maximum number of counters (~40 bytes each) + */ + +#define GP_COUNTER_NAME_LEN 24 +#define GP_COUNTER_MAX 256 + +/* + * Basic types. + * Only use GP_Counter in your programs. + */ + +typedef int64_t GP_Counter_t; +typedef GP_Counter_t *GP_Counter; + +/* + * Increase a counter by 1. + */ + +inline void GP_IncCounter(GP_Counter counter) +{ +#ifdef GP_IMPLEMENT_COUNTERS + if (!counter) return; + (*counter) ++; +#endif /* GP_IMPLEMENT_COUNTERS */ +} + +/* + * Increase a counter by delta (may be negative). + * No checks for underflow. + */ + +inline void GP_AddCounter(GP_Counter counter, GP_Counter_t delta) +{ +#ifdef GP_IMPLEMENT_COUNTERS + if (!counter) return; + (*counter) += delta; +#endif /* GP_IMPLEMENT_COUNTERS */ +} + +/* + * Return counter value + */ + +inline GP_Counter_t GP_CounterVal(GP_Counter counter) +{ +#ifdef GP_IMPLEMENT_COUNTERS + if (!counter) return 0; + return *counter; +#else /* GP_IMPLEMENT_COUNTERS */ + return 0; +#endif /* GP_IMPLEMENT_COUNTERS */ +} + +/* + * Pretty-printing of all counters and their values to f + * Includes info about counter-list overflow + */ + +void GP_PrintCounters(FILE *f); + +/* + * Lookup a counter by name, possibly creating a new one. + * + * May return NULL if no space is left in the counter list. + * The returned value is not unallocated in any way. + * + * NOTE: Current implementation has very slow adds (O(current_counters)), + * but the lookup is reasonably fast (bisection) + */ + +GP_Counter GP_GetCounter(const char *name); + diff --git a/core/tests/GP_Counter.test.c b/core/tests/GP_Counter.test.c new file mode 100644 index 0000000..a334106 --- /dev/null +++ b/core/tests/GP_Counter.test.c @@ -0,0 +1,69 @@ +/***************************************************************************** + * 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) 2011 Tomas Gavenciak gavento@ucw.cz * + * * + *****************************************************************************/ + +#include <string.h> + +#include "GP_Test.h" +#include "GP_Counter.h" + +GP_SUITE(GP_Counter) + +GP_TEST(Smoke) +{ + fail_unless(GP_CounterVal(NULL) == 0); + GP_IncCounter(NULL); + GP_AddCounter(NULL, -10); + fail_unless(GP_GetCounter("") != NULL); + + GP_IncCounter(GP_GetCounter("a")); + fail_unless(GP_CounterVal(GP_GetCounter("a")) == 1); +} + +GP_TEST(Allocation) +{ + GP_IncCounter(GP_GetCounter("a")); + GP_AddCounter(GP_GetCounter("e"), -42); + GP_AddCounter(GP_GetCounter("b"), -8); + GP_IncCounter(GP_GetCounter("a")); + GP_IncCounter(GP_GetCounter("d")); + GP_Counter b = GP_GetCounter("b"); + GP_AddCounter(GP_GetCounter("c"), 21); + GP_IncCounter(GP_GetCounter("b")); + GP_IncCounter(b); + + fail_unless(GP_CounterVal(GP_GetCounter("a")) == 2); + fail_unless(GP_CounterVal(GP_GetCounter("b")) == -6); + fail_unless(GP_CounterVal(GP_GetCounter("c")) == 21); + fail_unless(GP_CounterVal(GP_GetCounter("d")) == 1); + fail_unless(GP_CounterVal(GP_GetCounter("e")) == -42); +} + +GP_TEST(Overflow) +{ + char buf[8]; + for (int i = 0; i < GP_COUNTER_MAX + 10; i++) { + sprintf(buf, "%d", i); + GP_GetCounter(buf); + } + fail_unless(GP_GetCounter("") == NULL); +} +
-----------------------------------------------------------------------
Summary of changes: Makefile | 64 ++-- algo/README | 7 - app.mk | 15 + build/Makefile | 41 ++ build/liblock.sh | 25 ++ build/link.sh | 27 ++ config.mk | 3 + core/GP_Circle.c | 61 --- core/GP_FillCircle.h | 37 -- core/GP_FillEllipse.c | 61 --- core/GP_FillRect.c | 77 ---- core/GP_FillRect.h | 46 --- core/GP_FillTetragon.c | 57 --- core/GP_FillTetragon.h | 38 -- core/GP_FillTriangle.c | 64 --- core/GP_FillTriangle.h | 37 -- core/GP_LineTrack.h | 72 ---- core/GP_Pixel.c | 244 ------------ core/GP_ReadPixel.h | 36 -- core/Makefile | 52 --- core/tests/GP_color_type_test.c | 61 --- core/tests/GP_palette_test.c | 74 ---- core/tests/Makefile | 19 - core/tests/runtest.sh | 10 - doc/context.txt | 24 ++ doc/drawing_api.txt | 82 ++-- drivers/Makefile | 29 -- filters/Makefile | 29 -- filters/tests/Makefile | 17 - include.mk | 101 +++++ targets/sdl/GP_SDL_Context.h => include/GP.h | 16 +- .../backends/GP_Backend.h | 96 +++--- include/config.h | 1 + {core => include/core}/GP_Clip.h | 0 {core => include/core}/GP_Color.h | 0 {core => include/core}/GP_Common.h | 96 ++++- {core => include/core}/GP_Context.h | 72 +++- core/GP_Circle.h => include/core/GP_Core.h | 27 +- include/core/GP_Counter.h | 125 ++++++ {core => include/core}/GP_FnPerBpp.h | 61 ++- {core => include/core}/GP_GetPixel.h | 0 {core => include/core}/GP_Palette.h | 0 {core => include/core}/GP_Pixel.h | 46 ++- {core => include/core}/GP_PutPixel.h | 18 +- {core => include/core}/GP_RetCode.h | 3 +- {core => include/core}/GP_Transform.h | 25 +- {core => include/core}/GP_WritePixel.h | 37 -- {filters => include/filters}/GP_Filters.h | 0 {filters => include/filters}/GP_Rotate.h | 3 +- core/GP_FillEllipse.h => include/gfx/GP_Circle.h | 22 +- {core => include/gfx}/GP_Ellipse.h | 17 +- {core => include/gfx}/GP_Fill.h | 4 +- core/GP.h => include/gfx/GP_Gfx.h | 49 ++-- {core => include/gfx}/GP_HLine.h | 18 +- {core => include/gfx}/GP_Line.h | 12 +- core/GP_Fill.h => include/gfx/GP_Polygon.h | 11 +- {core => include/gfx}/GP_Rect.h | 33 ++- {core => include/gfx}/GP_Symbol.h | 24 +- {core => include/gfx}/GP_Tetragon.h | 16 +- {core => include/gfx}/GP_Triangle.h | 16 +- {core => include/gfx}/GP_VLine.h | 16 +- {input => include/input}/GP_Event.h | 0 {loaders => include/loaders}/GP_Loaders.h | 6 + {loaders => include/loaders}/GP_PBM.h | 2 +- {loaders => include/loaders}/GP_PGM.h | 2 +- {core => include/text}/GP_Font.h | 9 +- {core => include/text}/GP_Text.h | 41 ++- {core => include/text}/GP_TextMetric.h | 8 +- {core => include/text}/GP_TextStyle.h | 10 +- input/Makefile | 27 -- lib.mk | 11 + libs/Makefile | 3 + .../GP_font_save.c => libs/backends/GP_Backend.c | 81 +++-- .../backends/GP_Backend_SDL.c | 149 ++++++-- libs/backends/Makefile | 5 + {core => libs/core}/GP_Color.c | 0 {core => libs/core}/GP_Context.c | 77 ++++- libs/core/GP_Counter.c | 109 ++++++ {core => libs/core}/GP_GetPixel.c | 4 +- {core => libs/core}/GP_Palette.c | 0 libs/core/GP_Pixel.c | 235 ++++++++++++ {core => libs/core}/GP_PutPixel.c | 27 +- {core => libs/core}/GP_RetCode.c | 1 + {core => libs/core}/GP_WritePixel.c | 27 +- libs/core/Makefile | 5 + {core => libs/core}/gen/README | 0 {core => libs/core}/gen/defs.py | 0 {core => libs/core}/gen/gen_blit.py | 70 ++-- {core => libs/core}/gen/gen_pixeltype.py | 38 +- {core => libs/core}/gen/gen_utils.py | 0 {core => libs/core}/gen/make_GP_Blit.py | 6 +- {core => libs/core}/gen/make_GP_Pixel.py | 9 +- {core => libs/core}/gen/make_GP_Pixel_Scale.py | 0 {core => libs/core}/gen/pixeltype.py | 16 +- {filters => libs/filters}/GP_Rotate.c | 19 +- libs/filters/Makefile | 5 + {filters => libs/filters/algo}/GP_MirrorV.algo.h | 2 +- {filters => libs/filters/algo}/GP_Rotate.algo.h | 6 +- core/GP_FillCircle.c => libs/gfx/GP_Circle.c | 50 ++- {core => libs/gfx}/GP_Ellipse.c | 61 +++- {core => libs/gfx}/GP_Fill.c | 8 +- {core => libs/gfx}/GP_HLine.c | 54 ++-- {core => libs/gfx}/GP_Line.c | 38 +- libs/gfx/GP_Polygon.c | 196 ++++++++++ {core => libs/gfx}/GP_Rect.c | 84 +++-- {core => libs/gfx}/GP_Symbol.c | 67 ++-- {core => libs/gfx}/GP_Tetragon.c | 45 ++- {core => libs/gfx}/GP_Triangle.c | 46 ++- {core => libs/gfx}/GP_VLine.c | 52 ++-- libs/gfx/Makefile | 5 + {algo => libs/gfx/algo}/Circle.algo.h | 0 {algo => libs/gfx/algo}/Ellipse.algo.h | 0 {algo => libs/gfx/algo}/FillCircle.algo.h | 0 {algo => libs/gfx/algo}/FillEllipse.algo.h | 0 {algo => libs/gfx/algo}/FillTriangle.algo.h | 94 ++++- {algo => libs/gfx/algo}/HLine.algo.h | 0 {algo => libs/gfx/algo}/Line.algo.h | 0 {algo => libs/gfx/algo}/VLine.algo.h | 0 {input => libs/input}/GP_Event.c | 0 libs/input/Makefile | 5 + {loaders => libs/loaders}/GP_PBM.c | 0 {loaders => libs/loaders}/GP_PGM.c | 0 {loaders => libs/loaders}/GP_PXMCommon.c | 0 {loaders => libs/loaders}/GP_PXMCommon.h | 2 +- libs/loaders/Makefile | 5 + {core => libs/text}/GP_DefaultFont.c | 224 ++++++------ {core => libs/text}/GP_Font.c | 25 +- {core => libs/text}/GP_Text.c | 74 +++- {core => libs/text}/GP_TextMetric.c | 78 +++- {core => libs/text}/GP_TextStyle.c | 8 +- libs/text/Makefile | 5 + {algo => libs/text/algo}/Text.algo.h | 0 loaders/Makefile | 29 -- loaders/tests/Makefile | 17 - old_tests/Makefile | 26 -- old_tests/circlefps.c | 148 ------- old_tests/circlestest.c | 220 ----------- old_tests/ellipsetest.c | 240 ------------ old_tests/linefps.c | 149 -------- old_tests/linetest.c | 158 -------- old_tests/pixeltest.c | 138 ------- old_tests/runtest.sh | 10 - old_tests/shapetest.c | 402 -------------------- old_tests/widelinetest.c | 138 ------- targets/sdl/Makefile | 61 --- tests/Makefile | 3 + tests/core/GP_Comon.test.c | 100 +++++ .../GP_LineTrack.c => tests/core/GP_Counter.test.c | 94 +++--- core/GP_Palette.h => tests/core/GP_Tests.h | 88 +++-- tests/core/Makefile | 31 ++ core/GP_ReadPixel.c => tests/core/core_tests.c | 78 +++-- tests/core/find_tests.py | 154 ++++++++ drivers/GP_Framebuffer.h => tests/core/font.test.c | 54 ++- {drivers => tests/drivers}/GP_Framebuffer.c | 115 +++++- {drivers => tests/drivers}/GP_Framebuffer.h | 5 +- {drivers => tests/drivers}/tests/Makefile | 0 .../drivers}/tests/framebuffer_test.c | 54 ++- {drivers => tests/drivers}/tests/runtest.sh | 0 {drivers => tests/drivers}/tests/sierpinsky.c | 4 +- tests/filters/Makefile | 11 + {filters/tests => tests/filters}/PGM_rotate.c | 0 {filters/tests => tests/filters}/rotate_test.c | 0 {filters/tests => tests/filters}/runtest.sh | 0 {filters/tests => tests/filters}/test-big.pgm | 0 tests/loaders/Makefile | 11 + {loaders/tests => tests/loaders}/PBM_invert.c | 0 {loaders/tests => tests/loaders}/PBM_test.c | 0 {loaders/tests => tests/loaders}/PGM_invert.c | 0 {loaders/tests => tests/loaders}/PGM_test.c | 0 {loaders/tests => tests/loaders}/autotest.sh | 0 {loaders/tests => tests/loaders}/runtest.sh | 0 {targets => tests}/sdl/GP_SDL.h | 0 {targets => tests}/sdl/GP_SDL_Context.c | 0 {targets => tests}/sdl/GP_SDL_Context.h | 0 {targets => tests}/sdl/GP_SDL_VideoInit.c | 0 {targets => tests}/sdl/GP_SDL_VideoInit.h | 0 tests/sdl/Makefile | 2 + {targets => tests}/sdl/tests/Makefile | 2 +- {targets => tests}/sdl/tests/fileview.c | 11 +- {targets => tests}/sdl/tests/fonttest.c | 24 ++ {targets => tests}/sdl/tests/linetest.c | 0 {targets => tests}/sdl/tests/pixeltest.c | 0 {targets => tests}/sdl/tests/randomshapetest.c | 24 ++- {targets => tests}/sdl/tests/runtest.sh | 0 {targets => tests}/sdl/tests/shapetest.c | 24 +- {targets => tests}/sdl/tests/sierpinsky.c | 96 ++++-- {targets => tests}/sdl/tests/symbolstest.c | 0 {targets => tests}/sdl/tests/textaligntest.c | 2 +- {targets => tests}/sdl/tests/trianglefps.c | 0 189 files changed, 3282 insertions(+), 4051 deletions(-) delete mode 100644 algo/README create mode 100644 app.mk create mode 100644 build/Makefile create mode 100644 build/liblock.sh create mode 100755 build/link.sh create mode 100644 config.mk delete mode 100644 core/GP_Circle.c delete mode 100644 core/GP_FillCircle.h delete mode 100644 core/GP_FillEllipse.c delete mode 100644 core/GP_FillRect.c delete mode 100644 core/GP_FillRect.h delete mode 100644 core/GP_FillTetragon.c delete mode 100644 core/GP_FillTetragon.h delete mode 100644 core/GP_FillTriangle.c delete mode 100644 core/GP_FillTriangle.h delete mode 100644 core/GP_LineTrack.h delete mode 100644 core/GP_Pixel.c delete mode 100644 core/GP_ReadPixel.h delete mode 100644 core/Makefile delete mode 100644 core/tests/GP_color_type_test.c delete mode 100644 core/tests/GP_palette_test.c delete mode 100644 core/tests/Makefile delete mode 100755 core/tests/runtest.sh delete mode 100644 drivers/Makefile delete mode 100644 filters/Makefile delete mode 100644 filters/tests/Makefile create mode 100644 include.mk copy targets/sdl/GP_SDL_Context.h => include/GP.h (90%) copy core/GP_WritePixel.h => include/backends/GP_Backend.h (53%) create mode 100644 include/config.h rename {core => include/core}/GP_Clip.h (100%) rename {core => include/core}/GP_Color.h (100%) rename {core => include/core}/GP_Common.h (57%) rename {core => include/core}/GP_Context.h (71%) rename core/GP_Circle.h => include/core/GP_Core.h (84%) create mode 100644 include/core/GP_Counter.h rename {core => include/core}/GP_FnPerBpp.h (73%) rename {core => include/core}/GP_GetPixel.h (100%) copy {core => include/core}/GP_Palette.h (100%) rename {core => include/core}/GP_Pixel.h (77%) rename {core => include/core}/GP_PutPixel.h (83%) rename {core => include/core}/GP_RetCode.h (95%) rename {core => include/core}/GP_Transform.h (79%) rename {core => include/core}/GP_WritePixel.h (74%) rename {filters => include/filters}/GP_Filters.h (100%) rename {filters => include/filters}/GP_Rotate.h (98%) rename core/GP_FillEllipse.h => include/gfx/GP_Circle.h (77%) rename {core => include/gfx}/GP_Ellipse.h (77%) copy {core => include/gfx}/GP_Fill.h (96%) rename core/GP.h => include/gfx/GP_Gfx.h (78%) rename {core => include/gfx}/GP_HLine.h (86%) rename {core => include/gfx}/GP_Line.h (89%) rename core/GP_Fill.h => include/gfx/GP_Polygon.h (90%) rename {core => include/gfx}/GP_Rect.h (67%) rename {core => include/gfx}/GP_Symbol.h (76%) rename {core => include/gfx}/GP_Tetragon.h (76%) rename {core => include/gfx}/GP_Triangle.h (78%) rename {core => include/gfx}/GP_VLine.h (83%) rename {input => include/input}/GP_Event.h (100%) rename {loaders => include/loaders}/GP_Loaders.h (97%) rename {loaders => include/loaders}/GP_PBM.h (98%) rename {loaders => include/loaders}/GP_PGM.h (98%) rename {core => include/text}/GP_Font.h (93%) rename {core => include/text}/GP_Text.h (65%) rename {core => include/text}/GP_TextMetric.h (92%) rename {core => include/text}/GP_TextStyle.h (91%) delete mode 100644 input/Makefile create mode 100644 lib.mk create mode 100644 libs/Makefile rename core/tests/GP_font_save.c => libs/backends/GP_Backend.c (62%) copy targets/sdl/GP_SDL_Context.c => libs/backends/GP_Backend_SDL.c (50%) create mode 100644 libs/backends/Makefile rename {core => libs/core}/GP_Color.c (100%) rename {core => libs/core}/GP_Context.c (75%) create mode 100644 libs/core/GP_Counter.c rename {core => libs/core}/GP_GetPixel.c (96%) rename {core => libs/core}/GP_Palette.c (100%) create mode 100644 libs/core/GP_Pixel.c rename {core => libs/core}/GP_PutPixel.c (79%) rename {core => libs/core}/GP_RetCode.c (98%) rename {core => libs/core}/GP_WritePixel.c (94%) create mode 100644 libs/core/Makefile rename {core => libs/core}/gen/README (100%) rename {core => libs/core}/gen/defs.py (100%) rename {core => libs/core}/gen/gen_blit.py (52%) rename {core => libs/core}/gen/gen_pixeltype.py (86%) rename {core => libs/core}/gen/gen_utils.py (100%) rename {core => libs/core}/gen/make_GP_Blit.py (76%) rename {core => libs/core}/gen/make_GP_Pixel.py (86%) rename {core => libs/core}/gen/make_GP_Pixel_Scale.py (100%) rename {core => libs/core}/gen/pixeltype.py (83%) rename {filters => libs/filters}/GP_Rotate.c (93%) create mode 100644 libs/filters/Makefile rename {filters => libs/filters/algo}/GP_MirrorV.algo.h (98%) rename {filters => libs/filters/algo}/GP_Rotate.algo.h (97%) rename core/GP_FillCircle.c => libs/gfx/GP_Circle.c (66%) rename {core => libs/gfx}/GP_Ellipse.c (60%) rename {core => libs/gfx}/GP_Fill.c (92%) rename {core => libs/gfx}/GP_HLine.c (72%) rename {core => libs/gfx}/GP_Line.c (73%) create mode 100644 libs/gfx/GP_Polygon.c rename {core => libs/gfx}/GP_Rect.c (57%) rename {core => libs/gfx}/GP_Symbol.c (80%) rename {core => libs/gfx}/GP_Tetragon.c (66%) rename {core => libs/gfx}/GP_Triangle.c (68%) rename {core => libs/gfx}/GP_VLine.c (71%) create mode 100644 libs/gfx/Makefile rename {algo => libs/gfx/algo}/Circle.algo.h (100%) rename {algo => libs/gfx/algo}/Ellipse.algo.h (100%) rename {algo => libs/gfx/algo}/FillCircle.algo.h (100%) rename {algo => libs/gfx/algo}/FillEllipse.algo.h (100%) rename {algo => libs/gfx/algo}/FillTriangle.algo.h (69%) rename {algo => libs/gfx/algo}/HLine.algo.h (100%) rename {algo => libs/gfx/algo}/Line.algo.h (100%) rename {algo => libs/gfx/algo}/VLine.algo.h (100%) rename {input => libs/input}/GP_Event.c (100%) create mode 100644 libs/input/Makefile rename {loaders => libs/loaders}/GP_PBM.c (100%) rename {loaders => libs/loaders}/GP_PGM.c (100%) rename {loaders => libs/loaders}/GP_PXMCommon.c (100%) rename {loaders => libs/loaders}/GP_PXMCommon.h (99%) create mode 100644 libs/loaders/Makefile rename {core => libs/text}/GP_DefaultFont.c (56%) rename {core => libs/text}/GP_Font.c (91%) rename {core => libs/text}/GP_Text.c (76%) rename {core => libs/text}/GP_TextMetric.c (68%) rename {core => libs/text}/GP_TextStyle.c (94%) create mode 100644 libs/text/Makefile rename {algo => libs/text/algo}/Text.algo.h (100%) delete mode 100644 loaders/Makefile delete mode 100644 loaders/tests/Makefile delete mode 100644 old_tests/Makefile delete mode 100644 old_tests/circlefps.c delete mode 100644 old_tests/circlestest.c delete mode 100644 old_tests/ellipsetest.c delete mode 100644 old_tests/linefps.c delete mode 100644 old_tests/linetest.c delete mode 100644 old_tests/pixeltest.c delete mode 100755 old_tests/runtest.sh delete mode 100644 old_tests/shapetest.c delete mode 100644 old_tests/widelinetest.c delete mode 100644 targets/sdl/Makefile create mode 100644 tests/Makefile create mode 100644 tests/core/GP_Comon.test.c rename core/GP_LineTrack.c => tests/core/GP_Counter.test.c (51%) rename core/GP_Palette.h => tests/core/GP_Tests.h (50%) create mode 100644 tests/core/Makefile rename core/GP_ReadPixel.c => tests/core/core_tests.c (60%) create mode 100644 tests/core/find_tests.py copy drivers/GP_Framebuffer.h => tests/core/font.test.c (69%) rename {drivers => tests/drivers}/GP_Framebuffer.c (67%) rename {drivers => tests/drivers}/GP_Framebuffer.h (97%) rename {drivers => tests/drivers}/tests/Makefile (100%) rename {drivers => tests/drivers}/tests/framebuffer_test.c (68%) rename {drivers => tests/drivers}/tests/runtest.sh (100%) rename {drivers => tests/drivers}/tests/sierpinsky.c (98%) create mode 100644 tests/filters/Makefile rename {filters/tests => tests/filters}/PGM_rotate.c (100%) rename {filters/tests => tests/filters}/rotate_test.c (100%) rename {filters/tests => tests/filters}/runtest.sh (100%) rename {filters/tests => tests/filters}/test-big.pgm (100%) create mode 100644 tests/loaders/Makefile rename {loaders/tests => tests/loaders}/PBM_invert.c (100%) rename {loaders/tests => tests/loaders}/PBM_test.c (100%) rename {loaders/tests => tests/loaders}/PGM_invert.c (100%) rename {loaders/tests => tests/loaders}/PGM_test.c (100%) rename {loaders/tests => tests/loaders}/autotest.sh (100%) rename {loaders/tests => tests/loaders}/runtest.sh (100%) rename {targets => tests}/sdl/GP_SDL.h (100%) rename {targets => tests}/sdl/GP_SDL_Context.c (100%) rename {targets => tests}/sdl/GP_SDL_Context.h (100%) rename {targets => tests}/sdl/GP_SDL_VideoInit.c (100%) rename {targets => tests}/sdl/GP_SDL_VideoInit.h (100%) create mode 100644 tests/sdl/Makefile rename {targets => tests}/sdl/tests/Makefile (89%) rename {targets => tests}/sdl/tests/fileview.c (97%) rename {targets => tests}/sdl/tests/fonttest.c (88%) rename {targets => tests}/sdl/tests/linetest.c (100%) rename {targets => tests}/sdl/tests/pixeltest.c (100%) rename {targets => tests}/sdl/tests/randomshapetest.c (93%) rename {targets => tests}/sdl/tests/runtest.sh (100%) rename {targets => tests}/sdl/tests/shapetest.c (97%) rename {targets => tests}/sdl/tests/sierpinsky.c (65%) rename {targets => tests}/sdl/tests/symbolstest.c (100%) rename {targets => tests}/sdl/tests/textaligntest.c (98%) rename {targets => tests}/sdl/tests/trianglefps.c (100%)
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.