This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project gfxprim.git.
The branch, master has been updated via a2551d947cc9e247126f7f6576c9b74b726484cc (commit) via fb5e60ee7fa8028cadf3860bd3011d0fce562d4c (commit) via 042f61acb0230f8fb15e50876c5be6efbbec1206 (commit) from b4569232ecafc8e3fc6bfd877588b42ca8a21452 (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/a2551d947cc9e247126f7f6576c9b74b72648...
commit a2551d947cc9e247126f7f6576c9b74b726484cc Author: Cyril Hrubis metan@ucw.cz Date: Mon May 21 19:32:41 2012 +0200
core: Fix rest of the G2_LE and G4_LE WritePixels.
diff --git a/demos/c_simple/virtual_backend_example.c b/demos/c_simple/virtual_backend_example.c index 7976377..523a826 100644 --- a/demos/c_simple/virtual_backend_example.c +++ b/demos/c_simple/virtual_backend_example.c @@ -25,7 +25,7 @@ Simple virtual backend test.
Virtual backned allows you to test interactively pixel types that your - hardware/xserverd doesn't support. + hardware/xserver doesn't support.
*/
diff --git a/include/core/GP_WritePixel.h b/include/core/GP_WritePixel.h index 991782f..18a4ef6 100644 --- a/include/core/GP_WritePixel.h +++ b/include/core/GP_WritePixel.h @@ -30,10 +30,27 @@ #include <stdint.h> #include <unistd.h>
+/* + * Writes cnt pixels starting at offset off. + */ void GP_WritePixels_1BPP_LE(uint8_t *start, uint8_t off, size_t cnt, uint8_t val);
/* + * Writes cnt pixels starting at offset off (offset is in pixel sizes not in + * bits). + */ +void GP_WritePixels_2BPP_LE(uint8_t *start, uint8_t off, + size_t cnt, uint8_t val); + +/* + * Writes cnt pixels starting at offset off (offset is in pixel sizes not in + * bits i.e. offset could be either 0 or 1). + */ +void GP_WritePixels_4BPP_LE(uint8_t *start, uint8_t off, + size_t cnt, uint8_t val); + +/* * These calls are not byte aligned, thuss needs start offset. */ void GP_WritePixels1bpp(uint8_t *start, uint8_t off, size_t cnt, uint8_t val); diff --git a/libs/core/GP_Blit.c b/libs/core/GP_Blit.c index 3b9f88a..eadfe1d 100644 --- a/libs/core/GP_Blit.c +++ b/libs/core/GP_Blit.c @@ -37,7 +37,7 @@ void GP_BlitXYXY_Fast(const GP_Context *src, GP_Coord x0, GP_Coord y0, GP_Coord x1, GP_Coord y1, GP_Context *dst, GP_Coord x2, GP_Coord y2);
- +/* void GP_BlitXYXY_Naive(const GP_Context *src, GP_Coord x0, GP_Coord y0, GP_Coord x1, GP_Coord y1, GP_Context *dst, GP_Coord x2, GP_Coord y2) @@ -54,6 +54,7 @@ void GP_BlitXYXY_Naive(const GP_Context *src, GP_PutPixel(dst, x2 + (x - x0), y2 + (y - y0), p); } } +*/
void GP_BlitXYXY(const GP_Context *src, GP_Coord x0, GP_Coord y0, GP_Coord x1, GP_Coord y1, diff --git a/libs/core/GP_WritePixel.c b/libs/core/GP_WritePixel.c index d255223..bc57ea1 100644 --- a/libs/core/GP_WritePixel.c +++ b/libs/core/GP_WritePixel.c @@ -104,6 +104,91 @@ void GP_WritePixels_1BPP_LE(uint8_t *start, uint8_t off, } }
+static const uint8_t bytes_2BPP[] = {0x00, 0x55, 0xaa, 0xff}; + +void GP_WritePixels_2BPP_LE(uint8_t *start, uint8_t off, + size_t cnt, uint8_t val) +{ + int len = cnt; + + /* Write start of the line */ + switch (off) { + case 0: + break; + case 1: + GP_SET_BITS1_ALIGNED(2, 2, start, val); + + if (--len == 0) + return; + case 2: + GP_SET_BITS1_ALIGNED(4, 2, start, val); + + if (--len == 0) + return; + case 3: + GP_SET_BITS1_ALIGNED(6, 2, start, val); + + if (--len == 0) + return; + + start++; + break; + } + + /* Write as many bytes as possible */ + memset(start, bytes_2BPP[val & 0x03], len/4); + + start+=len/4; + + /* And the rest */ + switch (len%4) { + case 3: + GP_SET_BITS1_ALIGNED(4, 2, start, val); + case 2: + GP_SET_BITS1_ALIGNED(2, 2, start, val); + case 1: + GP_SET_BITS1_ALIGNED(0, 2, start, val); + break; + } +} + +static const uint8_t bytes_4BPP[] = { + 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, + 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff +}; + +void GP_WritePixels_4BPP_LE(uint8_t *start, uint8_t off, + size_t cnt, uint8_t val) +{ + int len = cnt; + + /* Write start of the line */ + switch (off) { + case 0: + break; + case 1: + GP_SET_BITS1_ALIGNED(4, 4, start, val); + + if (--len == 0) + return; + + start++; + break; + } + + /* Write as many bytes as possible */ + memset(start, bytes_4BPP[val & 0x0f], len/2); + + start+=len/2; + + /* And the rest */ + switch (len%2) { + case 1: + GP_SET_BITS1_ALIGNED(0, 4, start, val); + break; + } +} + static const uint8_t chunks_1bpp[8] = { 0x00, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe, }; diff --git a/libs/gfx/GP_HLine.c b/libs/gfx/GP_HLine.c index b31611f..35e3e36 100644 --- a/libs/gfx/GP_HLine.c +++ b/libs/gfx/GP_HLine.c @@ -37,9 +37,9 @@ //TODO: BIT ENDIANESS DEF_HLINE_BU_FN(GP_HLine_Raw_1BPP_LE, GP_Context*, GP_Pixel, GP_PIXEL_ADDR, GP_WritePixels_1BPP_LE) DEF_HLINE_BU_FN(GP_HLine_Raw_1BPP_BE, GP_Context*, GP_Pixel, GP_PIXEL_ADDR, GP_WritePixels1bpp) -DEF_HLINE_BU_FN(GP_HLine_Raw_2BPP_LE, GP_Context*, GP_Pixel, GP_PIXEL_ADDR, GP_WritePixels2bpp) +DEF_HLINE_BU_FN(GP_HLine_Raw_2BPP_LE, GP_Context*, GP_Pixel, GP_PIXEL_ADDR, GP_WritePixels_2BPP_LE) DEF_HLINE_BU_FN(GP_HLine_Raw_2BPP_BE, GP_Context*, GP_Pixel, GP_PIXEL_ADDR, GP_WritePixels2bpp) -DEF_HLINE_BU_FN(GP_HLine_Raw_4BPP_LE, GP_Context*, GP_Pixel, GP_PIXEL_ADDR, GP_WritePixels4bpp) +DEF_HLINE_BU_FN(GP_HLine_Raw_4BPP_LE, GP_Context*, GP_Pixel, GP_PIXEL_ADDR, GP_WritePixels_4BPP_LE) DEF_HLINE_BU_FN(GP_HLine_Raw_4BPP_BE, GP_Context*, GP_Pixel, GP_PIXEL_ADDR, GP_WritePixels4bpp) DEF_HLINE_BU_FN(GP_HLine_Raw_18BPP_LE, GP_Context *, GP_Pixel, GP_PIXEL_ADDR, GP_WritePixels18bpp)
http://repo.or.cz/w/gfxprim.git/commit/fb5e60ee7fa8028cadf3860bd3011d0fce562...
commit fb5e60ee7fa8028cadf3860bd3011d0fce562d4c Author: Cyril Hrubis metan@ucw.cz Date: Mon May 21 15:41:11 2012 +0200
config: Add xRGB2222 into config file.
diff --git a/gfxprim_config.py b/gfxprim_config.py index b3eed3b..b0aafed 100644 --- a/gfxprim_config.py +++ b/gfxprim_config.py @@ -89,6 +89,12 @@ config = GfxPrimConfig( ('R', 6, 3), ('G', 3, 3), ('B', 0, 3)]), + + PixelType(name='xRGB2222', pixelsize=PS_8BPP, chanslist=[ + ('R', 4, 2), + ('G', 2, 2), + ('B', 0, 2)]), + # # Palette types #
http://repo.or.cz/w/gfxprim.git/commit/042f61acb0230f8fb15e50876c5be6efbbec1...
commit 042f61acb0230f8fb15e50876c5be6efbbec1206 Author: Cyril Hrubis metan@ucw.cz Date: Mon May 21 15:40:42 2012 +0200
examples: More work on virtual backend example.
diff --git a/demos/c_simple/virtual_backend_example.c b/demos/c_simple/virtual_backend_example.c index 8f8858e..7976377 100644 --- a/demos/c_simple/virtual_backend_example.c +++ b/demos/c_simple/virtual_backend_example.c @@ -36,8 +36,8 @@ int main(int argc, char *argv[]) { GP_Backend *backend; GP_Context *context; - GP_Pixel white_pixel, black_pixel; - const char *backend_opts = "X11:400x400"; + GP_Pixel white_pixel, black_pixel, red_pixel, blue_pixel, green_pixel; + const char *backend_opts = "X11:350x350"; int opt; GP_PixelType emul_type = GP_PIXEL_UNKNOWN;
@@ -95,18 +95,18 @@ int main(int argc, char *argv[])
GP_EventSetScreenSize(context->w, context->h); + /* Now draw some testing patters */ black_pixel = GP_ColorToContextPixel(GP_COL_BLACK, context); white_pixel = GP_ColorToContextPixel(GP_COL_WHITE, context); + red_pixel = GP_ColorToContextPixel(GP_COL_RED, context); + blue_pixel = GP_ColorToContextPixel(GP_COL_BLUE, context); + green_pixel = GP_ColorToContextPixel(GP_COL_GREEN, context);
GP_Fill(context, white_pixel); - - /* Now draw some testing patters */ - unsigned int i; + + unsigned int i, j; for (i = 0; i < 40; i++) { GP_HLineXYW(context, 0, i, i, black_pixel); - - GP_HLineXYW(context, 40 + i, i, i, black_pixel); - GP_HLineXYW(context, 1, i + 40, i, black_pixel); GP_HLineXYW(context, 2, i + 80, i, black_pixel); GP_HLineXYW(context, 3, i + 120, i, black_pixel); @@ -116,6 +116,27 @@ int main(int argc, char *argv[]) GP_HLineXYW(context, 7, i + 280, i, black_pixel); }
+ for (i = 0; i < 256; i++) { + for (j = 0; j < 256; j++) { + uint8_t val = 1.00 * sqrt(i*i + j*j)/sqrt(2) + 0.5; + + GP_Pixel pix = GP_RGBToContextPixel(i, j, val, context); + GP_PutPixel(context, i + 60, j + 10, pix); + } + } + + GP_Text(context, NULL, 60, 270, GP_VALIGN_BELOW|GP_ALIGN_RIGHT, + black_pixel, white_pixel, "Lorem Ipsum dolor sit..."); + + GP_Text(context, NULL, 60, 290, GP_VALIGN_BELOW|GP_ALIGN_RIGHT, + red_pixel, white_pixel, "Lorem Ipsum dolor sit..."); + + GP_Text(context, NULL, 60, 310, GP_VALIGN_BELOW|GP_ALIGN_RIGHT, + green_pixel, white_pixel, "Lorem Ipsum dolor sit..."); + + GP_Text(context, NULL, 60, 330, GP_VALIGN_BELOW|GP_ALIGN_RIGHT, + blue_pixel, white_pixel, "Lorem Ipsum dolor sit..."); + /* Update the backend screen */ GP_BackendFlip(backend);
-----------------------------------------------------------------------
Summary of changes: demos/c_simple/virtual_backend_example.c | 39 +++++++++++--- gfxprim_config.py | 6 ++ include/core/GP_WritePixel.h | 17 ++++++ libs/core/GP_Blit.c | 3 +- libs/core/GP_WritePixel.c | 85 ++++++++++++++++++++++++++++++ libs/gfx/GP_HLine.c | 4 +- 6 files changed, 142 insertions(+), 12 deletions(-)
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.