patches/gtk+-12-dlopen-medialib.diff
author yippi
Mon, 27 Sep 2010 21:07:51 +0000
changeset 20108 51df67ca9307
parent 18292 9ff9c0fa64d9
permissions -rw-r--r--
I had these modules listed as being owned by me, but they are really owned by wangke, correcting.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
18292
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
     1
diff --git a/configure.in b/configure.in
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
     2
index 7614ea8..b36d45a 100644
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
     3
--- a/configure.in
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
     4
+++ b/configure.in
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
     5
@@ -1200,27 +1200,18 @@ AC_CHECK_HEADER(sys/sysinfo.h,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
     6
                 AC_DEFINE(HAVE_SYS_SYSINFO_H, 1,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
     7
                           [Define to 1 if sys/sysinfo.h is available]))
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
     8
 
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
     9
-AC_MSG_CHECKING(for mediaLib 2.3)
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    10
-use_mlib25=no
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    11
-# Check for a mediaLib 2.3 function since that is what the GTK+ mediaLib
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    12
+# Check for a mediaLib 2.5 function since that is what the GTK+ mediaLib
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    13
 # patch requires.
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    14
-AC_CHECK_LIB(mlib, mlib_ImageSetStruct, use_mlib=yes, use_mlib=no)
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    15
+AC_MSG_CHECKING(for mediaLib 2.5)
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    16
+use_mlib=no
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    17
+# Check for a mediaLib 2.5 function since that is what is needed for
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    18
+# gdk_rgb_convert integration.
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    19
+AC_CHECK_LIB(mlib, mlib_VideoColorRGBint_to_BGRAint, use_mlib=yes, use_mlib=no)
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    20
 if test $use_mlib = yes; then
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    21
     AC_DEFINE(USE_MEDIALIB, 1,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    22
-              [Define to 1 if medialib is available and should be used])
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    23
-    MEDIA_LIB=-lmlib
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    24
-
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    25
-    AC_MSG_CHECKING(for mediaLib 2.5)
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    26
-    # Check for a mediaLib 2.5 function since that is what is needed for
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    27
-    # gdk_rgb_convert integration.
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    28
-    AC_CHECK_LIB(mlib, mlib_VideoColorRGBint_to_BGRAint, use_mlib25=yes, use_mlib25=no)
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    29
-    if test $use_mlib25 = yes; then
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    30
-        AC_DEFINE(USE_MEDIALIB25, 1,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    31
-                  [Define to 1 if medialib 2.5 is available])
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    32
-    fi
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    33
+              [Define to 1 if medialib 2.5 is available])
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    34
 fi
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    35
 AM_CONDITIONAL(USE_MEDIALIB, test $use_mlib = yes)
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    36
-AM_CONDITIONAL(USE_MEDIALIB25, test $use_mlib25 = yes)
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    37
 
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    38
 # Checks to see if we should compile in MMX support (there will be
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    39
 # a runtime test when the code is actually run to see if it should
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    40
@@ -1291,7 +1282,7 @@ fi
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    41
 AC_SUBST(REBUILD_PNGS)
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    42
 
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    43
 GDK_PIXBUF_PACKAGES="gmodule-no-export-2.0 gobject-2.0 gio-2.0"
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    44
-GDK_PIXBUF_EXTRA_LIBS="$STATIC_LIB_DEPS $MATH_LIB $MEDIA_LIB"
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    45
+GDK_PIXBUF_EXTRA_LIBS="$STATIC_LIB_DEPS $MATH_LIB"
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    46
 GDK_PIXBUF_EXTRA_CFLAGS= 
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    47
 GDK_PIXBUF_DEP_LIBS="`$PKG_CONFIG --libs $GDK_PIXBUF_PACKAGES` $GDK_PIXBUF_EXTRA_LIBS"
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    48
 GDK_PIXBUF_DEP_CFLAGS="`$PKG_CONFIG --cflags  gthread-2.0 $GDK_PIXBUF_PACKAGES $PNG_DEP_CFLAGS_PACKAGES` $GDK_PIXBUF_EXTRA_CFLAGS"
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    49
diff --git a/gdk-pixbuf/pixops/pixops.c b/gdk-pixbuf/pixops/pixops.c
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    50
index 513d16f..06598d1 100644
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    51
--- a/gdk-pixbuf/pixops/pixops.c
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    52
+++ b/gdk-pixbuf/pixops/pixops.c
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    53
@@ -146,6 +146,89 @@ static void pixops_medialib_scale        (guchar          *dest_buf,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    54
 
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    55
 typedef struct _mlInterp mlInterp;
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    56
 
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    57
+typedef mlib_image*     (*ml_ImageSetStruct)     (mlib_image *image,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    58
+                                                 mlib_type type,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    59
+                                                 mlib_s32 channels,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    60
+                                                 mlib_s32 width,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    61
+                                                 mlib_s32 height,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    62
+                                                 mlib_s32 stride,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    63
+                                                 const void *data);
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    64
+typedef mlib_status     (*ml_ImageChannelExtract) (mlib_image *dst,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    65
+                                                   mlib_image *src,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    66
+                                                   mlib_s32   cmask);
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    67
+typedef void *          (*ml_InterpTableCreate)       (mlib_type type,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    68
+                                                 mlib_s32 width,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    69
+                                                 mlib_s32 height,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    70
+                                                 mlib_s32 leftPadding,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    71
+                                                 mlib_s32 topPadding,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    72
+                                                 mlib_s32 subsampleBitsH,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    73
+                                                 mlib_s32 subsampleBitsV,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    74
+                                                 mlib_s32 precisionBits,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    75
+                                                 void * dataH,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    76
+                                                 void * dataV);
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    77
+typedef void            (*ml_InterpTableDelete)       (void *);
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    78
+typedef mlib_status     (*ml_ZoomTranslateTable)(mlib_image * dst,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    79
+                                                 mlib_image * src,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    80
+                                                 mlib_d64 zoomx,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    81
+                                                 mlib_d64 zoomy,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    82
+                                                 mlib_d64 tx,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    83
+                                                 mlib_d64 ty,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    84
+                                                 void *interp_table,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    85
+                                                 mlib_edge edge);
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    86
+typedef mlib_status     (*ml_ZoomTranslate)     (mlib_image * dst,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    87
+                                                 mlib_image * src,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    88
+                                                 mlib_d64 zoomx,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    89
+                                                 mlib_d64 zoomy,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    90
+                                                 mlib_d64 tx,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    91
+                                                 mlib_d64 ty,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    92
+                                                 mlib_filter filter,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    93
+                                                 mlib_edge edge);
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    94
+typedef mlib_status (*ml_ZoomTranslateBlend)   (mlib_image *dst,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    95
+                                                const mlib_image *src,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    96
+                                                mlib_d64 zoomx,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    97
+                                                mlib_d64 zoomy,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    98
+                                                mlib_d64 tx,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
    99
+                                                mlib_d64 ty,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   100
+                                                mlib_filter filter,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   101
+                                                mlib_edge edge,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   102
+                                                mlib_blend blend,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   103
+                                                mlib_s32 alpha,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   104
+                                                mlib_s32 cmask);
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   105
+typedef mlib_status (*ml_ZoomTranslateTableBlend) (mlib_image *dst,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   106
+                                                   const mlib_image *src,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   107
+                                                   mlib_d64 zoomx,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   108
+                                                   mlib_d64 zoomy,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   109
+                                                   mlib_d64 tx,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   110
+                                                   mlib_d64 ty,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   111
+                                                   const void *table,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   112
+                                                   mlib_edge edge,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   113
+                                                   mlib_blend blend,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   114
+                                                   mlib_s32 cmask);
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   115
+typedef void (*ml_ColorRGBint_to_BGRAint)      (mlib_u8 *bgra,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   116
+                                                const mlib_u8 *rgb,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   117
+                                                const mlib_u8 *a_array,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   118
+                                                mlib_u8 a_const,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   119
+                                                mlib_s32 w,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   120
+                                                mlib_s32 h,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   121
+                                                mlib_s32 dlb,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   122
+                                                mlib_s32 slb,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   123
+                                                mlib_s32 alb);
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   124
+
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   125
+
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   126
+
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   127
+static ml_ImageSetStruct        _medialib_ImageSetStruct = NULL;
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   128
+static ml_ImageChannelExtract   _medialib_ImageChannelExtract = NULL;
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   129
+static ml_ZoomTranslate         _medialib_ZoomTranslate = NULL;
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   130
+static ml_InterpTableCreate     _medialib_InterpTableCreate = NULL;
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   131
+static ml_InterpTableDelete     _medialib_InterpTableDelete = NULL;
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   132
+static ml_ZoomTranslateTable    _medialib_ZoomTranslateTable = NULL;
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   133
+static ml_ZoomTranslateBlend    _medialib_ZoomTranslateBlend = NULL;
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   134
+static ml_ZoomTranslateTableBlend _medialib_ZoomTranslateTableBlend = NULL;
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   135
+static ml_ColorRGBint_to_BGRAint _medialib_ColorRGBint_to_BGRAint = NULL;
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   136
+
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   137
+static gboolean medialib_initialized = FALSE;
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   138
+static gboolean use_medialib = TRUE;
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   139
+
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   140
 struct _mlInterp
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   141
 {
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   142
   double       tx;
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   143
@@ -154,82 +237,152 @@ struct _mlInterp
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   144
   void         *interp_table;
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   145
 };
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   146
 
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   147
-static gboolean medialib_initialized = FALSE;
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   148
-static gboolean use_medialib         = TRUE;
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   149
+static void *
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   150
+dlopen_mlib (void)
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   151
+{
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   152
+  void *handle = NULL;
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   153
 
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   154
-/*
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   155
- * Sun mediaLib(tm) support.
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   156
- *
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   157
- *   http://www.sun.com/processors/vis/mlib.html
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   158
- *
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   159
- */
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   160
-static void
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   161
-_pixops_use_medialib ()
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   162
+  if ((handle = dlopen ("libmlib.so.2", RTLD_LAZY)) != NULL)
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   163
+    return handle;
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   164
+  if ((handle = dlopen ("/usr/lib/libmlib.so.2", RTLD_LAZY)) != NULL)
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   165
+    return handle;
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   166
+
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   167
+  return NULL;
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   168
+}
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   169
+
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   170
+static gboolean
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   171
+initialize_mediaLib (void *handle)
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   172
+{
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   173
+  _medialib_ImageSetStruct = (ml_ImageSetStruct)dlsym (handle,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   174
+                           "mlib_ImageSetStruct");
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   175
+  _medialib_ImageChannelExtract = (ml_ImageChannelExtract)dlsym (
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   176
+                                handle,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   177
+                                "mlib_ImageChannelExtract");
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   178
+  _medialib_ZoomTranslate  = (ml_ZoomTranslate)dlsym (handle,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   179
+                           "mlib_ImageZoomTranslate");
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   180
+
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   181
+  _medialib_InterpTableCreate  = (ml_InterpTableCreate)dlsym (handle,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   182
+                               "mlib_ImageInterpTableCreate");
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   183
+  _medialib_InterpTableDelete  = (ml_InterpTableDelete)dlsym (handle,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   184
+                               "mlib_ImageInterpTableDelete");
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   185
+  _medialib_ZoomTranslateTable = (ml_ZoomTranslateTable)dlsym (handle,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   186
+                               "mlib_ImageZoomTranslateTable");
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   187
+
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   188
+  _medialib_ZoomTranslateBlend = (ml_ZoomTranslateBlend)dlsym (handle,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   189
+                               "mlib_ImageZoomTranslateBlend");
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   190
+  _medialib_ZoomTranslateTableBlend = (ml_ZoomTranslateTableBlend)dlsym (
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   191
+                                    handle,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   192
+                                    "mlib_ImageZoomTranslateTableBlend");
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   193
+
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   194
+  if (_medialib_ImageSetStruct == NULL || _medialib_ImageChannelExtract == NULL ||
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   195
+       _medialib_ZoomTranslate == NULL || _medialib_InterpTableCreate == NULL ||
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   196
+       _medialib_InterpTableDelete == NULL || _medialib_ZoomTranslateTable == NULL ||
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   197
+       _medialib_ZoomTranslateBlend == NULL ||
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   198
+       _medialib_ZoomTranslateTableBlend == NULL)
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   199
+    return FALSE;
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   200
+
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   201
+  return TRUE;
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   202
+}
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   203
+
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   204
+static gboolean
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   205
+mlib_x86_checks (void *handle)
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   206
 {
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   207
+  typedef char * (*ml_version) (void);
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   208
+  ml_version medialib_version;
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   209
   char *mlib_version_string;
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   210
-  char  sys_info[257];
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   211
-  long  count;
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   212
+  char *mlib_target_isa;
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   213
 
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   214
-  medialib_initialized = TRUE; 
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   215
-
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   216
-  if (getenv ("GDK_DISABLE_MEDIALIB"))
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   217
-    {
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   218
-      use_medialib = FALSE;
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   219
-      return;
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   220
-    }
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   221
+  medialib_version = (ml_version)dlsym (handle, "mlib_version");
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   222
+  if (medialib_version == NULL)
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   223
+    return FALSE;
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   224
 
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   225
   /*
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   226
-   * The imaging functions we want to use were added in mediaLib version 2.
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   227
-   * So turn off mediaLib support if the user has an older version.
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   228
    * mlib_version returns a string in this format:
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   229
    *
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   230
    * mediaLib:0210:20011101:v8plusa
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   231
    * ^^^^^^^^ ^^^^ ^^^^^^^^ ^^^^^^^
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   232
    * libname  vers  build   ISALIST identifier
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   233
    *                date    (in this case sparcv8plus+vis)
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   234
-   * 
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   235
+   *
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   236
    * The first 2 digits of the version are the major version.  The 3rd digit
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   237
    * is the minor version, and the 4th digit is the micro version.  So the
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   238
-   * above string corresponds to version 2.1.0.  In the following test we only
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   239
-   * care about the major version.
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   240
+   * above string corresponds to version 2.1.0.
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   241
    */
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   242
-  mlib_version_string = mlib_version ();
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   243
+  mlib_version_string = medialib_version ();
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   244
+  mlib_target_isa = &mlib_version_string[23];
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   245
 
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   246
-  count = sysinfo (SI_ARCHITECTURE, &sys_info[0], 257);
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   247
+  /*
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   248
+   * For x86 processors mediaLib generic C implementation
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   249
+   * does not give any performance advantage so disable it.
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   250
+   */
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   251
+  if (strncmp (mlib_target_isa, "sse", 3) != 0)
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   252
+    return FALSE;
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   253
+
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   254
+  /*
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   255
+   * For x86 processors use of libumem conflicts with
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   256
+   * mediaLib, so avoid using it.
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   257
+   */
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   258
+  if (dlsym (RTLD_PROBE,   "umem_alloc") != NULL)
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   259
+    return FALSE;
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   260
+
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   261
+  return TRUE;
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   262
+}
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   263
+
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   264
+/*
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   265
+ * Sun mediaLib(tm) support.
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   266
+ *
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   267
+ *   http://www.sun.com/processors/vis/mlib.html
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   268
+ *
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   269
+ */
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   270
+gboolean
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   271
+_pixops_use_medialib (void)
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   272
+{
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   273
+  void *medialib_handle = NULL;
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   274
+  char sys_info[257];
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   275
+  long count;
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   276
 
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   277
+  if (medialib_initialized == TRUE)
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   278
+    return TRUE;
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   279
+
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   280
+  if (use_medialib == FALSE)
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   281
+    return FALSE;
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   282
+
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   283
+  if (getenv ("GDK_DISABLE_MEDIALIB"))
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   284
+    {
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   285
+      use_medialib = FALSE;
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   286
+      return FALSE;
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   287
+    }
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   288
+
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   289
+  medialib_handle = dlopen_mlib ();
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   290
+  if (medialib_handle == NULL)
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   291
+    goto fail;
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   292
+
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   293
+  count = sysinfo (SI_ARCHITECTURE, &sys_info[0], 257);
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   294
+             
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   295
   if (count != -1)
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   296
     {
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   297
       if (strcmp (sys_info, "i386") == 0)
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   298
         {
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   299
-          char *mlib_target_isa = &mlib_version_string[23];
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   300
-
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   301
-          /*
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   302
-           * For x86 processors mediaLib generic C implementation
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   303
-           * does not give any performance advantage so disable it
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   304
-           */
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   305
-          if (strncmp (mlib_target_isa, "sse", 3) != 0)
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   306
-            {
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   307
-              use_medialib = FALSE;
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   308
-              return;
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   309
-            }
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   310
-
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   311
-          /*
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   312
-           * For x86 processors use of libumem conflicts with
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   313
-           * mediaLib, so avoid using it.
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   314
-           */
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   315
-          if (dlsym (RTLD_PROBE,   "umem_alloc") != NULL)
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   316
-            {
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   317
-              use_medialib = FALSE;
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   318
-              return;
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   319
-            }
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   320
+          if (mlib_x86_checks (medialib_handle) == FALSE)
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   321
+            goto fail;
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   322
         }
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   323
     }
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   324
   else
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   325
     {
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   326
-      /* Failed to get system architecture, disable mediaLib anyway */
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   327
-      use_medialib = FALSE;
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   328
-      return;
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   329
+      /* Failed to get system architecture, disable mediaLib */
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   330
+      goto fail;
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   331
     }
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   332
+
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   333
+  if (initialize_mediaLib (medialib_handle) == FALSE)
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   334
+    goto fail;
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   335
+
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   336
+  medialib_initialized = TRUE;
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   337
+  return TRUE;
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   338
+
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   339
+fail:
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   340
+  dlclose (medialib_handle);
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   341
+  use_medialib = FALSE;
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   342
+  return FALSE;
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   343
 }
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   344
 #endif
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   345
 
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   346
@@ -1850,9 +2003,7 @@ _pixops_composite (guchar          *dest_buf,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   347
                              dest_region_width, dest_region_height, offset_x,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   348
 			     offset_y, scale_x, scale_y,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   349
                              (PixopsInterpType)interp_type, overall_alpha);
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   350
-  return;
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   351
-#endif
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   352
-
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   353
+#else
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   354
   new_dest_buf = dest_buf + dest_y * dest_rowstride + dest_x * dest_channels;
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   355
   render_x0 = dest_x - offset_x;
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   356
   render_y0 = dest_y - offset_y;
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   357
@@ -1865,6 +2016,7 @@ _pixops_composite (guchar          *dest_buf,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   358
 			  src_rowstride, src_channels, src_has_alpha, scale_x,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   359
 			  scale_y, (PixopsInterpType)interp_type,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   360
 			  overall_alpha);
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   361
+#endif
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   362
 }
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   363
 
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   364
 #ifdef USE_MEDIALIB
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   365
@@ -1967,7 +2119,7 @@ medialib_get_interpolation (mlInterp * ml_interp,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   366
          ml_interp->po_filter.y.weights[i] *= sqrt_alpha;
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   367
     }
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   368
     
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   369
-  ml_interp->interp_table = (void *) mlib_ImageInterpTableCreate (MLIB_DOUBLE,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   370
+  ml_interp->interp_table = (void *) _medialib_InterpTableCreate (MLIB_DOUBLE,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   371
     ml_interp->po_filter.x.n, ml_interp->po_filter.y.n, leftPadding,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   372
     topPadding, SUBSAMPLE_BITS, SUBSAMPLE_BITS, 8,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   373
     ml_interp->po_filter.x.weights, ml_interp->po_filter.y.weights);
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   374
@@ -2042,25 +2194,25 @@ pixops_medialib_composite (guchar          *dest_buf,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   375
           return;
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   376
         }
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   377
 
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   378
-      mlib_ImageSetStruct (&img_src, MLIB_BYTE, src_channels,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   379
-			   src_width, src_height, src_rowstride, src_buf);
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   380
+      _medialib_ImageSetStruct (&img_src, MLIB_BYTE, src_channels,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   381
+                                src_width, src_height, src_rowstride, src_buf);
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   382
 
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   383
       if (dest_x == 0 && dest_y == 0 &&
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   384
           dest_width  == dest_region_width &&
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   385
           dest_height == dest_region_height)
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   386
         {
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   387
-          mlib_ImageSetStruct (&img_dest, MLIB_BYTE, dest_channels,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   388
-			       dest_width, dest_height, dest_rowstride,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   389
-			       dest_buf);
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   390
+          _medialib_ImageSetStruct (&img_dest, MLIB_BYTE, dest_channels,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   391
+                                    dest_width, dest_height, dest_rowstride,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   392
+                                    dest_buf);
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   393
         }
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   394
       else
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   395
         {
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   396
 	  mlib_u8 *data = dest_buf + (dest_y * dest_rowstride) + 
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   397
 				     (dest_x * dest_channels);
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   398
 
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   399
-          mlib_ImageSetStruct (&img_dest, MLIB_BYTE, dest_channels,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   400
-			       dest_region_width, dest_region_height,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   401
-			       dest_rowstride, data);
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   402
+          _medialib_ImageSetStruct (&img_dest, MLIB_BYTE, dest_channels,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   403
+                                    dest_region_width, dest_region_height,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   404
+                                    dest_rowstride, data);
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   405
         }
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   406
 
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   407
       ml_offset_x = floor (offset_x) - dest_x;
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   408
@@ -2070,7 +2222,7 @@ pixops_medialib_composite (guchar          *dest_buf,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   409
         {
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   410
           blend = src_has_alpha ? MLIB_BLEND_GTK_SRC_OVER2 : MLIB_BLEND_GTK_SRC;
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   411
 
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   412
-          mlib_ImageZoomTranslateBlend (&img_dest,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   413
+          _medialib_ZoomTranslateBlend (&img_dest,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   414
                                         &img_src,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   415
                                         scale_x,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   416
                                         scale_y,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   417
@@ -2089,7 +2241,7 @@ pixops_medialib_composite (guchar          *dest_buf,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   418
           if (interp_type == PIXOPS_INTERP_BILINEAR &&
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   419
 	      scale_x > 1.0 && scale_y > 1.0)
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   420
             {
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   421
-              mlib_ImageZoomTranslateBlend (&img_dest,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   422
+              _medialib_ZoomTranslateBlend (&img_dest,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   423
                                             &img_src,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   424
                                             scale_x,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   425
                                             scale_y,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   426
@@ -2108,7 +2260,7 @@ pixops_medialib_composite (guchar          *dest_buf,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   427
 
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   428
               if (ml_interp.interp_table != NULL)
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   429
                 {
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   430
-                  mlib_ImageZoomTranslateTableBlend (&img_dest,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   431
+                  _medialib_ZoomTranslateTableBlend (&img_dest,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   432
                                                      &img_src,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   433
                                                      scale_x,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   434
                                                      scale_y,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   435
@@ -2118,7 +2270,7 @@ pixops_medialib_composite (guchar          *dest_buf,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   436
                                                      MLIB_EDGE_SRC_EXTEND_INDEF,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   437
                                                      blend,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   438
                                                      1);
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   439
-                  mlib_ImageInterpTableDelete (ml_interp.interp_table);
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   440
+                  _medialib_InterpTableDelete (ml_interp.interp_table);
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   441
                 }
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   442
               else
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   443
                 {
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   444
@@ -2231,12 +2383,6 @@ _pixops_scale (guchar          *dest_buf,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   445
                double           scale_y,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   446
                PixopsInterpType interp_type)
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   447
 {
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   448
-  guchar *new_dest_buf;
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   449
-  int render_x0;
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   450
-  int render_y0;
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   451
-  int render_x1;
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   452
-  int render_y1;
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   453
-
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   454
 #ifdef USE_MEDIALIB
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   455
   pixops_medialib_scale (dest_buf, dest_width, dest_height, dest_rowstride,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   456
                          dest_channels, dest_has_alpha, src_buf, src_width,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   457
@@ -2244,8 +2390,12 @@ _pixops_scale (guchar          *dest_buf,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   458
                          src_has_alpha, dest_x, dest_y, dest_region_width,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   459
 			 dest_region_height, offset_x, offset_y, scale_x,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   460
 			 scale_y, (PixopsInterpType)interp_type);
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   461
-  return;
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   462
-#endif
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   463
+#else
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   464
+  guchar *new_dest_buf;
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   465
+  int render_x0;
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   466
+  int render_y0;
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   467
+  int render_x1;
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   468
+  int render_y1;
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   469
 
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   470
   new_dest_buf = dest_buf + dest_y * dest_rowstride + dest_x * dest_channels;
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   471
   render_x0    = dest_x - offset_x;
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   472
@@ -2258,6 +2408,7 @@ _pixops_scale (guchar          *dest_buf,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   473
                       dest_has_alpha, src_buf, src_width, src_height,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   474
                       src_rowstride, src_channels, src_has_alpha,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   475
                       scale_x, scale_y, (PixopsInterpType)interp_type);
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   476
+#endif
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   477
 }
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   478
 
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   479
 #ifdef USE_MEDIALIB
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   480
@@ -2290,15 +2441,6 @@ pixops_medialib_scale     (guchar          *dest_buf,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   481
   if (!medialib_initialized)
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   482
     _pixops_use_medialib ();
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   483
  
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   484
-  /*
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   485
-   * We no longer support mediaLib 2.1 because it has a core dumping problem
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   486
-   * in the mlib_ImageZoomTranslateTable function that has been corrected in
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   487
-   * 2.2.  Although the mediaLib_zoom function could be used, it does not
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   488
-   * work properly if the source and destination images have different 
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   489
-   * values for "has_alpha" or "num_channels".  The complicated if-logic
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   490
-   * required to support both versions is not worth supporting
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   491
-   * mediaLib 2.1 moving forward.
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   492
-   */
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   493
   if (!use_medialib)
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   494
     {
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   495
       _pixops_scale_real (dest_buf + dest_y * dest_rowstride + dest_x *
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   496
@@ -2317,25 +2459,25 @@ pixops_medialib_scale     (guchar          *dest_buf,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   497
       double ml_offset_x, ml_offset_y;
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   498
       guchar *tmp_buf = NULL;
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   499
 
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   500
-      mlib_ImageSetStruct (&img_orig_src, MLIB_BYTE, src_channels, src_width, 
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   501
-			   src_height, src_rowstride, src_buf);
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   502
+      _medialib_ImageSetStruct (&img_orig_src, MLIB_BYTE, src_channels, src_width, 
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   503
+                                src_height, src_rowstride, src_buf);
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   504
 
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   505
       if (dest_x == 0 && dest_y == 0 &&
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   506
           dest_width == dest_region_width &&
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   507
           dest_height == dest_region_height)
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   508
         {
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   509
-          mlib_ImageSetStruct (&img_dest, MLIB_BYTE, dest_channels,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   510
-			       dest_width, dest_height, dest_rowstride,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   511
-			       dest_buf);
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   512
+          _medialib_ImageSetStruct (&img_dest, MLIB_BYTE, dest_channels,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   513
+                                    dest_width, dest_height, dest_rowstride,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   514
+                                    dest_buf);
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   515
         }
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   516
       else
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   517
         {
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   518
 	  mlib_u8 *data = dest_buf + (dest_y * dest_rowstride) + 
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   519
 				     (dest_x * dest_channels);
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   520
 
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   521
-          mlib_ImageSetStruct (&img_dest, MLIB_BYTE, dest_channels,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   522
-			       dest_region_width, dest_region_height,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   523
-			       dest_rowstride, data);
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   524
+          _medialib_ImageSetStruct (&img_dest, MLIB_BYTE, dest_channels,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   525
+                                    dest_region_width, dest_region_height,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   526
+                                    dest_rowstride, data);
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   527
         }
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   528
 
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   529
       ml_offset_x = floor (offset_x) - dest_x;
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   530
@@ -2373,10 +2515,10 @@ pixops_medialib_scale     (guchar          *dest_buf,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   531
                   src_channels  = channels;
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   532
                   src_rowstride = rowstride;
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   533
           
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   534
-                  mlib_ImageSetStruct (&img_src, MLIB_BYTE, src_channels,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   535
-				       src_width, src_height, src_rowstride,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   536
-				       tmp_buf);
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   537
-                  mlib_ImageChannelExtract (&img_src, &img_orig_src, 0xE);  
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   538
+                  _medialib_ImageSetStruct (&img_src, MLIB_BYTE, src_channels,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   539
+                                            src_width, src_height, src_rowstride,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   540
+                                            tmp_buf);
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   541
+                  _medialib_ImageChannelExtract (&img_src, &img_orig_src, 0xE);  
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   542
                 }
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   543
             }
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   544
         }
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   545
@@ -2385,7 +2527,7 @@ pixops_medialib_scale     (guchar          *dest_buf,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   546
         {
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   547
           if (src_channels == dest_channels)
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   548
             {
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   549
-              mlib_ImageZoomTranslate (&img_dest,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   550
+              _medialib_ZoomTranslate (&img_dest,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   551
                                        &img_src,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   552
                                        scale_x,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   553
                                        scale_y,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   554
@@ -2396,7 +2538,7 @@ pixops_medialib_scale     (guchar          *dest_buf,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   555
             }
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   556
           else
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   557
             {
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   558
-              mlib_ImageZoomTranslateBlend (&img_dest,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   559
+              _medialib_ZoomTranslateBlend (&img_dest,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   560
                                             &img_src,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   561
                                             scale_x,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   562
                                             scale_y,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   563
@@ -2414,7 +2556,7 @@ pixops_medialib_scale     (guchar          *dest_buf,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   564
           if (interp_type == PIXOPS_INTERP_BILINEAR &&
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   565
               scale_x > 1.0 && scale_y > 1.0)
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   566
             {
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   567
-               mlib_ImageZoomTranslate (&img_dest,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   568
+               _medialib_ZoomTranslate (&img_dest,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   569
                                         &img_src,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   570
                                         scale_x,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   571
                                         scale_y,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   572
@@ -2430,7 +2572,7 @@ pixops_medialib_scale     (guchar          *dest_buf,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   573
 
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   574
               if (ml_interp.interp_table != NULL)
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   575
                 {
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   576
-                  mlib_ImageZoomTranslateTable (&img_dest, 
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   577
+                  _medialib_ZoomTranslateTable (&img_dest, 
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   578
                                                 &img_src,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   579
                                                 scale_x,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   580
                                                 scale_y,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   581
@@ -2439,7 +2581,7 @@ pixops_medialib_scale     (guchar          *dest_buf,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   582
                                                 ml_interp.interp_table,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   583
                                                 MLIB_EDGE_SRC_EXTEND_INDEF);
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   584
 
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   585
-	          mlib_ImageInterpTableDelete (ml_interp.interp_table);
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   586
+	          _medialib_InterpTableDelete (ml_interp.interp_table);
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   587
                 }
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   588
               else
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   589
                 {
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   590
@@ -2461,7 +2603,7 @@ pixops_medialib_scale     (guchar          *dest_buf,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   591
                       break;
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   592
                     }
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   593
 
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   594
-                  mlib_ImageZoomTranslate (&img_dest,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   595
+                  _medialib_ZoomTranslate (&img_dest,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   596
                                            &img_src,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   597
                                            scale_x,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   598
                                            scale_y,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   599
@@ -2477,7 +2619,7 @@ pixops_medialib_scale     (guchar          *dest_buf,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   600
       else if (interp_type == PIXOPS_INTERP_BILINEAR &&
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   601
                scale_x > 1.0 && scale_y > 1.0)
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   602
         {
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   603
-          mlib_ImageZoomTranslateBlend (&img_dest,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   604
+          _medialib_ZoomTranslateBlend (&img_dest,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   605
                                         &img_src,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   606
                                         scale_x,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   607
                                         scale_y,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   608
@@ -2496,7 +2638,7 @@ pixops_medialib_scale     (guchar          *dest_buf,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   609
 
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   610
           if (ml_interp.interp_table != NULL)
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   611
             {
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   612
-              mlib_ImageZoomTranslateTableBlend (&img_dest,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   613
+              _medialib_ZoomTranslateTableBlend (&img_dest,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   614
                                                  &img_src,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   615
                                                  scale_x,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   616
                                                  scale_y,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   617
@@ -2506,7 +2648,7 @@ pixops_medialib_scale     (guchar          *dest_buf,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   618
                                                  MLIB_EDGE_SRC_EXTEND_INDEF,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   619
                                                  MLIB_BLEND_GTK_SRC,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   620
                                                  1);
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   621
-              mlib_ImageInterpTableDelete (ml_interp.interp_table);
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   622
+              _medialib_InterpTableDelete (ml_interp.interp_table);
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   623
             }
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   624
           else
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   625
             {
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   626
@@ -2517,7 +2659,7 @@ pixops_medialib_scale     (guchar          *dest_buf,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   627
                 case PIXOPS_INTERP_BILINEAR:
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   628
                   ml_filter = MLIB_BILINEAR;
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   629
                   break;
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   630
-            
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   631
+
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   632
                 case PIXOPS_INTERP_TILES:
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   633
                   ml_filter = MLIB_BILINEAR;
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   634
                   break;
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   635
@@ -2527,7 +2669,7 @@ pixops_medialib_scale     (guchar          *dest_buf,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   636
                   break;
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   637
                 }
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   638
 
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   639
-              mlib_ImageZoomTranslate (&img_dest,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   640
+              _medialib_ZoomTranslate (&img_dest,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   641
                                        &img_src,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   642
                                        scale_x,
9ff9c0fa64d9 2010-07-29 Christian Kelly <[email protected]>
chrisk
parents: 18249
diff changeset
   643
                                        scale_y,
16520
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   644
diff --git a/gdk/gdkdraw.c b/gdk/gdkdraw.c
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   645
index 81e6e08..d659480 100644
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   646
--- a/gdk/gdkdraw.c
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   647
+++ b/gdk/gdkdraw.c
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   648
@@ -1385,26 +1385,26 @@ composite_0888_medialib (guchar      *src_buf,
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   649
 
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   650
   mlib_image img_src, img_dst;
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   651
 
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   652
-  mlib_ImageSetStruct (&img_dst,
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   653
-                       MLIB_BYTE,
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   654
-                       4,
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   655
-                       width,
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   656
-                       height,
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   657
-                       dest_rowstride,
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   658
-                       dest_buf);
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   659
-
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   660
-  mlib_ImageSetStruct (&img_src,
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   661
-                       MLIB_BYTE,
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   662
-                       4,
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   663
-                       width,
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   664
-                       height,
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   665
-                       src_rowstride,
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   666
-                       src_buf);
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   667
+  medialib_ImageSetStruct (&img_dst,
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   668
+                           MLIB_BYTE,
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   669
+                           4,
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   670
+                           width,
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   671
+                           height,
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   672
+                          dest_rowstride,
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   673
+                          dest_buf);
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   674
+
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   675
+  medialib_ImageSetStruct (&img_src,
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   676
+                           MLIB_BYTE,
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   677
+                           4,
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   678
+                           width,
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   679
+                           height,
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   680
+                           src_rowstride,
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   681
+                           src_buf);
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   682
 
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   683
   if (dest_byte_order == GDK_LSB_FIRST)
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   684
-      mlib_ImageBlendRGBA2BGRA (&img_dst, &img_src);
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   685
+      medialib_BlendRGBA2BGRA (&img_dst, &img_src);
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   686
   else
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   687
-      mlib_ImageBlendRGBA2ARGB (&img_dst, &img_src);
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   688
+      medialib_BlendRGBA2ARGB (&img_dst, &img_src);
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   689
 }
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   690
 #endif
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   691
 
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   692
diff --git a/gdk/gdkmedialib.c b/gdk/gdkmedialib.c
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   693
index effb89d..ae01bfb 100644
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   694
--- a/gdk/gdkmedialib.c
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   695
+++ b/gdk/gdkmedialib.c
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   696
@@ -46,29 +46,56 @@
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   697
 
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   698
 #include "gdkmedialib.h"
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   699
 
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   700
-typedef char *      (*ml_version)         (void);
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   701
+ml_ImageSetStruct medialib_ImageSetStruct = NULL;
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   702
+ml_BlendRGBA2BGRA medialib_BlendRGBA2BGRA = NULL;
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   703
+ml_BlendRGBA2ARGB medialib_BlendRGBA2ARGB = NULL;
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   704
+ml_ColorRGBint_to_BGRAint medialib_ColorRGBint_to_BGRAint = NULL;
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   705
 
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   706
-static ml_version                 medialib_version = mlib_version;
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   707
+static void *
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   708
+dlopen_mlib (void)
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   709
+{
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   710
+  void *handle = NULL;
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   711
 
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   712
-gboolean 
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   713
-_gdk_use_medialib (void)
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   714
+  if ((handle = dlopen ("libmlib.so.2", RTLD_LAZY)) != NULL)
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   715
+    return handle;
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   716
+  if ((handle = dlopen ("/usr/lib/libmlib.so.2", RTLD_LAZY)) != NULL)
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   717
+    return handle;
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   718
+
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   719
+  return NULL;
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   720
+}
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   721
+
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   722
+static gboolean
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   723
+initialize_mediaLib (void *handle)
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   724
+{
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   725
+  medialib_ImageSetStruct = (ml_ImageSetStruct)dlsym (handle,
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   726
+                             "mlib_ImageSetStruct");
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   727
+  medialib_BlendRGBA2BGRA = (ml_BlendRGBA2BGRA)dlsym (handle,
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   728
+                             "mlib_ImageBlendRGBA2BGRA");
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   729
+  medialib_BlendRGBA2ARGB = (ml_BlendRGBA2ARGB)dlsym (handle,
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   730
+                             "mlib_ImageBlendRGBA2ARGB");
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   731
+  medialib_ColorRGBint_to_BGRAint = (ml_ColorRGBint_to_BGRAint)dlsym (
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   732
+                                     handle,
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   733
+                                    "mlib_VideoColorRGBint_to_BGRAint");
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   734
+  if (medialib_ImageSetStruct == NULL || medialib_BlendRGBA2BGRA == NULL ||
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   735
+       medialib_BlendRGBA2ARGB == NULL || medialib_ColorRGBint_to_BGRAint == NULL)
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   736
+    return FALSE;
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   737
+
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   738
+  return TRUE;
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   739
+}
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   740
+
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   741
+static gboolean
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   742
+mlib_x86_checks (void *handle)
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   743
 {
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   744
+  typedef char * (*ml_version) (void);
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   745
+  ml_version medialib_version;
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   746
   char *mlib_version_string;
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   747
-  char sys_info[257];
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   748
-  long count;
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   749
+  char *mlib_target_isa;
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   750
 
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   751
-  /*
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   752
-   * Sun mediaLib(tm) support.
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   753
-   *
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   754
-   *   http://www.sun.com/processors/vis/mlib.html
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   755
-   *
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   756
-   */
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   757
-  if (getenv ("GDK_DISABLE_MEDIALIB"))
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   758
+  medialib_version = (ml_version)dlsym (handle, "mlib_version");
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   759
+  if (medialib_version == NULL)
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   760
     return FALSE;
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   761
 
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   762
   /*
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   763
-   * The imaging functions we want to use were added in mediaLib version 2.
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   764
-   * So turn off mediaLib support if the user has an older version.
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   765
    * mlib_version returns a string in this format:
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   766
    *
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   767
    * mediaLib:0210:20011101:v8plusa
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   768
@@ -78,43 +105,83 @@ _gdk_use_medialib (void)
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   769
    *
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   770
    * The first 2 digits of the version are the major version.  The 3rd digit
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   771
    * is the minor version, and the 4th digit is the micro version. So the
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   772
-   * above string corresponds to version 2.1.0.In the following test we only
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   773
-   * care about the major version.
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   774
+   * above string corresponds to version 2.1.0.
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   775
+   */
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   776
+  mlib_version_string = medialib_version ();
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   777
+  mlib_target_isa = &mlib_version_string[23];
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   778
+
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   779
+  /*
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   780
+   * For x86 processors mediaLib generic C implementation
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   781
+   * does not give any performance advantage so disable it.
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   782
+   */
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   783
+  if (strncmp (mlib_target_isa, "sse", 3) != 0)
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   784
+    return FALSE;
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   785
+
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   786
+  /*
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   787
+   * For x86 processors use of libumem conflicts with
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   788
+   * mediaLib, so avoid using it.
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   789
    */
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   790
-   mlib_version_string = medialib_version ();
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   791
+  if (dlsym (RTLD_PROBE,   "umem_alloc") != NULL)
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   792
+    return FALSE;
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   793
+
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   794
+  return TRUE;
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   795
+}
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   796
 
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   797
-   count = sysinfo (SI_ARCHITECTURE, &sys_info[0], 257);
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   798
+/*
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   799
+ * Sun mediaLib(tm) support.
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   800
+ *
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   801
+ *   http://www.sun.com/processors/vis/mlib.html
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   802
+ *
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   803
+ */
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   804
+gboolean
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   805
+_gdk_use_medialib (void)
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   806
+{
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   807
+  static gboolean medialib_initialized = FALSE;
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   808
+  static gboolean use_medialib = TRUE;
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   809
+  void *medialib_handle = NULL;
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   810
+  char sys_info[257];
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   811
+  long count;
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   812
+
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   813
+  if (medialib_initialized == TRUE)
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   814
+    return TRUE;
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   815
+
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   816
+  if (use_medialib == FALSE)
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   817
+    return FALSE;
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   818
+
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   819
+  if (getenv ("GDK_DISABLE_MEDIALIB"))
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   820
+    {
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   821
+      use_medialib = FALSE;
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   822
+      return FALSE;
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   823
+    }
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   824
+
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   825
+  medialib_handle = dlopen_mlib ();
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   826
+  if (medialib_handle == NULL)
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   827
+    goto fail;
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   828
+
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   829
+  count = sysinfo (SI_ARCHITECTURE, &sys_info[0], 257);
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   830
              
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   831
-   if (count != -1)
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   832
-     {
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   833
-       if (strcmp (sys_info, "i386") == 0)
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   834
-         {
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   835
-           char *mlib_target_isa = &mlib_version_string[23];
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   836
-  
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   837
-           /*
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   838
-            * For x86 processors mediaLib generic C implementation
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   839
-            * does not give any performance advantage so disable it.
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   840
-            */
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   841
-           if (strncmp (mlib_target_isa, "sse", 3) != 0)
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   842
-             {
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   843
-               return FALSE;
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   844
-             }
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   845
-
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   846
-           /*
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   847
-            * For x86 processors use of libumem conflicts with
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   848
-            * mediaLib, so avoid using it.
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   849
-            */
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   850
-           if (dlsym (RTLD_PROBE,   "umem_alloc") != NULL)
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   851
-             {
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   852
-               return FALSE;
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   853
-             }
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   854
-         }
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   855
-     }
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   856
-   else
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   857
-     {
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   858
-       /* Failed to get system architecture, disable mediaLib */
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   859
-       return FALSE;
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   860
-     }
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   861
+  if (count != -1)
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   862
+    {
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   863
+      if (strcmp (sys_info, "i386") == 0)
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   864
+        {
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   865
+          if (mlib_x86_checks (medialib_handle) == FALSE)
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   866
+            goto fail;
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   867
+        }
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   868
+    }
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   869
+  else
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   870
+    {
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   871
+      /* Failed to get system architecture, disable mediaLib */
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   872
+      goto fail;
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   873
+    }
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   874
 
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   875
+  if (initialize_mediaLib (medialib_handle) == FALSE)
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   876
+    goto fail;
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   877
+
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   878
+  medialib_initialized = TRUE;
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   879
   return TRUE;
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   880
+
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   881
+fail:
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   882
+  dlclose (medialib_handle);
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   883
+  use_medialib = FALSE;
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   884
+  return FALSE;
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   885
 }
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   886
diff --git a/gdk/gdkmedialib.h b/gdk/gdkmedialib.h
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   887
index 1912e9d..1306277 100644
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   888
--- a/gdk/gdkmedialib.h
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   889
+++ b/gdk/gdkmedialib.h
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   890
@@ -36,6 +36,32 @@
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   891
 
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   892
 G_BEGIN_DECLS
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   893
 
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   894
+typedef mlib_image*     (*ml_ImageSetStruct)   (mlib_image *image,
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   895
+                                               mlib_type type,
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   896
+                                               mlib_s32 channels,
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   897
+                                               mlib_s32 width,
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   898
+                                               mlib_s32 height,
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   899
+                                               mlib_s32 stride,
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   900
+                                               const void *data);
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   901
+typedef mlib_status (*ml_BlendRGBA2BGRA)       (mlib_image *dst,
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   902
+                                                const mlib_image *src);
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   903
+typedef mlib_status (*ml_BlendRGBA2ARGB)       (mlib_image *dst,
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   904
+                                                const mlib_image *src);
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   905
+typedef void (*ml_ColorRGBint_to_BGRAint)      (mlib_u8 *bgra,
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   906
+                                                const mlib_u8 *rgb,
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   907
+                                                const mlib_u8 *a_array,
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   908
+                                                mlib_u8 a_const,
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   909
+                                                mlib_s32 w,
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   910
+                                                mlib_s32 h,
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   911
+                                                mlib_s32 dlb,
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   912
+                                                mlib_s32 slb,
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   913
+                                                mlib_s32 alb);
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   914
+
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   915
+extern ml_ColorRGBint_to_BGRAint medialib_ColorRGBint_to_BGRAint;
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   916
+extern ml_ImageSetStruct medialib_ImageSetStruct;
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   917
+extern ml_BlendRGBA2BGRA medialib_BlendRGBA2BGRA;
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   918
+extern ml_BlendRGBA2ARGB medialib_BlendRGBA2ARGB;
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   919
+
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   920
 gboolean _gdk_use_medialib (void);
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   921
 
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   922
 G_END_DECLS
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   923
diff --git a/gdk/gdkrgb.c b/gdk/gdkrgb.c
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   924
index 347ff59..9f34366 100644
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   925
--- a/gdk/gdkrgb.c
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   926
+++ b/gdk/gdkrgb.c
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   927
@@ -2154,7 +2154,7 @@ gdk_rgb_convert_0888 (GdkRgbInfo *image_info, GdkImage *image,
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   928
     }
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   929
 }
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   930
 
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   931
-#ifdef USE_MEDIALIB25
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   932
+#ifdef USE_MEDIALIB
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   933
 /* convert 24-bit packed to 32-bit unpacked */
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   934
 static void
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   935
 gdk_rgb_convert_0888_medialib (GdkRgbInfo *image_info, GdkImage *image,
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   936
@@ -2171,9 +2171,9 @@ gdk_rgb_convert_0888_medialib (GdkRgbInfo *image_info, GdkImage *image,
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   937
   bpl = image->bpl;
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   938
   obuf = ((guchar *)image->mem) + y0 * bpl + x0 * 4;
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   939
 
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   940
-  mlib_VideoColorRGBint_to_BGRAint (obuf, bptr, NULL, 0xff,
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   941
-                                    width, height, bpl, 
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   942
-                                    rowstride, 0);
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   943
+  medialib_ColorRGBint_to_BGRAint (obuf, bptr, NULL, 0xff,
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   944
+                                   width, height, bpl, 
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   945
+                                   rowstride, 0);
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   946
 }
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   947
 #endif
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   948
 
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   949
@@ -3157,7 +3157,7 @@ gdk_rgb_select_conv (GdkRgbInfo *image_info)
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   950
 	   vtype == GDK_VISUAL_TRUE_COLOR &&
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   951
 	   (mask_rgb && byte_order == GDK_LSB_FIRST))
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   952
     {
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   953
-#ifdef USE_MEDIALIB25
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   954
+#ifdef USE_MEDIALIB
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   955
       if (_gdk_use_medialib ())
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   956
         conv = gdk_rgb_convert_0888_medialib;
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   957
       else
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   958
@@ -3184,7 +3184,7 @@ gdk_rgb_select_conv (GdkRgbInfo *image_info)
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   959
   else if (bpp == 32 && depth == 32 && vtype == GDK_VISUAL_TRUE_COLOR &&
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   960
 	   (mask_rgb && byte_order == GDK_LSB_FIRST))
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   961
     {
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   962
-#ifdef USE_MEDIALIB25
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   963
+#ifdef USE_MEDIALIB
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   964
       if (_gdk_use_medialib ())
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   965
         conv = gdk_rgb_convert_0888_medialib;
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   966
       else
a6a49be55475 2009-09-10 Wang Xin <[email protected]>
jedy
parents:
diff changeset
   967