D Haley 2571047
diff -r 9ad9a88a8e91 include/mgl2/base.h
D Haley 2571047
--- include/mgl2/base.h	Sun Apr 14 22:38:31 2013 +0100
D Haley 2571047
+++ include/mgl2/base.h	Sun Apr 14 22:42:46 2013 +0100
D Haley 2571047
@@ -161,11 +161,14 @@
D Haley 2571047
 	{	Create(a.nt, a.nl);	memcpy(trig, a.trig, 6*nt*sizeof(short));
D Haley 2571047
 		memcpy(line, a.line, 2*nl*sizeof(short));	return *this;	}
D Haley 2571047
 };
D Haley 2571047
+
D Haley 2571047
+const int MGL_TEXTURE_COLOURS=512;
D Haley 2571047
+
D Haley 2571047
 //-----------------------------------------------------------------------------
D Haley 2571047
 /// Structure for texture (color scheme + palette) representation
D Haley 2571047
 struct MGL_EXPORT mglTexture
D Haley 2571047
 {
D Haley 2571047
-	mglColor col[512];	///< Colors itself
D Haley 2571047
+	mglColor col[MGL_TEXTURE_COLOURS];	///< Colors itself
D Haley 2571047
 	long n;				///< Number of initial colors along u
D Haley 2571047
 
D Haley 2571047
 	char Sch[260];		///< Color scheme used
D Haley 2571047
@@ -179,6 +182,7 @@
D Haley 2571047
 	void Set(const char *cols, int smooth=0,mreal alpha=1);
D Haley 2571047
 	void Set(HCDT val, const char *cols);
D Haley 2571047
 	void GetC(mreal u,mreal v,mglPnt &p) const;
D Haley 2571047
+	size_t GetNumColours() { return MGL_TEXTURE_COLOURS;}
D Haley 2571047
 	mglColor GetC(mreal u,mreal v=0) const;
D Haley 2571047
 	inline bool IsSame(const mglTexture &t) const
D Haley 2571047
 	{	return n==t.n && !memcmp(col,t.col,512*sizeof(mglColor));	}
D Haley 2571047
diff -r 9ad9a88a8e91 src/base.cpp
D Haley 2571047
--- src/base.cpp	Sun Apr 14 22:38:31 2013 +0100
D Haley 2571047
+++ src/base.cpp	Sun Apr 14 22:42:46 2013 +0100
D Haley 2571047
@@ -882,7 +882,8 @@
D Haley 2571047
 			return i+j/255.;
D Haley 2571047
 	// add new texture
D Haley 2571047
 	mglTexture t;
D Haley 2571047
-	for(i=0;i<514;i++)	t.col[i]=c;
D Haley 2571047
+	size_t maxColours=t.GetNumColours();
D Haley 2571047
+	for(i=0;i
D Haley 2571047
 	MGL_PUSH(Txt,t,mutexTxt);	return Txt.size()-1;
D Haley 2571047
 }
D Haley 2571047
 //-----------------------------------------------------------------------------