Index: [thread] [date] [subject] [author]
  From: teunis <teunis@computersupportcentre.com>
  To  : GGI Developers <ggi-develop@eskimo.com>
  Date: Mon, 24 Aug 1998 22:27:45 -0700 (MST)

memory visual fix: palettes

For some reason there's no default setpalette function in libggi?
This is odd...  (this is where I was having probs)

So here's a patch to display/memory that fixes things for that anyways.

--- display/memory.orig/mode.c	Mon Aug 24 20:58:12 1998
+++ display/memory/mode.c	Mon Aug 24 22:24:28 1998
@@ -76,6 +76,7 @@
 	if (GT_SCHEME(LIBGGI_GT(vis)) == GT_PALETTE) {
 		vis->palette = _ggi_malloc((1 << GT_DEPTH(LIBGGI_GT(vis)))*
 					sizeof(ggi_color));
+		vis->opcolor->setpalvec=GGIsetpalvec;
 	}
 	
 	return 0;
@@ -280,5 +281,19 @@
 int GGIsetflags(ggi_visual *vis,ggi_flags flags)
 {
 	LIBGGI_FLAGS(vis)=flags;
+	return 0;
+}
+
+int GGIsetpalvec(ggi_visual *vis,int start,int len,ggi_color *colormap)
+{
+	int i;
+
+	DPRINT("memory setpalette.\n");
+	if (start == -1) start = 0;
+	if (colormap==NULL || start+len > (1<<GT_DEPTH(LIBGGI_GT(vis))))
+		return -1;
+                        
+	memcpy(vis->palette+start, colormap, len*sizeof(ggi_color)); 
+
 	return 0;
 }


G'day, eh? :)
	- Teunis

Index: [thread] [date] [subject] [author]