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 6e824825b32a4d3ed3fc9b7e41dee600d010b093 (commit)
from efe1e66de81808a60c5c3d3e91ae50eb973cf733 (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/6e824825b32a4d3ed3fc9b7e41dee600d010…
commit 6e824825b32a4d3ed3fc9b7e41dee600d010b093
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Thu Sep 22 21:31:53 2011 +0200
Add support for png 1BPP palette (eg. black&white).
diff --git a/libs/loaders/GP_PNG.c b/libs/loaders/GP_PNG.c
index a533287..50395b4 100644
--- a/libs/loaders/GP_PNG.c
+++ b/libs/loaders/GP_PNG.c
@@ -108,7 +108,8 @@ GP_RetCode GP_ReadPNG(FILE *f, GP_Context **res)
png_get_IHDR(png, png_info, &w, &h, &depth,
&color_type, NULL, NULL, NULL);
- GP_DEBUG(2, "Have %s PNG%s size %ux%u depth %i",
+ GP_DEBUG(2, "Have %s%s PNG%s size %ux%u depth %i",
+ color_type & PNG_COLOR_MASK_PALETTE ? "pallete " : "",
color_type & PNG_COLOR_MASK_COLOR ? "color" : "gray",
color_type & PNG_COLOR_MASK_ALPHA ? " with alpha channel" : "",
w, h, depth);
@@ -140,6 +141,17 @@ GP_RetCode GP_ReadPNG(FILE *f, GP_Context **res)
break;
}
break;
+ case PNG_COLOR_TYPE_PALETTE:
+ /* Grayscale with BPP < 8 is usually saved as palette */
+ if (png_get_channels(png, png_info) == 1) {
+ switch (depth) {
+ case 1:
+ png_set_packswap(png);
+ pixel_type = GP_PIXEL_G1;
+ break;
+ }
+ }
+ break;
}
if (pixel_type == GP_PIXEL_UNKNOWN) {
-----------------------------------------------------------------------
Summary of changes:
libs/loaders/GP_PNG.c | 14 +++++++++++++-
1 files changed, 13 insertions(+), 1 deletions(-)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos(a)gmail.com
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
gfxprim.git ("A simple 2D graphics library with emphasis on correctness and well-defined operation.")
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project gfxprim.git.
The branch, generate has been updated
via c019f09ad68b300c79e25e59465f0a80ef999c7c (commit)
from bdecc49ad74d5d50032ba686e53eb98c5bec913e (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/c019f09ad68b300c79e25e59465f0a80ef99…
commit c019f09ad68b300c79e25e59465f0a80ef999c7c
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sun Aug 28 11:35:34 2011 +0200
Fixed the clipping for the time being.
Added GP_PutPixel_Raw_Clipped_xxx and
changed gfx primitives to use it.
diff --git a/include/core/GP_Context.h b/include/core/GP_Context.h
index e5f62bf..bd53482 100644
--- a/include/core/GP_Context.h
+++ b/include/core/GP_Context.h
@@ -83,8 +83,8 @@ static inline GP_PixelType GP_GetContextPixelType(const GP_Context *context)
* Is true, when pixel is clipped out of context.
*/
#define GP_PIXEL_IS_CLIPPED(context, x, y) - ((x) < 0 || x >= (int) context->w - || (y) < 0 || y >= (int) context->h) + ((x) < 0 || x >= (typeof(x)) context->w + || (y) < 0 || y >= (typeof(y)) context->h)
/*
* Allocate context.
diff --git a/include/core/GP_DefFnPerBpp.h b/include/core/GP_DefFnPerBpp.h
index bedc3b0..277c956 100644
--- a/include/core/GP_DefFnPerBpp.h
+++ b/include/core/GP_DefFnPerBpp.h
@@ -31,7 +31,7 @@
#define GP_DEF_FN_PER_BPP_H
#define GP_DEF_DRAW_FN_PER_BPP(fname, MACRO_NAME) - GP_DEF_FN_PER_BPP(fname, MACRO_NAME, GP_PutPixel_Raw_)
+ GP_DEF_FN_PER_BPP(fname, MACRO_NAME, GP_PutPixel_Raw_Clipped_)
#define GP_DEF_FILL_FN_PER_BPP(fname, MACRO_NAME) GP_DEF_FN_PER_BPP(fname, MACRO_NAME, GP_HLine_Raw_)
diff --git a/include/core/GP_GetPutPixel.gen.h.t b/include/core/GP_GetPutPixel.gen.h.t
index c29ae57..ee1ea90 100644
--- a/include/core/GP_GetPutPixel.gen.h.t
+++ b/include/core/GP_GetPutPixel.gen.h.t
@@ -8,8 +8,7 @@ Do not include directly, use GP_Pixel.h
%% block body
#include "GP_Common.h"
-
-struct GP_Context;
+#include "GP_Context.h"
%% for ps in pixelsizes
/*
@@ -68,6 +67,14 @@ static inline void GP_PutPixel_Raw_{{ ps.suffix }}(GP_Context *c, int x, int y,
%% endif
}
+static inline void GP_PutPixel_Raw_Clipped_{{ ps.suffix }}(GP_Context *c, GP_Coord x, GP_Coord y, GP_Pixel p)
+{
+ if (GP_PIXEL_IS_CLIPPED(c, x, y))
+ return;
+
+ GP_PutPixel_Raw_{{ ps.suffix }}(c, x, y, p);
+}
+
%% endfor
%% endblock body
diff --git a/tests/SDL/subcontext.c b/tests/SDL/subcontext.c
index 963e8e8..cbe110e 100644
--- a/tests/SDL/subcontext.c
+++ b/tests/SDL/subcontext.c
@@ -48,7 +48,7 @@ Uint32 timer_callback(__attribute__((unused)) Uint32 interval,
{
timer_event.type = SDL_USEREVENT;
SDL_PushEvent((SDL_Event *) &timer_event);
- return 10;
+ return 30;
}
static void draw_line(GP_Context *dest, GP_Coord x, GP_Coord y,
-----------------------------------------------------------------------
Summary of changes:
include/core/GP_Context.h | 4 ++--
include/core/GP_DefFnPerBpp.h | 2 +-
include/core/GP_GetPutPixel.gen.h.t | 11 +++++++++--
tests/SDL/subcontext.c | 2 +-
4 files changed, 13 insertions(+), 6 deletions(-)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos(a)gmail.com
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
gfxprim.git ("A simple 2D graphics library with emphasis on correctness and well-defined operation.")