Gfxprim
Threads by month
- ----- 2026 -----
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- 929 discussions
[repo.or.cz] gfxprim.git branch generate updated: 1e00e08031c90d4f8d1b987d4908c9d2c938671a
by gavento 02 Jun '11
by gavento 02 Jun '11
02 Jun '11
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project gfxprim.git.
The branch, generate has been updated
via 1e00e08031c90d4f8d1b987d4908c9d2c938671a (commit)
via 0dc22c99f6f5c323d4d623e57edce53324d7caeb (commit)
via 8484734afb7ec336d7cf4399064b785e8a3d99d4 (commit)
via daa6ed769550d82191a853913d329d4881a9ab85 (commit)
via 9d50a7192a8d4620a221c571092015891182f63a (commit)
via 57eae77c4371c555ba66b24e739bd2aab83732a9 (commit)
via a31120b664ac415df88655407937f2e9c0fea489 (commit)
via 3eca4f4778eee54992fcd133978419cefd9135b0 (commit)
via 34f8b640d9ce81505a024b745b03a9d179eb9b27 (commit)
via ecb50dd5415f6b8079e3dda4e2cd0a4f9d8043d3 (commit)
from 46a94e8b7af27012503eca96f3d5a1395d75bb10 (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/1e00e08031c90d4f8d1b987d4908c9d2c938…
commit 1e00e08031c90d4f8d1b987d4908c9d2c938671a
Author: Tomas Gavenciak <gavento(a)ucw.cz>
Date: Thu Jun 2 19:16:20 2011 +0200
Update .gitignore (.dep, library)
diff --git a/.gitignore b/.gitignore
index 6126da2..1d500c6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,8 +1,9 @@
*.o
+*.dep
*.pyc
*.gen.c
*.gen.h
*.swp
-libGP_core.so*
-libGP_core.a
+libGP.so*
+libGP.a
http://repo.or.cz/w/gfxprim.git/commit/0dc22c99f6f5c323d4d623e57edce53324d7…
commit 0dc22c99f6f5c323d4d623e57edce53324d7caeb
Author: Tomas Gavenciak <gavento(a)ucw.cz>
Date: Thu Jun 2 19:15:23 2011 +0200
Fix a typo in GP_Get/PutPixel name
diff --git a/include/core/GP_Pixel_Access.h b/include/core/GP_Pixel_Access.h
index 3513d61..331d7eb 100644
--- a/include/core/GP_Pixel_Access.h
+++ b/include/core/GP_Pixel_Access.h
@@ -36,7 +36,7 @@
* GetPixel with context transformations and clipping.
* Returns 0 for clipped pixels or pixels outside bitmap.
*/
-GP_Pixel GP_GetPixel_(GP_Context *context, int x, int y);
+GP_Pixel GP_GetPixel(GP_Context *context, int x, int y);
/*
* Version of GetPixel without transformations nor border checking.
@@ -51,7 +51,7 @@ static inline GP_Pixel GP_GetPixel_Raw(GP_Context *context, int x, int y)
* PutPixel with context transformations and clipping.
* NOP for clipped pixels or pixels outside bitmap.
*/
-void GP_PutPixel_(GP_Context *context, int x, int y, GP_Pixel p);
+void GP_PutPixel(GP_Context *context, int x, int y, GP_Pixel p);
/*
* Version of PutPixel without transformations nor border checking.
diff --git a/libs/core/GP_Pixel_Access.c b/libs/core/GP_Pixel_Access.c
index 4f9b579..f2b8924 100644
--- a/libs/core/GP_Pixel_Access.c
+++ b/libs/core/GP_Pixel_Access.c
@@ -23,7 +23,7 @@
#include "GP_Pixel_Access.h"
#include "GP_Transform.h"
-GP_Pixel GP_GetPixel_(GP_Context *context, int x, int y)
+GP_Pixel GP_GetPixel(GP_Context *context, int x, int y)
{
GP_TRANSFORM_POINT(context, x, y);
if (GP_PIXEL_IS_CLIPPED(context, x, y))
@@ -31,7 +31,7 @@ GP_Pixel GP_GetPixel_(GP_Context *context, int x, int y)
return GP_GetPixel_Raw(context, x, y);
}
-void GP_PutPixel_(GP_Context *context, int x, int y, GP_Pixel p)
+void GP_PutPixel(GP_Context *context, int x, int y, GP_Pixel p)
{
GP_TRANSFORM_POINT(context, x, y);
if (! GP_PIXEL_IS_CLIPPED(context, x, y))
http://repo.or.cz/w/gfxprim.git/commit/8484734afb7ec336d7cf4399064b785e8a3d…
commit 8484734afb7ec336d7cf4399064b785e8a3d99d4
Author: Tomas Gavenciak <gavento(a)ucw.cz>
Date: Thu Jun 2 19:12:27 2011 +0200
Testing framework refactoring and move, new tests.mk
Test collection now part of code generation
Testing should be now accessible from any module
diff --git a/gen.mk b/gen.mk
index ba375c0..5df5588 100644
--- a/gen.mk
+++ b/gen.mk
@@ -5,6 +5,14 @@ ifndef LIBNAME
$(error LIBNAME not defined, fix your library Makefile)
endif
+ifndef GENHEADERS
+GENHEADERS=
+endif
+
+ifndef GENSOURCES
+GENSOURCES=
+endif
+
#
# Headers goes into include/core/
#
diff --git a/include.mk b/include.mk
index 2a103a9..c8f8b18 100644
--- a/include.mk
+++ b/include.mk
@@ -1,3 +1,10 @@
+#
+# Make no subdirs by default
+#
+ifndef SUBDIRS
+SUBDIRS=
+endif
+
.PHONY: $(SUBDIRS) all clean help
all: $(SUBDIRS)
diff --git a/pylib/gfxprim/generators/make_collected_tests.py b/pylib/gfxprim/generators/make_collected_tests.py
new file mode 100644
index 0000000..ca117ec
--- /dev/null
+++ b/pylib/gfxprim/generators/make_collected_tests.py
@@ -0,0 +1,140 @@
+#!/usr/bin/python
+#
+# Script generating collected_tests.gen.c
+#
+# Scrapes the target directory for .test.c files, looks for
+# GP_TEST and GP_SUITE macros and generates code creating all the
+# tests and the suite
+#
+# 2011 - Tomas Gavenciak <gavento(a)ucw.cz>
+#
+
+# Also fixed in tests.mk
+collected_tests_file = 'collected_tests.gen.c'
+
+import os, re, glob
+from gfxprim.generators.generator import *
+
+def warn(msg_s, fname=None, line=None):
+ msg('W', msg_s, fname, line)
+
+def msg(prefix, msg_s, fname=None, line=None):
+ s = '[' + prefix
+ if fname:
+ s += ' ' + fname
+ if line:
+ s += ':%d'%line
+ s += '] '
+ sys.stderr.write(s + msg_s + 'n')
+
+testfile_pattern = '*.test.c'
+
+suites = {} # {"suitename":["testname":{test_parameters}]}
+
+suite_re = re.compile("A\s*GP_SUITE\((.*)\)\s*Z")
+test_re = re.compile("A\s*GP_TEST\((.*)\)\s*Z")
+
+@generator(CHeaderGenerator(name = collected_tests_file),
+ descr = 'Code creating the tests and suites for tests collected '
+ 'from .test.c files',
+ authors = ["2011 - Tomas Gavenciak <gavento(a)ucw.cz>"])
+def tests_collected_tests(c):
+ fnames = glob.fnmatch.filter(os.listdir(c.fdir or '.'), testfile_pattern)
+ print fnames
+ for fn in fnames:
+ dirfn = os.path.join(c.fdir, fn)
+ with open(dirfn, 'rt') as f:
+ find_tests(f, fn)
+ if not fnames:
+ warn('No .test.c files found in "%s".' % c.fdir)
+ if not suites:
+ warn('No suites found, generating empty testsuite.')
+
+ c.rhead("#include <check.h>nn")
+
+ for suite, tests in suites.iteritems():
+ c.rbody(
+ "/****************************************************************n"
+ " * Suite {{ suite }}n"
+ " */nn", suite=suite)
+ for t in tests:
+ assert ('loop_start' in t) == ('loop_end' in t)
+ c.rbody(
+ "/*n"
+ " * Test {{ suite }}/{{ t['name'] }} defined in {{ t['fname'] }}:{{ t['line'] }}n"
+ " */nn"
+ "void GP_TEST_{{ t['name'] }}(int);nn"
+ "TCase *GP_TC_{{ suite }}_{{ t['name'] }}() {n"
+ " TCase *tc = tcase_create("{{ t['name'] }}");n"
+ " _tcase_add_test(tc, GP_TEST_{{ t['name'] }}, "{{ t['name'] }}", "
+ "{{ t.get('expect_signal', 0) }}, {{ t.get('expect_exit', 0) }}, "
+ "{{ t.get('loop_start', 0) }}, {{ t.get('loop_end', 1) }});n"
+ " return tc;n}nn", t=t, suite=suite)
+ # TODO: Handle special test requirements (timing, fixture, ...)
+
+ c.rbody(
+ "Suite *GP_TS_{{ suite }}() {n"
+ " Suite *s = suite_create("{{ suite }}");n"
+ "{% for t in tests %}"
+ " suite_add_tcase(s, GP_TC_{{ suite }}_{{ t['name'] }}());n"
+ "{% endfor %}"
+ " return s;n}nn", tests=tests, suite=suite)
+
+ # Once for all suites
+ c.rbody(
+ "/****************************************************************n"
+ " * Create and add all suites to a SRunnern"
+ " */nn"
+ "void GP_AddSuitesToSRunner(SRunner *sr) {n"
+ "{% for s in suites %}"
+ " srunner_add_suite(sr, GP_TS_{{ s }}());n"
+ "{% endfor %}"
+ "}nn", suites=suites)
+
+def find_GP_directive(name, regexp, l, fname='unknown', line=0):
+ "Looks for a given GP_* directive, parses args if any, "
+ "retuns (name, dict_of_args) or (None, None) if not found."
+ if name in l:
+ m = regexp.search(l)
+ if not m:
+ warn("found unsuitable %s directive, ignoring." % name, fname, line)
+ else:
+ d = m.groups()[0].split(',', 1)
+ args = {}
+ if len(d)>1:
+ try:
+ s = 'dict( ' + d[1].strip(" tn"") + ' )'
+ args = eval(s)
+ except:
+ die("error parsing arguments: %r" % s, fname, line)
+ return d[0].strip(), args
+ return None, None
+
+def find_tests(f, fname):
+ "Finds all tests in a file."
+ suite = None
+ ls = f.readlines()
+ for i in range(len(ls)):
+ l = ls[i]
+ # Look for suite declaration
+ name, args = find_GP_directive("GP_SUITE", suite_re, l, fname=fname, line=i)
+ if name:
+ suite = name
+ if args:
+ warn("suite should have no arguments other than name.", fname, i)
+ suites.setdefault(name, [])
+ # Look for suite declaration
+ name, args = find_GP_directive("GP_TEST", test_re, l, fname=fname, line=i)
+ if name:
+ test_suite = suite
+ if 'suite' in args:
+ test_suite = args['suite']
+ if not test_suite:
+ test_suite = 'default'
+ warn("no suite defined before test %s, using %r." % (name, test_suite), fname, i)
+ args['name'] = name
+ args['fname'] = fname
+ args['line'] = i
+ suites.setdefault(test_suite, [])
+ suites[test_suite].append(args)
+
diff --git a/pylib/gfxprim/generators/utils.py b/pylib/gfxprim/generators/utils.py
index 28c1891..3ddc7ad 100644
--- a/pylib/gfxprim/generators/utils.py
+++ b/pylib/gfxprim/generators/utils.py
@@ -16,6 +16,7 @@ def j2render(tmpl, **kw):
def load_generators():
"Load all modules containig generators to allow them to register"
# TODO: write proper discovery
+ import gfxprim.generators.make_collected_tests
import gfxprim.generators.core.make_GP_Pixel
import gfxprim.generators.core.make_GP_Blit
pass
diff --git a/tests.mk b/tests.mk
new file mode 100644
index 0000000..5dbcc80
--- /dev/null
+++ b/tests.mk
@@ -0,0 +1,46 @@
+.PHONY: tests runtests
+
+#
+# List of test targets (testsuite incl. automatically)
+#
+ifndef TESTS
+TESTS=
+endif
+
+#
+# Testsuite with automated collection of tests
+# All .test.c files are scraped for GP_TEST definitions
+#
+
+ifdef TESTSUITE
+# a bit crude way to link with test minilibrary
+GP_TESTLIB_SRCS=${TOPDIR}/tests/common/GP_Tests.c
+CSOURCES+=${GP_TESTLIB_SRCS}
+
+# generated suite creation code
+TESTSUITE_GEN=collected_tests.gen.c # also fixed in the code generator
+GENSOURCES+=${TESTSUITE_GEN}
+
+TESTSUITE_SRCS=$(wildcard *.test.c) ${TESTSUITE_GEN} ${GP_TESTLIB_SRCS}
+INCLUDE+=../tests/common
+TESTSUITE_OBJS=$(patsubst %.c,%.o,$(TESTSUITE_SRCS))
+CLEAN+=${TESTSUITE}
+TESTS+=${TESTSUITE}
+
+${TESTSUITE}: ${TESTSUITE_OBJS}
+ifdef VERBOSE
+ $(CC) $(CFLAGS) $(LDFLAGS) -Wl,--start-group $(LDLIBS) $^ -Wl,--end-group -o $@
+else
+ @echo "LD $@"
+ @$(CC) $(CFLAGS) $(LDFLAGS) -Wl,--start-group $(LDLIBS) $^ -Wl,--end-group -o $@
+endif # VERBOSE
+
+endif # TESTSUITE
+
+tests: $(TESTS)
+
+runtests: tests
+ for test in $(TESTS); do LD_LIBRARY_PATH=../../build ./"$$test" -v ; done
+
+# WARN: avoid double includion?
+include $(TOPDIR)/gen.mk
diff --git a/tests/core/core_tests.c b/tests/common/GP_Tests.c
similarity index 100%
rename from tests/core/core_tests.c
rename to tests/common/GP_Tests.c
diff --git a/tests/core/GP_Tests.h b/tests/common/GP_Tests.h
similarity index 100%
rename from tests/core/GP_Tests.h
rename to tests/common/GP_Tests.h
diff --git a/tests/core/GP_Comon.test.c b/tests/core/GP_Common.test.c
similarity index 100%
rename from tests/core/GP_Comon.test.c
rename to tests/core/GP_Common.test.c
diff --git a/tests/core/Makefile b/tests/core/Makefile
index 2911629..929a30c 100644
--- a/tests/core/Makefile
+++ b/tests/core/Makefile
@@ -1,31 +1,10 @@
TOPDIR=../..
-CSOURCES=$(shell echo *.test.c) core_tests.gen.c
-
-INCLUDE=core
+LIBNAME=core
+TESTSUITE=core
LDLIBS+=-lGP -L$(TOPDIR)/build/ -lcheck
-APPS=core_tests
-
include $(TOPDIR)/include.mk
-include $(TOPDIR)/app.mk
-
-.PHONY: run
-
-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=../../build ./"$$test" -v ; done
+include $(TOPDIR)/tests.mk
-core_tests.gen.c: $(TEST_SRCS) find_tests.py
-ifdef VERBOSE
- python find_tests.py -c $@ $(TEST_SRCS)
-else
- @echo "GEN (python) $@"
- @python find_tests.py -c $@ $(TEST_SRCS)
-endif
-core_tests: $(TEST_OBJS) core_tests.gen.o
diff --git a/tests/core/find_tests.py b/tests/core/find_tests.py
deleted file mode 100644
index 7ddc7fb..0000000
--- a/tests/core/find_tests.py
+++ /dev/null
@@ -1,154 +0,0 @@
-#!/bin/python
-
-import sys, re, getopt
-
-# Helpers
-
-def die(msg_s, fname=None, line=None):
- msg('E', msg_s, fname, line)
- sys.exit(1)
-
-def warn(msg_s, fname=None, line=None):
- msg('W', msg_s, fname, line)
-
-def msg(prefix, msg_s, fname=None, line=None):
- s = '[' + prefix
- if fname:
- s += ' ' + fname
- if line:
- s += ':%d'%line
- s += '] '
- sys.stderr.write(s + msg_s + 'n')
-
-# Globals
-
-suites = {} # {"suitename":["testname":{test_parameters}]}
-
-suite_re = re.compile("A\s*GP_SUITE\((.*)\)\s*Z")
-test_re = re.compile("A\s*GP_TEST\((.*)\)\s*Z")
-
-
-def find_GP_directive(name, regexp, l, fname='unknown', line=0):
- "Looks for a given GP_* directive, parses args if any, "
- "retuns (name, dict_of_args) or (None, None) if not found."
- if name in l:
- m = regexp.search(l)
- if not m:
- warn("found unsuitable %s directive, ignoring." % name, fname, line)
- else:
- d = m.groups()[0].split(',', 1)
- args = {}
- if len(d)>1:
- try:
- s = 'dict( ' + d[1].strip(" tn"") + ' )'
- args = eval(s)
- except:
- die("error parsing arguments: %r" % s, fname, line)
- return d[0].strip(), args
- return None, None
-
-def find_tests(f, fname):
- "Finds all tests in a file."
- suite = None
- ls = f.readlines()
- for i in range(len(ls)):
- l = ls[i]
- # Look for suite declaration
- name, args = find_GP_directive("GP_SUITE", suite_re, l, fname=fname, line=i)
- if name:
- suite = name
- if args:
- warn("suite should have no arguments other than name.", fname, i)
- suites.setdefault(name, [])
- # Look for suite declaration
- name, args = find_GP_directive("GP_TEST", test_re, l, fname=fname, line=i)
- if name:
- test_suite = suite
- if 'suite' in args:
- test_suite = args['suite']
- if not test_suite:
- test_suite = 'default'
- warn("no suite defined before test %s, using %r." % (name, test_suite), fname, i)
- args['name'] = name
- args['fname'] = fname
- args['line'] = i
- suites.setdefault(test_suite, [])
- suites[test_suite].append(args)
-
-def gen_tests(f):
- f.write("/*n"
- " * This GENERATED file is part of GfxPrim. See LICENSE for legal stuff.n"
- " * Do not modify this file directly!n"
- " */nn"
- "#include <check.h>nn")
-
- for suite, tests in suites.iteritems():
- f.write("/****************************************************************n"
- " * Suite %sn"
- " */nn" % suite)
- for t in tests:
- f.write("/*n"
- " * Test %s/%s defined in %s:%dn"
- " */nn" % (suite, t['name'], t['fname'], t['line']))
- f.write("void GP_TEST_%s(int);nn"
- "TCase *GP_TC_%s_%s()n"
- "{n"
- " TCase *tc = tcase_create("%s");n" %
- (t['name'], suite, t['name'], t['name']))
- signal = t.get('expect_signal', 0)
- exitval = t.get('expect_exit', 0)
- assert ('loop_start' in t) == ('loop_end' in t)
- loop_start = t.get('loop_start', 0)
- loop_end = t.get('loop_end', 1)
- f.write(" _tcase_add_test(tc, GP_TEST_%s, "%s", %d, %d, %d, %d);n" % - (t['name'], t['name'], signal, exitval, loop_start, loop_end))
- f.write(" return tc;n}nn")
- # TODO: Handle special test requirements (timing, fixture, ...)
-
- f.write("Suite *GP_TS_%s()n"
- "{n"
- " Suite *s = suite_create("%s");n" % (suite, suite))
- for t in tests:
- f.write(" suite_add_tcase(s, GP_TC_%s_%s());n" % (suite, t['name']))
- f.write(" return s;n"
- "}nn")
-
- f.write("/****************************************************************n"
- " * Create and add all suites to a SRunnern"
- " */nn"
- "void GP_AddSuitesToSRunner(SRunner *sr)n"
- "{n")
- for suite in suites:
- f.write(" srunner_add_suite(sr, GP_TS_%s());n" % suite)
- f.write("}nn")
-
-
-def main():
- try:
- opts, args = getopt.gnu_getopt(sys.argv[1:], "c:")
- except:
- die("Invalid arguments")
- cfile = None
- for opt, val in opts:
- if opt == '-c':
- cfile = val
- if not cfile:
- die("You must specify: -c <output.c>")
-
- for fn in args:
- try:
- f = open(fn, 'rt')
- except:
- die("Unable to open '%s'" % fn)
- find_tests(f, fn)
- f.close()
-
- try:
- f = open(cfile, 'wt')
- except:
- die("Unable to open '%s'" % cfile)
- gen_tests(f)
- f.close()
-
-if __name__ == '__main__':
- main()
diff --git a/tests/core/font.test.c b/tests/text/font.test.c
similarity index 100%
rename from tests/core/font.test.c
rename to tests/text/font.test.c
http://repo.or.cz/w/gfxprim.git/commit/daa6ed769550d82191a853913d329d4881a9…
commit daa6ed769550d82191a853913d329d4881a9ab85
Merge: 46a94e8 9d50a71
Author: Tomas Gavenciak <gavento(a)ucw.cz>
Date: Thu Jun 2 17:40:59 2011 +0200
Merge remote branch 'origin/master' into generate
Conflicts:
libs/core/Makefile
-----------------------------------------------------------------------
Summary of changes:
.gitignore | 5 +-
Makefile | 22 +---
build/Makefile | 4 +
gen.mk | 8 +
include.mk | 7 +
include/{sdl => SDL}/GP_SDL.h | 0
include/{sdl => SDL}/GP_SDL_Context.h | 0
include/{sdl => SDL}/GP_SDL_VideoInit.h | 0
include/{sdl => SDL}/README | 0
include/core/GP_Pixel_Access.h | 4 +-
install.sh | 24 ++++
lib.mk | 39 ++++++-
libs/Makefile | 2 +-
libs/{sdl => SDL}/GP_SDL_Context.c | 0
libs/{sdl => SDL}/GP_SDL_VideoInit.c | 0
libs/{backends => SDL}/Makefile | 3 +-
libs/core/GP_Pixel_Access.c | 4 +-
libs/core/Makefile | 1 -
libs/sdl/Makefile | 5 -
pylib/gfxprim/generators/make_collected_tests.py | 140 ++++++++++++++++++++
pylib/gfxprim/generators/utils.py | 1 +
tests.mk | 46 +++++++
tests/Makefile | 2 +-
tests/{sdl => SDL}/Makefile | 10 +-
tests/{sdl => SDL}/fileview.c | 0
tests/{sdl => SDL}/fonttest.c | 0
tests/{sdl => SDL}/linetest.c | 0
tests/{sdl => SDL}/pixeltest.c | 0
tests/{sdl => SDL}/randomshapetest.c | 0
tests/{sdl => SDL}/runtest.sh | 0
tests/{sdl => SDL}/shapetest.c | 0
tests/{sdl => SDL}/sierpinsky.c | 0
tests/{sdl => SDL}/symbolstest.c | 0
tests/{sdl => SDL}/textaligntest.c | 0
tests/{sdl => SDL}/trianglefps.c | 0
tests/{core/core_tests.c => common/GP_Tests.c} | 0
tests/{core => common}/GP_Tests.h | 0
tests/core/{GP_Comon.test.c => GP_Common.test.c} | 0
tests/core/Makefile | 27 +----
tests/core/find_tests.py | 154 ----------------------
tests/sdl/old.dddd | 19 ---
tests/{core => text}/font.test.c | 0
42 files changed, 291 insertions(+), 236 deletions(-)
rename include/{sdl => SDL}/GP_SDL.h (100%)
rename include/{sdl => SDL}/GP_SDL_Context.h (100%)
rename include/{sdl => SDL}/GP_SDL_VideoInit.h (100%)
rename include/{sdl => SDL}/README (100%)
create mode 100755 install.sh
rename libs/{sdl => SDL}/GP_SDL_Context.c (100%)
rename libs/{sdl => SDL}/GP_SDL_VideoInit.c (100%)
copy libs/{backends => SDL}/Makefile (78%)
delete mode 100644 libs/sdl/Makefile
create mode 100644 pylib/gfxprim/generators/make_collected_tests.py
create mode 100644 tests.mk
rename tests/{sdl => SDL}/Makefile (55%)
rename tests/{sdl => SDL}/fileview.c (100%)
rename tests/{sdl => SDL}/fonttest.c (100%)
rename tests/{sdl => SDL}/linetest.c (100%)
rename tests/{sdl => SDL}/pixeltest.c (100%)
rename tests/{sdl => SDL}/randomshapetest.c (100%)
rename tests/{sdl => SDL}/runtest.sh (100%)
rename tests/{sdl => SDL}/shapetest.c (100%)
rename tests/{sdl => SDL}/sierpinsky.c (100%)
rename tests/{sdl => SDL}/symbolstest.c (100%)
rename tests/{sdl => SDL}/textaligntest.c (100%)
rename tests/{sdl => SDL}/trianglefps.c (100%)
rename tests/{core/core_tests.c => common/GP_Tests.c} (100%)
rename tests/{core => common}/GP_Tests.h (100%)
rename tests/core/{GP_Comon.test.c => GP_Common.test.c} (100%)
delete mode 100644 tests/core/find_tests.py
delete mode 100644 tests/sdl/old.dddd
rename tests/{core => text}/font.test.c (100%)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos(a)gmail.com
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
gfxprim.git ("A simple 2D graphics library with emphasis on correctness and well-defined operation.")
1
0
[repo.or.cz] gfxprim.git branch generate updated: 46a94e8b7af27012503eca96f3d5a1395d75bb10
by gavento 30 May '11
by gavento 30 May '11
30 May '11
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project gfxprim.git.
The branch, generate has been updated
via 46a94e8b7af27012503eca96f3d5a1395d75bb10 (commit)
via af8413c459e1427af1690769d44dd38eec968016 (commit)
via d82e10f8c5711640d32a614c043d75c9b49808e1 (commit)
via 3ac85f2f55d88631e43794d67e93663b73bd1f9d (commit)
via 4920417b0a6d627b8d44d50a79ffe53419cd50d5 (commit)
via ae4159f55d95af964981f666c129693281aade0e (commit)
via 2ef01b5df8f4d6c6fe1e3a4f45096399b5629752 (commit)
from c8a27730e311669696166d376863941b73e5e552 (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/46a94e8b7af27012503eca96f3d5a1395d75…
commit 46a94e8b7af27012503eca96f3d5a1395d75bb10
Author: Tomas Gavenciak <gavento(a)ucw.cz>
Date: Mon May 30 01:10:48 2011 +0200
Add TRANSFORM_BLIT for blit pre-transformation
+ edit doc string
diff --git a/include/core/GP_Transform.h b/include/core/GP_Transform.h
index 152253d..9ea5eec 100644
--- a/include/core/GP_Transform.h
+++ b/include/core/GP_Transform.h
@@ -63,16 +63,29 @@
* 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.
+ * Arguments x, y, w, h are modified.
*/
-#define GP_TRANSFORM_RECT(context, x, y, rw, rh) do { - GP_TRANSFORM_SWAP(context, x, y); - GP_TRANSFORM_SWAP(context, w, h); - if ((context)->x_swap) { - x = (context)->w - x - rw; - } - if ((context)->y_swap) { - y = (context)->h - y - rh; - } +#define GP_TRANSFORM_RECT(context, x, y, w, h) do { + GP_TRANSFORM_SWAP(context, x, y); + GP_TRANSFORM_SWAP(context, w, h); + if ((context)->x_swap) { + x = (context)->w - x - w; + } + if ((context)->y_swap) { + y = (context)->h - y - h; + } +} while (0)
+
+/*
+ * Transform "user"-coordinates to "real"-coordinates for a blit
+ * called as GP_Blit(c1, x1, y1, w, h, c2, x2, y2).
+ * All x1, y1, x2, y2, w, h are adjusted.
+ */
+#define GP_TRANSFORM_BLIT(c1, x1, y1, w, h, c2, x2, y2) do { + GP_TRANSFORM_RECT(c1, x1, y1, w, h); + int w2 = w, h2 = h; + GP_TRANSFORM_SWAP(c2, w2, h2); + GP_TRANSFORM_RECT(c2, x2, y2, w2, h2); } while (0)
/*
http://repo.or.cz/w/gfxprim.git/commit/af8413c459e1427af1690769d44dd38eec96…
commit af8413c459e1427af1690769d44dd38eec968016
Author: Tomas Gavenciak <gavento(a)ucw.cz>
Date: Mon May 30 01:09:50 2011 +0200
Add one generated header
diff --git a/include/core/GP_Pixel.h b/include/core/GP_Pixel.h
index feb7eac..a1469e8 100644
--- a/include/core/GP_Pixel.h
+++ b/include/core/GP_Pixel.h
@@ -52,8 +52,9 @@ struct GP_Context;
typedef uint32_t GP_Pixel;
-/* Generated header */
+/* Generated headers */
#include "GP_Pixel.gen.h"
+#include "GP_Pixel_Scale.gen.h"
/*
* Information about ordering of pixels in byte for 1, 2 and 4 bpp
http://repo.or.cz/w/gfxprim.git/commit/d82e10f8c5711640d32a614c043d75c9b498…
commit d82e10f8c5711640d32a614c043d75c9b49808e1
Author: Tomas Gavenciak <gavento(a)ucw.cz>
Date: Mon May 30 01:07:32 2011 +0200
Reimplemented Get/PutPixel with generated code
Minor shuffling generators and includes around
Common file GP_Pixel_Access.h (ugly name, huh)
diff --git a/include/core/GP_Core.h b/include/core/GP_Core.h
index dd70700..a00f1d7 100644
--- a/include/core/GP_Core.h
+++ b/include/core/GP_Core.h
@@ -41,8 +41,10 @@
/* ... and it's trasformations */
#include "core/GP_Transform.h"
-/* Pixels */
-#include "GP_GetPixel.h"
-#include "GP_PutPixel.h"
+/* Pixeltypes */
+#include "core/GP_Pixel.h"
+
+/* Individual pixel access */
+#include "core/GP_Pixel_Access.h"
#endif /* GP_CORE_H */
diff --git a/include/core/GP_GetPixel.h b/include/core/GP_GetPixel.h
deleted file mode 100644
index f611a1a..0000000
--- a/include/core/GP_GetPixel.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*****************************************************************************
- * This file is part of gfxprim library. *
- * *
- * Gfxprim is free software; you can redistribute it and/or *
- * modify it under the terms of the GNU Lesser General Public *
- * License as published by the Free Software Foundation; either *
- * version 2.1 of the License, or (at your option) any later version. *
- * *
- * Gfxprim is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with gfxprim; if not, write to the Free Software *
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
- * Boston, MA 02110-1301 USA *
- * *
- * Copyright (C) 2009-2010 Jiri "BlueBear" Dluhos *
- * <jiri.bluebear.dluhos(a)gmail.com> *
- * *
- * Copyright (C) 2009-2010 Cyril Hrubis <metan(a)ucw.cz> *
- * *
- *****************************************************************************/
-
-#ifndef GP_GETPIXEL_H
-#define GP_GETPIXEL_H
-
-#include "GP_Context.h"
-
-#define GP_GETPIXEL_1BPP(context, x, y) ({ - uint8_t *gp_pix_addr = GP_PIXEL_ADDR(context, x, y); - (0x80>>(x%8) & *gp_pix_addr) ? 1 : 0; -})
-
-#define GP_GETPIXEL_2BPP(context, x, y) ({ - uint8_t *gp_pix_addr = GP_PIXEL_ADDR(context, x, y); - (*gp_pix_addr & (0xc0 >> (2*(x%4)))) >> (2*(3 - x%4)); -})
-
-#define GP_GETPIXEL_4BPP(context, x, y) ({ - uint8_t *gp_pix_addr = GP_PIXEL_ADDR(context, x, y); - (*gp_pix_addr & (0xf0 >> (4*(x%2)))) >> (4*(1 - x%2)); -})
-
-#define GP_GETPIXEL_8BPP(context, x, y) ({ - uint8_t *gp_pix_addr = GP_PIXEL_ADDR(context, x, y); - gp_pix_addr[0]; -})
-
-#define GP_GETPIXEL_16BPP(context, x, y) ({ - uint8_t *gp_pix_addr = GP_PIXEL_ADDR(context, x, y); - gp_pix_addr[0]<<8 | gp_pix_addr[1]; -})
-
-#define GP_GETPIXEL_24BPP(context, x, y) ({ - uint8_t *gp_pix_addr = GP_PIXEL_ADDR(context, x, y); - gp_pix_addr[0]<<16 | gp_pix_addr[1] << 8 | - gp_pix_addr[2]; -})
-
-#define GP_GETPIXEL_32BPP(context, x, y) ({ - uint8_t *gp_pix_addr = GP_PIXEL_ADDR(context, x, y); - gp_pix_addr[0]<<24 | gp_pix_addr[1] << 16 | - gp_pix_addr[2] << 8 | gp_pix_addr[3]; -})
-
-/*
- * General getpixel.
- */
-GP_Pixel GP_GetPixel(GP_Context *context, int x, int y);
-
-/*
- * General rotated getpixel.
- */
-GP_Pixel GP_TGetPixel(GP_Context *context, int x, int y);
-
-#endif /* GP_GETPIXEL_H */
diff --git a/libs/core/GP_PutPixel.c b/include/core/GP_Pixel_Access.h
similarity index 60%
rename from libs/core/GP_PutPixel.c
rename to include/core/GP_Pixel_Access.h
index 40a8363..3513d61 100644
--- a/libs/core/GP_PutPixel.c
+++ b/include/core/GP_Pixel_Access.h
@@ -16,50 +16,50 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, *
* Boston, MA 02110-1301 USA *
* *
- * Copyright (C) 2009-2010 Jiri "BlueBear" Dluhos *
- * <jiri.bluebear.dluhos(a)gmail.com> *
- * *
- * Copyright (C) 2009-2010 Cyril Hrubis <metan(a)ucw.cz> *
+ * Copyright (C) 2011 Tomas Gavenciak <gavento(a)ucw.cz> *
* *
*****************************************************************************/
-#include "GP_Core.h"
+#ifndef GP_PIXEL_ACCESS_H
+#define GP_PIXEL_ACCESS_H
+#include "GP_Context.h"
#include "GP_FnPerBpp.h"
+#include "GP_Pixel.h"
-#define DO_PUTPIXEL(bits) -void GP_PutPixel##bits##bpp(GP_Context *context, int x, int y, GP_Pixel pixel) -{ - if (GP_PIXEL_IS_CLIPPED(context, x, y)) - return; -- GP_PUTPIXEL_##bits##BPP(context, x, y, pixel); -} +/*
+ * Generated header
+ */
+#include "GP_Pixel_Access.gen.h"
-DO_PUTPIXEL(1)
-DO_PUTPIXEL(2)
-DO_PUTPIXEL(4)
-DO_PUTPIXEL(8)
-DO_PUTPIXEL(16)
-DO_PUTPIXEL(24)
-DO_PUTPIXEL(32)
+/*
+ * GetPixel with context transformations and clipping.
+ * Returns 0 for clipped pixels or pixels outside bitmap.
+ */
+GP_Pixel GP_GetPixel_(GP_Context *context, int x, int y);
/*
- * A generic PutPixel call that automatically determines the number of
- * bits per pixel.
+ * Version of GetPixel without transformations nor border checking.
*/
-void GP_PutPixel(GP_Context *context, int x, int y, GP_Pixel pixel)
+static inline GP_Pixel GP_GetPixel_Raw(GP_Context *context, int x, int y)
{
- GP_CHECK_CONTEXT(context);
-
- GP_FN_PER_BPP(GP_PutPixel, context->bpp, context, x, y, pixel);
+ GP_FN_RET_PER_BPP(GP_GetPixel_Raw, context->bpp, context->bit_endian,
+ context, x, y);
}
-void GP_TPutPixel(GP_Context *context, int x, int y, GP_Pixel pixel)
-{
- GP_CHECK_CONTEXT(context);
-
- GP_TRANSFORM_POINT(context, x, y);
+/*
+ * PutPixel with context transformations and clipping.
+ * NOP for clipped pixels or pixels outside bitmap.
+ */
+void GP_PutPixel_(GP_Context *context, int x, int y, GP_Pixel p);
- GP_PutPixel(context, x, y, pixel);
+/*
+ * Version of PutPixel without transformations nor border checking.
+ */
+static inline void GP_PutPixel_Raw(GP_Context *context, int x, int y, GP_Pixel p)
+{
+ GP_FN_PER_BPP(GP_PutPixel_Raw, context->bpp, context->bit_endian,
+ context, x, y, p);
}
+
+#endif /* GP_PIXEL_ACCESS_H */
diff --git a/include/core/GP_PutPixel.h b/include/core/GP_PutPixel.h
deleted file mode 100644
index fe5b219..0000000
--- a/include/core/GP_PutPixel.h
+++ /dev/null
@@ -1,109 +0,0 @@
-/*****************************************************************************
- * This file is part of gfxprim library. *
- * *
- * Gfxprim is free software; you can redistribute it and/or *
- * modify it under the terms of the GNU Lesser General Public *
- * License as published by the Free Software Foundation; either *
- * version 2.1 of the License, or (at your option) any later version. *
- * *
- * Gfxprim is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with gfxprim; if not, write to the Free Software *
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
- * Boston, MA 02110-1301 USA *
- * *
- * Copyright (C) 2009-2010 Jiri "BlueBear" Dluhos *
- * <jiri.bluebear.dluhos(a)gmail.com> *
- * *
- * Copyright (C) 2009-2010 Cyril Hrubis <metan(a)ucw.cz> *
- * *
- *****************************************************************************/
-
-#ifndef GP_PUTPIXEL_H
-#define GP_PUTPIXEL_H
-
-#include "GP_Context.h"
-
-/*
- * Putpixel macros.
- */
-#define GP_PUTPIXEL_1BPP(context, x, y, pixel) do { - uint8_t *gp_pix_addr = GP_PIXEL_ADDR(context, x, y); -- if (pixel) - *gp_pix_addr |= (0x80>>(x%8)); - else - *gp_pix_addr &= ~(0x80>>(x%8)); -} while (0)
-
-#define GP_PUTPIXEL_2BPP(context, x, y, pixel) do { - uint8_t *gp_pix_addr = GP_PIXEL_ADDR(context, x, y); -- *gp_pix_addr = (*gp_pix_addr & ~(0xc0 >> (2*(x%4)))) | - (pixel << (2*(3 - x%4))); --} while (0)
-
-#define GP_PUTPIXEL_4BPP(context, x, y, pixel) do { - uint8_t *gp_pix_addr = GP_PIXEL_ADDR(context, x, y); -- *gp_pix_addr = (*gp_pix_addr & (0xf0 >> (4*(x%2)))) | - (pixel << (4*(1 - x%2))); -} while (0)
-
-#define GP_PUTPIXEL_8BPP(context, x, y, pixel) do { - uint8_t *gp_pix_addr = GP_PIXEL_ADDR(context, x, y); -- *gp_pix_addr = (pixel) & 0xff; -} while (0)
-
-#define GP_PUTPIXEL_16BPP(context, x, y, pixel) do { - uint8_t *gp_pix_addr = GP_PIXEL_ADDR(context, x, y); -- gp_pix_addr[0] = pixel & 0xff; - gp_pix_addr[1] = (pixel>>8) & 0xff; -} while (0)
-
-#define GP_PUTPIXEL_24BPP(context, x, y, pixel) do { - uint8_t *gp_pix_addr = GP_PIXEL_ADDR(context, x, y); -- gp_pix_addr[0] = pixel & 0xff; - gp_pix_addr[1] = (pixel>>8) & 0xff; - gp_pix_addr[2] = (pixel>>16) & 0xff; -} while (0)
-
-#define GP_PUTPIXEL_32BPP(context, x, y, pixel) do { - uint8_t *gp_pix_addr = GP_PIXEL_ADDR(context, x, y); -- gp_pix_addr[0] = pixel & 0xff; - gp_pix_addr[1] = (pixel>>8) & 0xff; - gp_pix_addr[2] = (pixel>>16) & 0xff; - gp_pix_addr[3] = (pixel>>24) & 0xff; -} while (0)
-
-/*
- * Safe functions, that checks clipping.
- */
-void GP_PutPixel1bpp(GP_Context *context, int x, int y, GP_Pixel pixel);
-void GP_PutPixel2bpp(GP_Context *context, int x, int y, GP_Pixel pixel);
-void GP_PutPixel4bpp(GP_Context *context, int x, int y, GP_Pixel pixel);
-void GP_PutPixel8bpp(GP_Context *context, int x, int y, GP_Pixel pixel);
-void GP_PutPixel16bpp(GP_Context *context, int x, int y, GP_Pixel pixel);
-void GP_PutPixel24bpp(GP_Context *context, int x, int y, GP_Pixel pixel);
-void GP_PutPixel32bpp(GP_Context *context, int x, int y, GP_Pixel pixel);
-
-/*
- * General putpixel.
- */
-void GP_PutPixel(GP_Context *context, int x, int y, GP_Pixel pixel);
-
-/*
- * General rotated putpixel.
- */
-void GP_TPutPixel(GP_Context *context, int x, int y, GP_Pixel pixel);
-
-#endif /* GP_PUTPIXEL_H */
diff --git a/include/gfx/GP_Gfx.h b/include/gfx/GP_Gfx.h
index 19bad4e..2f42cb1 100644
--- a/include/gfx/GP_Gfx.h
+++ b/include/gfx/GP_Gfx.h
@@ -37,8 +37,7 @@
#include "core/GP_Transform.h"
#include "core/GP_Context.h"
#include "core/GP_WritePixel.h"
-#include "core/GP_GetPixel.h"
-#include "core/GP_PutPixel.h"
+#include "core/GP_Pixel_Access.h"
#include "core/GP_Color.h"
/* public drawing API */
diff --git a/libs/core/GP_GetPixel.c b/libs/core/GP_Pixel_Access.c
similarity index 64%
rename from libs/core/GP_GetPixel.c
rename to libs/core/GP_Pixel_Access.c
index 76013b4..4f9b579 100644
--- a/libs/core/GP_GetPixel.c
+++ b/libs/core/GP_Pixel_Access.c
@@ -16,44 +16,24 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, *
* Boston, MA 02110-1301 USA *
* *
- * Copyright (C) 2009-2010 Jiri "BlueBear" Dluhos *
- * <jiri.bluebear.dluhos(a)gmail.com> *
- * *
- * Copyright (C) 2009-2010 Cyril Hrubis <metan(a)ucw.cz> *
+ * Copyright (C) 2011 Tomas Gavenciak <gavento(a)ucw.cz> *
* *
*****************************************************************************/
-#include "GP_Core.h"
-#include "GP_FnPerBpp.h"
-
-#define DO_GETPIXEL(bits) -GP_RetCode GP_GetPixel##bits##bpp(GP_Context *context, int x, int y) -{ - if (GP_PIXEL_IS_CLIPPED(context, x, y)) - return 0; -- return GP_GETPIXEL_##bits##BPP(context, x, y); -} -
-DO_GETPIXEL(1)
-DO_GETPIXEL(2)
-DO_GETPIXEL(4)
-DO_GETPIXEL(8)
-DO_GETPIXEL(16)
-DO_GETPIXEL(24)
-DO_GETPIXEL(32)
+#include "GP_Pixel_Access.h"
+#include "GP_Transform.h"
-GP_Pixel GP_GetPixel(GP_Context *context, int x, int y)
+GP_Pixel GP_GetPixel_(GP_Context *context, int x, int y)
{
- GP_CHECK_CONTEXT(context);
-
- GP_FN_RET_PER_BPP(GP_GetPixel, context->bpp, context, x, y);
-
- return 0;
+ GP_TRANSFORM_POINT(context, x, y);
+ if (GP_PIXEL_IS_CLIPPED(context, x, y))
+ return 0;
+ return GP_GetPixel_Raw(context, x, y);
}
-GP_Pixel GP_TGetPixel(GP_Context *context, int x, int y)
+void GP_PutPixel_(GP_Context *context, int x, int y, GP_Pixel p)
{
GP_TRANSFORM_POINT(context, x, y);
- return GP_GetPixel(context, x, y);
+ if (! GP_PIXEL_IS_CLIPPED(context, x, y))
+ GP_PutPixel_Raw(context, x, y, p);
}
diff --git a/libs/core/Makefile b/libs/core/Makefile
index 8126e00..0b9fb55 100644
--- a/libs/core/Makefile
+++ b/libs/core/Makefile
@@ -1,6 +1,6 @@
TOPDIR=../..
GENSOURCES=GP_Pixel.gen.c GP_Blit.gen.c
-GENHEADERS=GP_Pixel_Scale.gen.h GP_Blit.gen.h GP_Pixel.gen.h
+GENHEADERS=GP_Pixel_Scale.gen.h GP_Blit.gen.h GP_Pixel.gen.h GP_Pixel_Access.gen.h
CSOURCES=$(filter-out $(wildcard *.gen.c),$(wildcard *.c))
LIBNAME=core
diff --git a/pylib/gfxprim/generators/core/gen_pixel_access.py b/pylib/gfxprim/generators/core/gen_pixel_access.py
new file mode 100644
index 0000000..6b96fc3
--- /dev/null
+++ b/pylib/gfxprim/generators/core/gen_pixel_access.py
@@ -0,0 +1,51 @@
+# Module generating C source and headers for get/putpixel
+# 2011 - Tomas Gavenciak <gavento(a)ucw.cz>
+
+from gfxprim.generators.utils import *
+
+def gen_get_pixel_addr_bpp(size, size_suffix, header):
+ "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.rbody(
+ "/* 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_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_suffix }}(x)
"
+ " (((x) % {{ 8//size }}) * {{ size }})n"
+ "{% else %}"
+ "#define GP_PIXEL_ADDR_OFFSET_{{ size_suffix }}(x)
"
+ " ({{ 8-size }} - ((x) % {{ 8//size }}) * {{ size }})n"
+ "{% endif %}"
+ "{% endif %}",
+ size=size, size_suffix=size_suffix, bit_endian=bit_endian)
+
+def gen_getpixel_bpp(size, size_suffix, header):
+ "Generate code for GetPixel_Raw_xBPP, no clipping or transform. "
+ "Only depends on bpp (bit size), size_suffix must be "
+ "of form 8BPP, 2BPP_LE and the like."
+ header.rbody(
+ "n/*** GP_GetPixel for {{ size_suffix }} ***/n"
+ "static inline GP_Pixel GP_GetPixel_Raw_{{ size_suffix }}(GP_Context *c, int x, int y)n"
+ "{n"
+ " return GP_GET_BITS(GP_PIXEL_ADDR_OFFSET_{{ size_suffix }}(x) , {{ size }},n"
+ " *(GP_PIXEL_ADDR_{{ size_suffix}}(c, x, y)));n"
+ "}nn", size=size, size_suffix=size_suffix)
+
+def gen_putpixel_bpp(size, size_suffix, header):
+ "Generate code for PutPixel_Raw_xBPP, no clipping or transform. "
+ "Only depends on bpp (bit size), size_suffix must be "
+ "of form 8BPP, 2BPP_LE and the like."
+ header.rbody(
+ "n/*** GP_PutPixel for {{ size_suffix }} ***/n"
+ "static inline void GP_PutPixel_Raw_{{ size_suffix }}(GP_Context *c, int x, int y, GP_Pixel p)n"
+ "{n"
+ " GP_SET_BITS(GP_PIXEL_ADDR_OFFSET_{{ size_suffix }}(x) , {{ size }},n"
+ " *(GP_PIXEL_ADDR_{{ size_suffix}}(c, x, y)), p);n"
+ "}nn", size=size, size_suffix=size_suffix)
diff --git a/pylib/gfxprim/generators/core/gen_pixeltype.py b/pylib/gfxprim/generators/core/gen_pixeltype.py
index b46d3dd..ea3ae20 100644
--- a/pylib/gfxprim/generators/core/gen_pixeltype.py
+++ b/pylib/gfxprim/generators/core/gen_pixeltype.py
@@ -154,25 +154,3 @@ def gen_get_pixel_addr(ptype, header, code):
" GP_PIXEL_ADDR_OFFSET_{{ f.size_suffix }}(x)n",
f=ptype)
-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.rbody(
- "/* 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_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_suffix }}(x)
"
- " (((x) % {{ 8//size }}) * {{ size }})n"
- "{% else %}"
- "#define GP_PIXEL_ADDR_OFFSET_{{ size_suffix }}(x)
"
- " ({{ 8-size }} - ((x) % {{ 8//size }}) * {{ size }})n"
- "{% endif %}"
- "{% endif %}",
- size=size, size_suffix=size_suffix, bit_endian=bit_endian)
diff --git a/pylib/gfxprim/generators/core/make_GP_Pixel.py b/pylib/gfxprim/generators/core/make_GP_Pixel.py
index f383f98..0a1ff3b 100644
--- a/pylib/gfxprim/generators/core/make_GP_Pixel.py
+++ b/pylib/gfxprim/generators/core/make_GP_Pixel.py
@@ -1,6 +1,10 @@
#!/usr/bin/python
#
-# Script generating GP_Pixel.gen.c and GP_Pixel.gen.h
+# Script generating:
+#
+# GP_Pixel.gen.c, GP_Pixel.gen.h
+# GP_Pixel_Scale.gen.h
+# GP_Pixel_Access.gen.h
#
# 2011 - Tomas Gavenciak <gavento(a)ucw.cz>
#
@@ -8,9 +12,10 @@
from gfxprim.generators.generator import *
from gfxprim.generators.pixeltype import *
from gfxprim.generators.core.gen_pixeltype import *
+from gfxprim.generators.core.gen_pixel_access import *
@generator(CHeaderGenerator(name = 'GP_Pixel_Scale.gen.h'),
- descr = 'fast value scaling macros',
+ descr = 'Fast value scaling macrosnDo not include directly, use GP_Pixel.h',
authors = ["2011 - Tomas Gavenciak <gavento(a)ucw.cz>"])
def core_GP_Pixel_Scale_gen(h):
h.rhead(
@@ -31,13 +36,12 @@ def core_GP_Pixel_Scale_gen(h):
@generator(CHeaderGenerator(name='GP_Pixel.gen.h'),
CSourceGenerator(name='GP_Pixel.gen.c'),
- descr = 'pixel type definitions and functions',
+ descr = 'Pixel type definitions and functionsnDo not include directly, use GP_Pixel.h',
authors = ["2011 - Tomas Gavenciak <gavento(a)ucw.cz>"])
def core_GP_Pixel_gen(h, c):
c.rhead(
'#include <stdio.h>n'
- '#include <GP.h>n'
- '#include "GP_Pixel.h"n')
+ '#include "GP_Pixel.h"nn')
## Enum of types
gen_GP_PixelType(h, c)
@@ -57,14 +61,28 @@ def core_GP_Pixel_gen(h, c):
gen_get_chs(t, h, c)
gen_get_pixel_addr(t, h, c)
- # Per-bpp macros
- for bpp in bitsizes:
- 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
gen_convert_to(pixeltypes['RGB565'], pixeltypes['RGBA8888'], h, c)
gen_convert_to(pixeltypes['RGBA8888'], pixeltypes['V2'], h, c)
gen_convert_to(pixeltypes['VA12'], pixeltypes['RGBA8888'], h, c)
+
+@generator(CHeaderGenerator(name = 'GP_Pixel_Access.gen.h'),
+ descr = 'Access pixel bytes, Put and GetPixelnDo not include directly, use GP_Pixel.h',
+ authors = ["2011 - Tomas Gavenciak <gavento(a)ucw.cz>"])
+def core_GP_Pixel_Scale_gen(h):
+ h.rhead('#include "GP_Common.h"nn');
+ h.rhead('struct GP_Context;nn');
+ # Per-bpp adress/offset macros
+ for bpp in bitsizes:
+ 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)
+
+ # Per-bpp adress/offset macros
+ for bpp in bitsizes:
+ for bit_endian in bit_endians:
+ if (bpp < 8) or (bit_endian == bit_endians[0]):
+ gen_getpixel_bpp(bpp, get_size_suffix(bpp, bit_endian), h)
+ gen_putpixel_bpp(bpp, get_size_suffix(bpp, bit_endian), h)
+
http://repo.or.cz/w/gfxprim.git/commit/3ac85f2f55d88631e43794d67e93663b73bd…
commit 3ac85f2f55d88631e43794d67e93663b73bd1f9d
Author: Tomas Gavenciak <gavento(a)ucw.cz>
Date: Mon May 30 01:03:59 2011 +0200
Add includes to GP_Blit.c
diff --git a/libs/core/GP_Blit.c b/libs/core/GP_Blit.c
index 20c13ba..a316597 100644
--- a/libs/core/GP_Blit.c
+++ b/libs/core/GP_Blit.c
@@ -21,6 +21,8 @@
*****************************************************************************/
#include "GP_Pixel.h"
+#include "GP_Pixel_Access.h"
+#include "GP_Context.h"
/*
void GP_Blit(const GP_Context *c1, int x1, int y1, int w, int h,
http://repo.or.cz/w/gfxprim.git/commit/4920417b0a6d627b8d44d50a79ffe53419cd…
commit 4920417b0a6d627b8d44d50a79ffe53419cd50d5
Author: Tomas Gavenciak <gavento(a)ucw.cz>
Date: Mon May 30 01:03:16 2011 +0200
Make FnPerBPP depend on bit-endian
diff --git a/include/core/GP_FnPerBpp.h b/include/core/GP_FnPerBpp.h
index 7cd5889..ed2356d 100644
--- a/include/core/GP_FnPerBpp.h
+++ b/include/core/GP_FnPerBpp.h
@@ -29,79 +29,79 @@
* Extra arguments are arguments to be passed to the function.
* Returns GP_ENOIMPL if the bit depth is unknown.
*/
-#define GP_FN_PER_BPP(FN_NAME, bpp, ...) +#define GP_FN_PER_BPP(FN_NAME, bpp, bit_endian, ...) switch (bpp) { case 1: {- if (context->bit_endian==GP_BIT_ENDIAN_LE)- FN_NAME##1bpp_LE(__VA_ARGS__);+ if (bit_endian==GP_BIT_ENDIAN_LE)+ FN_NAME##_1BPP_LE(__VA_ARGS__); else - FN_NAME##1bpp_BE(__VA_ARGS__);+ FN_NAME##_1BPP_BE(__VA_ARGS__); } break; case 2: {- if (context->bit_endian==GP_BIT_ENDIAN_LE)- FN_NAME##2bpp_LE(__VA_ARGS__);+ if (bit_endian==GP_BIT_ENDIAN_LE)+ FN_NAME##_2BPP_LE(__VA_ARGS__); else - FN_NAME##2bpp_BE(__VA_ARGS__);+ FN_NAME##_2BPP_BE(__VA_ARGS__); } break; case 4: {- if (context->bit_endian==GP_BIT_ENDIAN_LE)- FN_NAME##4bpp_LE(__VA_ARGS__);+ if (bit_endian==GP_BIT_ENDIAN_LE)+ FN_NAME##_4BPP_LE(__VA_ARGS__); else - FN_NAME##4bpp_BE(__VA_ARGS__);+ FN_NAME##_4BPP_BE(__VA_ARGS__); } break; case 8: - FN_NAME##8bpp(__VA_ARGS__); + FN_NAME##_8BPP(__VA_ARGS__); break; case 16: - FN_NAME##16bpp(
__VA_ARGS__); + FN_NAME##_16BPP(__VA_ARGS__); break; case 24: - FN_NAME##24bpp(__VA_ARGS__); + FN_NAME##_24BPP(__VA_ARGS__); break; case 32: - FN_NAME##32bpp(__VA_ARGS__); + FN_NAME##_32BPP(__VA_ARGS__); break; default: break; }
-#define GP_FN_RET_PER_BPP(FN_NAME, bpp, ...) +#define GP_FN_RET_PER_BPP(FN_NAME, bpp, bit_endian, ...) switch (bpp) { case 1: {- if (context->bit_endian==GP_BIT_ENDIAN_LE)- return FN_NAME##1bpp_LE(__VA_ARGS__);+ if (bit_endian==GP_BIT_ENDIAN_LE)+ return FN_NAME##_1BPP_LE(__VA_ARGS__); else - return FN_NAME##1bpp_BE(__VA_ARGS__);+ return FN_NAME##_1BPP_BE(__VA_ARGS__); } case 2: {- if (context->bit_endian==GP_BIT_ENDIAN_LE)- return FN_NAME##2bpp_LE(__VA_ARGS__);+ if (bit_endian==GP_BIT_ENDIAN_LE)+ return FN_NAME##_2BPP_LE(__VA_ARGS__); else - return FN_NAME##2bpp_BE(__VA_ARGS__);+ return FN_NAME##_2BPP_BE(__VA_ARGS__); } case 4: {- if (context->bit_endian==GP_BIT_ENDIAN_LE)- return FN_NAME##4bpp_LE(__VA_ARGS__);+ if (bit_endian==GP_BIT_ENDIAN_LE)+ return FN_NAME##_4BPP_LE(__VA_ARGS__); else - return FN_NAME##4bpp_BE(__VA_ARGS__);+ return FN_NAME##_4BPP_BE(__VA_ARGS__); } case 8: - return FN_NAME##8bpp(__VA_ARGS__)
; + return FN_NAME##_8BPP(__VA_ARGS__); case 16: - return FN_NAME##16bpp(__VA_ARGS__); + return FN_NAME##_16BPP(__VA_ARGS__); case 24: - return FN_NAME##24bpp(__VA_ARGS__); + return FN_NAME##_24BPP(__VA_ARGS__); case 32: - return FN_NAME##32bpp(__VA_ARGS__); + return FN_NAME##_32BPP(__VA_ARGS__); }
http://repo.or.cz/w/gfxprim.git/commit/ae4159f55d95af964981f666c129693281aa…
commit ae4159f55d95af964981f666c129693281aade0e
Author: Tomas Gavenciak <gavento(a)ucw.cz>
Date: Mon May 30 00:55:18 2011 +0200
Added 'const' to GP_ContextW/H
diff --git a/include/core/GP_Context.h b/include/core/GP_Context.h
index a8b04db..da344f3 100644
--- a/include/core/GP_Context.h
+++ b/include/core/GP_Context.h
@@ -141,7 +141,7 @@ void GP_ContextFlagsRotateCCW(GP_Context *context);
/*
* Returns context width and height.
*/
-static inline uint32_t GP_ContextW(GP_Context *context)
+static inline uint32_t GP_ContextW(const GP_Context *context)
{
if (context->axes_swap)
return context->h;
@@ -149,7 +149,7 @@ static inline uint32_t GP_ContextW(GP_Context *context)
return context->w;
}
-static inline uint32_t GP_ContextH(GP_Context *context)
+static inline uint32_t GP_ContextH(const GP_Context *context)
{
if (context->axes_swap)
return context->w;
http://repo.or.cz/w/gfxprim.git/commit/2ef01b5df8f4d6c6fe1e3a4f45096399b562…
commit 2ef01b5df8f4d6c6fe1e3a4f45096399b5629752
Author: Tomas Gavenciak <gavento(a)ucw.cz>
Date: Mon May 30 00:14:43 2011 +0200
Naive blit implementation (testing reference)
After losing my older, much more complete version ...
diff --git a/libs/core/GP_Blit.c b/libs/core/GP_Blit.c
new file mode 100644
index 0000000..20c13ba
--- /dev/null
+++ b/libs/core/GP_Blit.c
@@ -0,0 +1,74 @@
+/*****************************************************************************
+ * 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(a)ucw.cz> *
+ * *
+ *****************************************************************************/
+
+#include "GP_Pixel.h"
+
+/*
+void GP_Blit(const GP_Context *c1, int x1, int y1, int w, int h,
+ GP_Context *c2, int x2, int y2)
+{
+ // Ultimate TODO: effective processing
+ GP_Blit_Naive(c1, x1, y1, w, h, c2, x2, y2);
+}
+*/
+
+// TODO(gavento, czech) Plan:
+// GP_Blit_Naive - Zadne rotovani a tak, jen Get/PutPixel a konverze A->RGBA8888->B
+// GP_Blit_Simple - S rotovanim, makrovy Get/PutPixel, mozna optimalizace na radky, chytrejsi konverze (ale porad univ.)
+// GP_Blit_Simple_xBPP - S rotovanim, makrovy Get/PutPixel
+// GP_Blit_xBPP - Optimalizovane, muze volat GP_Blit_Simple_xBPP pro divne pripady
+// GP_Blit - Vola GP_Blit_xBPP (stejny typ) nebo GP_Blit_Simple (jine typy), pripadne optimalizovat
+
+/*
+void GP_Blit_Naive(const GP_Context *c1, int x1, int y1, int w, int h,
+ GP_Context *c2, int x2, int y2)
+{
+ GP_TRANSFORM_BLIT(c1, x1, y1, w, h, c2, x2, y2);
+ // TODO: Cipping?
+ GP_Blit_Naive_Raw(c1, x1, y1, w, h, c2, x2, y2);
+}
+*/
+
+/*
+ * Very naive blit, no optimalizations whatsoever - keep it that way.
+ * Used as a reference for testing and such. Aaand ultimate fallback.
+ */
+void GP_Blit_Naive(const GP_Context *c1, int x1, int y1, int w, int h,
+ GP_Context *c2, int x2, int y2)
+{
+ GP_CHECK(x1 >= 0);
+ GP_CHECK(y1 >= 0);
+ GP_CHECK(w >= 0);
+ GP_CHECK(h >= 0);
+ GP_CHECK(x1 + w <= GP_ContextW(c1));
+ GP_CHECK(y1 + h <= GP_ContextH(c1));
+ GP_CHECK(x2 >= 0);
+ GP_CHECK(y2 >= 0);
+ GP_CHECK(x2 + w <= GP_ContextW(c2));
+ GP_CHECK(y2 + h <= GP_ContextH(c2));
+
+ for (int i = 0; i < w; i++)
+ for (int j = 0; j < h; j++) {
+ GP_Pixel p = GP_GetPixel(c1, x1 + i, y1 + j);
+ GP_PutPixel(c2, x2 + i, y2 + j);
+ }
+}
-----------------------------------------------------------------------
Summary of changes:
include/core/GP_Context.h | 4 +-
include/core/GP_Core.h | 8 +-
include/core/GP_FnPerBpp.h | 56 +++++-----
include/core/GP_GetPixel.h | 78 --------------
include/core/GP_Pixel.h | 3 +-
.../core/GP_Pixel_Access.h | 64 ++++++------
include/core/GP_PutPixel.h | 109 --------------------
include/core/GP_Transform.h | 31 ++++--
include/gfx/GP_Gfx.h | 3 +-
libs/core/GP_Blit.c | 76 ++++++++++++++
libs/core/GP_GetPixel.c | 59 -----------
.../GP_Filters.h => libs/core/GP_Pixel_Access.c | 30 +++---
libs/core/Makefile | 2 +-
pylib/gfxprim/generators/core/gen_pixel_access.py | 51 +++++++++
pylib/gfxprim/generators/core/gen_pixeltype.py | 22 ----
pylib/gfxprim/generators/core/make_GP_Pixel.py | 40 +++++--
16 files changed, 265 insertions(+), 371 deletions(-)
delete mode 100644 include/core/GP_GetPixel.h
rename libs/core/GP_PutPixel.c => include/core/GP_Pixel_Access.h (60%)
delete mode 100644 include/core/GP_PutPixel.h
create mode 100644 libs/core/GP_Blit.c
delete mode 100644 libs/core/GP_GetPixel.c
copy include/filters/GP_Filters.h => libs/core/GP_Pixel_Access.c (76%)
create mode 100644 pylib/gfxprim/generators/core/gen_pixel_access.py
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos(a)gmail.com
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
gfxprim.git ("A simple 2D graphics library with emphasis on correctness and well-defined operation.")
1
0
[repo.or.cz] gfxprim.git branch master updated: 9d50a7192a8d4620a221c571092015891182f63a
by metan 28 May '11
by metan 28 May '11
28 May '11
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project gfxprim.git.
The branch, master has been updated
via 9d50a7192a8d4620a221c571092015891182f63a (commit)
from 57eae77c4371c555ba66b24e739bd2aab83732a9 (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/9d50a7192a8d4620a221c571092015891182…
commit 9d50a7192a8d4620a221c571092015891182f63a
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sat May 28 18:50:06 2011 +0200
build: Fix library soname.
diff --git a/lib.mk b/lib.mk
index 52793ca..397515a 100644
--- a/lib.mk
+++ b/lib.mk
@@ -28,13 +28,13 @@ all: $(OBJECTS)
$(LIBP)$(LIB).so: $(OBJECTS)
ifdef VERBOSE
rm -f $(LIBP)$(LIB).so.0
- ln -s $(LIB).so $(LIBP)$(LIB).so.0
- $(CC) -fPIC -dPIC --shared -Wl,-soname -Wl,$@.0 $(OBJECTS) -o $@
+ cd $(LIBP) && ln -s $(LIB).so $(LIB).so.0
+ $(CC) -fPIC -dPIC --shared -Wl,-soname -Wl,$(LIB).so.0 $(OBJECTS) -o $@
else
@rm -f $(LIBP)$(LIB).so.0
- @ln -s $(LIB).so $(LIBP)$(LIB).so.0
+ @cd $(LIBP) && ln -s $(LIB).so $(LIB).so.0
@echo "LD $@"
- @$(CC) -fPIC -dPIC --shared -Wl,-soname -Wl,$@.0 $(OBJECTS) -o $@
+ @$(CC) -fPIC -dPIC --shared -Wl,-soname -Wl,$(LIB).so.0 $(OBJECTS) -o $@
endif
$(LIBP)$(LIB).a: $(OBJECTS)
-----------------------------------------------------------------------
Summary of changes:
lib.mk | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos(a)gmail.com
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
gfxprim.git ("A simple 2D graphics library with emphasis on correctness and well-defined operation.")
1
0
[repo.or.cz] gfxprim.git branch master updated: 57eae77c4371c555ba66b24e739bd2aab83732a9
by metan 28 May '11
by metan 28 May '11
28 May '11
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project gfxprim.git.
The branch, master has been updated
via 57eae77c4371c555ba66b24e739bd2aab83732a9 (commit)
from a31120b664ac415df88655407937f2e9c0fea489 (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/57eae77c4371c555ba66b24e739bd2aab837…
commit 57eae77c4371c555ba66b24e739bd2aab83732a9
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sat May 28 18:20:27 2011 +0200
build: The link creation must be spinlocked too.
diff --git a/build/Makefile b/build/Makefile
index 6f01215..5c24ac7 100644
--- a/build/Makefile
+++ b/build/Makefile
@@ -31,9 +31,13 @@ endif
@. ./liblock.sh; spinunlock .
libGP.so.0: libGP.so
+ @. ./liblock.sh; spinlock .
ifdef VERBOSE
+ rm -f libGP.so.0
ln -s libGP.so libGP.so.0
else
@echo "LN libGP.so.0"
+ @rm -f libGP.so.0
@ln -s libGP.so libGP.so.0
endif
+ @. ./liblock.sh; spinunlock .
-----------------------------------------------------------------------
Summary of changes:
build/Makefile | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos(a)gmail.com
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
gfxprim.git ("A simple 2D graphics library with emphasis on correctness and well-defined operation.")
1
0
[repo.or.cz] gfxprim.git branch master updated: a31120b664ac415df88655407937f2e9c0fea489
by metan 28 May '11
by metan 28 May '11
28 May '11
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project gfxprim.git.
The branch, master has been updated
via a31120b664ac415df88655407937f2e9c0fea489 (commit)
from 3eca4f4778eee54992fcd133978419cefd9135b0 (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/a31120b664ac415df88655407937f2e9c0fe…
commit a31120b664ac415df88655407937f2e9c0fea489
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sat May 28 17:58:00 2011 +0200
build: Moved the 'sdl' rather to 'SDL'.
diff --git a/include/sdl/GP_SDL.h b/include/SDL/GP_SDL.h
similarity index 100%
rename from include/sdl/GP_SDL.h
rename to include/SDL/GP_SDL.h
diff --git a/include/sdl/GP_SDL_Context.h b/include/SDL/GP_SDL_Context.h
similarity index 100%
rename from include/sdl/GP_SDL_Context.h
rename to include/SDL/GP_SDL_Context.h
diff --git a/include/sdl/GP_SDL_VideoInit.h b/include/SDL/GP_SDL_VideoInit.h
similarity index 100%
rename from include/sdl/GP_SDL_VideoInit.h
rename to include/SDL/GP_SDL_VideoInit.h
diff --git a/include/sdl/README b/include/SDL/README
similarity index 100%
rename from include/sdl/README
rename to include/SDL/README
diff --git a/libs/Makefile b/libs/Makefile
index 9907fb1..0842fc9 100644
--- a/libs/Makefile
+++ b/libs/Makefile
@@ -1,3 +1,3 @@
TOPDIR=..
-SUBDIRS=core gfx text loaders filters input backends sdl
+SUBDIRS=core gfx text loaders filters input backends SDL
include $(TOPDIR)/include.mk
diff --git a/libs/sdl/GP_SDL_Context.c b/libs/SDL/GP_SDL_Context.c
similarity index 100%
rename from libs/sdl/GP_SDL_Context.c
rename to libs/SDL/GP_SDL_Context.c
diff --git a/libs/sdl/GP_SDL_VideoInit.c b/libs/SDL/GP_SDL_VideoInit.c
similarity index 100%
rename from libs/sdl/GP_SDL_VideoInit.c
rename to libs/SDL/GP_SDL_VideoInit.c
diff --git a/libs/sdl/Makefile b/libs/SDL/Makefile
similarity index 89%
rename from libs/sdl/Makefile
rename to libs/SDL/Makefile
index a92d775..6d06e7c 100644
--- a/libs/sdl/Makefile
+++ b/libs/SDL/Makefile
@@ -1,6 +1,6 @@
TOPDIR=../..
CSOURCES=$(shell ls *.c)
-LIBNAME=sdl
+LIBNAME=SDL
BUILDLIB=yes
include $(TOPDIR)/include.mk
include $(TOPDIR)/lib.mk
diff --git a/tests/Makefile b/tests/Makefile
index 4181c5c..71029bb 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -1,3 +1,3 @@
TOPDIR=..
-SUBDIRS=loaders filters core sdl
+SUBDIRS=loaders filters core SDL
include $(TOPDIR)/include.mk
diff --git a/tests/sdl/Makefile b/tests/SDL/Makefile
similarity index 74%
rename from tests/sdl/Makefile
rename to tests/SDL/Makefile
index 11f0055..e186c7a 100644
--- a/tests/sdl/Makefile
+++ b/tests/SDL/Makefile
@@ -2,8 +2,8 @@ TOPDIR=../..
CSOURCES=$(shell echo *.c)
-INCLUDE=core gfx sdl backends
-LDLIBS+=-lGP -L$(TOPDIR)/build/ -lGP_sdl -lSDL
+INCLUDE=core gfx SDL backends
+LDLIBS+=-lGP -L$(TOPDIR)/build/ -lGP_SDL -lSDL
APPS=pixeltest fileview fonttest linetest randomshapetest shapetest sierpinsky symbolstest textaligntest trianglefps
diff --git a/tests/sdl/fileview.c b/tests/SDL/fileview.c
similarity index 100%
rename from tests/sdl/fileview.c
rename to tests/SDL/fileview.c
diff --git a/tests/sdl/fonttest.c b/tests/SDL/fonttest.c
similarity index 100%
rename from tests/sdl/fonttest.c
rename to tests/SDL/fonttest.c
diff --git a/tests/sdl/linetest.c b/tests/SDL/linetest.c
similarity index 100%
rename from tests/sdl/linetest.c
rename to tests/SDL/linetest.c
diff --git a/tests/sdl/pixeltest.c b/tests/SDL/pixeltest.c
similarity index 100%
rename from tests/sdl/pixeltest.c
rename to tests/SDL/pixeltest.c
diff --git a/tests/sdl/randomshapetest.c b/tests/SDL/randomshapetest.c
similarity index 100%
rename from tests/sdl/randomshapetest.c
rename to tests/SDL/randomshapetest.c
diff --git a/tests/sdl/runtest.sh b/tests/SDL/runtest.sh
similarity index 100%
rename from tests/sdl/runtest.sh
rename to tests/SDL/runtest.sh
diff --git a/tests/sdl/shapetest.c b/tests/SDL/shapetest.c
similarity index 100%
rename from tests/sdl/shapetest.c
rename to tests/SDL/shapetest.c
diff --git a/tests/sdl/sierpinsky.c b/tests/SDL/sierpinsky.c
similarity index 100%
rename from tests/sdl/sierpinsky.c
rename to tests/SDL/sierpinsky.c
diff --git a/tests/sdl/symbolstest.c b/tests/SDL/symbolstest.c
similarity index 100%
rename from tests/sdl/symbolstest.c
rename to tests/SDL/symbolstest.c
diff --git a/tests/sdl/textaligntest.c b/tests/SDL/textaligntest.c
similarity index 100%
rename from tests/sdl/textaligntest.c
rename to tests/SDL/textaligntest.c
diff --git a/tests/sdl/trianglefps.c b/tests/SDL/trianglefps.c
similarity index 100%
rename from tests/sdl/trianglefps.c
rename to tests/SDL/trianglefps.c
-----------------------------------------------------------------------
Summary of changes:
include/{sdl => SDL}/GP_SDL.h | 0
include/{sdl => SDL}/GP_SDL_Context.h | 0
include/{sdl => SDL}/GP_SDL_VideoInit.h | 0
include/{sdl => SDL}/README | 0
libs/Makefile | 2 +-
libs/{sdl => SDL}/GP_SDL_Context.c | 0
libs/{sdl => SDL}/GP_SDL_VideoInit.c | 0
libs/{sdl => SDL}/Makefile | 2 +-
tests/Makefile | 2 +-
tests/{sdl => SDL}/Makefile | 4 ++--
tests/{sdl => SDL}/fileview.c | 0
tests/{sdl => SDL}/fonttest.c | 0
tests/{sdl => SDL}/linetest.c | 0
tests/{sdl => SDL}/pixeltest.c | 0
tests/{sdl => SDL}/randomshapetest.c | 0
tests/{sdl => SDL}/runtest.sh | 0
tests/{sdl => SDL}/shapetest.c | 0
tests/{sdl => SDL}/sierpinsky.c | 0
tests/{sdl => SDL}/symbolstest.c | 0
tests/{sdl => SDL}/textaligntest.c | 0
tests/{sdl => SDL}/trianglefps.c | 0
21 files changed, 5 insertions(+), 5 deletions(-)
rename include/{sdl => SDL}/GP_SDL.h (100%)
rename include/{sdl => SDL}/GP_SDL_Context.h (100%)
rename include/{sdl => SDL}/GP_SDL_VideoInit.h (100%)
rename include/{sdl => SDL}/README (100%)
rename libs/{sdl => SDL}/GP_SDL_Context.c (100%)
rename libs/{sdl => SDL}/GP_SDL_VideoInit.c (100%)
rename libs/{sdl => SDL}/Makefile (89%)
rename tests/{sdl => SDL}/Makefile (74%)
rename tests/{sdl => SDL}/fileview.c (100%)
rename tests/{sdl => SDL}/fonttest.c (100%)
rename tests/{sdl => SDL}/linetest.c (100%)
rename tests/{sdl => SDL}/pixeltest.c (100%)
rename tests/{sdl => SDL}/randomshapetest.c (100%)
rename tests/{sdl => SDL}/runtest.sh (100%)
rename tests/{sdl => SDL}/shapetest.c (100%)
rename tests/{sdl => SDL}/sierpinsky.c (100%)
rename tests/{sdl => SDL}/symbolstest.c (100%)
rename tests/{sdl => SDL}/textaligntest.c (100%)
rename tests/{sdl => SDL}/trianglefps.c (100%)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos(a)gmail.com
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
gfxprim.git ("A simple 2D graphics library with emphasis on correctness and well-defined operation.")
1
0
[repo.or.cz] gfxprim.git branch master updated: 3eca4f4778eee54992fcd133978419cefd9135b0
by metan 28 May '11
by metan 28 May '11
28 May '11
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project gfxprim.git.
The branch, master has been updated
via 3eca4f4778eee54992fcd133978419cefd9135b0 (commit)
via 34f8b640d9ce81505a024b745b03a9d179eb9b27 (commit)
from ecb50dd5415f6b8079e3dda4e2cd0a4f9d8043d3 (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/3eca4f4778eee54992fcd133978419cefd91…
commit 3eca4f4778eee54992fcd133978419cefd9135b0
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sat May 28 17:52:21 2011 +0200
build: Fixed the link library for tests.
diff --git a/tests/sdl/Makefile b/tests/sdl/Makefile
index 2795a44..11f0055 100644
--- a/tests/sdl/Makefile
+++ b/tests/sdl/Makefile
@@ -3,7 +3,7 @@ TOPDIR=../..
CSOURCES=$(shell echo *.c)
INCLUDE=core gfx sdl backends
-LDLIBS+=-lGP -L$(TOPDIR)/build/ -lGP_SDL -lSDL
+LDLIBS+=-lGP -L$(TOPDIR)/build/ -lGP_sdl -lSDL
APPS=pixeltest fileview fonttest linetest randomshapetest shapetest sierpinsky symbolstest textaligntest trianglefps
http://repo.or.cz/w/gfxprim.git/commit/34f8b640d9ce81505a024b745b03a9d179eb…
commit 34f8b640d9ce81505a024b745b03a9d179eb9b27
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sat May 28 17:50:56 2011 +0200
build: Fixed the 'make install'.
diff --git a/Makefile b/Makefile
index 972796b..5630ef8 100644
--- a/Makefile
+++ b/Makefile
@@ -28,9 +28,9 @@ LIB_LOC=/usr/lib/
install:
ifdef VERBOSE
- ./install.sh "/tmp/"
+ ./install.sh ""
else
- @./install.sh "/tmp/"
+ @./install.sh ""
endif
tar:
diff --git a/install.sh b/install.sh
index 50dbd4d..ee5403f 100755
--- a/install.sh
+++ b/install.sh
@@ -7,7 +7,7 @@ LIB_LOC="$INSTALL_PREFIX/usr/lib/"
# Headers
echo "INSTALL headers"
-install -m 775 -d "$HEADER_LOC"
+install -m 775 -d "${HEADER_LOC}GP"
for i in `ls include/`; do
if [ -d "include/$i" ]; then
echo " $i"
-----------------------------------------------------------------------
Summary of changes:
Makefile | 4 ++--
install.sh | 2 +-
tests/sdl/Makefile | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos(a)gmail.com
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
gfxprim.git ("A simple 2D graphics library with emphasis on correctness and well-defined operation.")
1
0
[repo.or.cz] gfxprim.git branch master updated: ecb50dd5415f6b8079e3dda4e2cd0a4f9d8043d3
by metan 28 May '11
by metan 28 May '11
28 May '11
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project gfxprim.git.
The branch, master has been updated
via ecb50dd5415f6b8079e3dda4e2cd0a4f9d8043d3 (commit)
from 7f6bea085c6d5bdcef77c514eb41a96aac13e6d1 (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/ecb50dd5415f6b8079e3dda4e2cd0a4f9d80…
commit ecb50dd5415f6b8079e3dda4e2cd0a4f9d8043d3
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sat May 28 17:46:33 2011 +0200
build: Fixed build, now we can create lib from directory.
diff --git a/Makefile b/Makefile
index 35b28d4..972796b 100644
--- a/Makefile
+++ b/Makefile
@@ -27,22 +27,12 @@ HEADER_LOC=/usr/include/
LIB_LOC=/usr/lib/
install:
- # core library
-# install -m 775 -d $(HEADER_LOC)GP/
-# install -m 664 core/*.h $(HEADER_LOC)GP/
-# install -m 664 core/*.so core/*.so.0 core/*.a $(LIB_LOC)
- # bitmap loaders
-# install -m 775 -d $(HEADER_LOC)GP/loaders/
-# install -m 664 loaders/*.h $(HEADER_LOC)GP/loaders/
-# install -m 664 loaders/*.so loaders/*.so.0 loaders/*.a $(LIB_LOC)
- # context filters
-# install -m 775 -d $(HEADER_LOC)GP/filters/
-# install -m 664 filters/*.h $(HEADER_LOC)GP/filters/
-# install -m 664 filters/*.so filters/*.so.0 filters/*.a $(LIB_LOC)
- # sdl target
-# install -m 775 -d $(HEADER_LOC)GP/SDL/
-# install -m 664 targets/sdl/*.h $(HEADER_LOC)GP/SDL/
-# install -m 664 targets/sdl/*.so targets/sdl/*.so.0 targets/sdl/*.a $(LIB_LOC)
+ifdef VERBOSE
+ ./install.sh "/tmp/"
+else
+ @./install.sh "/tmp/"
+endif
tar:
+ $(MAKE) clean
cd .. && tar cjf gfxprim-`date +%Y-%b-%d-%HH%MM`.tar.bz2 gfxprim
diff --git a/install.sh b/install.sh
new file mode 100755
index 0000000..50dbd4d
--- /dev/null
+++ b/install.sh
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+INSTALL_PREFIX="$1"
+
+HEADER_LOC="$INSTALL_PREFIX/usr/include/"
+LIB_LOC="$INSTALL_PREFIX/usr/lib/"
+
+# Headers
+echo "INSTALL headers"
+install -m 775 -d "$HEADER_LOC"
+for i in `ls include/`; do
+ if [ -d "include/$i" ]; then
+ echo " $i"
+ install -m 775 -d "${HEADER_LOC}GP/$i"
+ install -m 664 "include/$i/"*.h "${HEADER_LOC}GP/$i"
+ else
+ install -m 664 "include/$i" "${HEADER_LOC}GP/$i"
+ fi
+done
+
+# Library
+echo "INSTALL libraries"
+install -m 775 -d "$LIB_LOC"
+install -m 664 build/*.so build/*.so.0 build/*.a "$LIB_LOC"
diff --git a/lib.mk b/lib.mk
index a8bccff..52793ca 100644
--- a/lib.mk
+++ b/lib.mk
@@ -2,10 +2,47 @@ ifndef LIBNAME
$(error LIBNAME not defined, fix your library Makefile)
endif
+LIB=libGP_$(LIBNAME)
+LIBP=$(TOPDIR)/build/
+
+#
+# If set to yes, builds single library for directory
+#
+ifeq ($(BUILDLIB),yes)
+all: $(LIBP)$(LIB).so $(LIBP)$(LIB).a
+endif
+
+ifeq ($(BUILDLIB),yes)
+CLEAN+=$(LIBP)$(LIB).so $(LIBP)$(LIB).so.0 $(LIBP)$(LIB).a
+endif
+
#
-# Trigger library rebuild
+# Trigger libGP.XX library rebuild
#
all: $(OBJECTS)
@$(MAKE) --no-print-directory -C $(TOPDIR)/build/
+#
+# Rules for single library
+#
+$(LIBP)$(LIB).so: $(OBJECTS)
+ifdef VERBOSE
+ rm -f $(LIBP)$(LIB).so.0
+ ln -s $(LIB).so $(LIBP)$(LIB).so.0
+ $(CC) -fPIC -dPIC --shared -Wl,-soname -Wl,$@.0 $(OBJECTS) -o $@
+else
+ @rm -f $(LIBP)$(LIB).so.0
+ @ln -s $(LIB).so $(LIBP)$(LIB).so.0
+ @echo "LD $@"
+ @$(CC) -fPIC -dPIC --shared -Wl,-soname -Wl,$@.0 $(OBJECTS) -o $@
+endif
+
+$(LIBP)$(LIB).a: $(OBJECTS)
+ifdef VERBOSE
+ $(AR) rcs $@ $(OBJECTS)
+else
+ @echo "AR $@"
+ @$(AR) rcs $@ $(OBJECTS)
+endif
+
CLEAN+=$(OBJECTS)
diff --git a/libs/core/Makefile b/libs/core/Makefile
index 0ef2e5b..8994912 100644
--- a/libs/core/Makefile
+++ b/libs/core/Makefile
@@ -1,12 +1,7 @@
TOPDIR=../..
-GENSOURCES=GP_Pixel.gen.c
-GENHEADERS=GP_Pixel.gen.h
CSOURCES=$(filter-out $(wildcard *.gen.c),$(wildcard *.c))
LIBNAME=core
include $(TOPDIR)/gen.mk
include $(TOPDIR)/include.mk
include $(TOPDIR)/lib.mk
-
-GP_Pixel.gen.c $(INCLUDE_PREFIX)GP_Pixel.gen.h: gen/make_GP_Pixel.py
- python gen/make_GP_Pixel.py $(INCLUDE_PREFIX)GP_Pixel.gen.h GP_Pixel.gen.c
diff --git a/libs/sdl/Makefile b/libs/sdl/Makefile
index ede8ef8..a92d775 100644
--- a/libs/sdl/Makefile
+++ b/libs/sdl/Makefile
@@ -1,5 +1,6 @@
TOPDIR=../..
CSOURCES=$(shell ls *.c)
LIBNAME=sdl
+BUILDLIB=yes
include $(TOPDIR)/include.mk
include $(TOPDIR)/lib.mk
diff --git a/tests/sdl/Makefile b/tests/sdl/Makefile
index 41b109f..2795a44 100644
--- a/tests/sdl/Makefile
+++ b/tests/sdl/Makefile
@@ -3,14 +3,10 @@ TOPDIR=../..
CSOURCES=$(shell echo *.c)
INCLUDE=core gfx sdl backends
-LDLIBS+=-lGP -L$(TOPDIR)/build/ -lSDL
+LDLIBS+=-lGP -L$(TOPDIR)/build/ -lGP_SDL -lSDL
APPS=pixeltest fileview fonttest linetest randomshapetest shapetest sierpinsky- symboltest textaligntest trianglefps
+ symbolstest textaligntest trianglefps
include $(TOPDIR)/include.mk
include $(TOPDIR)/app.mk
-
-
-$(APPS): $(TOPDIR)/libs/sdl/*.o
-
diff --git a/tests/sdl/old.dddd b/tests/sdl/old.dddd
deleted file mode 100644
index 2d2c9c0..0000000
--- a/tests/sdl/old.dddd
+++ /dev/null
@@ -1,19 +0,0 @@
-LIBRARY=../libGP_SDL.a ../../../libGP_core.a
-LDFLAGS=-lSDL -L.. -L../../../core -lGP_SDL -lGP_core
-
-INCLUDE=-I.. -I../../../core
-# Some warnings are triggered only with -O2
-# thuss added here
-CFLAGS=$(INCLUDE) -ggdb -W -Wall -O -lm
-SOURCES=$(shell ls *.c)
-TESTS=$(SOURCES:.c=)
-
-all: $(TESTS)
-
-%: %.c $(LIBRARY)
- $(CC) $(CFLAGS) $(LDFLAGS) $^ $(LIBRARY) -o $@
-
-clean:
- rm -f *.o
- rm -f $(TESTS)
-
-----------------------------------------------------------------------
Summary of changes:
Makefile | 22 ++++++----------------
install.sh | 24 ++++++++++++++++++++++++
lib.mk | 39 ++++++++++++++++++++++++++++++++++++++-
libs/core/Makefile | 5 -----
libs/sdl/Makefile | 1 +
tests/sdl/Makefile | 8 ++------
tests/sdl/old.dddd | 19 -------------------
7 files changed, 71 insertions(+), 47 deletions(-)
create mode 100755 install.sh
delete mode 100644 tests/sdl/old.dddd
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos(a)gmail.com
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
gfxprim.git ("A simple 2D graphics library with emphasis on correctness and well-defined operation.")
1
0
[repo.or.cz] gfxprim.git branch generate updated: c8a27730e311669696166d376863941b73e5e552
by metan 28 May '11
by metan 28 May '11
28 May '11
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project gfxprim.git.
The branch, generate has been updated
via c8a27730e311669696166d376863941b73e5e552 (commit)
from 588c0e7afe142449c09802fbe59fcd4a2fed3d42 (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/c8a27730e311669696166d376863941b73e5…
commit c8a27730e311669696166d376863941b73e5e552
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sat May 28 15:07:31 2011 +0200
Fix the clean target redefinition.
* The clean is moved into pylib so
it's done exactly once
* The *.py is escaped in the find
(otherwise it doesn't work in directory
that contains any file with .py suffix)
diff --git a/Makefile b/Makefile
index 35b28d4..2c103a7 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
TOPDIR=.
-SUBDIRS=libs tests
+SUBDIRS=libs tests pylib
include include.mk
#
diff --git a/include.mk b/include.mk
index 6505a3d..2a103a9 100644
--- a/include.mk
+++ b/include.mk
@@ -33,10 +33,8 @@ endif
#
# Potential python dependencies for generated files and scripts
-# Add .pyc files to CLEAN list
#
-PYTHON_FILES=$(shell find "${PYLIBSDIR}" -name *.py)
-CLEAN+=$(patsubst %.py, %.pyc, ${PYTHON_FILES})
+PYTHON_FILES=$(shell find "${PYLIBSDIR}" -name '*.py')
#
# 1. Generate and include dependencies for all C sources
diff --git a/pylib/Makefile b/pylib/Makefile
new file mode 100644
index 0000000..af75868
--- /dev/null
+++ b/pylib/Makefile
@@ -0,0 +1,14 @@
+TOPDIR=..
+
+#
+# Add .pyc files to CLEAN list
+#
+CLEAN+=$(patsubst %.py, %.pyc, ${PYTHON_FILES})
+
+include $(TOPDIR)/include.mk
+
+all:
+ ls $(PYLIBSDIR)
+ echo $(PYTHON_FILES)
+ echo $(CLEAN)
+ @true
-----------------------------------------------------------------------
Summary of changes:
Makefile | 2 +-
include.mk | 4 +---
pylib/Makefile | 14 ++++++++++++++
3 files changed, 16 insertions(+), 4 deletions(-)
create mode 100644 pylib/Makefile
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos(a)gmail.com
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
gfxprim.git ("A simple 2D graphics library with emphasis on correctness and well-defined operation.")
1
0
[repo.or.cz] gfxprim.git branch generate updated: 588c0e7afe142449c09802fbe59fcd4a2fed3d42
by metan 27 May '11
by metan 27 May '11
27 May '11
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project gfxprim.git.
The branch, generate has been updated
via 588c0e7afe142449c09802fbe59fcd4a2fed3d42 (commit)
via ad7a06bf6cfd11f3038f32e018c6e6c69912c50c (commit)
from 47ceeb4450654c49fb304c7e79da62c50eb83304 (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/588c0e7afe142449c09802fbe59fcd4a2fed…
commit 588c0e7afe142449c09802fbe59fcd4a2fed3d42
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Fri May 27 02:58:36 2011 +0200
Fix header generator dependencies.
diff --git a/gen.mk b/gen.mk
index f15aae6..ba375c0 100644
--- a/gen.mk
+++ b/gen.mk
@@ -21,6 +21,8 @@ CSOURCES+=$(GENSOURCES)
#
all: $(RGENHEADERS)
+$(CSOURCES): $(RGENHEADERS)
+
#
# And clean them
#
http://repo.or.cz/w/gfxprim.git/commit/ad7a06bf6cfd11f3038f32e018c6e6c69912…
commit ad7a06bf6cfd11f3038f32e018c6e6c69912c50c
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Fri May 27 02:57:44 2011 +0200
Fix bad merge.
diff --git a/include/gfx/GP_Gfx.h b/include/gfx/GP_Gfx.h
index 149f26e..19bad4e 100644
--- a/include/gfx/GP_Gfx.h
+++ b/include/gfx/GP_Gfx.h
@@ -55,13 +55,3 @@
#include "GP_Symbol.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
-----------------------------------------------------------------------
Summary of changes:
gen.mk | 2 ++
include/gfx/GP_Gfx.h | 10 ----------
2 files changed, 2 insertions(+), 10 deletions(-)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos(a)gmail.com
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
gfxprim.git ("A simple 2D graphics library with emphasis on correctness and well-defined operation.")
1
0
[repo.or.cz] gfxprim.git branch generate updated: 47ceeb4450654c49fb304c7e79da62c50eb83304
by gavento 26 May '11
by gavento 26 May '11
26 May '11
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project gfxprim.git.
The branch, generate has been updated
via 47ceeb4450654c49fb304c7e79da62c50eb83304 (commit)
via 5b542b7f5b3c026c6dc859bd55287f05f3586624 (commit)
from 6c56dcd01573c443d0cd512a43a5966aa6edfde8 (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/47ceeb4450654c49fb304c7e79da62c50eb8…
commit 47ceeb4450654c49fb304c7e79da62c50eb83304
Author: Tomas Gavenciak <gavento(a)ucw.cz>
Date: Thu May 26 23:29:07 2011 +0200
Fix .pyc cleanup rule
diff --git a/include.mk b/include.mk
index ada1072..6505a3d 100644
--- a/include.mk
+++ b/include.mk
@@ -36,7 +36,7 @@ endif
# Add .pyc files to CLEAN list
#
PYTHON_FILES=$(shell find "${PYLIBSDIR}" -name *.py)
-CLEAN+=$(patsubst, %.py, %.pyc, ${})
+CLEAN+=$(patsubst %.py, %.pyc, ${PYTHON_FILES})
#
# 1. Generate and include dependencies for all C sources
http://repo.or.cz/w/gfxprim.git/commit/5b542b7f5b3c026c6dc859bd55287f05f358…
commit 5b542b7f5b3c026c6dc859bd55287f05f3586624
Author: Tomas Gavenciak <gavento(a)ucw.cz>
Date: Thu May 26 23:26:15 2011 +0200
Old generators transformed to use new layout
Yay!
diff --git a/pylib/gfxprim/generators/core/gen_blit.py b/pylib/gfxprim/generators/core/gen_blit.py
index 26fd3f7..819f29f 100644
--- a/pylib/gfxprim/generators/core/gen_blit.py
+++ b/pylib/gfxprim/generators/core/gen_blit.py
@@ -2,7 +2,7 @@
# - submodule for blit and friends
# 2011 - Tomas Gavenciak <gavento(a)ucw.cz>
-from gfxprim.gen_utils import *
+from gfxprim.generators.utils import *
## all generated direct blits, for generating GP_Blit() and others
generated_blits = []
@@ -14,15 +14,15 @@ def gen_blit_same_t(size, size_suffix, header, code):
"Only depends on bpp (bit size), size_suffix must be"
"of form 8BPP, 2BPP_LE and the like."
- header.append(r(
+ header.rbody(
"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_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_suffix=size_suffix))
+ size=size, size_suffix=size_suffix)
- code.append(r(
+ code.rbody(
"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"
@@ -71,7 +71,7 @@ def gen_blit_same_t(size, size_suffix, header, code):
" } else /* Different bit-alignment, can't use memcpy() */n"
" GP_Blit_Naive(c1, x1, y1, w, h, c2, x2, y2);n"
"{% endif %}"
- "}n", size=size, size_suffix=size_suffix))
+ "}n", size=size, size_suffix=size_suffix)
def gen_blit_t(f1, f2, header, code):
@@ -82,10 +82,10 @@ def gen_blit_t(f1, f2, header, code):
assert(set(f1.chans.keys()) in allowed_chansets)
assert(set(f2.chans.keys()) in allowed_chansets)
- header.append(r(
+ header.rbody(
"n/*** Blit line {{ f1.name }} -> {{ f2.name }} ***n"
" * Assumes the contexts to be of the right types and sizes */nn"
"void GP_Blit_{{ f1.name }}_{{ f2.name }}(const GP_Context *c1, int x1, int y2, int w, int h,n"
" GP_Context *c2, int x2, int y2);n",
- f1=f1, f2=f2))
+ f1=f1, f2=f2)
diff --git a/pylib/gfxprim/generators/core/gen_pixeltype.py b/pylib/gfxprim/generators/core/gen_pixeltype.py
index bfde4f2..b46d3dd 100644
--- a/pylib/gfxprim/generators/core/gen_pixeltype.py
+++ b/pylib/gfxprim/generators/core/gen_pixeltype.py
@@ -7,9 +7,8 @@ Such functions accept (and then extend) two list of strins.
These should be later joined with "" or "
".
"""
-from gfxprim.pixeltype import pixeltypes, channels
-from gfxprim.genutils import *
-from gfxprim.genutils import j2render as r
+from gfxprim.generators.pixeltype import pixeltypes, channels
+from gfxprim.generators.utils import j2render as r, hmask
def str_start(ptype):
@@ -36,20 +35,20 @@ def gen_GP_PixelType(header, code):
pt_by_num = sorted([(t.number, t) for t in pixeltypes.values()])
sorted_pts = [t[1] for t in pt_by_num]
pt_max = len(sorted_pts)
- header.append(r(
+ header.rbody(
"/* List of all known pixel types */n"
"typedef enum GP_PixelType {n"
"{% for t in sorted_pts %}"
" GP_PIXEL_{{ t.name }} = {{ t.number }},n"
"{% endfor %}"
" GP_PIXEL_MAX = {{ pt_max }},n"
- "} GP_PixelType;n", sorted_pts=sorted_pts, pt_max=pt_max))
+ "} GP_PixelType;n", sorted_pts=sorted_pts, pt_max=pt_max)
def gen_GP_PixelTypes(header, code):
"Generate the const structure GP_PixelTypes describing all the PixelTypes"
pt_by_num = sorted([(t.number, t) for t in pixeltypes.values()])
sorted_pts = [t[1] for t in pt_by_num]
- code.append(r(
+ code.rbody(
"/* Description of all known pixel types */n"
"const GP_PixelTypeDescription const GP_PixelTypes [] = {n"
"{% for t in sorted_pts %}"
@@ -67,14 +66,14 @@ def gen_GP_PixelTypes(header, code):
'{% endfor %}'
' } },n'
'{% endfor %}'
- '};n', sorted_pts=sorted_pts, len=len))
+ '};n', sorted_pts=sorted_pts, len=len)
def gen_print(ptype, header, code):
"Generate a GP_Pixel_Print_<TYPE> function (source and header)"
- header.append(r(
+ header.rbody(
"/* print formatted value of pixel type {{ f.name }} */n"
- "void GP_Pixel_Print_{{ f.name }}(GP_Pixel p);n", f=ptype))
- code.append(r(
+ "void GP_Pixel_Print_{{ f.name }}(GP_Pixel p);n", f=ptype)
+ code.rbody(
"/* print formatted value of pixel type {{f.name}} */n"
"void GP_Pixel_Print_{{ f.name }}(GP_Pixel p)n"
"{n"
@@ -83,15 +82,15 @@ def gen_print(ptype, header, code):
"{% for c in f.chanslist %}"
",n GP_GET_BITS({{ c[1] }}, {{ c[2] }}, p)"
"{% endfor %});n"
- "}n", f=ptype))
+ "}n", f=ptype)
def gen_get_chs(ptype, header, code):
"Generate GP_Pixel_GET_<CHAN>_<TYPE> macros"
- header.append(r(
+ header.rbody(
"/* macros to get channels of pixel type {{ f.name }} */n"
"{% for c in f.chanslist %}"
"#define GP_Pixel_GET_{{ c[0] }}_{{ f.name }}(p) (GP_GET_BITS({{ c[1] }}, {{ c[2] }}, (p)))n"
- "{% endfor %}", f=ptype))
+ "{% endfor %}", f=ptype)
def gen_convert_to(f1, f2, header, code):
"Generate a macro converting from f1 to f2"
@@ -100,7 +99,7 @@ def gen_convert_to(f1, f2, header, code):
assert(set(f1.chans.keys()) in allowed_chansets)
assert(set(f2.chans.keys()) in allowed_chansets)
- header.append(r(
+ header.rbody(
"n/*** {{ f1.name }} -> {{ f2.name }} ***n"
" * macro storing p1 ({{ f1.name }} at bit-offset o1) in p2 ({{ f2.name }} at bit-offset o2),n"
" * the relevant part of p2 is assumed to be clear (zero) */nn"
@@ -143,24 +142,24 @@ def gen_convert_to(f1, f2, header, code):
"/* a version without offsets */n"
"#define GP_Pixel_{{ f1.name }}_TO_{{ f2.name }}(p1, p2) "
"(GP_Pixel_{{ f1.name }}_TO_{{ f2.name }}_OFFSET(p1, 0, p2, 0))n",
- f1=f1, f2=f2, hmask=hmask, set=set))
+ f1=f1, f2=f2, hmask=hmask, set=set)
def gen_get_pixel_addr(ptype, header, code):
"Generate GP_PIXEL_ADDR_<TYPE> and _OFFSET_<TYPE> macros"
- header.append(r(
+ header.rbody(
"/* 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_suffix }}(context, x, y)n"
"/* macro to get bit-offset of pixel {{ f.name }} */n"
"#define GP_PIXEL_ADDR_OFFSET_{{ f.name }}(x)
"
" GP_PIXEL_ADDR_OFFSET_{{ f.size_suffix }}(x)n",
- f=ptype))
+ f=ptype)
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(
+ header.rbody(
"/* 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"
@@ -176,4 +175,4 @@ def gen_get_pixel_addr_bpp(size, size_suffix, header, code):
" ({{ 8-size }} - ((x) % {{ 8//size }}) * {{ size }})n"
"{% endif %}"
"{% endif %}",
- size=size, size_suffix=size_suffix, bit_endian=bit_endian))
+ size=size, size_suffix=size_suffix, bit_endian=bit_endian)
diff --git a/pylib/gfxprim/generators/core/make_GP_Blit.py b/pylib/gfxprim/generators/core/make_GP_Blit.py
index cda0e33..702d2ba 100644
--- a/pylib/gfxprim/generators/core/make_GP_Blit.py
+++ b/pylib/gfxprim/generators/core/make_GP_Blit.py
@@ -1,44 +1,31 @@
#!/usr/bin/python
#
-# Script generating GP_Pixel_Blit.gen.c and GP_Pixel_Blit.gen.h
+# Generators for GP_Pixel_Blit.gen.c and GP_Pixel_Blit.gen.h
#
# 2011 - Tomas Gavenciak <gavento(a)ucw.cz>
#
-from gfxprim.genutils import *
-from gfxprim.pixeltype import *
-from gfxprim.genutils import j2render as r
-from gfxprim.core.gen_pixeltype import *
-
-h = []
-c = []
-
-## Headers
-
-gen_headers(h, c,
- descr = "specialized blit functions and macros",
- authors = ["2011 - Tomas Gavenciak <gavento(a)ucw.cz>"],
- generator = __file__,
- 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.h"n')
-c.append('#include "GP_Context.h"n')
-c.append('#include "GP_Blit.gen.h"n')
-
-for bpp in bitsizes:
- 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
-
-gen_footers(h, c)
-
-## Write out!
-
-if __name__ == '__main__':
- main_write(h, c)
+from gfxprim.generators.generator import *
+from gfxprim.generators.pixeltype import *
+from gfxprim.generators.core.gen_pixeltype import *
+from gfxprim.generators.core.gen_blit import *
+
+@generator(CHeaderGenerator(name='GP_Blit.gen.h'),
+ CSourceGenerator(name='GP_Blit.gen.c'),
+ descr = 'specialized blit functions and macros',
+ authors = ["2011 - Tomas Gavenciak <gavento(a)ucw.cz>"])
+def core_GP_Blit_gen(h, c):
+ c.rhead(
+ '#include <stdio.h>n'
+ '#include <string.h>n'
+ '#include "GP_Pixel.h"n'
+ '#include "GP.h"n'
+ '#include "GP_Context.h"n'
+ '#include "GP_Blit.gen.h"n'
+ )
+
+ for bpp in bitsizes:
+ 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)
diff --git a/pylib/gfxprim/generators/core/make_GP_Pixel.py b/pylib/gfxprim/generators/core/make_GP_Pixel.py
index e8f9f9a..f383f98 100644
--- a/pylib/gfxprim/generators/core/make_GP_Pixel.py
+++ b/pylib/gfxprim/generators/core/make_GP_Pixel.py
@@ -5,65 +5,66 @@
# 2011 - Tomas Gavenciak <gavento(a)ucw.cz>
#
-from gfxprim.genutils import *
-from gfxprim.pixeltype import *
-from gfxprim.genutils import j2render as r
-from gfxprim.core.gen_pixeltype import *
-
-h = []
-c = []
-
-## Headers
-
-gen_headers(h, c,
- descr = "pixel type definitions and functions",
- authors = ["2011 - Tomas Gavenciak <gavento(a)ucw.cz>"],
- generator = __file__,
- 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
-
-gen_GP_PixelType(h, c)
-
-## PixelType parameters in C
-
-gen_GP_PixelTypes(h, c)
-
-## List of types
-
-for t in pixeltypes.values():
- if t.name != 'UNKNOWN':
- h.append(str_start(t))
- h.append(str_description(t))
- c.append(str_start(t))
- c.append(str_description(t))
-
- gen_print(t, h, c)
- gen_get_chs(t, h, c)
- gen_get_pixel_addr(t, h, c)
-
-# Per-bpp macros
-for bpp in bitsizes:
- 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
-
-gen_convert_to(pixeltypes['RGB565'], pixeltypes['RGBA8888'], h, c)
-gen_convert_to(pixeltypes['RGBA8888'], pixeltypes['V2'], h, c)
-gen_convert_to(pixeltypes['VA12'], pixeltypes['RGBA8888'], h, c)
-
-## Close the files
-
-gen_footers(h, c)
-
-## Write out!
-
-if __name__ == '__main__':
- main_write(h, c)
+from gfxprim.generators.generator import *
+from gfxprim.generators.pixeltype import *
+from gfxprim.generators.core.gen_pixeltype import *
+
+@generator(CHeaderGenerator(name = 'GP_Pixel_Scale.gen.h'),
+ descr = 'fast value scaling macros',
+ authors = ["2011 - Tomas Gavenciak <gavento(a)ucw.cz>"])
+def core_GP_Pixel_Scale_gen(h):
+ h.rhead(
+ "/* helper macros to transfer s1-bit value to s2-bit valuen"
+ " * NOTE: efficient and accurate for both up- and downscaling,n"
+ " * WARNING: GP_SCALE_VAL requires constants numebrs as first two parametersn"
+ " */n"
+ "#define GP_SCALE_VAL(s1, s2, val) ( GP_SCALE_VAL_##s1##_##s2(val) )nn"
+
+ "{% for s1 in [1, 2, 4, 8] %}{% for s2 in [1, 2, 4, 8] %}"
+ "{% if s2>s1 %}"
+ "#define GP_SCALE_VAL_{{s1}}_{{s2}}(val) ((val) * {{ multcoef(s1, s2) }})n"
+ "{% else %}"
+ "#define GP_SCALE_VAL_{{s1}}_{{s2}}(val) ((val) >> {{ s1 - s2 }})n"
+ "{% endif %}"
+ "{% endfor %}{% endfor %}", multcoef = lambda s1,s2: hex(sum([1<<i*s1 for i in range(s2/s1)]))
+ )
+
+@generator(CHeaderGenerator(name='GP_Pixel.gen.h'),
+ CSourceGenerator(name='GP_Pixel.gen.c'),
+ descr = 'pixel type definitions and functions',
+ authors = ["2011 - Tomas Gavenciak <gavento(a)ucw.cz>"])
+def core_GP_Pixel_gen(h, c):
+ c.rhead(
+ '#include <stdio.h>n'
+ '#include <GP.h>n'
+ '#include "GP_Pixel.h"n')
+
+ ## Enum of types
+ gen_GP_PixelType(h, c)
+
+ ## PixelType parameters in C
+ gen_GP_PixelTypes(h, c)
+
+ ## List of types
+ for t in pixeltypes.values():
+ if t.name != 'UNKNOWN':
+ h.rbody(str_start(t))
+ h.rbody(str_description(t))
+ c.rbody(str_start(t))
+ c.rbody(str_description(t))
+
+ gen_print(t, h, c)
+ gen_get_chs(t, h, c)
+ gen_get_pixel_addr(t, h, c)
+
+ # Per-bpp macros
+ for bpp in bitsizes:
+ 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
+ gen_convert_to(pixeltypes['RGB565'], pixeltypes['RGBA8888'], h, c)
+ gen_convert_to(pixeltypes['RGBA8888'], pixeltypes['V2'], h, c)
+ gen_convert_to(pixeltypes['VA12'], pixeltypes['RGBA8888'], h, c)
diff --git a/pylib/gfxprim/generators/core/make_GP_Pixel_Scale.py b/pylib/gfxprim/generators/core/make_GP_Pixel_Scale.py
deleted file mode 100644
index 77619fa..0000000
--- a/pylib/gfxprim/generators/core/make_GP_Pixel_Scale.py
+++ /dev/null
@@ -1,42 +0,0 @@
-#!/usr/bin/python
-#
-# Script generating GP_Pixel.gen.c and GP_Pixel.gen.h
-#
-# 2011 - Tomas Gavenciak <gavento(a)ucw.cz>
-#
-
-from gfxprim.generators.generator import *
-#from gfxprim.generators.core.gen_pixeltype import *
-
-@generator(CHeaderGenerator(name = 'GP_Pixel_Scale.gen.h'),
- descr = 'fast value scaling macros',
- authors = ["2011 - Tomas Gavenciak <gavento(a)ucw.cz>"])
-def core_GP_Pixel_Scale_gen(h):
- h.rhead(
- "/* helper macros to transfer s1-bit value to s2-bit valuen"
- " * NOTE: efficient and accurate for both up- and downscaling,n"
- " * WARNING: GP_SCALE_VAL requires constants numebrs as first two parametersn"
- " */n"
- "#define GP_SCALE_VAL(s1, s2, val) ( GP_SCALE_VAL_##s1##_##s2(val) )nn"
-
- "{% for s1 in [1, 2, 4, 8] %}{% for s2 in [1, 2, 4, 8] %}"
- "{% if s2>s1 %}"
- "#define GP_SCALE_VAL_{{s1}}_{{s2}}(val) ((val) * {{ multcoef(s1, s2) }})n"
- "{% else %}"
- "#define GP_SCALE_VAL_{{s1}}_{{s2}}(val) ((val) >> {{ s1 - s2 }})n"
- "{% endif %}"
- "{% endfor %}{% endfor %}", multcoef = lambda s1,s2: hex(sum([1<<i*s1 for i in range(s2/s1)]))
- )
-
-@generator(CSourceGenerator(name='GP_Pixel.gen.c'),
- CHeaderGenerator(name='GP_Pixel.gen.h'),
- descr = 'pixel type definitions and functions',
- authors = ["2011 - Tomas Gavenciak <gavento(a)ucw.cz>"])
-def core_GP_Pixel_gen(c, h):
- c.rhead("CCCCCC")
- h.rhead("HHHHHH")
-
-
-
-
-
diff --git a/pylib/gfxprim/generators/pixeltype.py b/pylib/gfxprim/generators/pixeltype.py
index 7c4248d..384930d 100644
--- a/pylib/gfxprim/generators/pixeltype.py
+++ b/pylib/gfxprim/generators/pixeltype.py
@@ -100,7 +100,7 @@ def load_pixeltypes(defs_file = None):
defs_file = os.environ.get('PIXELTYPE_DEFS', None)
if not defs_file:
path = os.path.dirname(os.path.abspath(__file__))
- defs_file = os.path.join(path, '..', 'pixeltypes.py')
+ defs_file = os.path.join(path, '..', '..', 'pixeltypes.py')
sys.stderr.write("Opening PixelType defs file '" + defs_file + "'n")
l1 = len(pixeltypes)
execfile(defs_file)
diff --git a/pylib/gfxprim/generators/utils.py b/pylib/gfxprim/generators/utils.py
index cd12e5e..28c1891 100644
--- a/pylib/gfxprim/generators/utils.py
+++ b/pylib/gfxprim/generators/utils.py
@@ -16,7 +16,8 @@ def j2render(tmpl, **kw):
def load_generators():
"Load all modules containig generators to allow them to register"
# TODO: write proper discovery
- import gfxprim.generators.core.make_GP_Pixel_Scale
+ import gfxprim.generators.core.make_GP_Pixel
+ import gfxprim.generators.core.make_GP_Blit
pass
def generate_file(fname):
@@ -34,4 +35,6 @@ def generate_file(fname):
with open(fname, "wt") as f:
f.write(s)
-
+def hmask(bits):
+ "Helper returning hex mask for that many bits"
+ return hex((1<<bits)-1).rstrip('L')
-----------------------------------------------------------------------
Summary of changes:
include.mk | 2 +-
pylib/gfxprim/generators/core/gen_blit.py | 14 +-
pylib/gfxprim/generators/core/gen_pixeltype.py | 37 +++---
pylib/gfxprim/generators/core/make_GP_Blit.py | 61 ++++------
pylib/gfxprim/generators/core/make_GP_Pixel.py | 123 ++++++++++----------
.../gfxprim/generators/core/make_GP_Pixel_Scale.py | 42 -------
pylib/gfxprim/generators/pixeltype.py | 2 +-
pylib/gfxprim/generators/utils.py | 7 +-
8 files changed, 118 insertions(+), 170 deletions(-)
delete mode 100644 pylib/gfxprim/generators/core/make_GP_Pixel_Scale.py
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos(a)gmail.com
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
gfxprim.git ("A simple 2D graphics library with emphasis on correctness and well-defined operation.")
1
0