From 783f3cdb23b699566962eb396ae32b81ff9e4ef1 Mon Sep 17 00:00:00 2001 From: Frans Meulenbroeks Date: Sun, 10 Oct 2010 13:22:48 +0200 Subject: gtk+ : moved unused files to obsolete dir Signed-off-by: Frans Meulenbroeks --- .../files/directfb-pixbuf-deprecated-fix.patch | 34 ++ .../gdk-pixbuf-csource/reduce-dependencies.patch | 221 ++++++++ .../obsolete/gtk+/gtk+-2.10.14/disable-print.patch | 50 ++ .../gtk+/gtk+-2.10.14/gnome-bug-341177.patch | 217 ++++++++ .../gtk+/gtk+-2.10.14/integer-pixops.patch | 348 +++++++++++++ .../obsolete/gtk+/gtk+-2.10.14/plana-pixops.patch | 569 +++++++++++++++++++++ 6 files changed, 1439 insertions(+) create mode 100644 recipes/obsolete/gtk+/files/directfb-pixbuf-deprecated-fix.patch create mode 100644 recipes/obsolete/gtk+/gdk-pixbuf-csource/reduce-dependencies.patch create mode 100644 recipes/obsolete/gtk+/gtk+-2.10.14/disable-print.patch create mode 100644 recipes/obsolete/gtk+/gtk+-2.10.14/gnome-bug-341177.patch create mode 100644 recipes/obsolete/gtk+/gtk+-2.10.14/integer-pixops.patch create mode 100644 recipes/obsolete/gtk+/gtk+-2.10.14/plana-pixops.patch (limited to 'recipes/obsolete/gtk+') diff --git a/recipes/obsolete/gtk+/files/directfb-pixbuf-deprecated-fix.patch b/recipes/obsolete/gtk+/files/directfb-pixbuf-deprecated-fix.patch new file mode 100644 index 0000000000..2def90f7e4 --- /dev/null +++ b/recipes/obsolete/gtk+/files/directfb-pixbuf-deprecated-fix.patch @@ -0,0 +1,34 @@ +--- gtk+-2.10.14/gdk/directfb/Makefile.am.orig 2007-07-16 15:46:15.000000000 -0400 ++++ gtk+-2.10.14/gdk/directfb/Makefile.am 2007-09-24 15:12:14.000000000 -0400 +@@ -8,7 +8,6 @@ + -I$(top_srcdir) \ + -I$(top_srcdir)/gdk \ + -I$(top_builddir)/gdk \ +- -DG_DISABLE_DEPRECATED \ + @GTK_DEBUG_FLAGS@ \ + @GDK_DEP_CFLAGS@ + +--- gtk+-2.10.14/gdk/quartz/Makefile.am.orig 2007-07-16 15:46:18.000000000 -0400 ++++ gtk+-2.10.14/gdk/quartz/Makefile.am 2007-09-24 15:12:28.000000000 -0400 +@@ -7,7 +7,6 @@ + -I$(top_srcdir)/gdk \ + -I$(top_builddir)/gdk \ + -DGDK_PIXBUF_DISABLE_DEPRECATED \ +- -DGDK_DISABLE_DEPRECATED \ + $(GTK_DEBUG_FLAGS) \ + $(GDK_DEP_CFLAGS) \ + "-xobjective-c" + +diff -ur gtk+-2.10.9~org/gdk-pixbuf/pixops/Makefile.am gtk+-2.10.9/gdk-pixbuf/pixops/Makefile.am +--- gtk+-2.10.9~org/gdk-pixbuf/pixops/Makefile.am 2007-03-18 00:02:40.000000000 -0400 ++++ gtk+-2.10.9/gdk-pixbuf/pixops/Makefile.am 2007-03-18 10:25:06.000000000 -0400 +@@@ -3,8 +3,7 @@ + INCLUDES = \ + -I$(top_srcdir) -I$(top_builddir) \ + $(GTK_DEBUG_FLAGS) \ +- $(GDK_PIXBUF_DEP_CFLAGS) \ +- -DGDK_PIXBUF_DISABLE_DEPRECATED ++ $(GDK_PIXBUF_DEP_CFLAGS) + + noinst_PROGRAMS = timescale + diff --git a/recipes/obsolete/gtk+/gdk-pixbuf-csource/reduce-dependencies.patch b/recipes/obsolete/gtk+/gdk-pixbuf-csource/reduce-dependencies.patch new file mode 100644 index 0000000000..6b030e8f16 --- /dev/null +++ b/recipes/obsolete/gtk+/gdk-pixbuf-csource/reduce-dependencies.patch @@ -0,0 +1,221 @@ +# +# strip unnecessary stuff out of configure, we just want +# to build gdk-pixbuf-csource. +# -- Michael 'Mickey' Lauer +# +--- +# configure.in | 116 ++--------------------------------------------------------- +# 1 file changed, 5 insertions(+), 111 deletions(-) +# +--- gtk+-2.12.7.orig/configure.in ++++ gtk+-2.12.7/configure.in +@@ -30,13 +30,10 @@ m4_define([gtk_api_version], [2.0]) + #GTK_BINARY_VERSION=$GTK_MAJOR_VERSION.$GTK_MINOR_VERSION.$LT_CURRENT + m4_define([gtk_binary_version], [2.10.0]) + + # required versions of other packages + m4_define([glib_required_version], [2.13.5]) +-m4_define([pango_required_version], [1.17.3]) +-m4_define([atk_required_version], [1.9.0]) +-m4_define([cairo_required_version], [1.2.0]) + + + AC_INIT([gtk+], [gtk_version], + [http://bugzilla.gnome.org/enter_bug.cgi?product=gtk%2B], + [gtk+]) +@@ -347,14 +344,11 @@ ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS" + ## Later on we actually use the cflags/libs from separate pkg-config + ## calls. Oh, also the later pkg-config calls don't include + ## the version requirements since those make the module lists + ## annoying to construct + PKG_CHECK_MODULES(BASE_DEPENDENCIES, +- [glib-2.0 >= glib_required_version dnl +- atk >= atk_required_version dnl +- pango >= pango_required_version dnl +- cairo >= cairo_required_version]) ++ [glib-2.0 >= glib_required_version]) + + if test "$os_win32" != yes; then + # libtool option to control which symbols are exported + # right now, symbols starting with _ are not exported + LIBTOOL_EXPORT_OPTIONS='-export-symbols-regex "^[[^_]].*"' +@@ -1059,27 +1053,19 @@ GDK_PIXBUF_DEP_CFLAGS="`$PKG_CONFIG --cf + + GDK_PIXBUF_XLIB_PACKAGES= + GDK_PIXBUF_XLIB_EXTRA_CFLAGS= + GDK_PIXBUF_XLIB_EXTRA_LIBS= + +-X_PACKAGES=fontconfig ++X_PACKAGES= + GDK_EXTRA_LIBS="$GDK_WLIBS" + GDK_EXTRA_CFLAGS= + + # GTK+ uses some X calls, so needs to link against X directly + GTK_DEP_PACKAGES_FOR_X= + GTK_DEP_LIBS_FOR_X= + + if test "x$gdktarget" = "xx11"; then +- # +- # We use fontconfig very peripherally when decoding the default +- # settings. +- # +- if $PKG_CONFIG --exists fontconfig; then : ; else +- AC_MSG_ERROR([ +-*** fontconfig (http://www.fontconfig.org) is required by the X11 backend.]) +- fi + + # + # Check for basic X packages; we use pkg-config if available + # + if $PKG_CONFIG --exists x11 xext xrender; then +@@ -1122,20 +1108,10 @@ if test "x$gdktarget" = "xx11"; then + CPPFLAGS="$CPPFLAGS $X_CFLAGS" + + gtk_save_LIBS=$LIBS + LIBS="$x_libs_for_checks $LIBS" + +- # Sanity check for the X11 and Xext libraries. While everything we need from +- # Xext is optional, the chances a system has *none* of these things is so +- # small that we just unconditionally require it. +- AC_CHECK_FUNC(XOpenDisplay, :, +- AC_MSG_ERROR([*** libX11 not found. Check 'config.log' for more details.])) +- AC_CHECK_FUNC(XextFindDisplay, :, +- AC_MSG_ERROR([*** libXext not found. Check 'config.log' for more details.])) +- AC_CHECK_FUNC(XRenderQueryExtension, :, +- AC_MSG_ERROR([*** libXrender not found. Check 'config.log' for more details.])) +- + # Check for xReply + + AC_MSG_CHECKING([if is needed for xReply]) + AC_TRY_COMPILE([#include ], + [xReply *rep;], +@@ -1416,104 +1392,33 @@ if test "x$gdktarget" = "xdirectfb"; the + AM_CONDITIONAL(USE_DIRECTFB, true) + else + AM_CONDITIONAL(USE_DIRECTFB, false) + fi + +- +-# Check for Pango flags +- +-if test "x$gdktarget" = "xwin32"; then +- PANGO_PACKAGES="pangowin32 pangocairo" +-else +- PANGO_PACKAGES="pango pangocairo" +-fi +- +-AC_MSG_CHECKING(Pango flags) +-if $PKG_CONFIG --exists $PANGO_PACKAGES ; then +- PANGO_CFLAGS=`$PKG_CONFIG --cflags $PANGO_PACKAGES` +- PANGO_LIBS=`$PKG_CONFIG --libs $PANGO_PACKAGES` +- +- AC_MSG_RESULT($PANGO_CFLAGS $PANGO_LIBS) +-else +- AC_MSG_ERROR([ +-*** Pango not found. Pango built with Cairo support is required +-*** to build GTK+. See http://www.pango.org for Pango information. +-]) +-fi +- +-CFLAGS="$CFLAGS $PANGO_CFLAGS" +- +-if $PKG_CONFIG --uninstalled $PANGO_PACKAGES; then +- : +-else +- gtk_save_LIBS="$LIBS" +- LIBS="$PANGO_LIBS $LIBS" +- AC_TRY_LINK_FUNC(pango_context_new, :, AC_MSG_ERROR([ +-*** Can't link to Pango. Pango is required to build +-*** GTK+. For more information see http://www.pango.org])) +- LIBS="$gtk_save_LIBS" +-fi +- +-CFLAGS="$saved_cflags" +-LDFLAGS="$saved_ldflags" +- +-GDK_PACKAGES="$PANGO_PACKAGES" +-if test "x$gdktarget" = "xx11"; then +- GDK_PACKAGES="$GDK_PACKAGES $X_PACKAGES" +-fi + GDK_DEP_LIBS="$GDK_EXTRA_LIBS `$PKG_CONFIG --libs $GDK_PIXBUF_PACKAGES $GDK_PACKAGES` $GDK_PIXBUF_EXTRA_LIBS" + GDK_DEP_CFLAGS="`$PKG_CONFIG --cflags gthread-2.0 $GDK_PIXBUF_PACKAGES $GDK_PACKAGES` $GDK_PIXBUF_EXTRA_CFLAGS $GDK_EXTRA_CFLAGS" + + # + # If we aren't writing explicit dependencies, then don't put the extra libraries we need + # into the pkg-config files + # + if test $enable_explicit_deps != yes ; then +- GDK_PACKAGES="$PANGO_PACKAGES" ++ GDK_PACKAGES= + GDK_EXTRA_LIBS= + fi + + AC_SUBST(GDK_PACKAGES) + AC_SUBST(GDK_EXTRA_LIBS) + AC_SUBST(GDK_EXTRA_CFLAGS) + AC_SUBST(GDK_DEP_LIBS) + AC_SUBST(GDK_DEP_CFLAGS) + + +-######################################## +-# Check for Accessibility Toolkit flags +-######################################## +- +-ATK_PACKAGES=atk +-AC_MSG_CHECKING(ATK flags) +-if $PKG_CONFIG --exists $ATK_PACKAGES ; then +- ATK_CFLAGS=`$PKG_CONFIG --cflags $ATK_PACKAGES` +- ATK_LIBS=`$PKG_CONFIG --libs $ATK_PACKAGES` +- +- AC_MSG_RESULT($ATK_CFLAGS $ATK_LIBS) +-else +- AC_MSG_ERROR([ +-*** Accessibility Toolkit not found. Accessibility Toolkit is required +-*** to build GTK+. +-]) +-fi +- +-if $PKG_CONFIG --uninstalled $ATK_PACKAGES; then +- : +-else +- gtk_save_LIBS="$LIBS" +- LIBS="$ATK_LIBS $LIBS" +- AC_TRY_LINK_FUNC(atk_object_get_type, : , AC_MSG_ERROR([ +- *** Cannot link to Accessibility Toolkit. Accessibility Toolkit is required +- *** to build GTK+])) +- LIBS="$gtk_save_LIBS" +-fi +- +-GTK_PACKAGES="atk cairo" ++GTK_PACKAGES= + GTK_EXTRA_LIBS= + GTK_EXTRA_CFLAGS= +-GTK_DEP_LIBS="$GDK_EXTRA_LIBS $GTK_DEP_LIBS_FOR_X `$PKG_CONFIG --libs $GDK_PIXBUF_PACKAGES $PANGO_PACKAGES $GTK_PACKAGES_FOR_X $GTK_PACKAGES` $GTK_EXTRA_LIBS $GDK_PIXBUF_EXTRA_LIBS" ++GTK_DEP_LIBS="$GDK_EXTRA_LIBS $GTK_DEP_LIBS_FOR_X `$PKG_CONFIG --libs $GDK_PIXBUF_PACKAGES $GTK_PACKAGES_FOR_X $GTK_PACKAGES` $GTK_EXTRA_LIBS $GDK_PIXBUF_EXTRA_LIBS" + GTK_DEP_CFLAGS="`$PKG_CONFIG --cflags gthread-2.0 $GDK_PIXBUF_PACKAGES $GDK_PACKAGES $GTK_PACKAGES` $GDK_PIXBUF_EXTRA_CFLAGS $GDK_EXTRA_CFLAGS $GTK_EXTRA_CFLAGS" + + if test x"$os_win32" = xyes; then + GTK_EXTRA_CFLAGS="$msnative_struct" + fi +@@ -1567,21 +1472,10 @@ LIBS="$CUPS_LIBS" + AC_CHECK_FUNCS(httpGetAuthString) + LIBS="$gtk_save_libs" + + gtk_save_cppflags="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $GTK_DEP_CFLAGS" +- +-AC_CHECK_HEADER(cairo-pdf.h,,AC_MSG_ERROR([ +-*** Can't find cairo-pdf.h. You must build Cairo with the pdf +-*** backend enabled.])) +- +-if test "$os_win32" != "yes"; then +- AC_CHECK_HEADER(cairo-ps.h,,AC_MSG_ERROR([ +-*** Can't find cairo-ps.h. You must build Cairo with the +-*** postscript backend enabled.])) +-fi +- + CPPFLAGS="$gtk_save_cppflags" + + + AC_ARG_ENABLE(test-print-backend, + [AC_HELP_STRING([--enable-test-print-backend], diff --git a/recipes/obsolete/gtk+/gtk+-2.10.14/disable-print.patch b/recipes/obsolete/gtk+/gtk+-2.10.14/disable-print.patch new file mode 100644 index 0000000000..1067773f12 --- /dev/null +++ b/recipes/obsolete/gtk+/gtk+-2.10.14/disable-print.patch @@ -0,0 +1,50 @@ +--- gtk+-2.10.0/configure.in~ 2006-07-05 18:11:44.000000000 +0200 ++++ gtk+-2.10.0/configure.in 2006-07-05 18:11:44.000000000 +0200 +@@ -1539,26 +1539,27 @@ + # Printing system checks + ################################################################ + +-AC_PATH_PROG(CUPS_CONFIG, cups-config, no) +-if test "x$CUPS_CONFIG" != "xno"; then +- CUPS_CFLAGS=`cups-config --cflags | sed 's/-O[0-9]*//' | sed 's/-m[^\t]*//g'` +- CUPS_LIBS=`cups-config --libs` +- +- CUPS_API_VERSION=`cups-config --api-version` +- CUPS_API_MAJOR=`echo -n $CUPS_API_VERSION | awk -F. '{print $1}'` +- CUPS_API_MINOR=`echo -n $CUPS_API_VERSION | awk -F. '{print $2}'` +- +- if test $CUPS_API_MAJOR -gt 1 -o \ +- $CUPS_API_MAJOR -eq 1 -a $CUPS_API_MINOR -ge 2; then +- AC_DEFINE(HAVE_CUPS_API_1_2) +- fi +- +- AC_SUBST(CUPS_API_MAJOR) +- AC_SUBST(CUPS_API_MINOR) +- AC_SUBST(CUPS_CFLAGS) +- AC_SUBST(CUPS_LIBS) +-fi +-AM_CONDITIONAL(HAVE_CUPS, test "x$CUPS_CONFIG" != "xno") ++#AC_PATH_PROG(CUPS_CONFIG, cups-config, no) ++#if test "x$CUPS_CONFIG" != "xno"; then ++# CUPS_CFLAGS=`cups-config --cflags | sed 's/-O[0-9]*//' | sed 's/-m[^\t]*//g'` ++# CUPS_LIBS=`cups-config --libs` ++# ++# CUPS_API_VERSION=`cups-config --api-version` ++# CUPS_API_MAJOR=`echo -n $CUPS_API_VERSION | awk -F. '{print $1}'` ++# CUPS_API_MINOR=`echo -n $CUPS_API_VERSION | awk -F. '{print $2}'` ++# ++# if test $CUPS_API_MAJOR -gt 1 -o \ ++# $CUPS_API_MAJOR -eq 1 -a $CUPS_API_MINOR -ge 2; then ++# AC_DEFINE(HAVE_CUPS_API_1_2) ++# fi ++# ++# AC_SUBST(CUPS_API_MAJOR) ++# AC_SUBST(CUPS_API_MINOR) ++# AC_SUBST(CUPS_CFLAGS) ++# AC_SUBST(CUPS_LIBS) ++#fi ++#AM_CONDITIONAL(HAVE_CUPS, test "x$CUPS_CONFIG" != "xno") ++AM_CONDITIONAL(HAVE_CUPS,false) + + gtk_save_cppflags="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $GTK_DEP_CFLAGS" diff --git a/recipes/obsolete/gtk+/gtk+-2.10.14/gnome-bug-341177.patch b/recipes/obsolete/gtk+/gtk+-2.10.14/gnome-bug-341177.patch new file mode 100644 index 0000000000..c31868462a --- /dev/null +++ b/recipes/obsolete/gtk+/gtk+-2.10.14/gnome-bug-341177.patch @@ -0,0 +1,217 @@ +diff -uprN gtk+-2.8.13.org/gdk-pixbuf/pixops/pixops.c gtk+-2.8.13.INNER_LOOP/gdk-pixbuf/pixops/pixops.c +--- gtk+-2.8.13.org/gdk-pixbuf/pixops/pixops.c Tue Jul 12 18:58:57 2005 ++++ gtk+-2.8.13.INNER_LOOP/gdk-pixbuf/pixops/pixops.c Tue May 9 17:30:53 2006 +@@ -71,35 +71,24 @@ get_check_shift (int check_size) + return check_shift; + } + +-static void +-pixops_scale_nearest (guchar *dest_buf, +- int render_x0, +- int render_y0, +- int render_x1, +- int render_y1, +- int dest_rowstride, +- int dest_channels, +- gboolean dest_has_alpha, +- const guchar *src_buf, +- int src_width, +- int src_height, +- int src_rowstride, +- int src_channels, +- gboolean src_has_alpha, +- double scale_x, +- double scale_y) +-{ +- int i; +- int x; +- int x_step = (1 << SCALE_SHIFT) / scale_x; +- int y_step = (1 << SCALE_SHIFT) / scale_y; +- int xmax, xstart, xstop, x_pos, y_pos; +- const guchar *p; ++typedef struct { guchar a,b,c; } b3; ++extern void BUG_bad_size_of_struct_b3(void); + +-#define INNER_LOOP(SRC_CHANNELS,DEST_CHANNELS,ASSIGN_PIXEL) \ ++#define INNER_LOOP_PREP() \ ++ do { \ ++ x = render_x0 * x_step + x_step / 2; \ + xmax = x + (render_x1 - render_x0) * x_step; \ + xstart = MIN (0, xmax); \ + xstop = MIN (src_width << SCALE_SHIFT, xmax); \ ++ } while(0) ++ ++#define INNER_LOOP_BODY(SRC_CHANNELS,DEST_CHANNELS,ASSIGN_PIXEL)\ ++ do { \ ++ y_pos = ((i + render_y0) * y_step + y_step / 2) >> SCALE_SHIFT; \ ++ y_pos = CLAMP (y_pos, 0, src_height - 1); \ ++ src = src_buf + y_pos * src_rowstride; \ ++ dest = dest_buf + i * dest_rowstride; \ ++ x = render_x0 * x_step + x_step / 2; \ + p = src + (CLAMP (x, xstart, xstop) >> SCALE_SHIFT) * SRC_CHANNELS; \ + while (x < xstart) \ + { \ +@@ -121,42 +110,58 @@ pixops_scale_nearest (guchar *des + ASSIGN_PIXEL; \ + dest += DEST_CHANNELS; \ + x += x_step; \ +- } ++ } \ ++ } while(0) + +- for (i = 0; i < (render_y1 - render_y0); i++) +- { +- const guchar *src; +- guchar *dest; +- y_pos = ((i + render_y0) * y_step + y_step / 2) >> SCALE_SHIFT; +- y_pos = CLAMP (y_pos, 0, src_height - 1); +- src = src_buf + y_pos * src_rowstride; +- dest = dest_buf + i * dest_rowstride; ++static void ++pixops_scale_nearest (guchar *dest_buf, ++ int render_x0, ++ int render_y0, ++ int render_x1, ++ int render_y1, ++ int dest_rowstride, ++ int dest_channels, ++ gboolean dest_has_alpha, ++ const guchar *src_buf, ++ int src_width, ++ int src_height, ++ int src_rowstride, ++ int src_channels, ++ gboolean src_has_alpha, ++ double scale_x, ++ double scale_y) ++{ ++ int i; ++ int x; ++ int x_step = (1 << SCALE_SHIFT) / scale_x; ++ int y_step = (1 << SCALE_SHIFT) / scale_y; ++ int xmax, xstart, xstop, x_pos, y_pos; ++ const guchar *p; + +- x = render_x0 * x_step + x_step / 2; ++ const guchar *src; ++ guchar *dest; + +- if (src_channels == 3) +- { +- if (dest_channels == 3) +- { +- INNER_LOOP (3, 3, dest[0]=p[0];dest[1]=p[1];dest[2]=p[2]); +- } +- else +- { +- INNER_LOOP (3, 4, dest[0]=p[0];dest[1]=p[1];dest[2]=p[2];dest[3]=0xff); +- } +- } +- else if (src_channels == 4) +- { +- if (dest_channels == 3) +- { +- INNER_LOOP (4, 3, dest[0]=p[0];dest[1]=p[1];dest[2]=p[2]); +- } +- else +- { +- guint32 *p32; +- INNER_LOOP(4, 4, p32=(guint32*)dest;*p32=*((guint32*)p)); +- } +- } ++ if(sizeof(b3) != 3) BUG_bad_size_of_struct_b3(); ++ ++ INNER_LOOP_PREP(); ++ ++ if (src_channels == 3) ++ { ++ if (dest_channels == 3) ++ for (i = 0; i < (render_y1 - render_y0); i++) ++ INNER_LOOP_BODY (3, 3, *(b3*)dest = *(b3*)p); ++ else ++ for (i = 0; i < (render_y1 - render_y0); i++) ++ INNER_LOOP_BODY (3, 4, (*(b3*)dest = *(b3*)p, dest[3]=0xff) ); ++ } ++ else if (src_channels == 4) ++ { ++ if (dest_channels == 3) ++ for (i = 0; i < (render_y1 - render_y0); i++) ++ INNER_LOOP_BODY (4, 3, *(b3*)dest = *(b3*)p); ++ else ++ for (i = 0; i < (render_y1 - render_y0); i++) ++ INNER_LOOP_BODY (4, 4, *(guint32*)dest = *((guint32*)p)); + } + } + +@@ -187,18 +192,14 @@ pixops_composite_nearest (guchar + const guchar *p; + unsigned int a0; + ++ INNER_LOOP_PREP(); ++ + for (i = 0; i < (render_y1 - render_y0); i++) + { + const guchar *src; + guchar *dest; +- y_pos = ((i + render_y0) * y_step + y_step / 2) >> SCALE_SHIFT; +- y_pos = CLAMP (y_pos, 0, src_height - 1); +- src = src_buf + y_pos * src_rowstride; +- dest = dest_buf + i * dest_rowstride; +- +- x = render_x0 * x_step + x_step / 2; + +- INNER_LOOP(src_channels, dest_channels, ++ INNER_LOOP_BODY(src_channels, dest_channels, + if (src_has_alpha) + a0 = (p[3] * overall_alpha) / 0xff; + else +@@ -209,9 +210,7 @@ pixops_composite_nearest (guchar + case 0: + break; + case 255: +- dest[0] = p[0]; +- dest[1] = p[1]; +- dest[2] = p[2]; ++ *(b3*)dest = *(b3*)p; + if (dest_has_alpha) + dest[3] = 0xff; + break; +@@ -279,17 +278,12 @@ pixops_composite_color_nearest (guchar + const guchar *p; + unsigned int a0; + ++ INNER_LOOP_PREP(); ++ + for (i = 0; i < (render_y1 - render_y0); i++) + { + const guchar *src; + guchar *dest; +- y_pos = ((i + render_y0) * y_step + y_step / 2) >> SCALE_SHIFT; +- y_pos = CLAMP (y_pos, 0, src_height - 1); +- src = src_buf + y_pos * src_rowstride; +- dest = dest_buf + i * dest_rowstride; +- +- x = render_x0 * x_step + x_step / 2; +- + + if (((i + check_y) >> check_shift) & 1) + { +@@ -313,7 +307,7 @@ pixops_composite_color_nearest (guchar + } + + j = 0; +- INNER_LOOP(src_channels, dest_channels, ++ INNER_LOOP_BODY(src_channels, dest_channels, + if (src_has_alpha) + a0 = (p[3] * overall_alpha + 0xff) >> 8; + else +@@ -372,7 +366,8 @@ pixops_composite_color_nearest (guchar + ); + } + } +-#undef INNER_LOOP ++#undef INNER_LOOP_BODY ++#undef INNER_LOOP_PREP + + static void + composite_pixel (guchar *dest, int dest_x, int dest_channels, int dest_has_alpha, diff --git a/recipes/obsolete/gtk+/gtk+-2.10.14/integer-pixops.patch b/recipes/obsolete/gtk+/gtk+-2.10.14/integer-pixops.patch new file mode 100644 index 0000000000..490a60dd8a --- /dev/null +++ b/recipes/obsolete/gtk+/gtk+-2.10.14/integer-pixops.patch @@ -0,0 +1,348 @@ +--- /tmp/config.h.in 2006-12-23 00:00:38.000000000 +0100 ++++ gtk+-2.10.6/config.h.in 2006-12-23 00:01:05.632227000 +0100 +@@ -253,3 +253,7 @@ + + /* Define to `int' if doesn't define. */ + #undef uid_t ++ ++/* Define to use integer math rather than floating point where possible. */ ++#undef ENABLE_INTEGER_PIXOPS ++ +--- /tmp/configure.in 2006-12-23 00:02:16.000000000 +0100 ++++ gtk+-2.10.6/configure.in 2006-12-23 00:05:11.172227000 +0100 +@@ -203,6 +203,15 @@ + [AC_HELP_STRING([--disable-rebuilds], + [disable all source autogeneration rules])],, + [enable_rebuilds=yes]) ++AC_ARG_ENABLE(integer-pixops, ++ [AC_HELP_STRING([--enable-integer-pixops], ++ [use integer math where possible])],, ++ [enable_integer_pixops=no]) ++ ++if test "x$enable_integer_pixops" = "xyes"; then ++ AC_DEFINE(ENABLE_INTEGER_PIXOPS) ++fi ++ + AC_ARG_ENABLE(visibility, + [AC_HELP_STRING([--disable-visibility], + [don't use ELF visibility attributes])],, +--- /tmp/pixops.c 2006-12-23 10:04:02.000000000 +0100 ++++ gtk+-2.10.6/gdk-pixbuf/pixops/pixops.c 2006-12-23 10:04:21.772227000 +0100 +@@ -28,6 +28,10 @@ + #define SUBSAMPLE_MASK ((1 << SUBSAMPLE_BITS)-1) + #define SCALE_SHIFT 16 + ++#ifdef ENABLE_INTEGER_PIXOPS ++#define FRAC 0x10000ULL ++#endif ++ + typedef struct _PixopsFilter PixopsFilter; + typedef struct _PixopsFilterDimension PixopsFilterDimension; + +@@ -972,6 +976,29 @@ + (*pixel_func) (dest, dest_x, dest_channels, dest_has_alpha, src_has_alpha, check_size, color1, color2, r, g, b, a); + } + ++#ifdef ENABLE_INTEGER_PIXOPS ++ ++static void ++correct_total (int *weights, ++ int n_x, ++ int n_y, ++ int total, ++ unsigned long overall_alpha) ++{ ++ int correction = (int)(overall_alpha - total); ++ int i; ++ for (i = n_x * n_y - 1; i >= 0; i--) ++ { ++ if (*(weights + i) + correction >= 0) ++ { ++ *(weights + i) += correction; ++ break; ++ } ++ } ++} ++ ++#else ++ + static void + correct_total (int *weights, + int n_x, +@@ -998,6 +1025,8 @@ + } + } + ++#endif ++ + static int * + make_filter_table (PixopsFilter *filter) + { +@@ -1026,7 +1055,11 @@ + *(pixel_weights + n_x * i + j) = weight; + } + +- correct_total (pixel_weights, n_x, n_y, total, filter->overall_alpha); ++#ifdef ENABLE_INTEGER_PIXOPS ++ correct_total (pixel_weights, n_x, n_y, total, overall_alpha * FRAC); ++#else ++ correct_total (pixel_weights, n_x, n_y, total, overall_alpha); ++#endif + } + + return weights; +@@ -1178,6 +1211,93 @@ + /* Compute weights for reconstruction by replication followed by + * sampling with a box filter + */ ++#ifdef ENABLE_INTEGER_PIXOPS ++ ++static void ++tile_make_weights (PixopsFilter *filter, double x_scale_d, double y_scale_d, double overall_alpha_d) ++{ ++ int i_offset, j_offset; ++ unsigned long x_scale = x_scale_d * FRAC; ++ unsigned long y_scale = y_scale_d * FRAC; ++ unsigned long overall_alpha = overall_alpha_d * FRAC; ++ unsigned long x_scale_r = FRAC / x_scale; ++ unsigned long y_scale_r = FRAC / y_scale; ++ ++ int n_x = ceil(1/x_scale_d + 1); ++ int n_y = ceil(1/y_scale_d + 1); ++ ++ filter->x_offset = 0; ++ filter->y_offset = 0; ++ filter->n_x = n_x; ++ filter->n_y = n_y; ++ filter->weights = g_new (int, SUBSAMPLE * SUBSAMPLE * n_x * n_y); ++ ++ for (i_offset=0; i_offsetweights + ((i_offset*SUBSAMPLE) + j_offset) * n_x * n_y; ++ unsigned long x = j_offset * FRAC / SUBSAMPLE; ++ unsigned long y = i_offset * FRAC / SUBSAMPLE; ++ int i,j; ++ int total = 0; ++ ++ for (i = 0; i < n_y; i++) ++ { ++ unsigned long tw, th; ++ ++ if (i < y) ++ { ++ ++ if (i + FRAC > y) ++ th = MIN(i+FRAC, y + y_scale_r) - y; ++ else ++ th = 0; ++ } ++ else ++ { ++ if (y + FRAC/y_scale > i) ++ th = MIN(i+FRAC, y + y_scale_r) - i; ++ else ++ th = 0; ++ } ++ ++ for (j = 0; j < n_x; j++) ++ { ++ int weight; ++ ++ if (j < x) ++ { ++ if (j + FRAC > x) ++ tw = MIN(j+FRAC, x + x_scale_r) - x; ++ else ++ tw = 0; ++ } ++ else ++ { ++ if (x + FRAC/x_scale > j) ++ tw = MIN(j+FRAC, x + x_scale_r) - j; ++ else ++ tw = 0; ++ } ++ ++ { ++ unsigned long lweight = (tw * x_scale) / FRAC; ++ lweight = (lweight * th) / FRAC; ++ lweight = (lweight * y_scale) / FRAC; ++ lweight = (lweight * overall_alpha) / FRAC; ++ weight = lweight; ++ } ++ total += weight; ++ *(pixel_weights + n_x * i + j) = weight; ++ } ++ } ++ ++ correct_total (pixel_weights, n_x, n_y, total, overall_alpha); ++ } ++} ++ ++#else ++ + static void + tile_make_weights (PixopsFilterDimension *dim, + double scale) +@@ -1216,10 +1336,151 @@ + } + } + ++#endif ++ + /* Compute weights for a filter that, for minification + * is the same as 'tiles', and for magnification, is bilinear + * reconstruction followed by a sampling with a delta function. + */ ++#ifdef ENABLE_INTEGER_PIXOPS ++ ++static void ++bilinear_magnify_make_weights (PixopsFilter *filter, double x_scale_d, double y_scale_d, double overall_alpha_d) ++{ ++ int i_offset, j_offset; ++ unsigned long *x_weights, *y_weights; ++ int n_x, n_y; ++ unsigned long x_scale = x_scale_d * FRAC; ++ unsigned long y_scale = y_scale_d * FRAC; ++ unsigned long overall_alpha = overall_alpha_d * FRAC; ++ unsigned long x_scale_r = (FRAC / x_scale_d); ++ unsigned long y_scale_r = (FRAC / y_scale_d); ++ ++ if (x_scale > FRAC) /* Bilinear */ ++ { ++ n_x = 2; ++ filter->x_offset = 0.5 * (1/x_scale_d - 1); ++ } ++ else /* Tile */ ++ { ++ n_x = ceil(1.0 + 1.0/x_scale_d); ++ filter->x_offset = 0.0; ++ } ++ ++ if (y_scale > FRAC) /* Bilinear */ ++ { ++ n_y = 2; ++ filter->y_offset = 0.5 * (1/y_scale_d - 1); ++ } ++ else /* Tile */ ++ { ++ n_y = ceil(1.0 + 1.0/y_scale_d); ++ filter->y_offset = 0.0; ++ } ++ ++ filter->n_y = n_y; ++ filter->n_x = n_x; ++ filter->weights = g_new (int, SUBSAMPLE * SUBSAMPLE * n_x * n_y); ++ ++ x_weights = g_new (unsigned long, n_x); ++ y_weights = g_new (unsigned long, n_y); ++ ++ for (i_offset=0; i_offsetweights + ((i_offset*SUBSAMPLE) + j_offset) * n_x * n_y; ++ unsigned long x = j_offset * FRAC / SUBSAMPLE; ++ unsigned long y = i_offset * FRAC / SUBSAMPLE; ++ int i,j; ++ int total = 0; ++ ++ if (x_scale > FRAC) /* Bilinear */ ++ { ++ for (i = 0; i < n_x; i++) ++ { ++ /* x_weights[i] = ((i == 0) ? (1 - x) : x) / x_scale; */ ++ unsigned long w = (((i == 0) ? (FRAC - x) : x) * x_scale_r); ++ x_weights[i] = w / FRAC; ++ } ++ } ++ else /* Tile */ ++ { ++ /* x ++ * ---------|--.-|----|--.-|------- SRC ++ * ------------|---------|--------- DEST ++ */ ++ for (i = 0; i < n_x; i++) ++ { ++ if (i < x) ++ { ++ if (i + 1 > x) ++ x_weights[i] = MIN(FRAC*(i+1), FRAC * x + (((unsigned long long)(FRAC * FRAC)) / (unsigned long)x_scale)) - (x * FRAC); ++ else ++ x_weights[i] = 0; ++ } ++ else ++ { ++ if (x + 1/x_scale > i) ++ x_weights[i] = MIN(FRAC*(i+1), FRAC * x + (((unsigned long long)(FRAC * FRAC)) / (unsigned long)x_scale)) - (i * FRAC); ++ else ++ x_weights[i] = 0; ++ } ++ } ++ } ++ ++ if (y_scale > FRAC) /* Bilinear */ ++ { ++ for (i = 0; i < n_y; i++) ++ { ++ unsigned long w = ((unsigned long)((i == 0) ? (FRAC - y) : y) * y_scale_r); ++ y_weights[i] = w / FRAC; ++ } ++ } ++ else /* Tile */ ++ { ++ /* y ++ * ---------|--.-|----|--.-|------- SRC ++ * ------------|---------|--------- DEST ++ */ ++ for (i = 0; i < n_y; i++) ++ { ++ if (i < y) ++ { ++ if (i + 1 > y) ++ y_weights[i] = MIN(FRAC*(i+1), FRAC * y + (FRAC * FRAC / (unsigned long)y_scale)) - (y * FRAC); ++ else ++ y_weights[i] = 0; ++ } ++ else ++ { ++ if (y + 1/y_scale > i) ++ y_weights[i] = MIN(FRAC*(i+1), FRAC * y + (FRAC * FRAC / (unsigned long)y_scale)) - (i * FRAC); ++ else ++ y_weights[i] = 0; ++ } ++ } ++ } ++ ++ for (i = 0; i < n_y; i++) ++ for (j = 0; j < n_x; j++) ++ { ++ unsigned long long weight = (x_weights[j] * x_scale) / FRAC; ++ weight = (weight * y_weights[i]) / FRAC; ++ weight = (weight * y_scale) / FRAC; ++ weight = (weight * overall_alpha) / FRAC; ++ *(pixel_weights + n_x * i + j) = (unsigned long)weight; ++ total += (unsigned long)weight; ++ } ++ ++ correct_total (pixel_weights, n_x, n_y, total, overall_alpha); ++ } ++ ++ g_free (x_weights); ++ g_free (y_weights); ++} ++ ++#else ++ + static void + bilinear_magnify_make_weights (PixopsFilterDimension *dim, + double scale) +@@ -1283,6 +1544,8 @@ + } + } + ++#endif ++ + /* Computes the integral from b0 to b1 of + * + * f(x) = x; 0 <= x < 1 diff --git a/recipes/obsolete/gtk+/gtk+-2.10.14/plana-pixops.patch b/recipes/obsolete/gtk+/gtk+-2.10.14/plana-pixops.patch new file mode 100644 index 0000000000..21fe4879c5 --- /dev/null +++ b/recipes/obsolete/gtk+/gtk+-2.10.14/plana-pixops.patch @@ -0,0 +1,569 @@ +diff -urN gtk+-2.10.9.orig/config.h.in gtk+-2.10.9-integer-pixops/config.h.in +--- gtk+-2.10.9.orig/config.h.in 2007-01-22 09:01:23.000000000 -0700 ++++ gtk+-2.10.9-integer-pixops/config.h.in 2007-02-10 12:15:39.000000000 -0700 +@@ -259,3 +259,7 @@ + + /* Define to `int' if doesn't define. */ + #undef uid_t ++ ++/* Define to use integer math rather than floating point where possible. */ ++#undef ENABLE_INTEGER_PIXOPS ++ +diff -urN gtk+-2.10.9.orig/configure.in gtk+-2.10.9-integer-pixops/configure.in +--- gtk+-2.10.9.orig/configure.in 2007-01-22 08:59:41.000000000 -0700 ++++ gtk+-2.10.9-integer-pixops/configure.in 2007-02-10 12:15:39.000000000 -0700 +@@ -203,6 +203,15 @@ + [AC_HELP_STRING([--disable-rebuilds], + [disable all source autogeneration rules])],, + [enable_rebuilds=yes]) ++AC_ARG_ENABLE(integer-pixops, ++ [AC_HELP_STRING([--enable-integer-pixops], ++ [use integer math where possible])],, ++ [enable_integer_pixops=no]) ++ ++if test "x$enable_integer_pixops" = "xyes"; then ++ AC_DEFINE(ENABLE_INTEGER_PIXOPS) ++fi ++ + AC_ARG_ENABLE(visibility, + [AC_HELP_STRING([--disable-visibility], + [don't use ELF visibility attributes])],, +diff -urN gtk+-2.10.9.orig/gdk-pixbuf/pixops/pixops.c gtk+-2.10.9-integer-pixops/gdk-pixbuf/pixops/pixops.c +--- gtk+-2.10.9.orig/gdk-pixbuf/pixops/pixops.c 2007-01-22 08:50:43.000000000 -0700 ++++ gtk+-2.10.9-integer-pixops/gdk-pixbuf/pixops/pixops.c 2007-02-12 01:00:23.000000000 -0700 +@@ -28,21 +28,42 @@ + #define SUBSAMPLE_MASK ((1 << SUBSAMPLE_BITS)-1) + #define SCALE_SHIFT 16 + ++/* TODO: Add a FLOOR() and CEIL() macro to handle normalized values) */ ++/* TODO: Get rid of standard C numeric types (ie. int). Replace with glib types */ ++#ifdef ENABLE_INTEGER_PIXOPS ++/* The bigger the value of FRAC is, the better the accuracy. Be wary of ++ overflows, though */ ++#define FRAC 0x10000ULL ++#define NORMALIZE(d) (d * FRAC) ++#define UNNORMALIZE(t,i) ((t)(i) / FRAC) ++#define FLOOR(i) (int)((i) / FRAC) ++#define CEIL(i) (((i) - 1) / FRAC + 1) ++#define DOUBLE_TYPE gint32 ++#define BIG_DOUBLE_TYPE gint64 ++#else ++#define NORMALIZE(d) (d) ++#define UNNORMALIZE(t,i) (t)(i) ++#define FLOOR(i) floor(i) ++#define CEIL(i) ceil(i) ++#define DOUBLE_TYPE double ++#define BIG_DOUBLE_TYPE double ++#endif ++ + typedef struct _PixopsFilter PixopsFilter; + typedef struct _PixopsFilterDimension PixopsFilterDimension; + + struct _PixopsFilterDimension + { + int n; +- double offset; +- double *weights; ++ BIG_DOUBLE_TYPE offset; ++ DOUBLE_TYPE *weights; + }; + + struct _PixopsFilter + { + PixopsFilterDimension x; + PixopsFilterDimension y; +- double overall_alpha; ++ gint32 overall_alpha; /* Normalized: alpha * 255; Not sure why original devs chose 255 */ + }; + + typedef guchar *(*PixopsLineFunc) (int *weights, int n_x, int n_y, +@@ -86,13 +107,13 @@ + int src_rowstride, + int src_channels, + gboolean src_has_alpha, +- double scale_x, +- double scale_y) ++ DOUBLE_TYPE scale_x, ++ DOUBLE_TYPE scale_y) + { + int i; + int x; +- int x_step = (1 << SCALE_SHIFT) / scale_x; +- int y_step = (1 << SCALE_SHIFT) / scale_y; ++ int x_step = NORMALIZE((1 << SCALE_SHIFT)) / scale_x; ++ int y_step = NORMALIZE((1 << SCALE_SHIFT)) / scale_y; + int xmax, xstart, xstop, x_pos, y_pos; + const guchar *p; + +@@ -175,14 +196,14 @@ + int src_rowstride, + int src_channels, + gboolean src_has_alpha, +- double scale_x, +- double scale_y, ++ DOUBLE_TYPE scale_x, ++ DOUBLE_TYPE scale_y, + int overall_alpha) + { + int i; + int x; +- int x_step = (1 << SCALE_SHIFT) / scale_x; +- int y_step = (1 << SCALE_SHIFT) / scale_y; ++ int x_step = NORMALIZE((1 << SCALE_SHIFT)) / scale_x; ++ int y_step = NORMALIZE((1 << SCALE_SHIFT)) / scale_y; + int xmax, xstart, xstop, x_pos, y_pos; + const guchar *p; + unsigned int a0; +@@ -260,8 +281,8 @@ + int src_rowstride, + int src_channels, + gboolean src_has_alpha, +- double scale_x, +- double scale_y, ++ DOUBLE_TYPE scale_x, ++ DOUBLE_TYPE scale_y, + int overall_alpha, + int check_x, + int check_y, +@@ -271,8 +292,8 @@ + { + int i, j; + int x; +- int x_step = (1 << SCALE_SHIFT) / scale_x; +- int y_step = (1 << SCALE_SHIFT) / scale_y; ++ int x_step = NORMALIZE((1 << SCALE_SHIFT)) / scale_x; ++ int y_step = NORMALIZE((1 << SCALE_SHIFT)) / scale_y; + int r1, g1, b1, r2, g2, b2; + int check_shift = get_check_shift (check_size); + int xmax, xstart, xstop, x_pos, y_pos; +@@ -977,9 +998,9 @@ + int n_x, + int n_y, + int total, +- double overall_alpha) ++ gint32 overall_alpha) + { +- int correction = (int)(0.5 + 65536 * overall_alpha) - total; ++ int correction = (int)(0.5 + 65536 / 255 * overall_alpha) - total; + int remaining, c, d, i; + + if (correction != 0) +@@ -1009,7 +1030,7 @@ + for (i_offset=0; i_offset < SUBSAMPLE; i_offset++) + for (j_offset=0; j_offset < SUBSAMPLE; j_offset++) + { +- double weight; ++ DOUBLE_TYPE weight; + int *pixel_weights = weights + ((i_offset*SUBSAMPLE) + j_offset) * n_x * n_y; + int total = 0; + int i, j; +@@ -1017,13 +1038,15 @@ + for (i=0; i < n_y; i++) + for (j=0; j < n_x; j++) + { +- weight = filter->x.weights[(j_offset * n_x) + j] * ++ weight = UNNORMALIZE(DOUBLE_TYPE, filter->x.weights[(j_offset * n_x) + j] * + filter->y.weights[(i_offset * n_y) + i] * +- filter->overall_alpha * 65536 + 0.5; ++ filter->overall_alpha * 65536 / 255) + NORMALIZE(0.5); ++ /* Wonder how I should treat the "+ 0.5" for scientific ++ rouding off */ + +- total += (int)weight; ++ total += UNNORMALIZE(int, weight); + +- *(pixel_weights + n_x * i + j) = weight; ++ *(pixel_weights + n_x * i + j) = UNNORMALIZE(int, weight); + } + + correct_total (pixel_weights, n_x, n_y, total, filter->overall_alpha); +@@ -1047,8 +1070,8 @@ + int src_rowstride, + int src_channels, + gboolean src_has_alpha, +- double scale_x, +- double scale_y, ++ DOUBLE_TYPE scale_x, ++ DOUBLE_TYPE scale_y, + int check_x, + int check_y, + int check_size, +@@ -1064,12 +1087,13 @@ + guchar **line_bufs = g_new (guchar *, filter->y.n); + int *filter_weights = make_filter_table (filter); + +- int x_step = (1 << SCALE_SHIFT) / scale_x; /* X step in source (fixed point) */ +- int y_step = (1 << SCALE_SHIFT) / scale_y; /* Y step in source (fixed point) */ ++ int x_step = NORMALIZE((1 << SCALE_SHIFT)) / scale_x; /* X step in source (fixed point) */ ++ int y_step = NORMALIZE((1 << SCALE_SHIFT)) / scale_y; /* Y step in source (fixed point) */ + + int check_shift = check_size ? get_check_shift (check_size) : 0; + +- int scaled_x_offset = floor (filter->x.offset * (1 << SCALE_SHIFT)); ++ /* Possible overflow when scale-shifting which is why offset is BIG_DOUBLE_TYPE */ ++ int scaled_x_offset = FLOOR(filter->x.offset * (1 << SCALE_SHIFT)); + + /* Compute the index where we run off the end of the source buffer. The furthest + * source pixel we access at index i is: +@@ -1087,7 +1111,7 @@ + int run_end_index = MYDIV (run_end_x + x_step - 1, x_step) - render_x0; + run_end_index = MIN (run_end_index, render_x1 - render_x0); + +- y = render_y0 * y_step + floor (filter->y.offset * (1 << SCALE_SHIFT)); ++ y = render_y0 * y_step + FLOOR(filter->y.offset * (1 << SCALE_SHIFT)); + for (i = 0; i < (render_y1 - render_y0); i++) + { + int dest_x; +@@ -1180,37 +1204,37 @@ + */ + static void + tile_make_weights (PixopsFilterDimension *dim, +- double scale) ++ DOUBLE_TYPE scale) + { +- int n = ceil (1 / scale + 1); +- double *pixel_weights = g_new (double, SUBSAMPLE * n); ++ int n = CEIL(NORMALIZE(NORMALIZE(1)) / scale + NORMALIZE(1)); /* Another possible overflow */ ++ DOUBLE_TYPE *pixel_weights = g_new (DOUBLE_TYPE, SUBSAMPLE * n); + int offset; + int i; +- ++ + dim->n = n; +- dim->offset = 0; ++ dim->offset = NORMALIZE(0); + dim->weights = pixel_weights; + + for (offset = 0; offset < SUBSAMPLE; offset++) + { +- double x = (double)offset / SUBSAMPLE; +- double a = x + 1 / scale; ++ DOUBLE_TYPE x = (DOUBLE_TYPE)NORMALIZE(offset) / SUBSAMPLE; ++ DOUBLE_TYPE a = x + NORMALIZE(NORMALIZE(1)) / scale; + + for (i = 0; i < n; i++) + { +- if (i < x) ++ if (NORMALIZE(i) < x) + { +- if (i + 1 > x) +- *(pixel_weights++) = (MIN (i + 1, a) - x) * scale; ++ if (NORMALIZE(i + 1) > x) ++ *(pixel_weights++) = UNNORMALIZE(DOUBLE_TYPE, (MIN(NORMALIZE(i + 1), a) - x) * scale); + else +- *(pixel_weights++) = 0; ++ *(pixel_weights++) = NORMALIZE(0); + } + else + { +- if (a > i) +- *(pixel_weights++) = (MIN (i + 1, a) - i) * scale; ++ if (a > NORMALIZE(i)) ++ *(pixel_weights++) = UNNORMALIZE(DOUBLE_TYPE, (MIN(NORMALIZE(i + 1), a) - i) * scale); + else +- *(pixel_weights++) = 0; ++ *(pixel_weights++) = NORMALIZE(0); + } + } + } +@@ -1222,41 +1246,44 @@ + */ + static void + bilinear_magnify_make_weights (PixopsFilterDimension *dim, +- double scale) ++ DOUBLE_TYPE scale) + { +- double *pixel_weights; ++ DOUBLE_TYPE *pixel_weights; + int n; + int offset; + int i; + +- if (scale > 1.0) /* Linear */ ++ if (scale > NORMALIZE(1.0)) /* Linear */ + { + n = 2; +- dim->offset = 0.5 * (1 / scale - 1); ++ dim->offset = NORMALIZE(NORMALIZE(0.5) / (scale - NORMALIZE(1))); + } + else /* Tile */ + { +- n = ceil (1.0 + 1.0 / scale); +- dim->offset = 0.0; ++ n = CEIL(NORMALIZE(1.0) + NORMALIZE(NORMALIZE(1.0)) / scale); ++ dim->offset = NORMALIZE(0.0); + } +- ++ + dim->n = n; +- dim->weights = g_new (double, SUBSAMPLE * n); ++ dim->weights = g_new (DOUBLE_TYPE, SUBSAMPLE * n); + + pixel_weights = dim->weights; + + for (offset=0; offset < SUBSAMPLE; offset++) + { +- double x = (double)offset / SUBSAMPLE; ++ DOUBLE_TYPE x = (DOUBLE_TYPE)NORMALIZE(offset) / SUBSAMPLE; + +- if (scale > 1.0) /* Linear */ ++ if (scale > NORMALIZE(1.0)) /* Linear */ + { + for (i = 0; i < n; i++) +- *(pixel_weights++) = (((i == 0) ? (1 - x) : x) / scale) * scale; ++ /* In the original, what is the point of dividing by scale then multiplying by scale? */ ++ /* *(pixel_weights++) = (((i == 0) ? (1 - x) : x) / scale) * scale;*/ ++ /* *(pixel_weights++) = i == 0 ? NORMALIZE(1) - x : x; */ ++ *(pixel_weights++) = (((i == 0) ? NORMALIZE(1) - x : x) / scale) * scale; + } + else /* Tile */ + { +- double a = x + 1 / scale; ++ DOUBLE_TYPE a = x + NORMALIZE(NORMALIZE(1)) / scale; + + /* x + * ---------|--.-|----|--.-|------- SRC +@@ -1264,19 +1291,19 @@ + */ + for (i = 0; i < n; i++) + { +- if (i < x) ++ if (NORMALIZE(i) < x) + { +- if (i + 1 > x) +- *(pixel_weights++) = (MIN (i + 1, a) - x) * scale; ++ if (NORMALIZE(i + 1) > x) ++ *(pixel_weights++) = UNNORMALIZE(DOUBLE_TYPE, (MIN(NORMALIZE(i + 1), a) - x) * scale); + else +- *(pixel_weights++) = 0; ++ *(pixel_weights++) = NORMALIZE(0); + } + else + { +- if (a > i) +- *(pixel_weights++) = (MIN (i + 1, a) - i) * scale; ++ if (a > NORMALIZE(i)) ++ *(pixel_weights++) = UNNORMALIZE(DOUBLE_TYPE, (MIN(NORMALIZE(i + 1), a) - i) * scale); + else +- *(pixel_weights++) = 0; ++ *(pixel_weights++) = NORMALIZE(0); + } + } + } +@@ -1291,14 +1318,14 @@ + * We combine two of these to compute the convolution of + * a box filter with a triangular spike. + */ +-static double +-linear_box_half (double b0, double b1) ++static DOUBLE_TYPE ++linear_box_half (DOUBLE_TYPE b0, DOUBLE_TYPE b1) + { +- double a0, a1; +- double x0, x1; ++ DOUBLE_TYPE a0, a1; ++ DOUBLE_TYPE x0, x1; + +- a0 = 0.; +- a1 = 1.; ++ a0 = NORMALIZE(0.); ++ a1 = NORMALIZE(1.); + + if (a0 < b0) + { +@@ -1308,7 +1335,7 @@ + x1 = MIN (a1, b1); + } + else +- return 0; ++ return NORMALIZE(0); + } + else + { +@@ -1318,10 +1345,10 @@ + x1 = MIN (a1, b1); + } + else +- return 0; ++ return NORMALIZE(0); + } + +- return 0.5 * (x1*x1 - x0*x0); ++ return UNNORMALIZE(DOUBLE_TYPE, NORMALIZE(0.5) * UNNORMALIZE(DOUBLE_TYPE, (x1*x1 - x0*x0))); + } + + /* Compute weights for reconstructing with bilinear +@@ -1329,28 +1356,28 @@ + */ + static void + bilinear_box_make_weights (PixopsFilterDimension *dim, +- double scale) ++ DOUBLE_TYPE scale) + { +- int n = ceil (1/scale + 3.0); +- double *pixel_weights = g_new (double, SUBSAMPLE * n); +- double w; ++ int n = CEIL(NORMALIZE(NORMALIZE(1))/scale + NORMALIZE(3.0)); ++ DOUBLE_TYPE *pixel_weights = g_new (DOUBLE_TYPE, SUBSAMPLE * n); ++ DOUBLE_TYPE w; + int offset, i; + +- dim->offset = -1.0; ++ dim->offset = NORMALIZE(-1.0); + dim->n = n; + dim->weights = pixel_weights; + + for (offset = 0; offset < SUBSAMPLE; offset++) + { +- double x = (double)offset / SUBSAMPLE; +- double a = x + 1 / scale; ++ DOUBLE_TYPE x = (DOUBLE_TYPE)NORMALIZE(offset) / SUBSAMPLE; ++ DOUBLE_TYPE a = x + NORMALIZE(NORMALIZE(1)) / scale; + + for (i = 0; i < n; i++) + { +- w = linear_box_half (0.5 + i - a, 0.5 + i - x); +- w += linear_box_half (1.5 + x - i, 1.5 + a - i); ++ w = linear_box_half (NORMALIZE(0.5) + NORMALIZE(i) - a, NORMALIZE(0.5) + NORMALIZE(i) - x); ++ w += linear_box_half (NORMALIZE(1.5) - NORMALIZE(i) + x, NORMALIZE(1.5) - NORMALIZE(i) + a); + +- *(pixel_weights++) = w * scale; ++ *(pixel_weights++) = UNNORMALIZE(DOUBLE_TYPE, w * scale); + } + } + } +@@ -1358,8 +1385,8 @@ + static void + make_weights (PixopsFilter *filter, + PixopsInterpType interp_type, +- double scale_x, +- double scale_y) ++ DOUBLE_TYPE scale_x, ++ DOUBLE_TYPE scale_y) + { + switch (interp_type) + { +@@ -1399,8 +1426,8 @@ + int src_rowstride, + int src_channels, + gboolean src_has_alpha, +- double scale_x, +- double scale_y, ++ double scale_x_d, ++ double scale_y_d, + PixopsInterpType interp_type, + int overall_alpha, + int check_x, +@@ -1409,6 +1436,8 @@ + guint32 color1, + guint32 color2) + { ++ DOUBLE_TYPE scale_x = NORMALIZE(scale_x_d); ++ DOUBLE_TYPE scale_y = NORMALIZE(scale_y_d); + PixopsFilter filter; + PixopsLineFunc line_func; + +@@ -1419,7 +1448,7 @@ + g_return_if_fail (!(dest_channels == 3 && dest_has_alpha)); + g_return_if_fail (!(src_channels == 3 && src_has_alpha)); + +- if (scale_x == 0 || scale_y == 0) ++ if (scale_x == NORMALIZE(0) || scale_y == NORMALIZE(0)) + return; + + if (!src_has_alpha && overall_alpha == 255) +@@ -1427,7 +1456,7 @@ + _pixops_scale (dest_buf, render_x0, render_y0, render_x1, render_y1, + dest_rowstride, dest_channels, dest_has_alpha, + src_buf, src_width, src_height, src_rowstride, src_channels, +- src_has_alpha, scale_x, scale_y, interp_type); ++ src_has_alpha, UNNORMALIZE(double, scale_x), UNNORMALIZE(double, scale_y), interp_type); + return; + } + +@@ -1441,7 +1470,8 @@ + return; + } + +- filter.overall_alpha = overall_alpha / 255.; ++ /* filter.overall_alpha = overall_alpha / 255.; /* Why is it 255 instead of 256? */ ++ filter.overall_alpha = overall_alpha; + make_weights (&filter, interp_type, scale_x, scale_y); + + #ifdef USE_MMX +@@ -1501,11 +1531,13 @@ + int src_rowstride, + int src_channels, + gboolean src_has_alpha, +- double scale_x, +- double scale_y, ++ double scale_x_d, ++ double scale_y_d, + PixopsInterpType interp_type, + int overall_alpha) + { ++ DOUBLE_TYPE scale_x = NORMALIZE(scale_x_d); ++ DOUBLE_TYPE scale_y = NORMALIZE(scale_y_d); + PixopsFilter filter; + PixopsLineFunc line_func; + +@@ -1516,7 +1548,7 @@ + g_return_if_fail (!(dest_channels == 3 && dest_has_alpha)); + g_return_if_fail (!(src_channels == 3 && src_has_alpha)); + +- if (scale_x == 0 || scale_y == 0) ++ if (scale_x == NORMALIZE(0) || scale_y == NORMALIZE(0)) + return; + + if (!src_has_alpha && overall_alpha == 255) +@@ -1524,7 +1556,7 @@ + _pixops_scale (dest_buf, render_x0, render_y0, render_x1, render_y1, + dest_rowstride, dest_channels, dest_has_alpha, + src_buf, src_width, src_height, src_rowstride, src_channels, +- src_has_alpha, scale_x, scale_y, interp_type); ++ src_has_alpha, UNNORMALIZE(double, scale_x), UNNORMALIZE(double, scale_y), interp_type); + return; + } + +@@ -1537,7 +1569,7 @@ + return; + } + +- filter.overall_alpha = overall_alpha / 255.; ++ filter.overall_alpha = overall_alpha; + make_weights (&filter, interp_type, scale_x, scale_y); + + if (filter.x.n == 2 && filter.y.n == 2 && +@@ -1578,10 +1610,12 @@ + int src_rowstride, + int src_channels, + gboolean src_has_alpha, +- double scale_x, +- double scale_y, ++ double scale_x_d, ++ double scale_y_d, + PixopsInterpType interp_type) + { ++ DOUBLE_TYPE scale_x = NORMALIZE(scale_x_d); ++ DOUBLE_TYPE scale_y = NORMALIZE(scale_y_d); + PixopsFilter filter; + PixopsLineFunc line_func; + +@@ -1593,7 +1627,7 @@ + g_return_if_fail (!(src_channels == 3 && src_has_alpha)); + g_return_if_fail (!(src_has_alpha && !dest_has_alpha)); + +- if (scale_x == 0 || scale_y == 0) ++ if (scale_x == NORMALIZE(0) || scale_y == NORMALIZE(0)) + return; + + if (interp_type == PIXOPS_INTERP_NEAREST) +@@ -1605,7 +1639,7 @@ + return; + } + +- filter.overall_alpha = 1.0; ++ filter.overall_alpha = 255; + make_weights (&filter, interp_type, scale_x, scale_y); + + if (filter.x.n == 2 && filter.y.n == 2 && dest_channels == 3 && src_channels == 3) -- cgit 1.2.3-korg