git: 9front

Download patch

ref: 1dfb1b73ee62bad1b86bda8045a6c0d25717ff83
parent: 9f12b6c92fe91096fdbb80a5644f379f7c492680
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sat Nov 8 06:48:38 EST 2014

dont flush screen when hiding software cursor

we can avoid some flickering when removing the software cursor
from the shadow framebuffer by avoiding the flushscreenimage()
call.

once the cursor is redrawn, we flush the combined rect of its
old and new position in one go.

--- a/sys/src/9/port/swcursor.c
+++ b/sys/src/9/port/swcursor.c
@@ -42,7 +42,6 @@
 		return;
 	swvisible = 0;
 	memimagedraw(gscreen, swrect, swback, ZP, memopaque, ZP, S);
-	flushmemscreen(swrect);
 }
 
 void
@@ -57,6 +56,8 @@
 void
 swcursordraw(Point p)
 {
+	Rectangle flushr;
+
 	if(swvisible)
 		return;
 	if(swback == nil || swimg1 == nil || swmask1 == nil || gscreen == nil)
@@ -63,10 +64,12 @@
 		return;
 	assert(!canqlock(&drawlock));
 	swvispt = addpt(swoffset, p);
+	flushr = swrect; 
 	swrect = rectaddpt(Rect(0,0,16,16), swvispt);
+	combinerect(&flushr, swrect);
 	memimagedraw(swback, swback->r, gscreen, swvispt, memopaque, ZP, S);
 	memimagedraw(gscreen, swrect, swimg1, ZP, swmask1, ZP, SoverD);
-	flushmemscreen(swrect);
+	flushmemscreen(flushr);
 	swvisible = 1;
 }
 
--