summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.bundled-libs.txt201
-rw-r--r--nanosvg/README.txt19
-rw-r--r--nanosvg/altsvgrast.diff136
-rw-r--r--nanosvg/nanosvg.diff61
-rw-r--r--nanosvg/nanosvg.h16
-rw-r--r--nanosvg/nanosvgrast.h (renamed from nanosvg/altsvgrast.h)19
-rw-r--r--src/Fl_SVG_Image.cxx4
-rw-r--r--src/makedepend2
8 files changed, 240 insertions, 218 deletions
diff --git a/README.bundled-libs.txt b/README.bundled-libs.txt
new file mode 100644
index 000000000..75fbc1185
--- /dev/null
+++ b/README.bundled-libs.txt
@@ -0,0 +1,201 @@
+README.bundled-libs.txt - Developer information for bundled libraries
+---------------------------------------------------------------------
+
+******************************************************
+*** NOTICE *** This file is still work in progress ***
+******************************************************
+
+This file is mainly intended for FLTK developers and contains information
+about the current versions of all bundled libraries and about how to
+upgrade these bundled libraries.
+
+
+Current versions of bundled libraries:
+
+ ** work in progress -- not yet completely upgraded **
+
+ Library Version Release date FLTK Version
+ ------------------------------------------------------------------
+ jpeg jpeg-9c 2018-01-14 1.4.0
+ nanosvg [2017-07-09] n.a. 1.4.0
+ png libpng-1.6.34 2017-09-29 1.4.0
+ zlib zlib-1.2.11 2017-01-15 1.4.0
+
+
+Previous versions of bundled libraries:
+
+ Library Version Release date FLTK Version
+ ------------------------------------------------------------------
+ jpeg jpeg-9a 2014-01-19 1.3.4
+ png libpng-1.6.16 2014-12-22 1.3.4
+ zlib zlib-1.2.8 2013-04-28 1.3.4
+
+
+General information:
+
+ FLTK does not include the entire library distributions. We only provide
+ the source files necessary to build the library itself. There are no
+ test programs or other contributed files.
+
+ We use our own build files, hence a few files MUST NOT be upgraded when
+ the library source files are upgraded. We strive to keep changes to the
+ library source files as small as possible. Patching library code to
+ work with FLTK should be a rare exception.
+
+ If patches are necessary all changes in the library files should be
+ marked with "FLTK" in a comment so a developer that upgrades the library
+ later is aware of changes in the source code for FLTK. Additional comments
+ should be added to show the rationale, i.e. why a particular change was
+ necessary. If applicable, add a reference to a Software Trouble Report
+ like "STR #3456".
+
+
+How to update the bundled libraries:
+
+ It is generally advisable to use a graphical merge program. I'm using
+ 'meld' under Linux, but YMMV.
+
+ Do not add any source files unless they are required to build the library.
+
+ Some config header files may be pre-generated in the FLTK sources. These
+ header files should be left untouched, but it may be necessary to update
+ them if new items were added to the new library version. In this case
+ the new header should be pre-generated on a Linux system with default
+ options unless otherwise mentioned below for a specific library.
+ Currently there are no known exceptions.
+
+
+Merging source files:
+
+ Please check if some source and header files contain "FLTK" comments
+ to be aware of necessary merges. It is also good to get the distribution
+ tar ball of the previous version and to run a (graphical) diff or
+ merge tool on the previous version and the bundled version of FLTK
+ to see the "previous" differences.
+
+ Files that were not patched in previous versions should be copied to
+ the new version w/o changes. Files that had FLTK specific patches must
+ be merged manually. FLTK patches should be verified (if still necessary)
+ and should be kept in the new source files.
+
+ Source and header files that have been added in the new library version
+ should be added in FLTK as well if they are necessary to build the
+ library. A simple "trial and error" should be sufficient to find files
+ that need to be added. Added files must be added to FLTK's build files
+ as well, usually to both the Makefile and the CMakeLists.txt to be
+ used in configure/make and in CMake based builds.
+
+
+Upgrade order:
+
+ There is only one dependency between all bundled libraries: libpng
+ depends on zlib. Hence zlib should be upgraded first, then all other
+ libs can be upgraded in arbitrary order.
+
+
+Tests after merge:
+
+ Tests should be done on as many platforms as possible, both with
+ autotools (configure/make) and CMake. Windows (Visual Studio) and
+ macOS (Xcode) build need CMake to generate the IDE files.
+
+
+Upgrade notes for specific libraries:
+
+ The following chapters contain information of specific files and how
+ they are upgraded. Since the changes in all bundled libraries can't
+ be known in advance this information can change in the future. Please
+ very that no other changes are necessary.
+
+
+zlib:
+
+ Website: http://zlib.net/
+ Download: See website and follow links.
+ Repository: git clone https://github.com/madler/zlib.git
+
+
+ The following files need special handling:
+
+ CMakeLists.txt: Keep FLTK version, update manually if necessary.
+
+ Makefile: Same as CMakeLists.txt.
+
+ zconf.h: Merge changes.
+
+ As of zlib 1.2.11: two small sections marked with "FLTK" comments
+ that need to be kept.
+
+ makedepend: Keep this file. Run `make depend' in the zlib folder
+ on a Linux system after the upgrade to update this file.
+
+
+png:
+
+ Website: http://libpng.org/pub/png/libpng.html
+ Download: See website and follow links.
+ Repository: git clone https://git.code.sf.net/p/libpng/code libpng
+
+ libpng should be upgraded after zlib because it depends on zlib.
+
+ The following files need special handling:
+
+ CMakeLists.txt: Keep FLTK version, update manually if necessary.
+
+ Makefile: Same as CMakeLists.txt.
+
+ Note: more to come...
+
+ makedepend: Keep this file. Run `make depend' in the zlib folder
+ on a Linux system after the upgrade to update this file.
+
+
+jpeg:
+
+ Website: http://ijg.org/
+ Download: See website and follow links.
+ Repository: <unknown>
+
+ The following files need special handling:
+
+ CMakeLists.txt: Keep FLTK version, update manually if necessary.
+
+ Makefile: Same as CMakeLists.txt.
+
+ Note: more to come...
+
+ makedepend: Keep this file. Run `make depend' in the zlib folder
+ on a Linux system after the upgrade to update this file.
+
+
+nanosvg:
+
+ Website: https://github.com/memononen/nanosvg
+ Download: See website and follow links.
+ Repository: git clone https://github.com/memononen/nanosvg.git
+ FLTK Clone: git clone https://github.com/fltk/nanosvg.git
+
+ FLTK has its own GitHub clone of the original repository (see above).
+
+ The intention is to update this clone from time to time so the FLTK
+ specific patches are up-to-date with the original library. Hopefully
+ the FLTK patches will be accepted upstream at some time in the future
+ so we no longer need our own patches.
+ AlbrechtS, 04 Feb 2018.
+
+ Use this clone (branch 'fltk') to get the nanosvg library with FLTK
+ specific patches:
+
+ $ git clone https://github.com/fltk/nanosvg.git nanosvg-fltk
+ $ cd nanosvg-fltk
+ $ git checkout fltk
+ $ cd src
+ $ cp nanosvg.h nanosvgrast.h /path/to/fltk-1.4/nanosvg/
+
+ This library does not have its own build files since it is a
+ header-only library. The build is included in FLTK where necessary.
+
+ The following files need special handling:
+
+ nanosvg.h: Merge or download from FLTK's clone (see above).
+ nanosvgrast.h: Merge or download from FLTK's clone (see above).
diff --git a/nanosvg/README.txt b/nanosvg/README.txt
new file mode 100644
index 000000000..2cb5de3f4
--- /dev/null
+++ b/nanosvg/README.txt
@@ -0,0 +1,19 @@
+README for the nanosvg library bundled with FLTK
+------------------------------------------------
+
+This is a header-only library to display SVG images.
+
+This bundled library was modified for optimal use in the FLTK library.
+
+
+The original library can be found here:
+
+ https://github.com/memononen/nanosvg
+
+
+The modified library was cloned and can be found here:
+
+ https://github.com/fltk/nanosvg
+
+
+For more information see README.bundled-libs.txt in FLTK's root directory.
diff --git a/nanosvg/altsvgrast.diff b/nanosvg/altsvgrast.diff
deleted file mode 100644
index 83cdc6d06..000000000
--- a/nanosvg/altsvgrast.diff
+++ /dev/null
@@ -1,136 +0,0 @@
-1,6d0
-< //
-< // "$Id$"
-< //
-<
-< /* Modified by FLTK from original sources to support non-square X,Y axes scaling */
-<
-31d24
-<
-51,53d43
-<
-< // For non-square X,Y scaling, use
-< nsvgAltRasterize(rast, image, 0,0,1,1, img, w, h, w*4);
-63c53
-< // scale - image scale (assumes square aspect ratio)
----
-> // scale - image scale
-72,77d61
-< // As above, but allow X and Y axes to scale independently for non-square aspects
-< void nsvgAltRasterize(NSVGrasterizer* r,
-< NSVGimage* image, float tx, float ty,
-< float sx, float sy,
-< unsigned char* dst, int w, int h, int stride);
-<
-382c366
-< static void nsvg__flattenShape(NSVGrasterizer* r, NSVGshape* shape, float sx, float sy)
----
-> static void nsvg__flattenShape(NSVGrasterizer* r, NSVGshape* shape, float scale)
-390c374
-< nsvg__addPathPoint(r, path->pts[0]*sx, path->pts[1]*sy, 0);
----
-> nsvg__addPathPoint(r, path->pts[0]*scale, path->pts[1]*scale, 0);
-393c377
-< nsvg__flattenCubicBez(r, p[0]*sx,p[1]*sy, p[2]*sx,p[3]*sy, p[4]*sx,p[5]*sy, p[6]*sx,p[7]*sy, 0, 0);
----
-> nsvg__flattenCubicBez(r, p[0]*scale,p[1]*scale, p[2]*scale,p[3]*scale, p[4]*scale,p[5]*scale, p[6]*scale,p[7]*scale, 0, 0);
-396c380
-< nsvg__addPathPoint(r, path->pts[0]*sx, path->pts[1]*sy, 0);
----
-> nsvg__addPathPoint(r, path->pts[0]*scale, path->pts[1]*scale, 0);
-746c730
-< static void nsvg__flattenShapeStroke(NSVGrasterizer* r, NSVGshape* shape, float sx, float sy)
----
-> static void nsvg__flattenShapeStroke(NSVGrasterizer* r, NSVGshape* shape, float scale)
-754,755c738
-< const float sw = (sx + sy) / 2; // average scaling factor
-< const float lineWidth = shape->strokeWidth * sw; // FIXME (?)
----
-> float lineWidth = shape->strokeWidth * scale;
-760c743
-< nsvg__addPathPoint(r, path->pts[0]*sx, path->pts[1]*sy, NSVG_PT_CORNER);
----
-> nsvg__addPathPoint(r, path->pts[0]*scale, path->pts[1]*scale, NSVG_PT_CORNER);
-763c746
-< nsvg__flattenCubicBez(r, p[0]*sx,p[1]*sy, p[2]*sx,p[3]*sy, p[4]*sx,p[5]*sy, p[6]*sx,p[7]*sy, 0, NSVG_PT_CORNER);
----
-> nsvg__flattenCubicBez(r, p[0]*scale,p[1]*scale, p[2]*scale,p[3]*scale, p[4]*scale,p[5]*scale, p[6]*scale,p[7]*scale, 0, NSVG_PT_CORNER);
-809c792
-< dashLen = (shape->strokeDashArray[idash] - dashOffset) * sw;
----
-> dashLen = (shape->strokeDashArray[idash] - dashOffset) * scale;
-831c814
-< dashLen = shape->strokeDashArray[idash] * sw;
----
-> dashLen = shape->strokeDashArray[idash] * scale;
-1000c983
-< float tx, float ty, float sx, float sy, NSVGcachedPaint* cache)
----
-> float tx, float ty, float scale, NSVGcachedPaint* cache)
-1041,1043c1024,1026
-< fx = ((float)x - tx) / sx;
-< fy = ((float)y - ty) / sy;
-< dx = 1.0f / sx;
----
-> fx = ((float)x - tx) / scale;
-> fy = ((float)y - ty) / scale;
-> dx = 1.0f / scale;
-1086,1088c1069,1071
-< fx = ((float)x - tx) / sx;
-< fy = ((float)y - ty) / sy;
-< dx = 1.0f / sx;
----
-> fx = ((float)x - tx) / scale;
-> fy = ((float)y - ty) / scale;
-> dx = 1.0f / scale;
-1127c1110
-< static void nsvg__rasterizeSortedEdges(NSVGrasterizer *r, float tx, float ty, float sx, float sy, NSVGcachedPaint* cache, char fillRule)
----
-> static void nsvg__rasterizeSortedEdges(NSVGrasterizer *r, float tx, float ty, float scale, NSVGcachedPaint* cache, char fillRule)
-1209c1192
-< nsvg__scanlineSolid(&r->bitmap[y * r->stride] + xmin*4, xmax-xmin+1, &r->scanline[xmin], xmin, y, tx,ty, sx, sy, cache);
----
-> nsvg__scanlineSolid(&r->bitmap[y * r->stride] + xmin*4, xmax-xmin+1, &r->scanline[xmin], xmin, y, tx,ty, scale, cache);
-1377,1379c1360,1361
-< void nsvgAltRasterize(NSVGrasterizer* r,
-< NSVGimage* image, float tx, float ty,
-< float sx, float sy,
----
-> void nsvgRasterize(NSVGrasterizer* r,
-> NSVGimage* image, float tx, float ty, float scale,
-1410c1392
-< nsvg__flattenShape(r, shape, sx, sy);
----
-> nsvg__flattenShape(r, shape, scale);
-1427c1409
-< nsvg__rasterizeSortedEdges(r, tx,ty, sx, sy, &cache, shape->fillRule);
----
-> nsvg__rasterizeSortedEdges(r, tx,ty,scale, &cache, shape->fillRule);
-1429c1411
-< if (shape->stroke.type != NSVG_PAINT_NONE && (shape->strokeWidth * sx) > 0.01f) {
----
-> if (shape->stroke.type != NSVG_PAINT_NONE && (shape->strokeWidth * scale) > 0.01f) {
-1434c1416
-< nsvg__flattenShapeStroke(r, shape, sx, sy);
----
-> nsvg__flattenShapeStroke(r, shape, scale);
-1453c1435
-< nsvg__rasterizeSortedEdges(r, tx,ty,sx, sy, &cache, NSVG_FILLRULE_NONZERO);
----
-> nsvg__rasterizeSortedEdges(r, tx,ty,scale, &cache, NSVG_FILLRULE_NONZERO);
-1465,1477c1447
-< void nsvgRasterize(NSVGrasterizer* r,
-< NSVGimage* image, float tx, float ty, float scale,
-< unsigned char* dst, int w, int h, int stride)
-< {
-< nsvgAltRasterize(r,image, tx, ty, scale, scale, dst, w, h, stride);
-< }
-<
-< #endif // NANOSVGRAST_IMPLEMENTATION
-<
-<
-< //
-< // End of "$Id$".
-< //
----
-> #endif
diff --git a/nanosvg/nanosvg.diff b/nanosvg/nanosvg.diff
deleted file mode 100644
index 0f0db20f5..000000000
--- a/nanosvg/nanosvg.diff
+++ /dev/null
@@ -1,61 +0,0 @@
-Index: nanosvg.h
-===================================================================
---- nanosvg.h (revision 12413)
-+++ nanosvg.h (working copy)
-@@ -1081,7 +1081,7 @@
- char* cur = (char*)s;
- char* end = NULL;
- double res = 0.0, sign = 1.0;
-- long long intPart = 0, fracPart = 0;
-+ double intPart = 0, fracPart = 0;
- char hasIntPart = 0, hasFracPart = 0;
-
- // Parse optional sign
-@@ -1095,7 +1095,11 @@
- // Parse integer part
- if (nsvg__isdigit(*cur)) {
- // Parse digit sequence
-- intPart = (double)strtoll(cur, &end, 10);
-+#ifdef _MSC_VER
-+ intPart = (double)_strtoi64(cur, &end, 10);
-+#else
-+ intPart = (double)strtoll(cur, &end, 10);
-+#endif
- if (cur != end) {
- res = (double)intPart;
- hasIntPart = 1;
-@@ -1108,7 +1112,11 @@
- cur++; // Skip '.'
- if (nsvg__isdigit(*cur)) {
- // Parse digit sequence
-- fracPart = strtoll(cur, &end, 10);
-+#ifdef _MSC_VER
-+ fracPart = (double)_strtoi64(cur, &end, 10);
-+#else
-+ fracPart = (double)strtoll(cur, &end, 10);
-+#endif
- if (cur != end) {
- res += (double)fracPart / pow(10.0, (double)(end - cur));
- hasFracPart = 1;
-@@ -1123,11 +1131,11 @@
-
- // Parse optional exponent
- if (*cur == 'e' || *cur == 'E') {
-- int expPart = 0;
-+ double expPart = 0;
- cur++; // skip 'E'
-- expPart = strtol(cur, &end, 10); // Parse digit sequence with sign
-+ expPart = (double)strtol(cur, &end, 10); // Parse digit sequence with sign
- if (cur != end) {
-- res *= pow(10.0, (double)expPart);
-+ res *= pow(10.0, expPart);
- }
- }
-
-
-Property changes on: nanosvg.h
-___________________________________________________________________
-Added: eol-style
-## -0,0 +1 ##
-+native
-\ No newline at end of property
diff --git a/nanosvg/nanosvg.h b/nanosvg/nanosvg.h
index bd5b722f4..0426b0c3f 100644
--- a/nanosvg/nanosvg.h
+++ b/nanosvg/nanosvg.h
@@ -1081,7 +1081,7 @@ static double nsvg__atof(const char* s)
char* cur = (char*)s;
char* end = NULL;
double res = 0.0, sign = 1.0;
- double intPart = 0, fracPart = 0;
+ double intPart = 0.0, fracPart = 0.0;
char hasIntPart = 0, hasFracPart = 0;
// Parse optional sign
@@ -1096,12 +1096,12 @@ static double nsvg__atof(const char* s)
if (nsvg__isdigit(*cur)) {
// Parse digit sequence
#ifdef _MSC_VER
- intPart = (double)_strtoi64(cur, &end, 10);
+ intPart = (double)_strtoi64(cur, &end, 10);
#else
- intPart = (double)strtoll(cur, &end, 10);
+ intPart = (double)strtoll(cur, &end, 10);
#endif
if (cur != end) {
- res = (double)intPart;
+ res = intPart;
hasIntPart = 1;
cur = end;
}
@@ -1113,12 +1113,12 @@ static double nsvg__atof(const char* s)
if (nsvg__isdigit(*cur)) {
// Parse digit sequence
#ifdef _MSC_VER
- fracPart = (double)_strtoi64(cur, &end, 10);
+ fracPart = (double)_strtoi64(cur, &end, 10);
#else
- fracPart = (double)strtoll(cur, &end, 10);
+ fracPart = (double)strtoll(cur, &end, 10);
#endif
if (cur != end) {
- res += (double)fracPart / pow(10.0, (double)(end - cur));
+ res += fracPart / pow(10.0, (double)(end - cur));
hasFracPart = 1;
cur = end;
}
@@ -1131,7 +1131,7 @@ static double nsvg__atof(const char* s)
// Parse optional exponent
if (*cur == 'e' || *cur == 'E') {
- double expPart = 0;
+ double expPart = 0.0;
cur++; // skip 'E'
expPart = (double)strtol(cur, &end, 10); // Parse digit sequence with sign
if (cur != end) {
diff --git a/nanosvg/altsvgrast.h b/nanosvg/nanosvgrast.h
index 5a4e43a35..63506e5cd 100644
--- a/nanosvg/altsvgrast.h
+++ b/nanosvg/nanosvgrast.h
@@ -1,9 +1,3 @@
-//
-// "$Id$"
-//
-
-/* Modified by FLTK from original sources to support non-square X,Y axes scaling */
-
/*
* Copyright (c) 2013-14 Mikko Mononen memon@inside.org
*
@@ -28,6 +22,11 @@
*
*/
+/* Modified by FLTK to support non-square X,Y axes scaling.
+ *
+ * Added: nsvgRasterizeXY()
+*/
+
#ifndef NANOSVGRAST_H
#define NANOSVGRAST_H
@@ -50,7 +49,7 @@ typedef struct NSVGrasterizer NSVGrasterizer;
nsvgRasterize(rast, image, 0,0,1, img, w, h, w*4);
// For non-square X,Y scaling, use
- nsvgAltRasterize(rast, image, 0,0,1,1, img, w, h, w*4);
+ nsvgRasterizeXY(rast, image, 0,0,1,1, img, w, h, w*4);
*/
// Allocated rasterizer context.
@@ -70,7 +69,7 @@ void nsvgRasterize(NSVGrasterizer* r,
unsigned char* dst, int w, int h, int stride);
// As above, but allow X and Y axes to scale independently for non-square aspects
-void nsvgAltRasterize(NSVGrasterizer* r,
+void nsvgRasterizeXY(NSVGrasterizer* r,
NSVGimage* image, float tx, float ty,
float sx, float sy,
unsigned char* dst, int w, int h, int stride);
@@ -1374,7 +1373,7 @@ static void dumpEdges(NSVGrasterizer* r, const char* name)
}
*/
-void nsvgAltRasterize(NSVGrasterizer* r,
+void nsvgRasterizeXY(NSVGrasterizer* r,
NSVGimage* image, float tx, float ty,
float sx, float sy,
unsigned char* dst, int w, int h, int stride)
@@ -1466,7 +1465,7 @@ void nsvgRasterize(NSVGrasterizer* r,
NSVGimage* image, float tx, float ty, float scale,
unsigned char* dst, int w, int h, int stride)
{
- nsvgAltRasterize(r,image, tx, ty, scale, scale, dst, w, h, stride);
+ nsvgRasterizeXY(r,image, tx, ty, scale, scale, dst, w, h, stride);
}
#endif // NANOSVGRAST_IMPLEMENTATION
diff --git a/src/Fl_SVG_Image.cxx b/src/Fl_SVG_Image.cxx
index fd941d49a..2e5904a21 100644
--- a/src/Fl_SVG_Image.cxx
+++ b/src/Fl_SVG_Image.cxx
@@ -41,7 +41,7 @@ static double strtoll(const char *str, char **endptr, int base) {
#include "../nanosvg/nanosvg.h"
#define NANOSVGRAST_IMPLEMENTATION // Expands implementation
-#include "../nanosvg/altsvgrast.h"
+#include "../nanosvg/nanosvgrast.h"
/** The constructor loads the SVG image from the given .svg/.svgz filename or in-memory data.
@@ -184,7 +184,7 @@ void Fl_SVG_Image::rasterize_(int W, int H) {
fy = (double)H / counted_svg_image_->svg_image->height;
}
array = new uchar[W*H*4];
- nsvgAltRasterize(rasterizer, counted_svg_image_->svg_image, 0, 0, fx, fy, (uchar* )array, W, H, W*4);
+ nsvgRasterizeXY(rasterizer, counted_svg_image_->svg_image, 0, 0, fx, fy, (uchar* )array, W, H, W*4);
alloc_array = 1;
data((const char * const *)&array, 1);
d(4);
diff --git a/src/makedepend b/src/makedepend
index 8038d1dcd..e40226a67 100644
--- a/src/makedepend
+++ b/src/makedepend
@@ -2000,7 +2000,7 @@ Fl_SVG_Image.o: ../FL/Fl_Graphics_Driver.H ../FL/Fl_Bitmap.H ../FL/Fl_Image.H
Fl_SVG_Image.o: ../FL/Fl_Pixmap.H ../FL/Fl_RGB_Image.H ../FL/Fl_Group.H
Fl_SVG_Image.o: ../FL/Fl_Rect.H ../FL/Fl_Widget.H ../FL/Fl_Scrollbar.H
Fl_SVG_Image.o: ../FL/Fl_Slider.H ../FL/Fl_Valuator.H ../FL/Fl_Text_Buffer.H
-Fl_SVG_Image.o: ../nanosvg/nanosvg.h ../nanosvg/altsvgrast.h
+Fl_SVG_Image.o: ../nanosvg/nanosvg.h ../nanosvg/nanosvgrast.h
flstring.o: flstring.h ../FL/Fl_Export.H ../config.h
numericsort.o: ../FL/platform_types.h ../FL/filename.H ../FL/Fl_Export.H
vsnprintf.o: flstring.h ../FL/Fl_Export.H ../config.h