diff options
author | V3n3RiX <venerix@redcorelinux.org> | 2018-01-26 15:48:02 +0000 |
---|---|---|
committer | V3n3RiX <venerix@redcorelinux.org> | 2018-01-26 15:48:02 +0000 |
commit | 38b7258d086dd5e263c3bbe3880c8c956676bc71 (patch) | |
tree | 6fce284d5bfddaf597a490ac66069d16c6a485db /media-libs/libharu | |
parent | 0ebf740b9c9bc7c10ac41bea315ecc6c01c79166 (diff) |
gentoo resync : 25.01.2018
Diffstat (limited to 'media-libs/libharu')
6 files changed, 1086 insertions, 0 deletions
diff --git a/media-libs/libharu/Manifest b/media-libs/libharu/Manifest index 868f8b1d7c4a..a00dcb1b513a 100644 --- a/media-libs/libharu/Manifest +++ b/media-libs/libharu/Manifest @@ -1,4 +1,9 @@ +AUX libharu-2.3.0-1-Included-necessary-char-widths-in-generated-PDF.patch 8278 BLAKE2B fe7ededc5a3d82abf89c6e4923f7c4e7d2020753098921710822f315436dc17577c0a530de9d06587f69cfa7a832fa5e6b43cec0e57f9c0c3f0ca676030fb773 SHA512 8a739951cba5264b11f575fa3e366d0968a6c6f412d0f467be914a5c666f16e6f60f9535a06c96ce50c11f8c99979e19c09d0b2522b1aef1a54be109b7a8f61a +AUX libharu-2.3.0-2-Avoid-issue-with-libtiff-duplicate-symbols.patch 2867 BLAKE2B aa68693458cf1f8c6677a7014e66feba95145f41099d555d07b05d914a117d8fce9dfc9a07ae0418bfe68f4ec4b6e66f3286009ec33dc80aea8866d9d175a7cd SHA512 05e7abd46ab817edd68fd1f5baac6a95155c1410651e92aea1067b8d80fc1e3cfa1c142527ab5bc578b4703361a992d6c5865beede5297f95260c59215e3d900 +AUX libharu-2.3.0-3-cmake-fixes.patch 6376 BLAKE2B ec14be6aeda6e0e43a40bc2f1d41fcec4b601161cdcf1bdeff3e585bd78d6924aae322ffa5fe48f4fe221b1750b672ec7a80ba0a985368da4e5b00122b7d6617 SHA512 186d36b0b943c811e9fc34d448f58177914d2146a3df5cf8b12fe8c9fe7525046a7e53361052d308164cb99d4ec9a28341e4fe3b6cc69d6cb2c0ea03a49b0355 +AUX libharu-2.3.0-4-Add-support-for-free-form-triangle-Shading-objects.patch 15988 BLAKE2B 6cbd9826317e6d1de126dfdcdd3508bfb6351c34cd58fda8f09fe44efead890d78c67f33750223cb2291312b2299ecf16f7b91e4e20a3024bb6007da96753f86 SHA512 94d1377e529d1d96941a90ac82276748f5bf7f0e248a6770d938394151e453aaa082c0d256c0de28f737e7e995bc0ee60a4eb5562aa450af1dfcc1733b403466 AUX libharu-2.3.0-dont-force-strip.patch 504 BLAKE2B 5450783ed2ae778d2d522a4e7157f681c12765e6493955a363187bc4032387580f121e427ad26c596a1b6da53d83bf857525a710ad3499188b8a6b7985de9067 SHA512 df72ea19a1c8da3f06c9fff5b5a9d7307baf0144b59b5f4342769027c947ef5ded4e1f5ed3e3310dae27d7f5ec0ab37d585b9dc16ef83e38b7edda4ff13fc950 DIST libharu-2.3.0.tar.gz 1396413 BLAKE2B 7f0c819f17740f12f9bf6c7a7c749eb8c6ada326d98985daeac4d3250733cfc8e085b540e0969cb1b4c3b1055f4d1e148a2ed010d9371685fd265b62a879be9c SHA512 ebcabf1e8488e21185a231e97b4c16f9de742ae0ac2ebc7535b72b6b8e2045c2619bc6a94a820f7f923b0dfeceb217408f4e4c613ef3602104373cdf000d3f41 EBUILD libharu-2.3.0-r1.ebuild 845 BLAKE2B fea8329a56331571253f0679e725a5ae0590ad3d7f403d3a1b5cb2831ae59f4d118d1780bef81f6ec02633d696d15029d77dc382a45840eb7d3024ee29c15f8a SHA512 a0a3efba5722bb80fc98de2726c12306382f555f19422b9c34ccdd23b9777bbf08893df15fe2aed6603a092d289c5c0bd887f6b960f4f9c82e4bba533a342820 +EBUILD libharu-2.3.0-r2.ebuild 951 BLAKE2B 2ba22cb4df1badf78d6fb25bcd6ddda4739826f0960d4ab0cefd782a498009cc3125e9f3cc4515265f82033de62e16537c42c20183d36addfaa7d5c5cc592e8f SHA512 f667d92469b308e8f790c48cab5708f521d261fdbd9c4e9cfb6611c406654ea329f5a5c600f58995be12a9afbfb7a229d82dceef4851ae3b75be81050699df0a MISC metadata.xml 1001 BLAKE2B 885dfdacbde50227739f7f1e4a0b23febf988628cecc2bf67995408e978673022633d14407bdf95c29c7a1c8cce11f3c0133dba529e25a1a6df2e5cdacbd27b0 SHA512 baab0fbcff40fe0cf1ac6df68416335bf01f08a0b26d8441d76cfb0e1a6b3227aa8ed54d3f080c0ba5cbcf372f7a99c0c45c9ea215e7210c5e77805a30140d4f diff --git a/media-libs/libharu/files/libharu-2.3.0-1-Included-necessary-char-widths-in-generated-PDF.patch b/media-libs/libharu/files/libharu-2.3.0-1-Included-necessary-char-widths-in-generated-PDF.patch new file mode 100644 index 000000000000..83ce9ca93e9f --- /dev/null +++ b/media-libs/libharu/files/libharu-2.3.0-1-Included-necessary-char-widths-in-generated-PDF.patch @@ -0,0 +1,248 @@ +From 16c09856508abbf059ed94b9234b28143025318b Mon Sep 17 00:00:00 2001 +From: Jonathan Scruggs <j.scruggs@gmail.com> +Date: Wed, 24 Jan 2018 10:09:02 +0000 +Subject: [PATCH 1/4] Included necessary char widths in generated PDF + +* /W and /CIDToGIDMap can be created in the before_write_fn + +* Only add width for actually used glyphs to the /W array + +* Try reducing the size of the /CIDToGIDMap. + +Only care about actually used glyphs, so that +a) the length of the array can be reduced, +b) unused entries can be easily compressed as they are + zeroed out. +--- + src/hpdf_font_cid.c | 139 ++++++++++++++++++++++++++++------------------------ + 1 file changed, 75 insertions(+), 64 deletions(-) + +diff --git a/src/hpdf_font_cid.c b/src/hpdf_font_cid.c +index d1c1a82..5ab3b28 100644 +--- a/src/hpdf_font_cid.c ++++ b/src/hpdf_font_cid.c +@@ -346,19 +346,14 @@ CIDFontType2_New (HPDF_Font parent, HPDF_Xref xref) + HPDF_STATUS ret = HPDF_OK; + HPDF_FontAttr attr = (HPDF_FontAttr)parent->attr; + HPDF_FontDef fontdef = attr->fontdef; +- HPDF_TTFontDefAttr fontdef_attr = (HPDF_TTFontDefAttr)fontdef->attr; + HPDF_Encoder encoder = attr->encoder; + HPDF_CMapEncoderAttr encoder_attr = + (HPDF_CMapEncoderAttr)encoder->attr; + + HPDF_Font font; + HPDF_Array array; +- HPDF_UINT i; +- HPDF_UNICODE tmp_map[65536]; + HPDF_Dict cid_system_info; + +- HPDF_UINT16 max = 0; +- + HPDF_PTRACE ((" HPDF_CIDFontType2_New\n")); + + font = HPDF_Dict_New (parent->mmgr); +@@ -388,11 +383,55 @@ CIDFontType2_New (HPDF_Font parent, HPDF_Xref xref) + ret += HPDF_Array_AddNumber (array, (HPDF_INT32)(fontdef->font_bbox.bottom - + fontdef->font_bbox.top)); + +- HPDF_MemSet (tmp_map, 0, sizeof(HPDF_UNICODE) * 65536); ++ /* create CIDSystemInfo dictionary */ ++ cid_system_info = HPDF_Dict_New (parent->mmgr); ++ if (!cid_system_info) ++ return NULL; ++ ++ if (HPDF_Dict_Add (font, "CIDSystemInfo", cid_system_info) != HPDF_OK) ++ return NULL; ++ ++ ret += HPDF_Dict_Add (cid_system_info, "Registry", ++ HPDF_String_New (parent->mmgr, encoder_attr->registry, NULL)); ++ ret += HPDF_Dict_Add (cid_system_info, "Ordering", ++ HPDF_String_New (parent->mmgr, encoder_attr->ordering, NULL)); ++ ret += HPDF_Dict_AddNumber (cid_system_info, "Supplement", ++ encoder_attr->suppliment); + + if (ret != HPDF_OK) + return NULL; + ++ return font; ++} ++ ++ ++static HPDF_STATUS ++CIDFontType2_BeforeWrite_Func (HPDF_Dict obj) ++{ ++ HPDF_FontAttr font_attr = (HPDF_FontAttr)obj->attr; ++ HPDF_FontDef def = font_attr->fontdef; ++ HPDF_TTFontDefAttr def_attr = (HPDF_TTFontDefAttr)def->attr; ++ HPDF_STATUS ret = 0; ++ ++ HPDF_Font font; ++ HPDF_Encoder encoder = font_attr->encoder; ++ HPDF_CMapEncoderAttr encoder_attr = ++ (HPDF_CMapEncoderAttr)encoder->attr; ++ ++ HPDF_Array array; ++ HPDF_UINT i; ++ HPDF_UNICODE tmp_map[65536]; ++ HPDF_UINT16 max = 0; ++ ++ ++ HPDF_PTRACE ((" CIDFontType2_BeforeWrite_Func\n")); ++ ++ font = font_attr->descendant_font; ++ HPDF_MemSet (tmp_map, 0, sizeof(HPDF_UNICODE) * 65536); ++ ++ if (ret != HPDF_OK) ++ return ret; ++ + for (i = 0; i < 256; i++) { + HPDF_UINT j; + +@@ -401,66 +440,70 @@ CIDFontType2_New (HPDF_Font parent, HPDF_Xref xref) + HPDF_UINT16 cid = encoder_attr->cid_map[i][j]; + if (cid != 0) { + HPDF_UNICODE unicode = encoder_attr->unicode_map[i][j]; +- HPDF_UINT16 gid = HPDF_TTFontDef_GetGlyphid (fontdef, ++ HPDF_UINT16 gid = HPDF_TTFontDef_GetGlyphid (def, + unicode); +- tmp_map[cid] = gid; +- if (max < cid) +- max = cid; ++ if (def_attr->glyph_tbl.flgs[gid]) { ++ tmp_map[cid] = gid; ++ if (max < cid) ++ max = cid; ++ } + } + } else { + HPDF_UNICODE unicode = (i << 8) | j; +- HPDF_UINT16 gid = HPDF_TTFontDef_GetGlyphid (fontdef, ++ HPDF_UINT16 gid = HPDF_TTFontDef_GetGlyphid (def, + unicode); +- tmp_map[unicode] = gid; +- if (max < unicode) +- max = unicode; ++ if (def_attr->glyph_tbl.flgs[gid]) { ++ tmp_map[unicode] = gid; ++ if (max < unicode) ++ max = unicode; ++ } + } + } + } + + if (max > 0) { +- HPDF_INT16 dw = fontdef->missing_width; ++ HPDF_INT16 dw = def->missing_width; + HPDF_UNICODE *ptmp_map = tmp_map; + HPDF_Array tmp_array = NULL; + + /* add 'W' element */ + array = HPDF_Array_New (font->mmgr); + if (!array) +- return NULL; ++ return HPDF_FAILD_TO_ALLOC_MEM; + + if (HPDF_Dict_Add (font, "W", array) != HPDF_OK) +- return NULL; ++ return HPDF_FAILD_TO_ALLOC_MEM; + + for (i = 0; i < max; i++, ptmp_map++) { +- HPDF_INT w = HPDF_TTFontDef_GetGidWidth (fontdef, *ptmp_map); ++ HPDF_INT w = HPDF_TTFontDef_GetGidWidth (def, *ptmp_map); + +- if (w != dw) { ++ if (def_attr->glyph_tbl.flgs[*ptmp_map] && w != dw) { + if (!tmp_array) { + if (HPDF_Array_AddNumber (array, i) != HPDF_OK) +- return NULL; ++ return HPDF_FAILD_TO_ALLOC_MEM; + + tmp_array = HPDF_Array_New (font->mmgr); + if (!tmp_array) +- return NULL; ++ return HPDF_FAILD_TO_ALLOC_MEM; + + if (HPDF_Array_Add (array, tmp_array) != HPDF_OK) +- return NULL; ++ return HPDF_FAILD_TO_ALLOC_MEM; + } + + if ((ret = HPDF_Array_AddNumber (tmp_array, w)) != HPDF_OK) +- return NULL; ++ return HPDF_FAILD_TO_ALLOC_MEM; + } else + tmp_array = NULL; + } + + /* create "CIDToGIDMap" data */ +- if (fontdef_attr->embedding) { +- attr->map_stream = HPDF_DictStream_New (font->mmgr, xref); +- if (!attr->map_stream) +- return NULL; ++ if (def_attr->embedding) { ++ font_attr->map_stream = HPDF_DictStream_New (font->mmgr, font_attr->xref); ++ if (!font_attr->map_stream) ++ return HPDF_FAILD_TO_ALLOC_MEM; + +- if (HPDF_Dict_Add (font, "CIDToGIDMap", attr->map_stream) != HPDF_OK) +- return NULL; ++ if (HPDF_Dict_Add (font, "CIDToGIDMap", font_attr->map_stream) != HPDF_OK) ++ return HPDF_FAILD_TO_ALLOC_MEM; + + for (i = 0; i < max; i++) { + HPDF_BYTE u[2]; +@@ -472,47 +515,15 @@ CIDFontType2_New (HPDF_Font parent, HPDF_Xref xref) + HPDF_MemCpy ((HPDF_BYTE *)(tmp_map + i), u, 2); + } + +- if ((ret = HPDF_Stream_Write (attr->map_stream->stream, ++ if ((ret = HPDF_Stream_Write (font_attr->map_stream->stream, + (HPDF_BYTE *)tmp_map, max * 2)) != HPDF_OK) +- return NULL; ++ return HPDF_FAILD_TO_ALLOC_MEM; + } + } else { + HPDF_SetError (font->error, HPDF_INVALID_FONTDEF_DATA, 0); +- return 0; ++ return HPDF_INVALID_FONTDEF_DATA; + } + +- /* create CIDSystemInfo dictionary */ +- cid_system_info = HPDF_Dict_New (parent->mmgr); +- if (!cid_system_info) +- return NULL; +- +- if (HPDF_Dict_Add (font, "CIDSystemInfo", cid_system_info) != HPDF_OK) +- return NULL; +- +- ret += HPDF_Dict_Add (cid_system_info, "Registry", +- HPDF_String_New (parent->mmgr, encoder_attr->registry, NULL)); +- ret += HPDF_Dict_Add (cid_system_info, "Ordering", +- HPDF_String_New (parent->mmgr, encoder_attr->ordering, NULL)); +- ret += HPDF_Dict_AddNumber (cid_system_info, "Supplement", +- encoder_attr->suppliment); +- +- if (ret != HPDF_OK) +- return NULL; +- +- return font; +-} +- +- +-static HPDF_STATUS +-CIDFontType2_BeforeWrite_Func (HPDF_Dict obj) +-{ +- HPDF_FontAttr font_attr = (HPDF_FontAttr)obj->attr; +- HPDF_FontDef def = font_attr->fontdef; +- HPDF_TTFontDefAttr def_attr = (HPDF_TTFontDefAttr)def->attr; +- HPDF_STATUS ret = 0; +- +- HPDF_PTRACE ((" CIDFontType2_BeforeWrite_Func\n")); +- + if (font_attr->map_stream) + font_attr->map_stream->filter = obj->filter; + +-- +2.16.0 + diff --git a/media-libs/libharu/files/libharu-2.3.0-2-Avoid-issue-with-libtiff-duplicate-symbols.patch b/media-libs/libharu/files/libharu-2.3.0-2-Avoid-issue-with-libtiff-duplicate-symbols.patch new file mode 100644 index 000000000000..78a56f6eb33c --- /dev/null +++ b/media-libs/libharu/files/libharu-2.3.0-2-Avoid-issue-with-libtiff-duplicate-symbols.patch @@ -0,0 +1,89 @@ +From c1ecbf1bd286e26572fc0fd7a49d06774d6436f7 Mon Sep 17 00:00:00 2001 +From: Bruno Virlet <bruno.virlet@gmail.com> +Date: Thu, 30 Nov 2017 12:19:37 +0100 +Subject: [PATCH 2/4] Avoid issue with libtiff duplicate symbols + +To achieve this, I move the G3CODES #define to pdf_conf.h so that anyone +who builds the project has more control. +--- + include/hpdf_conf.h | 3 ++- + src/hpdf_image_ccitt.c | 9 ++++----- + src/t4.h | 6 ++++-- + 3 files changed, 10 insertions(+), 8 deletions(-) + +diff --git a/include/hpdf_conf.h b/include/hpdf_conf.h +index d25b464..27d1dff 100644 +--- a/include/hpdf_conf.h ++++ b/include/hpdf_conf.h +@@ -78,8 +78,9 @@ + + /* alignment size of memory-pool-object + */ +-#define HPDF_ALIGN_SIZ sizeof int; ++#define HPDF_ALINMENT_SIZ sizeof(int) + ++#define G3CODES + + #endif /* _HPDF_CONF_H */ + +diff --git a/src/hpdf_image_ccitt.c b/src/hpdf_image_ccitt.c +index 8672763..939b0b5 100644 +--- a/src/hpdf_image_ccitt.c ++++ b/src/hpdf_image_ccitt.c +@@ -21,7 +21,6 @@ + #include <memory.h> + #include <assert.h> + +-#define G3CODES + #include "t4.h" + + typedef unsigned int uint32; +@@ -578,11 +577,11 @@ HPDF_Fax3Encode2DRow(struct _HPDF_CCITT_Data *pData, unsigned char* bp, unsigned + a2 = finddiff2(bp, a1, bits, PIXEL(bp,a1)); + putcode(pData, &horizcode); + if (a0+a1 == 0 || PIXEL(bp, a0) == 0) { +- putspan(pData, a1-a0, TIFFFaxWhiteCodes); +- putspan(pData, a2-a1, TIFFFaxBlackCodes); ++ putspan(pData, a1-a0, HPDF_TIFFFaxWhiteCodes); ++ putspan(pData, a2-a1, HPDF_TIFFFaxBlackCodes); + } else { +- putspan(pData, a1-a0, TIFFFaxBlackCodes); +- putspan(pData, a2-a1, TIFFFaxWhiteCodes); ++ putspan(pData, a1-a0, HPDF_TIFFFaxBlackCodes); ++ putspan(pData, a2-a1, HPDF_TIFFFaxWhiteCodes); + } + a0 = a2; + } else { /* vertical mode */ +diff --git a/src/t4.h b/src/t4.h +index f306e15..c4c8c0d 100644 +--- a/src/t4.h ++++ b/src/t4.h +@@ -55,7 +55,7 @@ typedef struct tableentry { + * during state generation (see mkg3states.c). + */ + #ifdef G3CODES +-const tableentry TIFFFaxWhiteCodes[] = { ++const tableentry HPDF_TIFFFaxWhiteCodes[] = { + { 8, 0x35, 0 }, /* 0011 0101 */ + { 6, 0x7, 1 }, /* 0001 11 */ + { 4, 0x7, 2 }, /* 0111 */ +@@ -167,7 +167,7 @@ const tableentry TIFFFaxWhiteCodes[] = { + { 12, 0x0, G3CODE_INVALID }, /* 0000 0000 0000 */ + }; + +-const tableentry TIFFFaxBlackCodes[] = { ++const tableentry HPDF_TIFFFaxBlackCodes[] = { + { 10, 0x37, 0 }, /* 0000 1101 11 */ + { 3, 0x2, 1 }, /* 010 */ + { 2, 0x3, 2 }, /* 11 */ +@@ -281,5 +281,7 @@ const tableentry TIFFFaxBlackCodes[] = { + #else + extern const tableentry TIFFFaxWhiteCodes[]; + extern const tableentry TIFFFaxBlackCodes[]; ++const tableentry *HPDF_TIFFFaxWhiteCodes = TIFFFaxWhiteCodes; ++const tableentry *HPDF_TIFFFaxBlackCodes = TIFFFaxBlackCodes; + #endif + #endif /* _T4_ */ +-- +2.16.0 + diff --git a/media-libs/libharu/files/libharu-2.3.0-3-cmake-fixes.patch b/media-libs/libharu/files/libharu-2.3.0-3-cmake-fixes.patch new file mode 100644 index 000000000000..385dfc228257 --- /dev/null +++ b/media-libs/libharu/files/libharu-2.3.0-3-cmake-fixes.patch @@ -0,0 +1,177 @@ +From 751d8a334d0f3fbce9c74352004e9d3899ec8b38 Mon Sep 17 00:00:00 2001 +From: Jonathan Scruggs <j.scruggs@gmail.com> +Date: Wed, 24 Jan 2018 11:08:16 +0000 +Subject: [PATCH 3/4] cmake fixes + +--- + CMakeLists.txt | 31 +++++++++++++++++-------------- + cmake/modules/haru.cmake | 2 +- + src/CMakeLists.txt | 19 ++++++++++++------- + src/hpdf_image_png.c | 2 +- + 4 files changed, 31 insertions(+), 23 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 354ca75..4227f03 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -25,7 +25,7 @@ endif(MSVC) + + # information about libharu + set(LIBHPDF_MAJOR 2) +-set(LIBHPDF_MINOR 2) ++set(LIBHPDF_MINOR 3) + set(LIBHPDF_PATCH 0) + set(LIBHPDF_VERSION ${LIBHPDF_MAJOR}.${LIBHPDF_MINOR}.${LIBHPDF_PATCH}) + set(LIBHPDF_DESCRIPTION "libHaru is a free, cross platform, open source library for generating PDF files.") +@@ -53,12 +53,17 @@ option(LIBHPDF_STATIC "Build static lib" YES) + option(LIBHPDF_EXAMPLES "Build libharu examples" NO) + option(DEVPAK "Create DevPackage" NO) + ++if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") ++ set(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS} -undefined dynamic_lookup") ++endif() ++ + # Enable exceptions on linux if required + # (eg if you are using libharu in a C++ environment, + # and you want your error-callback to throw an exception, + # you will need to enable this for the exception to be + # able to throw through the libharu callstack). + if (CMAKE_COMPILER_IS_GNUCC OR ("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang")) ++ set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread") + option (LIBHPDF_ENABLE_EXCEPTIONS "Enable exceptions" NO) + if (LIBHPDF_ENABLE_EXCEPTIONS) + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fexceptions") +@@ -81,6 +86,7 @@ endif(BUILD_SHARED_LIBS) + # ======================================================================= + # look for headers and libraries + # ======================================================================= ++include(GNUInstallDirs) + include(haru) + include(summary) + +@@ -110,7 +116,7 @@ endif(PNG_FOUND) + if(MSVC_VERSION GREATER 1399) + add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE) + endif(MSVC_VERSION GREATER 1399) +-include_directories(${CMAKE_SOURCE_DIR}/include) ++include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) + + + # these are options +@@ -149,16 +155,16 @@ endif (NOT ZLIB_FOUND) + + # create hpdf_config.h + configure_file( +- ${CMAKE_SOURCE_DIR}/include/hpdf_config.h.cmake +- ${CMAKE_BINARY_DIR}/include/hpdf_config.h ++ ${CMAKE_CURRENT_SOURCE_DIR}/include/hpdf_config.h.cmake ++ ${CMAKE_CURRENT_BINARY_DIR}/include/hpdf_config.h + ) +-include_directories(${CMAKE_BINARY_DIR}/include) ++include_directories(${CMAKE_CURRENT_BINARY_DIR}/include) + + # create DevPackage file + if(DEVPAK) + configure_file( +- ${CMAKE_SOURCE_DIR}/libharu.DevPackage.cmake +- ${CMAKE_BINARY_DIR}/libharu.DevPackage ++ ${CMAKE_CURRENT_SOURCE_DIR}/libharu.DevPackage.cmake ++ ${CMAKE_CURRENT_BINARY_DIR}/libharu.DevPackage + ) + endif(DEVPAK) + # ======================================================================= +@@ -203,19 +209,16 @@ set( + include/hpdf_pdfa.h + include/hpdf_3dmeasure.h + include/hpdf_exdata.h +- ${CMAKE_BINARY_DIR}/include/hpdf_config.h ++ ${CMAKE_CURRENT_BINARY_DIR}/include/hpdf_config.h + ) + + # install header files +-install(FILES ${haru_HDRS} DESTINATION include) ++install(FILES ${haru_HDRS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) + + # install various files +-install(FILES README CHANGES INSTALL DESTINATION .) +-if(NOT DEVPAK) +- install(DIRECTORY if DESTINATION .) +-endif(NOT DEVPAK) ++install(FILES README CHANGES INSTALL DESTINATION ${CMAKE_INSTALL_DOCDIR}) + if(DEVPAK) +- install(FILES ${CMAKE_BINARY_DIR}/libharu.DevPackage DESTINATION .) ++ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libharu.DevPackage DESTINATION ${CMAKE_INSTALL_BINDIR}) + endif(DEVPAK) + + # ======================================================================= +diff --git a/cmake/modules/haru.cmake b/cmake/modules/haru.cmake +index 95647b9..f0b08b5 100644 +--- a/cmake/modules/haru.cmake ++++ b/cmake/modules/haru.cmake +@@ -28,7 +28,7 @@ check_include_files(unistd.h LIBHPDF_HAVE_UNISTD_H) + # On windows systems the math library is not separated so do not specify + # it unless you are on a non-windows system. + if(NOT WIN32) +- find_library(MATH_LIB NAMES m PATHS /usr/local/lib /usr/lib) ++ find_library(MATH_LIB NAMES m PATHS ${CMAKE_INSTALL_FULL_LIBDIR}) + if(NOT MATH_LIB) + message(FATAL_ERROR "Cannot find required math library") + endif(NOT MATH_LIB) +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index 9d2a604..6f93d18 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -72,16 +72,21 @@ set( + # ======================================================================= + if(LIBHPDF_STATIC) + add_library(${LIBHPDF_NAME_STATIC} STATIC ${LIBHPDF_SRCS}) ++ ++ if( CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" ) ++ set_target_properties(${LIBHPDF_NAME_STATIC} PROPERTIES COMPILE_FLAGS "-fPIC") ++ endif( CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" ) ++ + target_link_libraries(${LIBHPDF_NAME_STATIC} ${ADDITIONAL_LIBRARIES}) + install( + TARGETS ${LIBHPDF_NAME_STATIC} +- ARCHIVE DESTINATION lib +- LIBRARY DESTINATION lib +- RUNTIME DESTINATION bin ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + ) + if(WIN32 AND NOT CYGWIN) + foreach(addlib ${ADDITIONAL_LIBRARIES}) +- install(FILES ${addlib} DESTINATION lib) ++ install(FILES ${addlib} DESTINATION ${CMAKE_INSTALL_LIBDIR}) + endforeach(addlib) + endif(WIN32 AND NOT CYGWIN) + endif(LIBHPDF_STATIC) +@@ -93,8 +98,8 @@ if(LIBHPDF_SHARED) + endif(WIN32 AND NOT CYGWIN) + install( + TARGETS ${LIBHPDF_NAME} +- ARCHIVE DESTINATION lib +- LIBRARY DESTINATION lib +- RUNTIME DESTINATION bin ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + ) + endif(LIBHPDF_SHARED) +diff --git a/src/hpdf_image_png.c b/src/hpdf_image_png.c +index 3a35f5c..4304ced 100644 +--- a/src/hpdf_image_png.c ++++ b/src/hpdf_image_png.c +@@ -20,7 +20,7 @@ + #include "hpdf_image.h" + + #ifndef LIBHPDF_HAVE_NOPNGLIB +-#include <png.h> ++#include "png.h" + #include <string.h> + + static void +-- +2.16.0 + diff --git a/media-libs/libharu/files/libharu-2.3.0-4-Add-support-for-free-form-triangle-Shading-objects.patch b/media-libs/libharu/files/libharu-2.3.0-4-Add-support-for-free-form-triangle-Shading-objects.patch new file mode 100644 index 000000000000..5248c4fcac16 --- /dev/null +++ b/media-libs/libharu/files/libharu-2.3.0-4-Add-support-for-free-form-triangle-Shading-objects.patch @@ -0,0 +1,530 @@ +From 54c145867ad04c20cc71878fab662f6eb720621e Mon Sep 17 00:00:00 2001 +From: "David C. Lonie" <david.lonie@kitware.com> +Date: Wed, 10 May 2017 11:07:28 -0400 +Subject: [PATCH 4/4] Add support for free-form triangle Shading objects. + +--- + include/hpdf.h | 24 ++++- + include/hpdf_error.h | 3 + + include/hpdf_objects.h | 2 + + include/hpdf_pages.h | 5 + + include/hpdf_types.h | 14 +++ + src/CMakeLists.txt | 1 + + src/hpdf_page_operator.c | 31 +++++++ + src/hpdf_pages.c | 55 ++++++++++- + src/hpdf_shading.c | 231 +++++++++++++++++++++++++++++++++++++++++++++++ + 9 files changed, 362 insertions(+), 4 deletions(-) + create mode 100644 src/hpdf_shading.c + +diff --git a/include/hpdf.h b/include/hpdf.h +index e369f67..40e3c41 100644 +--- a/include/hpdf.h ++++ b/include/hpdf.h +@@ -77,6 +77,7 @@ typedef HPDF_HANDLE HPDF_Dict; + typedef HPDF_HANDLE HPDF_EmbeddedFile; + typedef HPDF_HANDLE HPDF_OutputIntent; + typedef HPDF_HANDLE HPDF_Xref; ++typedef HPDF_HANDLE HPDF_Shading; + + #else + +@@ -1171,6 +1172,11 @@ HPDF_EXPORT(HPDF_STATUS) + HPDF_Page_SetExtGState (HPDF_Page page, + HPDF_ExtGState ext_gstate); + ++/* sh */ ++HPDF_EXPORT(HPDF_STATUS) ++HPDF_Page_SetShading (HPDF_Page page, ++ HPDF_Shading shading); ++ + + /*--- Special graphic state operator --------------------------------------*/ + +@@ -1450,7 +1456,23 @@ HPDF_Page_SetCMYKStroke (HPDF_Page page, + + /*--- Shading patterns ---------------------------------------------------*/ + +-/* sh --not implemented yet */ ++/* Notes for docs: ++ * - ShadingType must be HPDF_SHADING_FREE_FORM_TRIANGLE_MESH (the only ++ * defined option...) ++ * - colorSpace must be HPDF_CS_DEVICE_RGB for now. ++ */ ++HPDF_EXPORT(HPDF_Shading) ++HPDF_Shading_New (HPDF_Doc pdf, ++ HPDF_ShadingType type, ++ HPDF_ColorSpace colorSpace, ++ HPDF_REAL xMin, HPDF_REAL xMax, ++ HPDF_REAL yMin, HPDF_REAL yMax); ++ ++HPDF_EXPORT(HPDF_STATUS) ++HPDF_Shading_AddVertexRGB(HPDF_Shading shading, ++ HPDF_Shading_FreeFormTriangleMeshEdgeFlag edgeFlag, ++ HPDF_REAL x, HPDF_REAL y, ++ HPDF_UINT8 r, HPDF_UINT8 g, HPDF_UINT8 b); + + /*--- In-line images -----------------------------------------------------*/ + +diff --git a/include/hpdf_error.h b/include/hpdf_error.h +index b04e2cd..ef4fa61 100644 +--- a/include/hpdf_error.h ++++ b/include/hpdf_error.h +@@ -145,6 +145,9 @@ extern "C" { + #define HPDF_INVALID_U3D_DATA 0x1083 + #define HPDF_NAME_CANNOT_GET_NAMES 0x1084 + #define HPDF_INVALID_ICC_COMPONENT_NUM 0x1085 ++/* 0x1086 */ ++/* 0x1087 */ ++#define HPDF_INVALID_SHADING_TYPE 0x1088 + + /*---------------------------------------------------------------------------*/ + +diff --git a/include/hpdf_objects.h b/include/hpdf_objects.h +index 525adda..b16de02 100644 +--- a/include/hpdf_objects.h ++++ b/include/hpdf_objects.h +@@ -61,6 +61,7 @@ extern "C" { + #define HPDF_OSUBCLASS_EXT_GSTATE_R 0x0B00 /* read only object */ + #define HPDF_OSUBCLASS_NAMEDICT 0x0C00 + #define HPDF_OSUBCLASS_NAMETREE 0x0D00 ++#define HPDF_OSUBCLASS_SHADING 0x0E00 + + + +@@ -595,6 +596,7 @@ typedef HPDF_Array HPDF_Destination; + typedef HPDF_Dict HPDF_U3D; + typedef HPDF_Dict HPDF_OutputIntent; + typedef HPDF_Dict HPDF_JavaScript; ++typedef HPDF_Dict HPDF_Shading; + + #ifdef __cplusplus + } +diff --git a/include/hpdf_pages.h b/include/hpdf_pages.h +index 44b816c..60b1d84 100644 +--- a/include/hpdf_pages.h ++++ b/include/hpdf_pages.h +@@ -55,6 +55,7 @@ typedef struct _HPDF_PageAttr_Rec { + HPDF_Dict fonts; + HPDF_Dict xobjects; + HPDF_Dict ext_gstates; ++ HPDF_Dict shadings; + HPDF_GState gstate; + HPDF_Point str_pos; + HPDF_Point cur_pos; +@@ -101,6 +102,10 @@ const char* + HPDF_Page_GetExtGStateName (HPDF_Page page, + HPDF_ExtGState gstate); + ++const char* ++HPDF_Page_GetShadingName (HPDF_Page page, ++ HPDF_Shading shading); ++ + + HPDF_Box + HPDF_Page_GetMediaBox (HPDF_Page page); +diff --git a/include/hpdf_types.h b/include/hpdf_types.h +index 8b3e0a8..a2e2157 100644 +--- a/include/hpdf_types.h ++++ b/include/hpdf_types.h +@@ -557,6 +557,20 @@ typedef enum _HPDF_NameDictKey { + HPDF_NAME_EOF + } HPDF_NameDictKey; + ++/*----------------------------------------------------------------------------*/ ++ ++typedef enum _HPDF_ShadingType { ++ HPDF_SHADING_FREE_FORM_TRIANGLE_MESH = 4 /* TODO the rest */ ++} HPDF_ShadingType; ++ ++typedef enum _HPDF_Shading_FreeFormTriangleMeshEdgeFlag { ++ HPDF_FREE_FORM_TRI_MESH_EDGEFLAG_NO_CONNECTION = 0, ++ HPDF_FREE_FORM_TRI_MESH_EDGEFLAG_BC, ++ HPDF_FREE_FORM_TRI_MESH_EDGEFLAG_AC ++} HPDF_Shading_FreeFormTriangleMeshEdgeFlag; ++ ++/*----------------------------------------------------------------------------*/ ++ + #ifdef __cplusplus + } + #endif /* __cplusplus */ +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index 6f93d18..d428b78 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -56,6 +56,7 @@ set( + hpdf_page_operator.c + hpdf_pages.c + hpdf_real.c ++ hpdf_shading.c + hpdf_streams.c + hpdf_string.c + hpdf_u3d.c +diff --git a/src/hpdf_page_operator.c b/src/hpdf_page_operator.c +index 23f5920..dda1078 100644 +--- a/src/hpdf_page_operator.c ++++ b/src/hpdf_page_operator.c +@@ -312,6 +312,37 @@ HPDF_Page_SetExtGState (HPDF_Page page, + return ret; + } + ++/* sh */ ++HPDF_EXPORT(HPDF_STATUS) ++HPDF_Page_SetShading (HPDF_Page page, ++ HPDF_Shading shading) ++{ ++ HPDF_STATUS ret = HPDF_Page_CheckState (page, HPDF_GMODE_PAGE_DESCRIPTION); ++ HPDF_PageAttr attr; ++ const char *local_name; ++ ++ HPDF_PTRACE ((" HPDF_Page_SetShading\n")); ++ ++ if (ret != HPDF_OK) ++ return ret; ++ ++ if (page->mmgr != shading->mmgr) ++ return HPDF_RaiseError (page->error, HPDF_INVALID_OBJECT, 0); ++ ++ attr = (HPDF_PageAttr)page->attr; ++ local_name = HPDF_Page_GetShadingName (page, shading); ++ ++ if (!local_name) ++ return HPDF_CheckError (page->error); ++ ++ if (HPDF_Stream_WriteEscapeName (attr->stream, local_name) != HPDF_OK) ++ return HPDF_CheckError (page->error); ++ ++ if (HPDF_Stream_WriteStr (attr->stream, " sh\012") != HPDF_OK) ++ return HPDF_CheckError (page->error); ++ ++ return ret; ++} + + /*--- Special graphic state operator --------------------------------------*/ + +diff --git a/src/hpdf_pages.c b/src/hpdf_pages.c +index fcc9b5c..c0a7c4f 100644 +--- a/src/hpdf_pages.c ++++ b/src/hpdf_pages.c +@@ -514,7 +514,7 @@ HPDF_Page_GetLocalFontName (HPDF_Page page, + /* search font-object from font-resource */ + key = HPDF_Dict_GetKeyByObj (attr->fonts, font); + if (!key) { +- /* if the font is not resisterd in font-resource, register font to ++ /* if the font is not registered in font-resource, register font to + * font-resource. + */ + char fontName[HPDF_LIMIT_MAX_NAME_LEN + 1]; +@@ -603,7 +603,7 @@ HPDF_Page_GetXObjectName (HPDF_Page page, + /* search xobject-object from xobject-resource */ + key = HPDF_Dict_GetKeyByObj (attr->xobjects, xobj); + if (!key) { +- /* if the xobject is not resisterd in xobject-resource, register ++ /* if the xobject is not registered in xobject-resource, register + * xobject to xobject-resource. + */ + char xobj_name[HPDF_LIMIT_MAX_NAME_LEN + 1]; +@@ -654,7 +654,7 @@ HPDF_Page_GetExtGStateName (HPDF_Page page, + /* search ext_gstate-object from ext_gstate-resource */ + key = HPDF_Dict_GetKeyByObj (attr->ext_gstates, state); + if (!key) { +- /* if the ext-gstate is not resisterd in ext-gstate resource, register ++ /* if the ext-gstate is not registered in ext-gstate resource, register + * to ext-gstate resource. + */ + char ext_gstate_name[HPDF_LIMIT_MAX_NAME_LEN + 1]; +@@ -673,6 +673,55 @@ HPDF_Page_GetExtGStateName (HPDF_Page page, + return key; + } + ++const char* ++HPDF_Page_GetShadingName (HPDF_Page page, ++ HPDF_Shading shading) ++{ ++ HPDF_PageAttr attr = (HPDF_PageAttr )page->attr; ++ const char *key; ++ ++ HPDF_PTRACE((" HPDF_Page_GetShadingName\n")); ++ ++ if (!attr->shadings) { ++ HPDF_Dict resources; ++ HPDF_Dict shadings; ++ ++ resources = HPDF_Page_GetInheritableItem (page, "Resources", ++ HPDF_OCLASS_DICT); ++ if (!resources) ++ return NULL; ++ ++ shadings = HPDF_Dict_New (page->mmgr); ++ if (!shadings) ++ return NULL; ++ ++ if (HPDF_Dict_Add (resources, "Shading", shadings) != HPDF_OK) ++ return NULL; ++ ++ attr->shadings = shadings; ++ } ++ ++ /* search shading-object from shading-resource */ ++ key = HPDF_Dict_GetKeyByObj (attr->shadings, shading); ++ if (!key) { ++ /* if the shading is not registered in shadings resource, register ++ * to shadings resource. ++ */ ++ char shading_str[HPDF_LIMIT_MAX_NAME_LEN + 1]; ++ char *ptr; ++ char *end_ptr = shading_str + HPDF_LIMIT_MAX_NAME_LEN; ++ ++ ptr = (char *)HPDF_StrCpy (shading_str, "Sh", end_ptr); ++ HPDF_IToA (ptr, attr->shadings->list->count, end_ptr); ++ ++ if (HPDF_Dict_Add (attr->shadings, shading_str, shading) != HPDF_OK) ++ return NULL; ++ ++ key = HPDF_Dict_GetKeyByObj (attr->shadings, shading); ++ } ++ ++ return key; ++} + + static HPDF_STATUS + AddAnnotation (HPDF_Page page, +diff --git a/src/hpdf_shading.c b/src/hpdf_shading.c +new file mode 100644 +index 0000000..53204c0 +--- /dev/null ++++ b/src/hpdf_shading.c +@@ -0,0 +1,231 @@ ++/* ++ * << Haru Free PDF Library >> -- hpdf_shading.c ++ * ++ * URL: http://libharu.org ++ * ++ * Copyright (c) 1999-2006 Takeshi Kanno <takeshi_kanno@est.hi-ho.ne.jp> ++ * Copyright (c) 2007-2009 Antony Dovgal <tony@daylessday.org> ++ * Copyright (c) 2017 Kitware <kitware@kitware.com> ++ * ++ * Permission to use, copy, modify, distribute and sell this software ++ * and its documentation for any purpose is hereby granted without fee, ++ * provided that the above copyright notice appear in all copies and ++ * that both that copyright notice and this permission notice appear ++ * in supporting documentation. ++ * It is provided "as is" without express or implied warranty. ++ * ++ */ ++ ++#include "hpdf.h" ++#include "hpdf_utils.h" ++ ++#include "assert.h" ++ ++typedef struct _RGBVertex ++{ ++ HPDF_UINT8 EdgeFlag; ++ HPDF_UINT32 X; ++ HPDF_UINT32 Y; ++ HPDF_UINT8 RGB[3]; ++} RGBVertex; ++ ++static const char *COL_CMYK = "DeviceCMYK"; ++static const char *COL_RGB = "DeviceRGB"; ++static const char *COL_GRAY = "DeviceGray"; ++ ++/* bbox is filled with xMin, xMax, yMin, yMax */ ++static HPDF_BOOL _GetDecodeArrayVertexValues(HPDF_Shading shading, ++ HPDF_REAL *bbox) ++{ ++ HPDF_Array decodeArray; ++ HPDF_Real r; ++ int i; ++ ++ if (!shading) { ++ return HPDF_FALSE; ++ } ++ ++ decodeArray = (HPDF_Array)(HPDF_Dict_GetItem(shading, "Decode", ++ HPDF_OCLASS_ARRAY)); ++ if (!decodeArray) { ++ return HPDF_FALSE; ++ } ++ ++ for (i = 0; i < 4; ++i) ++ { ++ r = HPDF_Array_GetItem(decodeArray, i, HPDF_OCLASS_REAL); ++ if (!r) { ++ return HPDF_FALSE; ++ } ++ ++ bbox[i] = r->value; ++ } ++ ++ return HPDF_TRUE; ++} ++ ++static void UINT32Swap (HPDF_UINT32 *value) ++{ ++ HPDF_BYTE b[4]; ++ ++ HPDF_MemCpy (b, (HPDF_BYTE *)value, 4); ++ *value = (HPDF_UINT32)((HPDF_UINT32)b[0] << 24 | ++ (HPDF_UINT32)b[1] << 16 | ++ (HPDF_UINT32)b[2] << 8 | ++ (HPDF_UINT32)b[3]); ++} ++ ++/* Encode a position coordinate for writing */ ++static HPDF_UINT32 _EncodeValue(HPDF_REAL x, HPDF_REAL xMin, HPDF_REAL xMax) ++{ ++ HPDF_DOUBLE norm = (x - xMin) / (xMax - xMin); ++ HPDF_DOUBLE max = (HPDF_DOUBLE)(0xFFFFFFFF); ++ HPDF_UINT32 enc = (HPDF_UINT32)(norm * max); ++ UINT32Swap(&enc); ++ return enc; ++} ++ ++HPDF_EXPORT(HPDF_Shading) ++HPDF_Shading_New (HPDF_Doc pdf, ++ HPDF_ShadingType type, ++ HPDF_ColorSpace colorSpace, ++ HPDF_REAL xMin, HPDF_REAL xMax, ++ HPDF_REAL yMin, HPDF_REAL yMax) ++{ ++ HPDF_Shading shading; ++ HPDF_Array decodeArray; ++ HPDF_STATUS ret = HPDF_OK; ++ int i; ++ ++ HPDF_PTRACE((" HPDF_Shading_New\n")); ++ ++ if (!HPDF_HasDoc(pdf)) { ++ return NULL; ++ } ++ ++ /* Validate shading type: */ ++ switch (type) ++ { ++ case HPDF_SHADING_FREE_FORM_TRIANGLE_MESH: ++ break; ++ ++ default: ++ HPDF_SetError (pdf->mmgr->error, HPDF_INVALID_SHADING_TYPE, 0); ++ return NULL; ++ } ++ ++ decodeArray = HPDF_Array_New(pdf->mmgr); ++ if (!decodeArray) { ++ return NULL; ++ } ++ ++ /* X-range */ ++ ret += HPDF_Array_AddReal(decodeArray, xMin); ++ ret += HPDF_Array_AddReal(decodeArray, xMax); ++ ++ /* Y-range */ ++ ret += HPDF_Array_AddReal(decodeArray, yMin); ++ ret += HPDF_Array_AddReal(decodeArray, yMax); ++ ++ const char *colName = NULL; ++ switch (colorSpace) { ++ case HPDF_CS_DEVICE_RGB: ++ colName = COL_RGB; ++ for (i = 0; i < 3; ++i) { ++ ret += HPDF_Array_AddReal(decodeArray, 0.0); ++ ret += HPDF_Array_AddReal(decodeArray, 1.0); ++ } ++ break; ++ ++ default: ++ HPDF_SetError(pdf->mmgr->error, HPDF_INVALID_COLOR_SPACE, 0); ++ return NULL; ++ } ++ ++ if (ret != HPDF_OK) { ++ return NULL; ++ } ++ ++ shading = HPDF_DictStream_New(pdf->mmgr, pdf->xref); ++ if (!shading) { ++ return NULL; ++ } ++ ++ shading->header.obj_class |= HPDF_OSUBCLASS_SHADING; ++ ret += HPDF_Dict_AddNumber(shading, "ShadingType", type); ++ ret += HPDF_Dict_AddName(shading, "ColorSpace", colName); ++ ++ switch (type) ++ { ++ case HPDF_SHADING_FREE_FORM_TRIANGLE_MESH: ++ ret += HPDF_Dict_AddNumber(shading, "BitsPerCoordinate", 32); ++ ret += HPDF_Dict_AddNumber(shading, "BitsPerComponent", 8); ++ ret += HPDF_Dict_AddNumber(shading, "BitsPerFlag", 8); ++ ret += HPDF_Dict_Add(shading, "Decode", decodeArray); ++ break; ++ ++ default: ++ HPDF_SetError (pdf->mmgr->error, HPDF_INVALID_SHADING_TYPE, 0); ++ return NULL; ++ } ++ ++ if (ret != HPDF_OK) { ++ return NULL; ++ } ++ ++ return shading; ++} ++ ++HPDF_EXPORT(HPDF_STATUS) ++HPDF_Shading_AddVertexRGB(HPDF_Shading shading, ++ HPDF_Shading_FreeFormTriangleMeshEdgeFlag edgeFlag, ++ HPDF_REAL x, HPDF_REAL y, ++ HPDF_UINT8 r, HPDF_UINT8 g, HPDF_UINT8 b) ++{ ++ HPDF_STATUS ret = HPDF_OK; ++ RGBVertex vert; ++ float bbox[4]; ++ ++ HPDF_PTRACE((" HPDF_Shading_AddVertexRGB\n")); ++ ++ if (!shading) { ++ return HPDF_INVALID_OBJECT; ++ } ++ ++ if (_GetDecodeArrayVertexValues(shading, bbox) != HPDF_TRUE) { ++ return HPDF_SetError(shading->error, HPDF_INVALID_OBJECT, 0); ++ } ++ ++ vert.EdgeFlag = (HPDF_UINT8)edgeFlag; ++ vert.X = _EncodeValue(x, bbox[0], bbox[1]); ++ vert.Y = _EncodeValue(y, bbox[2], bbox[3]); ++ vert.RGB[0] = r; ++ vert.RGB[1] = g; ++ vert.RGB[2] = b; ++ ++ ret = HPDF_Stream_Write(shading->stream, ++ (HPDF_BYTE*)(&vert.EdgeFlag), sizeof(vert.EdgeFlag)); ++ if (ret != HPDF_OK) ++ { ++ return ret; ++ } ++ ++ ret = HPDF_Stream_Write(shading->stream, ++ (HPDF_BYTE*)(&vert.X), sizeof(vert.X)); ++ if (ret != HPDF_OK) ++ { ++ return ret; ++ } ++ ++ ret = HPDF_Stream_Write(shading->stream, ++ (HPDF_BYTE*)(&vert.Y), sizeof(vert.Y)); ++ if (ret != HPDF_OK) ++ { ++ return ret; ++ } ++ ++ ret = HPDF_Stream_Write(shading->stream, ++ (HPDF_BYTE*)(&vert.RGB), sizeof(vert.RGB)); ++ ++ return ret; ++} +-- +2.16.0 + diff --git a/media-libs/libharu/libharu-2.3.0-r2.ebuild b/media-libs/libharu/libharu-2.3.0-r2.ebuild new file mode 100644 index 000000000000..37c65b826878 --- /dev/null +++ b/media-libs/libharu/libharu-2.3.0-r2.ebuild @@ -0,0 +1,37 @@ +# Copyright 1999-2018 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=6 + +inherit cmake-multilib + +MYP=RELEASE_${PV//./_} + +DESCRIPTION="C/C++ library for PDF generation" +HOMEPAGE="http://www.libharu.org/" +SRC_URI="https://github.com/${PN}/${PN}/archive/${MYP}.tar.gz -> ${P}.tar.gz" + +LICENSE="ZLIB" +SLOT="0/${PV}" +KEYWORDS="~amd64 ~ppc ~x86 ~amd64-linux ~x86-linux" +IUSE="" + +DEPEND=" + media-libs/libpng:0=[${MULTILIB_USEDEP}] + sys-libs/zlib:=[${MULTILIB_USEDEP}]" +RDEPEND="${DEPEND}" + +S="${WORKDIR}/${PN}-${MYP}" + +PATCHES=( + "${FILESDIR}"/${P}-1-Included-necessary-char-widths-in-generated-PDF.patch + "${FILESDIR}"/${P}-2-Avoid-issue-with-libtiff-duplicate-symbols.patch + "${FILESDIR}"/${P}-3-cmake-fixes.patch + "${FILESDIR}"/${P}-4-Add-support-for-free-form-triangle-Shading-objects.patch +) + +mycmakeargs=( + -DLIBHPDF_EXAMPLES=NO # Doesn't work + -DLIBHPDF_STATIC=NO + -DCMAKE_INSTALL_DOCDIR="share/doc/${PF}" +) |