blewett@RESEARCH.ATT.COM (C. Douglas Blewett) (01/02/89)
The following is a couple line patch (not a bug fix) to X.V11R3/contrib/widgets/Xhp/Xw/SRaster.c to improve the image display performance. *** oSRaster.c Sun Jan 1 13:49:57 1989 --- nSRaster.c Sun Jan 1 13:39:34 1989 *************** *** 304,317 **** * event = XEvent structure * gc = GC to use ****************************************************************/ ! static void ShowSR(w, event,gc) register XwSRasterWidget w; ! XEvent *event; GC gc; { int HOffset,WOffset; int VisHeight,VisWidth; register ImageW,ImageH; if ((w->sraster.image == NULL) || (w->sraster.image->data == NULL)) { --- 304,319 ---- * event = XEvent structure * gc = GC to use ****************************************************************/ ! static void ShowSR(w, event, gc) register XwSRasterWidget w; ! XExposeEvent *event; GC gc; { int HOffset,WOffset; int VisHeight,VisWidth; register ImageW,ImageH; + int src_x = 0; + int src_y = 0; if ((w->sraster.image == NULL) || (w->sraster.image->data == NULL)) { *************** *** 345,353 **** VisHeight = w->core.height - (HOffset << 1); } if (XtIsRealized(w)) { XPutImage(XtDisplay(w),XtWindow(w),gc,w->sraster.image, ! 0,0, WOffset, HOffset,VisWidth,VisHeight); /* * We don't want to lose the highlight on redisplay * do we? --- 347,367 ---- VisHeight = w->core.height - (HOffset << 1); } + if (event && event -> type == Expose) + { + src_x = event -> x; + src_y = event -> y; + WOffset += src_x; + HOffset += src_y; + if (event -> width < VisWidth) + VisWidth = event -> width; + if (event -> height < VisHeight) + VisHeight = event -> height; + } + if (XtIsRealized(w)) { XPutImage(XtDisplay(w),XtWindow(w),gc,w->sraster.image, ! src_x, src_y, WOffset, HOffset,VisWidth,VisHeight); /* * We don't want to lose the highlight on redisplay * do we? *************** *** 495,504 **** *************************************<->***********************************/ ! static void Resize(w) XwSRasterWidget w; { ! ShowSR(w,NULL,w->sraster.NormalGC); } --- 509,519 ---- *************************************<->***********************************/ ! static void Resize (w, event) XwSRasterWidget w; + XExposeEvent *event; { ! ShowSR(w, event, w->sraster.NormalGC); } Doug Blewett (201) 582-6496 AT&T Bell Laboratories research!blewett office 2c470 blewett%research.att.com@relay.cs.net 600 Mountain Avenue blewett@research.att.com Murray Hill, NJ 07974 Doug Blewett (201) 582-6496 AT&T Bell Laboratories research!blewett office 2c470 blewett%research.att.com@relay.cs.net 600 Mountain Avenue blewett@research.att.com Murray Hill, NJ 07974