libgdiplus: update to 3.8.

This commit is contained in:
Juan RP 2014-11-24 12:54:35 +01:00
parent 8aa6c6d208
commit 7557b7b0cb
6 changed files with 47 additions and 342 deletions

View File

@ -1,26 +0,0 @@
commit 180c02e0f2a2016eba8520b456ca929e9dcf03db
Author: Jo Shields <directhex@apebox.org>
Date: Mon Dec 16 09:24:57 2013 +0000
Use FreeType macros for tttables.h inclusion
As of FreeType 2.1.6 (November 2003), using #include to include Freetype libraries directly is not supported.
This has come to a head, as in FreeType 2.5.0, the location of headers has been moved around, breaking building of libgdiplus.
This slight change uses the "official" way to include the required header file, without breaking building on older versions of the library.
diff --git a/src/gdiplus-private.h b/src/gdiplus-private.h
index 59edf9e..dfccc02 100644
--- a/src/gdiplus-private.h
+++ b/src/gdiplus-private.h
@@ -30,7 +30,8 @@
#include <stdio.h>
#include <math.h>
#include <glib.h>
-#include <freetype/tttables.h>
+#include <ft2build.h>
+#include FT_TRUETYPE_TABLES_H
#include <pthread.h>
#include <unistd.h>

View File

@ -1,16 +0,0 @@
tests/Makefile.in | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/tests/Makefile.in b/tests/Makefile.in
index 97f5f4e..c02ca25 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -228,7 +228,7 @@ DEPS = \
$(top_builddir)/src/libgdiplus.la
LDADDS = \
- $(top_builddir)/src/libgdiplus.la
+ $(top_builddir)/src/libgdiplus.la -lX11 -lglib-2.0
testgdi_DEPENDENCIES = $(TEST_DEPS)
testgdi_LDADD = $(LDADDS)

View File

@ -1,19 +1,22 @@
diff --git a/src/gifcodec.c b/src/gifcodec.c
index 8dee0eb..564beed 100644
--- a/src/gifcodec.c
+++ b/src/gifcodec.c
@@ -39,8 +39,10 @@ GUID gdip_gif_image_format_guid = {0xb96b3cb0U, 0x0728U, 0x11d3U, {0x9d, 0x7b, 0
--- src/gifcodec.c
+++ src/gifcodec.c
@@ -39,8 +39,15 @@ GUID gdip_gif_image_format_guid = {0xb96
#include "gifcodec.h"
+#if GIFLIB_MAJOR < 5
+#if !defined(GIFLIB_MAJOR) || GIFLIB_MAJOR < 5
/* giflib declares this incorrectly as EgifOpen */
extern GifFileType *EGifOpen(void *userData, OutputFunc writeFunc);
+#endif
+#if !defined(GIFLIB_MAJOR) || !(GIFLIB_MAJOR > 5 || \
+ (GIFLIB_MAJOR == 5 && GIFLIB_MINOR >= 1))
+# define DGifCloseFile(a, b) DGifCloseFile(a)
+# define EGifCloseFile(a, b) EGifCloseFile(a)
+#endif
/* Data structure used for callback */
typedef struct
@@ -105,7 +107,7 @@ gdip_gif_inputfunc (GifFileType *gif, GifByteType *data, int len)
@@ -105,7 +112,7 @@ gdip_gif_inputfunc (GifFileType *gif, Gi
*/
static int
@ -22,7 +25,7 @@ index 8dee0eb..564beed 100644
{
ExtensionBlock *ep;
@@ -129,7 +131,7 @@ AddExtensionBlockMono(SavedImage *New, int Len, BYTE ExtData[])
@@ -129,7 +136,7 @@ AddExtensionBlockMono(SavedImage *New, i
if (ExtData) {
memcpy(ep->Bytes, ExtData, Len);
@ -31,7 +34,7 @@ index 8dee0eb..564beed 100644
}
return (GIF_OK);
@@ -232,20 +234,20 @@ DGifSlurpMono(GifFileType * GifFile, SavedImage *TrailingExtensions)
@@ -232,20 +239,20 @@ DGifSlurpMono(GifFileType * GifFile, Sav
}
case EXTENSION_RECORD_TYPE: {
@ -55,7 +58,7 @@ index 8dee0eb..564beed 100644
}
break;
}
@@ -303,12 +305,19 @@ gdip_load_gif_image (void *stream, GpImage **image, BOOL from_file)
@@ -303,12 +310,19 @@ gdip_load_gif_image (void *stream, GpIma
result = NULL;
loop_counter = FALSE;
@ -76,7 +79,25 @@ index 8dee0eb..564beed 100644
if (gif == NULL) {
goto error;
}
@@ -660,11 +669,22 @@ gdip_save_gif_image (void *stream, GpImage *image, BOOL from_file)
@@ -581,7 +595,7 @@ gdip_load_gif_image (void *stream, GpIma
}
FreeExtensionMono(&global_extensions);
- DGifCloseFile (gif);
+ DGifCloseFile (gif, NULL);
*image = result;
return Ok;
@@ -597,7 +611,7 @@ error:
if (gif != NULL) {
FreeExtensionMono (&global_extensions);
- DGifCloseFile (gif);
+ DGifCloseFile (gif, NULL);
}
*image = NULL;
@@ -660,11 +674,22 @@ gdip_save_gif_image (void *stream, GpIma
return InvalidParameter;
}
@ -99,7 +120,7 @@ index 8dee0eb..564beed 100644
if (!fp) {
return FileNotFound;
@@ -848,8 +868,15 @@ gdip_save_gif_image (void *stream, GpImage *image, BOOL from_file)
@@ -848,8 +873,15 @@ gdip_save_gif_image (void *stream, GpIma
Buffer[0] = 1;
Buffer[1] = ptr[0];
Buffer[2] = ptr[1];
@ -115,3 +136,12 @@ index 8dee0eb..564beed 100644
}
}
@@ -923,7 +955,7 @@ gdip_save_gif_image (void *stream, GpIma
}
}
- EGifCloseFile (fp);
+ EGifCloseFile (fp, NULL);
return Ok;

View File

@ -1,164 +0,0 @@
$NetBSD: patch-aa,v 1.8 2011/01/21 10:21:51 wiz Exp $
Fix build with png-1.5.
--- a/src/pngcodec.c.orig 2010-11-03 16:52:54.000000000 +0000
+++ b/src/pngcodec.c
@@ -116,10 +116,15 @@ gdip_load_png_properties (png_structp pn
bitmap_data->dpi_horz = png_get_x_pixels_per_inch(png_ptr, info_ptr);
bitmap_data->dpi_vert = png_get_y_pixels_per_inch(png_ptr, info_ptr);
#elif defined(PNG_pHYs_SUPPORTED)
- if ((info_ptr->valid & PNG_INFO_pHYs) && (info_ptr->phys_unit_type == PNG_RESOLUTION_METER)) {
- bitmap_data->image_flags |= ImageFlagsHasRealDPI;
- bitmap_data->dpi_horz = info_ptr->x_pixels_per_unit * 0.0254;
- bitmap_data->dpi_vert = info_ptr->y_pixels_per_unit * 0.0254;
+ if (png_get_valid (png_ptr, info_ptr, PNG_INFO_pHYs)) {
+ png_uint_32 res_x, res_y;
+ int unit_type;
+ png_get_pHYs (png_ptr, info_ptr, &res_x, &res_y, &unit_type);
+ if (unit_type == PNG_RESOLUTION_METER) {
+ bitmap_data->image_flags |= ImageFlagsHasRealDPI;
+ bitmap_data->dpi_horz = res_x * 0.0254;
+ bitmap_data->dpi_vert = res_y * 0.0254;
+ }
}
#endif
/* default to screen resolution (if nothing was provided or available) */
@@ -130,7 +135,7 @@ gdip_load_png_properties (png_structp pn
#if defined(PNG_iCCP_SUPPORTED)
{
png_charp name;
- png_charp profile;
+ png_bytep profile;
png_uint_32 proflen;
int compression_type;
@@ -292,6 +297,11 @@ gdip_load_png_image_from_file_or_stream
ImageFlags colourspace_flag;
int i;
int j;
+ png_colorp png_palette;
+ int png_num_palette;
+ png_bytep trans_alpha;
+ int num_trans;
+ png_color_16p trans_color;
width = png_get_image_width (png_ptr, info_ptr);
height = png_get_image_height (png_ptr, info_ptr);
@@ -309,6 +319,8 @@ gdip_load_png_image_from_file_or_stream
}
/* Copy palette. */
+ png_get_PLTE (png_ptr, info_ptr, &png_palette, &png_num_palette);
+
num_colours = 1 << bit_depth;
if (png_get_color_type (png_ptr, info_ptr) == PNG_COLOR_TYPE_GRAY) {
@@ -321,8 +333,8 @@ gdip_load_png_image_from_file_or_stream
colourspace_flag = ImageFlagsColorSpaceRGB;
palette_entries = num_colours;
- if (palette_entries > info_ptr->num_palette) {
- palette_entries = info_ptr->num_palette;
+ if (palette_entries > png_num_palette) {
+ palette_entries = png_num_palette;
}
palette = GdipAlloc (sizeof(ColorPalette) + (num_colours - 1) * sizeof(ARGB));
@@ -331,29 +343,30 @@ gdip_load_png_image_from_file_or_stream
for (i=0; i < palette_entries; i++) {
set_pixel_bgra (&palette->Entries[i], 0,
- info_ptr->palette[i].blue,
- info_ptr->palette[i].green,
- info_ptr->palette[i].red,
+ png_palette[i].blue,
+ png_palette[i].green,
+ png_palette[i].red,
0xFF); /* alpha */
}
}
+ png_get_tRNS (png_ptr, info_ptr, &trans_alpha, &num_trans, &trans_color);
/* Make sure transparency is respected. */
- if (info_ptr->num_trans > 0) {
+ if (num_trans > 0) {
palette->Flags |= PaletteFlagsHasAlpha;
colourspace_flag |= ImageFlagsHasAlpha;
- if (info_ptr->num_trans > info_ptr->num_palette) {
- info_ptr->num_trans = info_ptr->num_palette;
+ if (num_trans > png_num_palette) {
+ num_trans = png_num_palette;
}
- for (i=0; i < info_ptr->num_trans; i++) {
+ for (i=0; i < num_trans; i++) {
set_pixel_bgra(&palette->Entries[i], 0,
- info_ptr->palette[i].blue,
- info_ptr->palette[i].green,
- info_ptr->palette[i].red,
+ png_palette[i].blue,
+ png_palette[i].green,
+ png_palette[i].red,
#if PNG_LIBPNG_VER > 10399
- info_ptr->trans_alpha [i]); /* alpha */
+ trans_alpha [i]); /* alpha */
#else
info_ptr->trans[i]); /* alpha */
#endif
@@ -398,6 +411,8 @@ gdip_load_png_image_from_file_or_stream
BYTE bit_depth;
int stride;
int interlace;
+ png_colorp png_palette;
+ int png_num_palette;
png_bytep *row_pointers;
BYTE *rawptr;
int i, j;
@@ -490,32 +505,33 @@ gdip_load_png_image_from_file_or_stream
png_byte palette = 0;
png_byte pix = *rowp++;
+ png_get_PLTE (png_ptr, info_ptr, &png_palette, &png_num_palette);
palette = (pix >> 6) & 0x03;
set_pixel_bgra (rawptr, 0,
- info_ptr->palette[palette].blue,
- info_ptr->palette[palette].green,
- info_ptr->palette[palette].red,
+ png_palette[palette].blue,
+ png_palette[palette].green,
+ png_palette[palette].red,
0xFF); /* alpha */
palette = (pix >> 4) & 0x03;
set_pixel_bgra (rawptr, 4,
- info_ptr->palette[palette].blue,
- info_ptr->palette[palette].green,
- info_ptr->palette[palette].red,
+ png_palette[palette].blue,
+ png_palette[palette].green,
+ png_palette[palette].red,
0xFF); /* alpha */
palette = (pix >> 2) & 0x03;
set_pixel_bgra (rawptr, 8,
- info_ptr->palette[palette].blue,
- info_ptr->palette[palette].green,
- info_ptr->palette[palette].red,
+ png_palette[palette].blue,
+ png_palette[palette].green,
+ png_palette[palette].red,
0xFF); /* alpha */
palette = pix & 0x03;
set_pixel_bgra (rawptr, 12,
- info_ptr->palette[palette].blue,
- info_ptr->palette[palette].green,
- info_ptr->palette[palette].red,
+ png_palette[palette].blue,
+ png_palette[palette].green,
+ png_palette[palette].red,
0xFF); /* alpha */
rawptr += 16;
}

View File

@ -1,27 +1,20 @@
# Template file for 'libgdiplus'
pkgname=libgdiplus
version=2.10.9
revision=4
version=3.8
revision=1
build_style=gnu-configure
configure_args="--with-cairo=system"
hostmakedepends="pkg-config"
makedepends="tiff-devel cairo-devel giflib-devel glib-devel libexif-devel libpng-devel"
patch_args="-Np1"
short_desc="An Open Source Implementation of the GDI+ API"
maintainer="Juan RP <xtraeme@gmail.com>"
homepage="http://www.go-mono.org"
license="LGPL-2, MPL"
distfiles="http://download.mono-project.com/sources/${pkgname}/$pkgname-$version.tar.bz2"
checksum=6ddeb6c327bada7cb6e06d1a20714f526a0c69520dfd42c12ddd032c3c5d964e
pre_configure() {
# make it build with giflib-5.1.0
# see http://wiki.linuxfromscratch.org/blfs/ticket/5076#comment:2
sed -i "/[DE]GifCloseFile/s:gif\|fp:&, NULL:g" src/gifcodec.c
}
distfiles="http://download.mono-project.com/sources/${pkgname}/$pkgname-$version.tar.gz"
checksum=6a3cfb4a1b67dd09197c385bacb8654f8d7ff49499f39c57825e1a8f77e69b28
libgdiplus-devel_package() {
short_desc+=" - Development files"
short_desc+=" - development files"
depends="libgdiplus>=${version}_${revision}"
pkg_install() {
# the .so symlink is needed at runtime

View File

@ -1,112 +0,0 @@
From d2cc22580898df5d4a15e0f99ab513e1570a6082 Mon Sep 17 00:00:00 2001
From: Zoltan Varga <vargaz@gmail.com>
Date: Fri, 20 Sep 2013 19:06:34 +0200
Subject: [PATCH] [sgen] Use __builtin_ctzl () in OBJ_BITMAP_FOREACH_PTR () on
64 bit platforms. Fixes #14834.
---
mono/metadata/sgen-descriptor.h | 28 +++++++++++++++++++++++++---
mono/tests/sgen-descriptors.cs | 15 +++++++++++++--
2 files changed, 38 insertions(+), 5 deletions(-)
diff --git a/mono/metadata/sgen-descriptor.h b/mono/metadata/sgen-descriptor.h
index cd53a86..3a00589 100644
--- a/mono/metadata/sgen-descriptor.h
+++ b/mono/metadata/sgen-descriptor.h
@@ -170,21 +170,43 @@ enum {
} \
} while (0)
-#ifdef __GNUC__
+#if defined(__GNUC__) && SIZEOF_VOID_P==4
+#define OBJ_BITMAP_FOREACH_PTR(desc,obj) do { \
+ /* there are pointers */ \
+ void **_objptr = (void**)(obj); \
+ gsize _bmap = (desc) >> 16; \
+ _objptr += OBJECT_HEADER_WORDS; \
+ { \
+ int _index = __builtin_ctz (_bmap); \
+ _objptr += _index; \
+ _bmap >>= (_index + 1); \
+ HANDLE_PTR (_objptr, (obj)); \
+ _objptr ++; \
+ } \
+ while (_bmap) { \
+ int _index = __builtin_ctz (_bmap); \
+ _objptr += _index; \
+ _bmap >>= (_index + 1); \
+ HANDLE_PTR (_objptr, (obj)); \
+ _objptr ++; \
+ } \
+ } while (0)
+#elif defined(__GNUC__) && SIZEOF_VOID_P==8
+/* Same as above, but use _builtin_ctzl () */
#define OBJ_BITMAP_FOREACH_PTR(desc,obj) do { \
/* there are pointers */ \
void **_objptr = (void**)(obj); \
gsize _bmap = (desc) >> 16; \
_objptr += OBJECT_HEADER_WORDS; \
{ \
- int _index = __builtin_ctz (_bmap); \
+ int _index = __builtin_ctzl (_bmap); \
_objptr += _index; \
_bmap >>= (_index + 1); \
HANDLE_PTR (_objptr, (obj)); \
_objptr ++; \
} \
while (_bmap) { \
- int _index = __builtin_ctz (_bmap); \
+ int _index = __builtin_ctzl (_bmap); \
_objptr += _index; \
_bmap >>= (_index + 1); \
HANDLE_PTR (_objptr, (obj)); \
diff --git a/mono/tests/sgen-descriptors.cs b/mono/tests/sgen-descriptors.cs
index ae00084..246e5aa 100644
--- a/mono/tests/sgen-descriptors.cs
+++ b/mono/tests/sgen-descriptors.cs
@@ -1,4 +1,5 @@
using System;
+using System.Runtime.InteropServices;
public struct SmallMixed
{
@@ -47,6 +48,13 @@ public class HugePtrFree {
public LargeStruct2 c;
}
+[StructLayout (LayoutKind.Sequential)]
+public class Non32bitBitmap {
+ public object o;
+ public long i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35;
+ public object o2;
+}
+
/*
This is a stress test for descriptors.
*/
@@ -54,10 +62,10 @@ class Driver {
static char[] FOO = new char[] { 'f', 'o', 'b' };
static void Fill (int cycles) {
- object[] root = new object [12];
+ object[] root = new object [13];
object[] current = root;
for (int i = 0; i < cycles; ++i) {
- current [0] = new object [12];
+ current [0] = new object [13];
current [1] = new int [6];
current [2] = new int [2,3];
current [3] = new string (FOO);
@@ -72,6 +80,9 @@ class Driver {
current [10] = new HugePtrFree ();
if ((i % 10000) == 0)
current [11] = new LargeStruct2 [1];
+
+ /* Test for 64 bit bitmap descriptors (#14834) */
+ current [12] = new Non32bitBitmap () { o = new object (), i32 = 1, i33 = 1, i34 = 1, i35 = 1, o2 = new object () };
current = (object[])current [0];
}
--
1.8.4