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 fc824cf87cc0e855dbbc14082dbd9cfd1d41045d (commit)
via 4f69149259b86bbd5087a7cbdd193af75950117b (commit)
from a45f634d8d10e20dae3f726ade452674f0bed6e8 (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/fc824cf87cc0e855dbbc14082dbd9cfd1d41…
commit fc824cf87cc0e855dbbc14082dbd9cfd1d41045d
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Mon Jun 25 11:32:37 2012 +0200
grabbers: V4L2 fix typo in YUV to RGB conversion.
diff --git a/libs/grabbers/GP_V4L2.c b/libs/grabbers/GP_V4L2.c
index 418839f..fa8a795 100644
--- a/libs/grabbers/GP_V4L2.c
+++ b/libs/grabbers/GP_V4L2.c
@@ -118,7 +118,7 @@ static void v4l2_yuv422_fillframe(struct GP_Grabber *self, void *buf)
*tmp++ = R;
*tmp++ = G;
- *tmp++ = G;
+ *tmp++ = B;
py += 2;
http://repo.or.cz/w/gfxprim.git/commit/4f69149259b86bbd5087a7cbdd193af75950…
commit 4f69149259b86bbd5087a7cbdd193af75950117b
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Mon Jun 25 11:25:19 2012 +0200
build: Add -D_FORTIFY_SOURCE=2 into default CFLAGS.
diff --git a/configure b/configure
index 4a59e25..9721a42 100755
--- a/configure
+++ b/configure
@@ -228,7 +228,7 @@ if __name__ == '__main__':
# Dictionary for default configuration parameters
#
cfg = {'CC' : ['gcc', 'Path/name of the C compiler'],
- 'CFLAGS' : ['-W -Wall -Wextra -fPIC -O2 -ggdb', 'C compiler flags'],
+ 'CFLAGS' : ['-W -Wall -Wextra -fPIC -O2 -ggdb -D_FORTIFY_SOURCE=2', 'C compiler flags'],
'PYTHON_BIN' : ['python', 'Path/name of python interpreter'],
'SWIG' : ['swig', 'Simplified Wrapper and Interface Generator'],
'include_path': ['/usr/include', 'Path to the system headers']}
-----------------------------------------------------------------------
Summary of changes:
configure | 2 +-
libs/grabbers/GP_V4L2.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos(a)gmail.com
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
gfxprim.git ("A simple 2D graphics library with emphasis on correctness and well-defined operation.")
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 a45f634d8d10e20dae3f726ade452674f0bed6e8 (commit)
from f874ce61275191ecdd5aae7938b0d56e368820ec (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/a45f634d8d10e20dae3f726ade452674f0be…
commit a45f634d8d10e20dae3f726ade452674f0bed6e8
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Fri Jun 22 00:16:13 2012 +0200
core: Fix context include.
diff --git a/libs/core/GP_Context.c b/libs/core/GP_Context.c
index 85530d1..8b66a3b 100644
--- a/libs/core/GP_Context.c
+++ b/libs/core/GP_Context.c
@@ -30,7 +30,7 @@
#include "GP_Transform.h"
#include "GP_Pixel.h"
#include "GP_GetPutPixel.h"
-#include "GP_GammaCorrection.h"
+#include "GP_Gamma.h"
#include "GP_Context.h"
#include "GP_Blit.h"
-----------------------------------------------------------------------
Summary of changes:
libs/core/GP_Context.c | 2 +-
1 files changed, 1 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, master has been updated
via c0d173dc45cf696113927b923decf2d1e140cace (commit)
from ce9e4793af70584532932e14d4adec6c38eefc4d (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/c0d173dc45cf696113927b923decf2d1e140…
commit c0d173dc45cf696113927b923decf2d1e140cace
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Mon Jun 18 14:27:37 2012 +0200
examples: Add simple showimage example.
diff --git a/demos/c_simple/Makefile b/demos/c_simple/Makefile
index 44926f8..6e3b7d7 100644
--- a/demos/c_simple/Makefile
+++ b/demos/c_simple/Makefile
@@ -6,7 +6,7 @@ INCLUDE=
LDLIBS+=-lGP -lGP_backends -lSDL -L$(TOPDIR)/build/
APPS=backend_example loaders_example loaders filters_symmetry gfx_koch- virtual_backend_example meta_data meta_data_dump tmp_file
+ virtual_backend_example meta_data meta_data_dump tmp_file showimage
include $(TOPDIR)/pre.mk
include $(TOPDIR)/app.mk
diff --git a/demos/c_simple/showimage.c b/demos/c_simple/showimage.c
new file mode 100644
index 0000000..9abbb6d
--- /dev/null
+++ b/demos/c_simple/showimage.c
@@ -0,0 +1,83 @@
+/*****************************************************************************
+ * This file is part of gfxprim library. *
+ * *
+ * Gfxprim is free software; you can redistribute it and/or *
+ * modify it under the terms of the GNU Lesser General Public *
+ * License as published by the Free Software Foundation; either *
+ * version 2.1 of the License, or (at your option) any later version. *
+ * *
+ * Gfxprim is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with gfxprim; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
+ * Boston, MA 02110-1301 USA *
+ * *
+ * Copyright (C) 2009-2012 Cyril Hrubis <metan(a)ucw.cz> *
+ * *
+ *****************************************************************************/
+
+/*
+
+ Simple example that shows X11 window with image.
+
+ */
+
+#include <stdio.h>
+#include <errno.h>
+#include <string.h>
+
+#include "GP.h"
+#include "backends/GP_X11.h"
+
+int main(int argc, char *argv[])
+{
+ GP_Backend *backend;
+ GP_Context *image;
+
+ GP_SetDebugLevel(10);
+
+ if (argc != 2) {
+ fprintf(stderr, "Takes image as an argumentn");
+ return 1;
+ }
+
+ /* Load image */
+ image = GP_LoadImage(argv[1], NULL);
+
+ if (image == NULL) {
+ fprintf(stderr, "Failed to load bitmap: %sn", strerror(errno));
+ return 1;
+ }
+
+ /* Initalize backend */
+ backend = GP_BackendX11Init(NULL, 0, 0, image->w, image->h, argv[1], 0);
+
+ if (backend == NULL) {
+ fprintf(stderr, "Failed to initalize backendn");
+ return 1;
+ }
+
+ /* Blit image into the window and show it */
+ GP_Blit(image, 0, 0, image->w, image->h, backend->context, 0, 0);
+ GP_BackendFlip(backend);
+
+ /* Wait for events */
+ for (;;) {
+ GP_BackendWait(backend);
+
+ GP_Event ev;
+
+ while (GP_EventGet(&ev)) {
+ if (ev.type == GP_EV_KEY && ev.val.val == GP_KEY_Q) {
+ GP_BackendExit(backend);
+ return 0;
+ }
+ }
+ }
+
+ return 0;
+}
diff --git a/doc/examples.txt b/doc/examples.txt
index ec356e2..cbd4cf5 100644
--- a/doc/examples.txt
+++ b/doc/examples.txt
@@ -94,6 +94,11 @@ Example in C
include::../demos/c_simple/backend_example.c[]
------------------------------------------------------------------
+[source,c]
+------------------------------------------------------------------
+include::../demos/c_simple/showimage.c[]
+------------------------------------------------------------------
+
GFXprim + PyGTK
---------------
-----------------------------------------------------------------------
Summary of changes:
demos/c_simple/Makefile | 2 +-
demos/c_simple/{loaders_example.c => showimage.c} | 56 ++++++++++++++------
doc/examples.txt | 5 ++
3 files changed, 45 insertions(+), 18 deletions(-)
copy demos/c_simple/{loaders_example.c => showimage.c} (67%)
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, master has been updated
via ce9e4793af70584532932e14d4adec6c38eefc4d (commit)
from e4962e78d7114be162c9c83e6068f03e9455fb01 (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/ce9e4793af70584532932e14d4adec6c38ee…
commit ce9e4793af70584532932e14d4adec6c38eefc4d
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Mon Jun 18 14:04:58 2012 +0200
doc: Add gamma docs + spellchecks.
diff --git a/doc/Makefile b/doc/Makefile
index 8d4ffbf..3fdfaad 100644
--- a/doc/Makefile
+++ b/doc/Makefile
@@ -1,7 +1,7 @@
all: api.html examples.html
api.html: general.txt api.txt context.txt loaders.txt filters.txt - basic_types.txt drawing_api.txt backends.txt
+ basic_types.txt drawing_api.txt backends.txt gamma.txt
asciidoc -a toc api.txt
examples.html: examples.txt ../demos/c_simple/*.c ../demos/py_simple/*.py
diff --git a/doc/api.txt b/doc/api.txt
index c2fca5c..402c6dd 100644
--- a/doc/api.txt
+++ b/doc/api.txt
@@ -5,6 +5,7 @@ Cyril Hrubis <metan(a)ucw.cz>
include::general.txt[]
include::basic_types.txt[]
include::context.txt[]
+include::gamma.txt[]
include::drawing_api.txt[]
include::filters.txt[]
include::loaders.txt[]
diff --git a/doc/context.txt b/doc/context.txt
index f92473c..13d5270 100644
--- a/doc/context.txt
+++ b/doc/context.txt
@@ -24,6 +24,11 @@ typedef struct GP_Context {
enum GP_PixelType pixel_type; /* pixel format */
+ /*
+ * Pointer to optional Gamma correction tables.
+ */
+ struct GP_Gamma *gamma;
+
uint8_t axes_swap:1; /* swap axes */
uint8_t x_swap:1; /* mirror x */
uint8_t y_swap:1; /* mirror y */
@@ -195,8 +200,11 @@ The 'free_pixels' flag for the resulting context is set.
void GP_ContextFree(GP_Context *context);
-------------------------------------------------------------------------------
-Frees the context memory. If 'free_pixels' flag is set, the pixels buffer is
-freed too.
+Frees the context memory.
+
+If 'free_pixels' flag is set, the pixels buffer is freed too.
+
+If gamma pointer is not 'NULL' the 'GP_GammaRelease()' is called.
Subcontext
~~~~~~~~~~
@@ -274,3 +282,4 @@ void GP_ContextPrintInfo(const GP_Context *self);
This function prints the content of 'GP_Context' structure, in a readable
format, into the stdout.
+
diff --git a/doc/gamma.txt b/doc/gamma.txt
new file mode 100644
index 0000000..f15f072
--- /dev/null
+++ b/doc/gamma.txt
@@ -0,0 +1,137 @@
+Gamma Correction
+----------------
+
+What is gamma and what is it doing in my computer?
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+First of all gamma is a function, or better there is a gamma function and
+it's inverse function. Both gamma function and it's inverse are defined on
+interval [0,1] and are defined as out = in^(gamma)^ and it's inverse as
+out = in^(1/gamma)^.
+
+The purpose of this function is to compensate nonlinearity of human eye
+perception. The human eye is more sensitive to dark tones than the light ones
+so without gamma correction storage and manipulation with image data would
+either be less efficient in space (in case you decided to use more bits and
+encode the image linearly) or quantization in darker tones would be more
+visible resulting in "pixelated" images (aliasing).
+
+So there is a gamma, the Internet seems to suggest that usual values for
+gamma are 2.5 for old CRT monitors and about 2.2 for LCD ones, ideally you
+should have color profile for your device (you need special hardware to
+measure it). So if you are trying to draw linear gradient on the screen
+you need to generate sequence of numbers accordingly to gamma function
+(the 50% intensity is around 186 for gamma = 2.2 and 8bit grayscale pixel).
+
+Moreover image formats tend to save data in nonlinear fashion (some formats
+include gamma value used to for the image) so before you apply filter that
+manipulates with pixel values, you need to convert it to linear space (adding
+some more bits to compensate for rounding errors).
+
+Also it's important to take gamma, into an account, when drawing anti aliased
+shapes, you can't get right results otherwise.
+
+NOTE: The gamma support in GFXprim is quite new and at a time of writing this
+docs, only one filter does support gamma correction. (The anti-aliased drawing
+and text still use legacy gamma support.)
+
+Implementation
+~~~~~~~~~~~~~~
+
+The 'GP_Gamma' structure defines per context, per channel, gamma tables.
+
+The tables for particular gamma are reference counted. There is only one table
+for particular gamma value and bit depth in memory at a time.
+
+Also the table output, for linear values, has two more bits than original in
+order not to loose precision.
+
+The pointers to gamma tables are storied in 'GP_Gamma' structure and are
+organized in the same order as channels. First N tables for each channel and
+gamma value gamma, then N tables for inverse 1/gamma function.
+
+So when we have RGB888 pixel and gamma 2.2 there are two tables in the memory,
+one for gamma 2.2 input 8bit output 10bit and it's inverse input 10bit output
+8bit. The 'GP_Gamma' contains six pointers. First three points to the gamma
+table for gamma 2.2 with 8bit input (256 array members) and the output format
+is 10bits so each array member is 'uint16_t'. The other three are for inverse
+gamma function (gamma = 0.454545...) with 10bit input (1024 array members) and
+8bit output so each member is 'uint8_t'.
+
+The whole interface is designed for speed, so that conversion to linear space
+or from linear space is just a matter of indexing arrays. Imagine you need to
+get gamma-corrected pixel value. First you take individual pixel channels then
+use the GP_Gamma structure as follows:
+
+[source,c]
+-------------------------------------------------------------------------------
+
+/* To convert channel gamma value to linear value: */
+gamma->tables[chan_number].u16[chan_val]
+
+/* ... or when result has no more than 8bits ... */
+
+gamma->tables[chan_number].u8[chan_val]
+
+/* The inverse transformation is done as: */
+
+gamma->tables[chan_count + chan_number].u8[chan_val]
+
+/* ... or when original pixel channel had more than 8bits ... */
+
+gamma->tables[chan_count + chan_number].u16[chan_val]
+
+/*
+ * When doing more than one conversion it's better to save pointers to
+ * individual table (example for RGB888):
+ */
+
+uint16_t *R_2_LIN = gamma->tables[0].u16;
+/* ... */
+uint8_t *R_2_GAMMA = gamma->tables[3].u8;
+/* ... */
+
+-------------------------------------------------------------------------------
+
+Gamma low level API
+~~~~~~~~~~~~~~~~~~~
+
+[source,c]
+-------------------------------------------------------------------------------
+#include <core/GP_Gamma.h>
+/* or */
+#include <GP.h>
+
+GP_Gamma *GP_GammaAcquire(GP_PixelType pixel_type, float gamma);
+-------------------------------------------------------------------------------
+
+Returns pointer to gamma table for particular pixel_type and gamma value.
+
+The same gamma is used for all channels.
+
+May fail and return 'NULL' if 'malloc()' has failed.
+
+[source,c]
+-------------------------------------------------------------------------------
+#include <core/GP_Gamma.h>
+/* or */
+#include <GP.h>
+
+GP_Gamma *GP_GammaCopy(GP_Gamma *gamma);
+-------------------------------------------------------------------------------
+
+Copies a Gamma table (actually only increases ref_count).
+
+Can't fail.
+
+[source,c]
+-------------------------------------------------------------------------------
+#include <core/GP_Gamma.h>
+/* or */
+#include <GP.h>
+
+void GP_GammaRelease(GP_Gamma *self);
+-------------------------------------------------------------------------------
+
+Releases Gama table (if ref_count has fallen to zero, frees memory).
+
diff --git a/include/core/GP_Gamma.h b/include/core/GP_Gamma.h
index a4112a7..9a93587 100644
--- a/include/core/GP_Gamma.h
+++ b/include/core/GP_Gamma.h
@@ -36,22 +36,22 @@
perception. The human eye is more sensitive to dark tones than the light ones
so without gamma correction storage and manipulation with image data would
either be less efficient in space (in case you decided to use more bits and
- encode the image lineary) or quantization in darker tones would be more
+ encode the image linearly) or quantization in darker tones would be more
visible resulting in "pixelated" images (aliasing).
- So there is a gamma, the internet seems to suggest that usual values for
+ So there is a gamma, the Internet seems to suggest that usual values for
gamma are 2.5 for old CRT monitors and about 2.2 for LCD ones, ideally you
should have color profile for your device (you need special hardware to
measure it). So if you are trying to draw linear gradient on the screen
- you need to generate sequence of numbers accordinly to gamma function
+ you need to generate sequence of numbers accordingly to gamma function
(the 50% intensity is around 186 for gamma = 2.2 and 8bit grayscale pixel).
Moreover image formats tend to save data in nonlinear fashion (some formats
- include gama value used to for the image) so before you apply filter that
+ include gamma value used to for the image) so before you apply filter that
manipulates with pixel values, you need to convert it to linear space (adding
some more bits to compensate for rounding errors).
- Also it's important to take gamma, into an accound, when drawing anti aliased
+ Also it's important to take gamma, into an account, when drawing anti-aliased
shapes, you can't get right results otherwise.
*/
@@ -62,21 +62,21 @@
channel, gamma tables.
The tables for particular gamma are reference counted. There is only one
- table for particulal gamma value and bit depth in memory at a time.
+ table for particular gamma value and bit depth in memory at a time.
Also the table output, for linear values, has two more bits than original in
order not to loose precision.
- The pointers to gamma tables are storied in GP_Gamma structure the pointers
- are organized in the same order as channes. First N tables for each channel
- and gamma value gamma, then N tables for inverse 1/gamma function.
+ The pointers to gamma tables are storied in GP_Gamma structure and are
+ organized in the same order as channels. First N tables for each channel and
+ gamma value gamma, then N tables for inverse 1/gamma function.
So when we have RGB888 pixel and gamma 2.2 there are two tables in the
memory, one for gamma 2.2 input 8bit output 10bit and it's inverse input
10bit output 8bit. The GP_Gamma contains six pointers. First three points to
- the gamma table for gamma 2.2 whith 8bit input (256 array members) and the
+ the gamma table for gamma 2.2 with 8bit input (256 array members) and the
output format is 10bits so each array member is uint16_t. The other three
- are for inverse gamma funcion (gamma = 0.454545...) with 10bit input (1024
+ are for inverse gamma function (gamma = 0.454545...) with 10bit input (1024
array members) and 8bit output so each member is uint8_t.
The whole interface is designed for speed, so that conversion to linear
@@ -94,16 +94,16 @@
gamma->tables[chan_count + chan_number].u8[chan_val]
- of when original pixel channel had more than 8bits
+ or when original pixel channel had more than 8bits
gamma->tables[chan_count + chan_number].u16[chan_val]
When doing more than one conversion it's better to save pointers to
individual table (example for RGB888):
- uint16_t *R2Lin = gamma->tables[0].u16;
+ uint16_t *R_2_LIN = gamma->tables[0].u16;
...
- uint8_t *R2Gamma = gamma->tables[3].u8;
+ uint8_t *R_2_GAMMA = gamma->tables[3].u8;
...
*/
@@ -139,9 +139,9 @@ typedef struct GP_GammaTable {
* Gamma structure for general pixel type.
*
* The GP_Gamma structure contains pointers to tables for each pixel
- * channel and for gamma and it's inverse transfomation.
+ * channel and for gamma and it's inverse transformation.
*
- * The interface is specialy designed so that getting Gamma corrected value is
+ * The interface is specially designed so that getting Gamma corrected value is
* a matter of indexing two arrays.
*/
typedef struct GP_Gamma {
diff --git a/libs/filters/GP_Cubic.h b/libs/filters/GP_Cubic.h
index 213031a..5d3c0e6 100644
--- a/libs/filters/GP_Cubic.h
+++ b/libs/filters/GP_Cubic.h
@@ -53,7 +53,7 @@ extern int16_t GP_CubicTable[];
/*
* Fixed point version of above.
*
- * Both input and output value are multiplied by MUL.
+ * The input and output are expected in 24.8 fixed point format
*/
static inline int cubic_int(int x)
{
diff --git a/libs/filters/GP_ResizeCubic.gen.c.t b/libs/filters/GP_ResizeCubic.gen.c.t
index f782b39..901e253 100644
--- a/libs/filters/GP_ResizeCubic.gen.c.t
+++ b/libs/filters/GP_ResizeCubic.gen.c.t
@@ -1,6 +1,6 @@
%% extends "filter.c.t"
-{% block descr %}Nearest Neighbour resampling{% endblock %}
+{% block descr %}Cubic resampling{% endblock %}
%% block body
-----------------------------------------------------------------------
Summary of changes:
doc/Makefile | 2 +-
doc/api.txt | 1 +
doc/context.txt | 13 +++-
doc/gamma.txt | 137 +++++++++++++++++++++++++++++++++++
include/core/GP_Gamma.h | 32 ++++----
libs/filters/GP_Cubic.h | 2 +-
libs/filters/GP_ResizeCubic.gen.c.t | 2 +-
7 files changed, 168 insertions(+), 21 deletions(-)
create mode 100644 doc/gamma.txt
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos(a)gmail.com
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
gfxprim.git ("A simple 2D graphics library with emphasis on correctness and well-defined operation.")
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 f4da6fbfe83e00302e52a89265b2f2e84283df4c (commit)
via 27bdc96dc97ee416a5d59c2c3155cbe6fdf00207 (commit)
from d4c258f6b3bd05560a400bb20a9d428782262eb9 (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/f4da6fbfe83e00302e52a89265b2f2e84283…
commit f4da6fbfe83e00302e52a89265b2f2e84283df4c
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Mon Jun 18 02:27:02 2012 +0200
spiv: Free caches before exit.
Which removes them from the valgrind warnings.
diff --git a/demos/spiv/spiv.c b/demos/spiv/spiv.c
index 489188e..176fa56 100644
--- a/demos/spiv/spiv.c
+++ b/demos/spiv/spiv.c
@@ -750,6 +750,8 @@ int main(int argc, char *argv[])
case GP_KEY_ESC:
case GP_KEY_ENTER:
case GP_KEY_Q:
+ image_cache_drop(params.img_resized_cache);
+ image_cache_drop(params.img_orig_cache);
GP_BackendExit(backend);
return 0;
break;
http://repo.or.cz/w/gfxprim.git/commit/27bdc96dc97ee416a5d59c2c3155cbe6fdf0…
commit 27bdc96dc97ee416a5d59c2c3155cbe6fdf00207
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Mon Jun 18 01:56:25 2012 +0200
spiv: Stop loader thread before resizing backend buffer.
diff --git a/demos/spiv/spiv.c b/demos/spiv/spiv.c
index 19f6d56..489188e 100644
--- a/demos/spiv/spiv.c
+++ b/demos/spiv/spiv.c
@@ -419,21 +419,26 @@ static void *image_loader(void *ptr)
static pthread_t loader_thread = (pthread_t)0;
-static void show_image(struct loader_params *params, const char *path)
+static void stop_loader(void)
{
- int ret;
-
- /* stop previous loader thread */
if (loader_thread) {
abort_flag = 1;
pthread_join(loader_thread, NULL);
loader_thread = (pthread_t)0;
abort_flag = 0;
}
-
+}
+
+static void show_image(struct loader_params *params, const char *path)
+{
+ int ret;
+
if (path != NULL)
params->img_path = path;
+ /* stop previous loader thread */
+ stop_loader();
+
ret = pthread_create(&loader_thread, NULL, image_loader, (void*)params);
if (ret) {
@@ -795,6 +800,8 @@ int main(int argc, char *argv[])
case GP_EV_SYS:
switch (ev.code) {
case GP_EV_SYS_RESIZE:
+ /* stop loader thread before resizing backend buffer */
+ stop_loader();
GP_BackendResize(backend, ev.val.sys.w, ev.val.sys.h);
GP_Fill(backend->context, 0);
params.show_progress_once = 1;
-----------------------------------------------------------------------
Summary of changes:
demos/spiv/spiv.c | 19 ++++++++++++++-----
1 files changed, 14 insertions(+), 5 deletions(-)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos(a)gmail.com
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
gfxprim.git ("A simple 2D graphics library with emphasis on correctness and well-defined operation.")