Commit Diff


commit - be0a15c47b75dc73a5c389cca125692f0cfdf726
commit + 7d43dde539378fb5730df6ce961f7916f495746e
blob - 3b66c954e9645b1b65e4a83e8b8c6a51b143649a
blob + 1221ec8c194fc33cd532e480c9cb67b0c28ac57b
--- src/cmd/devdraw/bigarrow.h
+++ src/cmd/devdraw/bigarrow.h
@@ -11,3 +11,73 @@ Cursor	bigarrow = {
 	  0x61, 0xF0, 0x60, 0xE0, 0x40, 0x40, 0x00, 0x00,
 	},
 };
+
+Cursor2	bigarrow2 = {
+	{ -2, -2 },
+	{ 0xFF, 0xFF, 0xFF, 0xFF, 
+	  0xFF, 0xFF, 0xFF, 0xFF, 
+	  0xC0, 0x00, 0x00, 0x03, 
+	  0xC0, 0x00, 0x00, 0x07, 
+	  0xC0, 0x00, 0x00, 0x1E, 
+	  0xC0, 0x00, 0x00, 0x3C, 
+	  0xC0, 0x00, 0x00, 0xF0, 
+	  0xC0, 0x00, 0x03, 0xE0, 
+	  0xC0, 0x00, 0x0F, 0x80, 
+	  0xC0, 0x00, 0x0E, 0x00, 
+	  0xC0, 0x00, 0x07, 0x00, 
+	  0xC0, 0x00, 0x03, 0x80, 
+	  0xC0, 0x00, 0x01, 0xC0, 
+	  0xC0, 0x00, 0x00, 0xE0, 
+	  0xC0, 0x00, 0x00, 0x70, 
+	  0xC0, 0x00, 0x00, 0x38, 
+	  0xC0, 0x00, 0x00, 0x1C, 
+	  0xC0, 0x00, 0x00, 0x0E, 
+	  0xC0, 0x00, 0x00, 0x07, 
+	  0xC0, 0x00, 0x00, 0x03, 
+	  0xC0, 0xC0, 0x00, 0x07, 
+	  0xC0, 0xE0, 0x00, 0x0E, 
+	  0xC1, 0xF0, 0x00, 0x1C, 
+	  0xC1, 0xB8, 0x00, 0x38, 
+	  0xC3, 0x9C, 0x00, 0x70, 
+	  0xC3, 0x0E, 0x00, 0xE0, 
+	  0xC7, 0x07, 0x01, 0xC0, 
+	  0xCE, 0x03, 0x83, 0x80, 
+	  0xCC, 0x01, 0xC7, 0x00, 
+	  0xDC, 0x00, 0xEE, 0x00, 
+	  0xF8, 0x00, 0x7C, 0x00, 
+	  0xF0, 0x00, 0x38, 0x00,
+	},
+	{ 0x00, 0x00, 0x00, 0x00, 
+	  0x00, 0x00, 0x00, 0x00, 
+	  0x3F, 0xFF, 0xFF, 0xFC, 
+	  0x3F, 0xFF, 0xFF, 0xF8, 
+	  0x3F, 0xFF, 0xFF, 0xE0, 
+	  0x3F, 0xFF, 0xFF, 0xC0, 
+	  0x3F, 0xFF, 0xFF, 0x00, 
+	  0x3F, 0xFF, 0xFC, 0x00, 
+	  0x3F, 0xFF, 0xF0, 0x00, 
+	  0x3F, 0xFF, 0xF0, 0x00, 
+	  0x3F, 0xFF, 0xF8, 0x00, 
+	  0x3F, 0xFF, 0xFC, 0x00, 
+	  0x3F, 0xFF, 0xFE, 0x00, 
+	  0x3F, 0xFF, 0xFF, 0x00, 
+	  0x3F, 0xFF, 0xFF, 0x80, 
+	  0x3F, 0xFF, 0xFF, 0xC0, 
+	  0x3F, 0xFF, 0xFF, 0xE0, 
+	  0x3F, 0xFF, 0xFF, 0xF0, 
+	  0x3F, 0xFF, 0xFF, 0xF8, 
+	  0x3F, 0xFF, 0xFF, 0xFC, 
+	  0x3F, 0x3F, 0xFF, 0xF8, 
+	  0x3F, 0x1F, 0xFF, 0xF0, 
+	  0x3E, 0x0F, 0xFF, 0xE0, 
+	  0x3E, 0x07, 0xFF, 0xC0, 
+	  0x3C, 0x03, 0xFF, 0x80, 
+	  0x3C, 0x01, 0xFF, 0x00, 
+	  0x38, 0x00, 0xFE, 0x00, 
+	  0x30, 0x00, 0x7C, 0x00, 
+	  0x30, 0x00, 0x38, 0x00, 
+	  0x20, 0x00, 0x10, 0x00, 
+	  0x00, 0x00, 0x00, 0x00, 
+	  0x00, 0x00, 0x00, 0x00,
+	}
+};
blob - c82ce0bc2690ecd3a2071c102e49520a7b804561
blob + 049d1c5cda028757bf64c2280ad6445c946f1b10
--- src/cmd/devdraw/cocoa-screen-metal.m
+++ src/cmd/devdraw/cocoa-screen-metal.m
@@ -252,21 +252,30 @@ threadmain(int argc, char **argv)
 	[myContent enlargeLastInputRect:r];
 }
 
+typedef struct Cursors Cursors;
+struct Cursors {
+	Cursor *c;
+	Cursor2 *c2;
+};
+
 + (void)callsetcursor:(NSValue *)v
 {
+	Cursors *cs;
 	Cursor *c;
+	Cursor2 *c2;
 	NSBitmapImageRep *r, *r2;
 	NSImage *i;
 	NSPoint p;
-	uint b, x, y, a;
 	uchar *plane[5], *plane2[5];
-	uchar pu, pb, pl, pr, pc;  // upper, bottom, left, right, center
-	uchar pul, pur, pbl, pbr;
-	uchar ful, fur, fbl, fbr;
+	int b;
 
-	c = [v pointerValue];
+	cs = [v pointerValue];
+	c = cs->c;
 	if(!c)
 		c = &bigarrow;
+	c2 = cs->c2;
+	if(!c2)
+		c2 = &bigarrow2;
 
 	r = [[NSBitmapImageRep alloc]
 		initWithBitmapDataPlanes:nil
@@ -280,7 +289,7 @@ threadmain(int argc, char **argv)
 		bytesPerRow:2
 		bitsPerPixel:0];
 	[r getBitmapDataPlanes:plane];
-	for(b=0; b<2*16; b++){
+	for(b=0; b<nelem(c->set); b++){
 		plane[0][b] = ~c->set[b] & c->clr[b];
 		plane[1][b] = c->set[b] | c->clr[b];
 	}
@@ -297,33 +306,9 @@ threadmain(int argc, char **argv)
 		bytesPerRow:4
 		bitsPerPixel:0];
 	[r2 getBitmapDataPlanes:plane2];
-	// https://en.wikipedia.org/wiki/Pixel-art_scaling_algorithms#EPX/Scale2×/AdvMAME2×
-	for(a=0; a<2; a++){
-		for(y=0; y<16; y++){
-			for(x=0; x<2; x++){
-				pc = plane[a][x+2*y];
-				pu = y==0 ? pc : plane[a][x+2*(y-1)];
-				pb = y==15 ? pc : plane[a][x+2*(y+1)];
-				pl = (pc>>1) | (x==0 ? pc&0x80 : (plane[a][x-1+2*y]&1)<<7);
-				pr = (pc<<1) | (x==1 ? pc&1 : (plane[a][x+1+2*y]&0x80)>>7);
-				ful = ~(pl^pu) & (pl^pb) & (pu^pr);
-				pul = (ful & pu) | (~ful & pc);
-				fur = ~(pu^pr) & (pu^pl) & (pr^pb);
-				pur = (fur & pr) | (~fur & pc);
-				fbl = ~(pb^pl) & (pb^pr) & (pl^pu);
-				pbl = (fbl & pl) | (~fbl & pc);
-				fbr = ~(pr^pb) & (pr^pu) & (pb^pl);
-				pbr = (fbr & pb) | (~fbr & pc);
-				plane2[a][2*x+4*2*y] = (pul&0x80) | ((pul&0x40)>>1)  | ((pul&0x20)>>2) | ((pul&0x10)>>3)
-					| ((pur&0x80)>>1) | ((pur&0x40)>>2)  | ((pur&0x20)>>3) | ((pur&0x10)>>4);
-				plane2[a][2*x+1+4*2*y] = ((pul&0x8)<<4) | ((pul&0x4)<<3)  | ((pul&0x2)<<2) | ((pul&0x1)<<1)
-					| ((pur&0x8)<<3) | ((pur&0x4)<<2)  | ((pur&0x2)<<1) | (pur&0x1);
-				plane2[a][2*x+4*(2*y+1)] =  (pbl&0x80) | ((pbl&0x40)>>1)  | ((pbl&0x20)>>2) | ((pbl&0x10)>>3)
-					| ((pbr&0x80)>>1) | ((pbr&0x40)>>2)  | ((pbr&0x20)>>3) | ((pbr&0x10)>>4);
-				plane2[a][2*x+1+4*(2*y+1)] = ((pbl&0x8)<<4) | ((pbl&0x4)<<3)  | ((pbl&0x2)<<2) | ((pbl&0x1)<<1)
-					| ((pbr&0x8)<<3) | ((pbr&0x4)<<2)  | ((pbr&0x2)<<1) | (pbr&0x1);
-			}
-		}
+	for(b=0; b<nelem(c2->set); b++){
+		plane2[0][b] = ~c2->set[b] & c2->clr[b];
+		plane2[1][b] = c2->set[b] | c2->clr[b];
 	}
 
 	// For checking out the cursor bitmap image
@@ -943,7 +928,7 @@ attachscreen(char *label, char *winsize)
 		withObject:[NSValue valueWithPointer:winsize]
 		waitUntilDone:YES];
 	kicklabel(label);
-	setcursor(nil);
+	setcursor(nil, nil);
 	mouseresized = 0;
 	return initimg();
 }
@@ -1099,11 +1084,16 @@ kicklabel(char *label)
 }
 
 void
-setcursor(Cursor *c)
+setcursor(Cursor *c, Cursor2 *c2)
 {
+	Cursors cs;
+	
+	cs.c = c;
+	cs.c2 = c2;
+
 	[AppDelegate
 		performSelectorOnMainThread:@selector(callsetcursor:)
-		withObject:[NSValue valueWithPointer:c]
+		withObject:[NSValue valueWithPointer:&cs]
 		waitUntilDone:YES];
 }
 
blob - 7b41c34b49fc04b49bbec3701697f76a5e3da251
blob + b5e3c70107ba82cd2020c2d9137d8d7950f3c519
--- src/cmd/devdraw/cocoa-screen.h
+++ src/cmd/devdraw/cocoa-screen.h
@@ -2,7 +2,7 @@
 
 Memimage *attachscreen(char*, char*);
 void	setmouse(Point);
-void	setcursor(Cursor*);
+void	setcursor(Cursor*, Cursor2*);
 void	setlabel(char*);
 char*	getsnarf(void);
 void	putsnarf(char*);
blob - 16053eaa2a1157c7f31e737a6f95ed13a71294b5
blob + c2489a6c90b368e746df553053503c8fc2fa4e0a
--- src/cmd/devdraw/cocoa-screen.m
+++ src/cmd/devdraw/cocoa-screen.m
@@ -1410,8 +1410,10 @@ kicklabel0(char *label) {
 }
 
 void
-setcursor(Cursor *c)
+setcursor(Cursor *c, Cursor2 *c2)
 {
+	USED(c2);
+
 	/*
 	 * No cursor change unless in main thread.
 	 */
@@ -1657,4 +1659,10 @@ setprocname(const char *s)
                                                NULL /* optional out param */);
   if(err != noErr)
     fprint(2, "Call to set process name failed\n");
+}
+
+void
+resizewindow(Rectangle r)
+{
+	USED(r);
 }
blob - 6f9449adcf15172d4532c3818caf595051d59b77
blob + 329dd71fa7d7b75f9deffcfecf109214f3f9b4b9
--- src/cmd/devdraw/cocoa-srv.c
+++ src/cmd/devdraw/cocoa-srv.c
@@ -163,9 +163,9 @@ runmsg(Wsysmsg *m)
 
 	case Tcursor:
 		if(m->arrowcursor)
-			setcursor(nil);
+			setcursor(nil, nil);
 		else
-			setcursor(&m->cursor);
+			setcursor(&m->cursor, &m->cursor2);
 		replymsg(m);
 		break;
 			
@@ -221,9 +221,7 @@ runmsg(Wsysmsg *m)
 		break;
 	
 	case Tresize:
-#if OSX_VERSION >= 101400
 		resizewindow(m->rect);
-#endif
 		replymsg(m);
 		break;
 	}
blob - 2e40087e0a3265892e530b69ccc0cfbbaf6a8efc
blob + 7f0c2a2031696ea5d3037e3af16b6114966fc8bf
--- src/cmd/devdraw/mkfile
+++ src/cmd/devdraw/mkfile
@@ -3,6 +3,8 @@
 
 TARG=devdraw
 
+SHORTLIB=draw memdraw
+
 WSYSOFILES=\
 	devdraw.$O\
 	latin1.$O\
blob - f50d8dfe7d023b2cc14d716176b5aea81f1f714b
blob + d5ba3dd24c6a00ba845250087caf07a50a8cd864
--- src/cmd/devdraw/osx-screen.h
+++ src/cmd/devdraw/osx-screen.h
@@ -5,7 +5,7 @@ void	zunlock(void);
 
 Memimage *attachscreen(char*, char*);
 void	setmouse(Point);
-void	setcursor(Cursor*);
+void	setcursor(Cursor*, Cursor2*);
 void	setlabel(char*);
 char*	getsnarf(void);
 void	putsnarf(char*);
blob - 6cbb523593df415f7fb6535a1ca39f0b17dcf1c3
blob + d0a1c2d311ae87adb231fc10ac4379fb0d5f82b7
--- src/cmd/devdraw/osx-srv.c
+++ src/cmd/devdraw/osx-srv.c
@@ -230,9 +230,9 @@ runmsg(Wsysmsg *m)
 
 	case Tcursor:
 		if(m->arrowcursor)
-			setcursor(nil);
+			setcursor(nil, nil);
 		else
-			setcursor(&m->cursor);
+			setcursor(&m->cursor, &m->cursor2);
 		replymsg(m);
 		break;