[mathgl] Add patch to fix pics generation

Dmitrij S. Kryzhevich krege at fedoraproject.org
Mon Apr 22 10:09:20 UTC 2013


commit fefea002b645545d97226c0c31d2314d540b7cea
Author: Dmitrij S. Kryzhevich <krege at land.ru>
Date:   Mon Apr 22 17:09:14 2013 +0700

    Add patch to fix pics generation

 mathgl-2.1.2-stlerror.patch |  219 +++++++++++++++++++++++++++++++++++++++++++
 mathgl.spec                 |   24 ++---
 2 files changed, 228 insertions(+), 15 deletions(-)
---
diff --git a/mathgl-2.1.2-stlerror.patch b/mathgl-2.1.2-stlerror.patch
new file mode 100644
index 0000000..e2fd4d2
--- /dev/null
+++ b/mathgl-2.1.2-stlerror.patch
@@ -0,0 +1,219 @@
+diff -urp mathgl-2.1.2/src/pixel.cpp mathgl-2.1.2-stlerror/src/pixel.cpp
+--- mathgl-2.1.2/src/pixel.cpp	2013-01-28 18:34:04.000000000 +0700
++++ mathgl-2.1.2-stlerror/src/pixel.cpp	2013-04-22 16:45:58.894481072 +0700
+@@ -839,7 +839,6 @@ void mglCanvas::mark_draw(long k, char t
+ #if MGL_HAVE_PTHREAD
+ 	pthread_mutex_lock(&mutexPnt);
+ #endif
+-	size_t pos = Pnt.size(), qos=pos;
+ 	if(type=='.' || ss==0)
+ 	{
+ 		if(d)	d->PenWidth = ss?ss:sqrt(font_factor/400);
+@@ -847,6 +846,9 @@ void mglCanvas::mark_draw(long k, char t
+ 	}
+ 	else
+ 	{
++		if(type=='C')	pnt_draw(k,d);
++		std::vector<mglPnt> pnt = Pnt;	Pnt.clear();
++		long qos = 0;
+ 		if(d)
+ 		{
+ 			d->PDef = 0xffff;	d->PenWidth*=fabs(50*size);
+@@ -857,10 +859,10 @@ void mglCanvas::mark_draw(long k, char t
+ 		{
+ 		case 'P':
+ 			p.x = q.x-ss;	p.y = q.y-ss;	Pnt.push_back(p);
+-			p.x = q.x+ss;	p.y = q.y-ss;	Pnt.push_back(p);	line_draw(pos,pos+1,d);
+-			p.x = q.x+ss;	p.y = q.y+ss;	Pnt.push_back(p);	line_draw(pos+1,pos+2,d);
+-			p.x = q.x-ss;	p.y = q.y+ss;	Pnt.push_back(p);	line_draw(pos+2,pos+3,d);
+-			line_draw(pos+3,pos,d);	qos+=4;
++			p.x = q.x+ss;	p.y = q.y-ss;	Pnt.push_back(p);	line_draw(0,1,d);
++			p.x = q.x+ss;	p.y = q.y+ss;	Pnt.push_back(p);	line_draw(1,2,d);
++			p.x = q.x-ss;	p.y = q.y+ss;	Pnt.push_back(p);	line_draw(2,3,d);
++			line_draw(3,0,d);	qos+=4;
+ 		case '+':
+ 			p.x = q.x-ss;	p.y = q.y;		Pnt.push_back(p);
+ 			p.x = q.x+ss;	p.y = q.y;		Pnt.push_back(p);	line_draw(qos,qos+1,d);
+@@ -869,10 +871,10 @@ void mglCanvas::mark_draw(long k, char t
+ 			break;
+ 		case 'X':
+ 			p.x = q.x-ss;	p.y = q.y-ss;	Pnt.push_back(p);
+-			p.x = q.x+ss;	p.y = q.y-ss;	Pnt.push_back(p);	line_draw(pos,pos+1,d);
+-			p.x = q.x+ss;	p.y = q.y+ss;	Pnt.push_back(p);	line_draw(pos+1,pos+2,d);
+-			p.x = q.x-ss;	p.y = q.y+ss;	Pnt.push_back(p);	line_draw(pos+2,pos+3,d);
+-			line_draw(pos+3,pos,d);	qos+=4;
++			p.x = q.x+ss;	p.y = q.y-ss;	Pnt.push_back(p);	line_draw(0,1,d);
++			p.x = q.x+ss;	p.y = q.y+ss;	Pnt.push_back(p);	line_draw(1,2,d);
++			p.x = q.x-ss;	p.y = q.y+ss;	Pnt.push_back(p);	line_draw(2,3,d);
++			line_draw(3,0,d);	qos+=4;
+ 		case 'x':
+ 			p.x = q.x-ss;	p.y = q.y-ss;	Pnt.push_back(p);
+ 			p.x = q.x+ss;	p.y = q.y+ss;	Pnt.push_back(p);	line_draw(qos,qos+1,d);
+@@ -884,7 +886,7 @@ void mglCanvas::mark_draw(long k, char t
+ 			p.x = q.x-ss;	p.y = q.y+ss;	Pnt.push_back(p);
+ 			p.x= q.x+ss;	p.y= q.y+ss;	Pnt.push_back(p);
+ 			p.x = q.x+ss;	p.y = q.y-ss;	Pnt.push_back(p);
+-			quad_draw(pos,pos+1,pos+3,pos+2,d);	qos+=4;
++			quad_draw(0,1,3,2,d);	qos+=4;
+ 		case 's':
+ 			p.x = q.x-ss;	p.y = q.y-ss;	Pnt.push_back(p);
+ 			p.x = q.x+ss;	p.y = q.y-ss;	Pnt.push_back(p);	line_draw(qos,qos+1,d);
+@@ -896,7 +898,7 @@ void mglCanvas::mark_draw(long k, char t
+ 			p.x = q.x+ss;	p.y = q.y;		Pnt.push_back(p);
+ 			p.x= q.x;	p.y= q.y+ss;		Pnt.push_back(p);
+ 			p.x = q.x-ss;	p.y = q.y;		Pnt.push_back(p);
+-			quad_draw(pos,pos+1,pos+3,pos+2,d);	qos+=4;
++			quad_draw(0,1,3,2,d);	qos+=4;
+ 		case 'd':
+ 			p.x = q.x;	p.y = q.y-ss;		Pnt.push_back(p);
+ 			p.x = q.x+ss;	p.y = q.y;		Pnt.push_back(p);	line_draw(qos,qos+1,d);
+@@ -905,23 +907,23 @@ void mglCanvas::mark_draw(long k, char t
+ 			line_draw(qos+3,qos,d);	break;
+ 		case 'Y':
+ 			p.x = q.x;	p.y = q.y;			Pnt.push_back(p);
+-			p.x = q.x;	p.y = q.y-ss;		Pnt.push_back(p);	line_draw(pos,pos+1,d);
+-			p.x = q.x-0.8*ss;	p.y = q.y+0.6*ss;	Pnt.push_back(p);	line_draw(pos,pos+2,d);
+-			p.x = q.x+0.8*ss;	p.y = q.y+0.6*ss;	Pnt.push_back(p);	line_draw(pos,pos+3,d);
++			p.x = q.x;	p.y = q.y-ss;		Pnt.push_back(p);	line_draw(0,1,d);
++			p.x = q.x-0.8*ss;	p.y = q.y+0.6*ss;	Pnt.push_back(p);	line_draw(0,2,d);
++			p.x = q.x+0.8*ss;	p.y = q.y+0.6*ss;	Pnt.push_back(p);	line_draw(0,3,d);
+ 			break;
+ 		case '*':
+ 			p.x = q.x-ss;		p.y = q.y;	Pnt.push_back(p);
+-			p.x = q.x+ss;		p.y = q.y;	Pnt.push_back(p);	line_draw(pos,pos+1,d);
++			p.x = q.x+ss;		p.y = q.y;	Pnt.push_back(p);	line_draw(0,1,d);
+ 			p.x = q.x-0.6*ss;	p.y = q.y-0.8*ss;	Pnt.push_back(p);
+-			p.x = q.x+0.6*ss;	p.y = q.y+0.8*ss;	Pnt.push_back(p);	line_draw(pos+2,pos+3,d);
++			p.x = q.x+0.6*ss;	p.y = q.y+0.8*ss;	Pnt.push_back(p);	line_draw(2,3,d);
+ 			p.x = q.x-0.6*ss;	p.y = q.y+0.8*ss;	Pnt.push_back(p);
+-			p.x = q.x+0.6*ss;	p.y = q.y-0.8*ss;	Pnt.push_back(p);	line_draw(pos+4,pos+5,d);
++			p.x = q.x+0.6*ss;	p.y = q.y-0.8*ss;	Pnt.push_back(p);	line_draw(4,5,d);
+ 			break;
+ 		case 'T':
+ 			p.x = q.x-ss;	p.y = q.y-ss/2;	Pnt.push_back(p);
+ 			p.x = q.x+ss;	p.y = q.y-ss/2;	Pnt.push_back(p);
+ 			p.x= q.x;		p.y= q.y+ss;	Pnt.push_back(p);
+-			trig_draw(pos,pos+1,pos+2,false,d);	qos+=3;
++			trig_draw(0,1,2,false,d);	qos+=3;
+ 		case '^':
+ 			p.x = q.x-ss;	p.y = q.y-ss/2;	Pnt.push_back(p);
+ 			p.x = q.x+ss;	p.y = q.y-ss/2;	Pnt.push_back(p);	line_draw(qos,qos+1,d);
+@@ -931,7 +933,7 @@ void mglCanvas::mark_draw(long k, char t
+ 			p.x = q.x-ss;	p.y = q.y+ss/2;	Pnt.push_back(p);
+ 			p.x = q.x+ss;	p.y = q.y+ss/2;	Pnt.push_back(p);
+ 			p.x= q.x;		p.y= q.y-ss;	Pnt.push_back(p);
+-			trig_draw(pos,pos+1,pos+2,false,d);	qos+=3;
++			trig_draw(0,1,2,false,d);	qos+=3;
+ 		case 'v':
+ 			p.x = q.x-ss;	p.y = q.y+ss/2;	Pnt.push_back(p);
+ 			p.x = q.x+ss;	p.y = q.y+ss/2;	Pnt.push_back(p);	line_draw(qos,qos+1,d);
+@@ -941,7 +943,7 @@ void mglCanvas::mark_draw(long k, char t
+ 			p.x = q.x+ss/2;	p.y = q.y+ss;	Pnt.push_back(p);
+ 			p.x = q.x+ss/2;	p.y = q.y-ss;	Pnt.push_back(p);
+ 			p.x= q.x-ss;	p.y= q.y;		Pnt.push_back(p);
+-			trig_draw(pos,pos+1,pos+2,false,d);	qos+=3;
++			trig_draw(0,1,2,false,d);	qos+=3;
+ 		case '<':
+ 			p.x = q.x+ss/2;	p.y = q.y+ss;	Pnt.push_back(p);
+ 			p.x = q.x+ss/2;	p.y = q.y-ss;	Pnt.push_back(p);	line_draw(qos,qos+1,d);
+@@ -951,7 +953,7 @@ void mglCanvas::mark_draw(long k, char t
+ 			p.x = q.x-ss/2;	p.y = q.y+ss;	Pnt.push_back(p);
+ 			p.x = q.x-ss/2;	p.y = q.y-ss;	Pnt.push_back(p);
+ 			p.x= q.x+ss;	p.y= q.y;		Pnt.push_back(p);
+-			trig_draw(pos,pos+1,pos+2,false,d);	qos+=3;
++			trig_draw(0,1,2,false,d);	qos+=3;
+ 		case '>':
+ 			p.x = q.x-ss/2;	p.y = q.y+ss;	Pnt.push_back(p);
+ 			p.x = q.x-ss/2;	p.y = q.y-ss;	Pnt.push_back(p);	line_draw(qos,qos+1,d);
+@@ -968,19 +970,18 @@ void mglCanvas::mark_draw(long k, char t
+ 			for(i=0;i<=20;i++)
+ 			{
+ 				p.x = q.x+ss*cos(i*M_PI/10);	p.y = q.y+ss*sin(i*M_PI/10);	Pnt.push_back(p);
+-				if(i>0)	line_draw(pos+i-1,pos+i,d);
++				if(i>0)	line_draw(i-1,i,d);
+ 			}
+ 			break;
+ 		case 'C':
+-			pnt_draw(k,d);
+ 			for(i=0;i<=20;i++)
+ 			{
+ 				p.x = q.x+ss*cos(i*M_PI/10);	p.y = q.y+ss*sin(i*M_PI/10);	Pnt.push_back(p);
+-				if(i>0)	line_draw(pos+i-1,pos+i,d);
++				if(i>0)	line_draw(i-1,i,d);
+ 			}
+ 			break;
+ 		}
+-		Pnt.erase(Pnt.begin()+pos,Pnt.end());
++		Pnt = pnt;
+ 	}
+ #if MGL_HAVE_PTHREAD
+ 	pthread_mutex_unlock(&mutexPnt);
+@@ -1045,7 +1046,8 @@ void mglCanvas::glyph_draw(const mglPrim
+ void mglCanvas::glyph_fill(const mglPnt &pp, mreal f, const mglGlyph &g, mglDrawReg *d)
+ {
+ 	if(!g.trig || g.nt<=0)	return;
+-	long ik,ii,pos=Pnt.size();
++	std::vector<mglPnt> pnt = Pnt;	Pnt.clear();
++	long ik,ii,jj=0;
+ 	mglPnt p=pp;	p.u=p.v=NAN;
+ 	mglPoint p1,p2,p3;
+ 	for(ik=0;ik<g.nt;ik++)
+@@ -1056,15 +1058,16 @@ void mglCanvas::glyph_fill(const mglPnt
+ 		p.x = p1.x;	p.y = p1.y;	p.z = p1.z;	Pnt.push_back(p);
+ 		p.x = p2.x;	p.y = p2.y;	p.z = p2.z;	Pnt.push_back(p);
+ 		p.x = p3.x;	p.y = p3.y;	p.z = p3.z;	Pnt.push_back(p);
+-		ii = Pnt.size()-3;	trig_draw(ii,ii+1,ii+2,false,d);
++		trig_draw(jj,jj+1,jj+2,false,d);	jj+=3;
+ 	}
+-	Pnt.erase(Pnt.begin()+pos,Pnt.end());
++	Pnt = pnt;
+ }
+ //-----------------------------------------------------------------------------
+ void mglCanvas::glyph_wire(const mglPnt &pp, mreal f, const mglGlyph &g, mglDrawReg *d)
+ {
+ 	if(!g.line || g.nl<=0)	return;
+-	long ik,ii,il=0,pos=Pnt.size();
++	long ik,ii,il=0,jj=0;
++	std::vector<mglPnt> pnt = Pnt;	Pnt.clear();
+ 	mglPnt p=pp;	p.u=p.v=NAN;
+ 	if(d)	{	d->PDef = 0xffff;	d->PenWidth=0.75;	}
+ 	mglPoint p1,p2;
+@@ -1086,9 +1089,9 @@ void mglCanvas::glyph_wire(const mglPnt
+ 		PostScale(p1);	PostScale(p2);
+ 		p.x = p1.x;	p.y = p1.y;	p.z = p1.z;	Pnt.push_back(p);
+ 		p.x = p2.x;	p.y = p2.y;	p.z = p2.z;	Pnt.push_back(p);
+-		ii = Pnt.size()-2;	line_draw(ii,ii+1,d);
++		line_draw(jj,jj+1,d);	jj+=2;
+ 	}
+-	Pnt.erase(Pnt.begin()+pos,Pnt.end());
++	Pnt = pnt;
+ }
+ //-----------------------------------------------------------------------------
+ void mglCanvas::glyph_line(const mglPnt &pp, mreal f, bool solid, mglDrawReg *d)
+@@ -1096,7 +1099,7 @@ void mglCanvas::glyph_line(const mglPnt
+ 	mglPnt p=pp;	p.u=p.v=NAN;
+ 	if(d)	{	d->PDef = 0xffff;	d->PenWidth=1;	}
+ 	mglPoint p1,p2,p3,p4;
+-	long pos=Pnt.size();
++	std::vector<mglPnt> pnt = Pnt;	Pnt.clear();
+ 
+ 	mreal dy = 0.004;
+ 	p1 = mglPoint(pp.u,pp.v-dy,0);	PostScale(p1);
+@@ -1109,13 +1112,13 @@ void mglCanvas::glyph_line(const mglPnt
+ 	p.x = p3.x;	p.y = p3.y;	p.z = p3.z;	Pnt.push_back(p);
+ 	p.x = p4.x;	p.y = p4.y;	p.z = p4.z;	Pnt.push_back(p);
+ 
+-	if(solid)	quad_draw(pos,pos+1,pos+3,pos+2,d);
++	if(solid)	quad_draw(0,1,3,2,d);
+ 	else
+ 	{
+-		line_draw(pos,pos+1,d);	line_draw(pos+2,pos+1,d);
+-		line_draw(pos,pos+3,d);	line_draw(pos+2,pos+3,d);
++		line_draw(0,1,d);	line_draw(2,1,d);
++		line_draw(0,3,d);	line_draw(2,3,d);
+ 	}
+-	Pnt.erase(Pnt.begin()+pos,Pnt.end());
++	Pnt = pnt;
+ }
+ //-----------------------------------------------------------------------------
+ long mglCanvas::setPp(mglPnt &q, const mglPoint &p)
diff --git a/mathgl.spec b/mathgl.spec
index c585b01..c468a1c 100644
--- a/mathgl.spec
+++ b/mathgl.spec
@@ -1,6 +1,6 @@
 Name:          mathgl
 Version:       2.1.2
-Release:       5%{?dist}
+Release:       6%{?dist}
 Summary:       Cross-platform library for making high-quality scientific graphics
 Summary(de):   Plattformübergreifende Bibliothek für hochwertige wissenschaftliche Graphiken
 Summary(ru):   Библиотека для осуществления высококачественной визуализации данных
@@ -29,6 +29,9 @@ Patch4:        mathgl-2.1.2-udav_desktop.patch
 # Install binaries for generation examples of illustrations
 Patch5:        mathgl-2.1.2-examples.patch
 
+# Fix for pics generation segfaults
+Patch6:        mathgl-2.1.2-stlerror.patch
+
 BuildRoot:     %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
 Requires:      %{name}-common = %{version}-%{release}
@@ -177,25 +180,12 @@ done
 %patch3
 %patch4 -p1
 %patch5 -p1
+%patch6 -p1
 
 # Fix hardcoded paths
 sed -i s,/usr/local/share/doc/mathgl/,%{_docdir}/%{name}/, udav/udav_wnd.h
 sed -i s,/usr/local/share/udav/,%{_datadir}/udav/, udav/udav_wnd.cpp
 
-# There are few .png that can't be generated on Fedora koji
-# (i686 , memory?)
-# There are disabled for now
-for pic in contf table tape parser tube;
-do
-    sed -i s", $pic , ," texinfo/CMakeLists.txt
-    for file in ex_mgl_en.texi ex_mgl_ru.texi example_en.texi example_ru.texi;
-    do
-        grep -v "@pfig{${pic}," texinfo/${file} > texinfo/${file}.n
-        touch -r texinfo/${file} texinfo/${file}.n
-        mv texinfo/${file}.n texinfo/${file}
-    done
-done
-
 %build
 
 %define building() \
@@ -297,6 +287,7 @@ rm -rf %{buildroot}
 %doc AUTHORS ChangeLog.txt README COPYING  README_V2
 %{_libdir}/*.so.*
 %{_bindir}/mgl*
+%exclude %{_bindir}/mgl_*example
 %{_mandir}/man1/mglconv.1.gz
 %{_mandir}/man1/mglview.1.gz
 
@@ -348,6 +339,9 @@ rm -rf %{buildroot}
 %{_includedir}/mpich2-%{_arch}/mgl2/
 
 %changelog
+* Mon Apr 22 2013 Dmitrij S. Kryzhevich <krege at land.ru> - 2.1.2-6
+- Add patch to fix pics generation.
+
 * Thu Apr 18 2013 Dmitrij S. Kryzhevich <krege at land.ru> - 2.1.2-5
 - Install binaries used for generation of examples of illustrations.
 


More information about the scm-commits mailing list