From nobody@FreeBSD.ORG  Mon May 22 23:12:36 2000
Return-Path: <nobody@FreeBSD.ORG>
Received: by hub.freebsd.org (Postfix, from userid 32767)
	id 2149537B85A; Mon, 22 May 2000 23:12:36 -0700 (PDT)
Message-Id: <20000523061236.2149537B85A@hub.freebsd.org>
Date: Mon, 22 May 2000 23:12:36 -0700 (PDT)
From: giffunip@tutopia.com
Sender: nobody@FreeBSD.ORG
To: freebsd-gnats-submit@FreeBSD.org
Subject: Minor speedups for libvgl's boxing functions 
X-Send-Pr-Version: www-1.0

>Number:         18769
>Category:       misc
>Synopsis:       Minor speedups for libvgl's boxing functions
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    pfg
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Mon May 22 23:20:00 PDT 2000
>Closed-Date:    Sat Feb 04 04:43:53 UTC 2012
>Last-Modified:  Sat Feb 04 04:43:53 UTC 2012
>Originator:     Pedro F. Giffuni
>Release:        3.4-Release
>Organization:
Universidad Nacional de Colombia
>Environment:
>Description:
The VGL boxing functions usually call VGLLine, which uses some 
arithmetic to work out the slope. In the case of boxes we already know
which lines are horizontal or vertical and we can do it faster.
>How-To-Repeat:
The problem is admittedly not noticeable, however the enhancements in
/usr/lib/libvgl/simple.c were trivial.
>Fix:
*** simple.c.orig	Mon May 22 23:31:21 2000
--- simple.c	Tue May 23 00:53:51 2000
***************
*** 140,157 ****
  void
  VGLBox(VGLBitmap *object, int x1, int y1, int x2, int y2, byte color)
  {
!   VGLLine(object, x1, y1, x2, y1, color);
!   VGLLine(object, x2, y1, x2, y2, color);
!   VGLLine(object, x2, y2, x1, y2, color);
!   VGLLine(object, x1, y2, x1, y1, color);
  }
  
  void
  VGLFilledBox(VGLBitmap *object, int x1, int y1, int x2, int y2, byte color)
  {
!   int y;
  
!   for (y=y1; y<=y2; y++) VGLLine(object, x1, y, x2, y, color);
  }
  
  void
--- 140,165 ----
  void
  VGLBox(VGLBitmap *object, int x1, int y1, int x2, int y2, byte color)
  {
!   int y,x;
! 
!   for (x=x1; x<=x2; x++) {	/* Horizontal lines */
! 	VGLSetXY(object, x, y1, color);
! 	VGLSetXY(object, x, y2, color);
!   }
!   for (y= ++y1; y<y2; y++) {	/* Vertical lines */
! 	VGLSetXY(object, x1, y, color);
! 	VGLSetXY(object, x2, y, color);
!   }
  }
  
  void
  VGLFilledBox(VGLBitmap *object, int x1, int y1, int x2, int y2, byte color)
  {
!   int x,y;
  
!   for (y=y1; y<=y2; y++) {	/* Horizontal lines */
!     for (x=x1; x<=x2; x++) VGLSetXY(object, x, y, color);
!   }
  }
  
  void


>Release-Note:
>Audit-Trail:

From: "Pedro S. Giffuni" <giffunip@netscape.net>
To: freebsd-gnats-submit@FreeBSD.org
Cc:  
Subject: Re: misc/18769: Minor speedups for libvgl's boxing functions
Date: Sun, 23 Jul 2000 21:03:44 -0500

 This is a multi-part message in MIME format.
 --------------53C8809E644D700D4AE87C58
 Content-Type: text/plain; charset=us-ascii
 Content-Transfer-Encoding: 7bit
 
 The attached uu-encoded diff for simple.c further improves VGLFilledBox
 by avoiding some loops.
 --------------53C8809E644D700D4AE87C58
 Content-Type: application/octet-stream;
  name="patch-vgl"
 Content-Transfer-Encoding: x-uuencode
 Content-Disposition: attachment;
  filename="patch-vgl"
 
 begin 644 simple.c.diff
 M*BHJ('-I;7!L92YC+F]R:6<)36]N($YO=B`@."`Q,3HS-SHS.2`Q.3DY"BTM
 M+2!S:6UP;&4N8PE3=6X@2G5L(#(S(#(P.C(V.C`P(#(P,#`**BHJ*BHJ*BHJ
 M*BHJ*BHJ"BHJ*B`Q-3DL,3<V("HJ*BH*("!V;VED"B`@5D=,0F]X*%9'3$)I
 M=&UA<"`J;V)J96-T+"!I;G0@>#$L(&EN="!Y,2P@:6YT('@R+"!I;G0@>3(L
 M(&)Y=&4@8V]L;W(I"B`@>PHA("`@5D=,3&EN92AO8FIE8W0L('@Q+"!Y,2P@
 M>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+"!I;G0@>#(L(&EN="!Y,BP@8GET92!C;VQO<BD*("!["B$@("!I
 M;G0@>"QY=7`L>61O=VX["B`@"B$@("!F;W(@*'ED;W=N/7DQ+"!Y=7`]>3([
 M('ED;W=N/'EU<#L@>61O=VXK*RP@>75P+2TI"B$@("`@(&9O<B`H>#UX,3L@
 M>#P]>#([('@K*RD@('L)+RH@2&]R:7IO;G1A;"!L:6YE<R`J+PHA("`@("`@
 M(%9'3%-E=%A9*&]B:F5C="P@>"P@>75P+"!C;VQO<BD["B$@("`@("`@5D=,
 M4V5T6%DH;V)J96-T+"!X+"!Y9&]W;BP@8V]L;W(I.PHA("`@("!]"B$@("!I
 M9B`H>75P/3UY9&]W;BD)+RH@5V4@;6ES<V5D('1H92!C96YT<F%L(&QI;F4@
 M*B\*(2`@("`@9F]R("AX/7@Q.R!X/#TR.R!X*RLI(`HA("`@("`@(%9'3%-E
 J=%A9*&]B:F5C="P@>"P@>75P+"!C;VQO<BD["B`@?0H@(`H@('9O:60*
 `
 end
 
 --------------53C8809E644D700D4AE87C58--
 
 
 

From: "Pedro S. Giffuni" <giffunip@asme.org>
To: freebsd-gnats-submit@FreeBSD.org
Cc:  
Subject: Re: misc/18769: Minor speedups for libvgl's boxing functions
Date: Sun, 23 Jul 2000 22:25:47 -0500

 This is a multi-part message in MIME format.
 --------------F3BBAF8CEAE36594F3632B54
 Content-Type: text/plain; charset=us-ascii
 Content-Transfer-Encoding: 7bit
 
 I am sorry, the previous patch had a minor typo with a problem difficult
 to notice:
 2 --> x2 on VGLBoxFill.
 
 The attached file fixes this. Also feel free to nuke the comments.
 --------------F3BBAF8CEAE36594F3632B54
 Content-Type: application/octet-stream;
  name="patch-vgl"
 Content-Transfer-Encoding: x-uuencode
 Content-Disposition: attachment;
  filename="patch-vgl"
 
 begin 644 simple.c.diff
 M*BHJ('-I;7!L92YC+F]R:6<)36]N($YO=B`@."`Q,3HS-SHS.2`Q.3DY"BTM
 M+2!S:6UP;&4N8PE3=6X@2G5L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*WDQ.R!Y/'DR.R!Y*RLI('L)+RH@5F5R=&EC86P@;&EN97,@
 M*B\*(2`)5D=,4V5T6%DH;V)J96-T+"!X,2P@>2P@8V]L;W(I.PHA(`E61TQ3
 M971862AO8FIE8W0L('@R+"!Y+"!C;VQO<BD["B$@("!]"B`@?0H@(`H@('9O
 M:60*("!61TQ&:6QL961";W@H5D=,0FET;6%P("IO8FIE8W0L(&EN="!X,2P@
 M:6YT('DQ+"!I;G0@>#(L(&EN="!Y,BP@8GET92!C;VQO<BD*("!["B$@("!I
 M;G0@>"QY=7`L>61O=VX["B`@"B$@("!F;W(@*'ED;W=N/7DQ+"!Y=7`]>3([
 M('ED;W=N/'EU<#L@>61O=VXK*RP@>75P+2TI"B$@("`@(&9O<B`H>#UX,3L@
 M>#P]>#([('@K*RD@('L)+RH@2&]R:7IO;G1A;"!L:6YE<R`J+PHA("`@("`@
 M(%9'3%-E=%A9*&]B:F5C="P@>"P@>75P+"!C;VQO<BD["B$@("`@("`@5D=,
 M4V5T6%DH;V)J96-T+"!X+"!Y9&]W;BP@8V]L;W(I.PHA("`@("!]"B$@("!I
 M9B`H>75P/3UY9&]W;BD)+RH@5V4@;6ES<V5D('1H92!C96YT<F%L(&QI;F4@
 M*B\*(2`@("`@9F]R("AX/7@Q.R!X/#UX,CL@>"LK*2`*(2`@("`@("!61TQ3
 K971862AO8FIE8W0L('@L('EU<"P@8V]L;W(I.PH@('T*("`*("!V;VED"DQ3
 `
 end
 
 --------------F3BBAF8CEAE36594F3632B54--
 
 
 
Responsible-Changed-From-To: freebsd-bugs->sos 
Responsible-Changed-By: sheldonh 
Responsible-Changed-When: Mon Jul 24 02:08:32 PDT 2000 
Responsible-Changed-Why:  
vgl is another of Soren's babies. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=18769 

From: "Pedro F. Giffuni" <pfg1+@pitt.edu>
To: freebsd-gnats-submit@FreeBSD.org
Cc:  
Subject: Re: misc/18769: Minor speedups for libvgl's boxing functions
Date: Sat, 09 Sep 2000 23:16:32 -0400

 This is a multi-part message in MIME format.
 --------------24E0A3755B09B6760F6EFD7A
 Content-Type: text/plain; charset=us-ascii
 Content-Transfer-Encoding: 7bit
 
 I integrated the line drawing algorithm in "Graphic Gems 1"; it claims
 to be 3-4 times faster than the traditional algorithm.
 --------------24E0A3755B09B6760F6EFD7A
 Content-Type: application/octet-stream;
  name="simple"
 Content-Transfer-Encoding: x-uuencode
 Content-Disposition: attachment;
  filename="simple"
 
 begin 644 simple.c.diff
 M*BHJ('-I;7!L92YC+F]R:6<)36]N($YO=B`@."`P-CHS-SHS.2`Q.3DY"BTM
 M+2!S:6UP;&4N8PE3870@4V5P("`Y(#(Q.C(V.C0V(#(P,#`**BHJ*BHJ*BHJ
 M*BHJ*BHJ"BHJ*B`Q,C(L,3<V("HJ*BH*("`@(')E='5R;B`P.PH@('T*("`*
 M("!V;VED"B`@5D=,3&EN92A61TQ":71M87`@*F]B:F5C="P@:6YT('@Q+"!I
 M;G0@>3$L(&EN="!X,BP@:6YT('DR+"!B>71E(&-O;&]R*0H@('L*(2`@(&EN
 M="!D+"!X+"!Y+"!A>"P@87DL('-X+"!S>2P@9'@L(&1Y.PH@(`HA("`@9'@@
 M/2!X,BUX,3L@87@@/2!!0E,H9'@I/#PQ.R!S>"`](%-'3BAD>"D[('@@/2!X
 M,3L*(2`@(&1Y(#T@>3(M>3$[(&%Y(#T@04)3*&1Y*3P\,3L@<WD@/2!31TXH
 M9'DI.R!Y(#T@>3$["B`@"B$@("!I9B`H87@^87DI('L)"0D)"2\J('@@9&]M
 M:6YA;G0@*B\*(2`@("`@9"`](&%Y+2AA>#X^,2D["B$@("`@(&9O<B`H.SLI
 M('L*(2`@("`@("!61TQ3971862AO8FIE8W0L('@L('DL(&-O;&]R*3L*(2`@
 M("`@("!I9B`H>#T]>#(I"B$@"6)R96%K.PHA("`@("`@(&EF("AD/CTP*2![
 M"B$@"7D@*ST@<WD[(&0@+3T@87@["B$@("`@("`@?0HA("`@("`@('@@*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96-T+"!X,BP@>2P@8V]L;W(I.PHA("`@
 M?0H@('T*("`*("!V;VED"B`@5D=,1FEL;&5D0F]X*%9'3$)I=&UA<"`J;V)J
 M96-T+"!I;G0@>#$L(&EN="!Y,2P@:6YT('@R+"!I;G0@>3(L(&)Y=&4@8V]L
 M;W(I"B`@>PHA("`@:6YT('@L>75P+'ED;W=N.PH@(`HA("`@9F]R("AY9&]W
 M;CUY,2P@>75P/7DR.R!Y9&]W;CQY=7`[('ED;W=N*RLL('EU<"TM*0HA("`@
 M("!F;W(@*'@]>#$[('@\/7@R.R!X*RLI("!["2\J($AO<FEZ;VYT86P@;&EN
 M97,@*B\*(2`@("`@("!61TQ3971862AO8FIE8W0L('@L('EU<"P@8V]L;W(I
 M.PHA("`@("`@(%9'3%-E=%A9*&]B:F5C="P@>"P@>61O=VXL(&-O;&]R*3L*
 M(2`@("`@?0HA("`@:68@*'EU<#T]>61O=VXI"2\J(%=E(&UI<W-E9"!T:&4@
 M8V5N=')A;"!L:6YE("HO"B$@("`@(&9O<B`H>#UX,3L@>#P]>#([('@K*RD@
 M"B$@("`@("`@5D=,4V5T6%DH;V)J96-T+"!X+"!Y=7`L(&-O;&]R*3L*("!]
 +"B`@"B`@=F]I9`I,
 `
 end
 
 --------------24E0A3755B09B6760F6EFD7A--
 
 
State-Changed-From-To: open->closed 
State-Changed-By: sos 
State-Changed-When: Mon Apr 28 11:49:30 PDT 2003 
State-Changed-Why:  
Long since this was relevant, I think vgl is no longer used.. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=18769 

From: "=?iso-8859-1?q?Pedro=20F.=20Giffuni?=" <giffunip@yahoo.com>
To: "Sren" Schmidt <sos@FreeBSD.org>
Cc: freebsd-gnats-submit@FreeBSD.org
Subject: Re: misc/18769: Minor speedups for libvgl's boxing functions
Date: Tue, 29 Apr 2003 15:54:14 +0200 (CEST)

 > Long since this was relevant, I think vgl is no
 > longer used..
 > 
 
 I respectfully disagree with the reasoning around this
 decision. As long as libvgl is distributed, and in
 fact included in the FreeBSD base distribution, well
 documented changes like the generic line drawing
 algorithm from "Graphic Gems" shouldn't be just dumped
 in the bit bucket.
 
 
 ______________________________________________________________________
 Yahoo! Cellulari: loghi, suonerie, picture message per il tuo telefonino
 http://it.yahoo.com/mail_it/foot/?http://it.mobile.yahoo.com/index2002.html
State-Changed-From-To: closed->open 
State-Changed-By: pfg 
State-Changed-When: Tue Jan 3 19:44:20 UTC 2012 
State-Changed-Why:  
reopen - unly for the fast line function. 


Responsible-Changed-From-To: sos->pfg 
Responsible-Changed-By: pfg 
Responsible-Changed-When: Tue Jan 3 19:44:20 UTC 2012 
Responsible-Changed-Why:  
Assign to myself. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=18769 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: misc/18769: commit references a PR
Date: Tue,  3 Jan 2012 19:47:43 +0000 (UTC)

 Author: pfg
 Date: Tue Jan  3 19:47:32 2012
 New Revision: 229415
 URL: http://svn.freebsd.org/changeset/base/229415
 
 Log:
   Integrate the line drawing algorithm from the book "Graphic Gems 1".
   
   http://www.graphicsgems.org/
   
   At the time it claimed to be 3-4 times faster than the traditional
   algorithm.
   
   PR:		18769
   Approved by:	jhb (mentor)
   MFC after:	2 weeks
 
 Modified:
   head/lib/libvgl/simple.c
 
 Modified: head/lib/libvgl/simple.c
 ==============================================================================
 --- head/lib/libvgl/simple.c	Tue Jan  3 19:44:36 2012	(r229414)
 +++ head/lib/libvgl/simple.c	Tue Jan  3 19:47:32 2012	(r229415)
 @@ -198,36 +198,205 @@ get_planar:
    return 0;		/* XXX black? */
  }
  
 + /*
 +  * Symmetric Double Step Line Algorithm by Brian Wyvill from
 +  * "Graphics Gems", Academic Press, 1990.
 +  */
 +
 +#define SL_SWAP(a,b)           {a^=b; b^=a; a^=b;}
 +#define SL_ABSOLUTE(i,j,k)     ( (i-j)*(k = ( (i-j)<0 ? -1 : 1)))
 +
 +void
 +plot(VGLBitmap * object, int x, int y, int flag, byte color)
 +{
 +  /* non-zero flag indicates the pixels need swapping back. */
 +  if (flag)
 +    VGLSetXY(object, y, x, color);
 +  else
 +    VGLSetXY(object, x, y, color);
 +}
 +
 +
  void
  VGLLine(VGLBitmap *object, int x1, int y1, int x2, int y2, u_long color)
  {
 -  int d, x, y, ax, ay, sx, sy, dx, dy;
 +  int dx, dy, incr1, incr2, D, x, y, xend, c, pixels_left;
 +  int sign_x, sign_y, step, reverse, i;
  
 -  dx = x2-x1; ax = ABS(dx)<<1; sx = SGN(dx); x = x1;
 -  dy = y2-y1; ay = ABS(dy)<<1; sy = SGN(dy); y = y1;
 +  dx = SL_ABSOLUTE(x2, x1, sign_x);
 +  dy = SL_ABSOLUTE(y2, y1, sign_y);
 +  /* decide increment sign by the slope sign */
 +  if (sign_x == sign_y)
 +    step = 1;
 +  else
 +    step = -1;
 +
 +  if (dy > dx) {	/* chooses axis of greatest movement (make dx) */
 +    SL_SWAP(x1, y1);
 +    SL_SWAP(x2, y2);
 +    SL_SWAP(dx, dy);
 +    reverse = 1;
 +  } else
 +    reverse = 0;
 +  /* note error check for dx==0 should be included here */
 +  if (x1 > x2) {      /* start from the smaller coordinate */
 +    x = x2;
 +    y = y2;
 +    x1 = x1;
 +    y1 = y1;
 +  } else {
 +    x = x1;
 +    y = y1;
 +    x1 = x2;
 +    y1 = y2;
 +  }
 +
 +
 +  /* Note dx=n implies 0 - n or (dx+1) pixels to be set */
 +  /* Go round loop dx/4 times then plot last 0,1,2 or 3 pixels */
 +  /* In fact (dx-1)/4 as 2 pixels are already plotted */
 +  xend = (dx - 1) / 4;
 +  pixels_left = (dx - 1) % 4;  /* number of pixels left over at the
 +           * end */
 +  plot(object, x, y, reverse, color);
 +  if (pixels_left < 0)
 +    return;      /* plot only one pixel for zero length
 +           * vectors */
 +  plot(object, x1, y1, reverse, color);  /* plot first two points */
 +  incr2 = 4 * dy - 2 * dx;
 +  if (incr2 < 0) {    /* slope less than 1/2 */
 +    c = 2 * dy;
 +    incr1 = 2 * c;
 +    D = incr1 - dx;
 +
 +    for (i = 0; i < xend; i++) {  /* plotting loop */
 +      ++x;
 +      --x1;
 +      if (D < 0) {
 +        /* pattern 1 forwards */
 +        plot(object, x, y, reverse, color);
 +        plot(object, ++x, y, reverse, color);
 +        /* pattern 1 backwards */
 +        plot(object, x1, y1, reverse, color);
 +        plot(object, --x1, y1, reverse, color);
 +        D += incr1;
 +      } else {
 +        if (D < c) {
 +          /* pattern 2 forwards */
 +          plot(object, x, y, reverse, color);
 +          plot(object, ++x, y += step, reverse,
 +              color);
 +          /* pattern 2 backwards */
 +          plot(object, x1, y1, reverse, color);
 +          plot(object, --x1, y1 -= step, reverse,
 +              color);
 +        } else {
 +          /* pattern 3 forwards */
 +          plot(object, x, y += step, reverse, color);
 +          plot(object, ++x, y, reverse, color);
 +          /* pattern 3 backwards */
 +          plot(object, x1, y1 -= step, reverse,
 +              color);
 +          plot(object, --x1, y1, reverse, color);
 +        }
 +        D += incr2;
 +      }
 +    }      /* end for */
  
 -  if (ax>ay) {					/* x dominant */
 -    d = ay-(ax>>1);
 -    for (;;) {
 -      VGLSetXY(object, x, y, color);
 -      if (x==x2)
 -	break;
 -      if (d>=0) {
 -	y += sy; d -= ax;
 +    /* plot last pattern */
 +    if (pixels_left) {
 +      if (D < 0) {
 +        plot(object, ++x, y, reverse, color);  /* pattern 1 */
 +        if (pixels_left > 1)
 +          plot(object, ++x, y, reverse, color);
 +        if (pixels_left > 2)
 +          plot(object, --x1, y1, reverse, color);
 +      } else {
 +        if (D < c) {
 +          plot(object, ++x, y, reverse, color);  /* pattern 2  */
 +          if (pixels_left > 1)
 +            plot(object, ++x, y += step, reverse, color);
 +          if (pixels_left > 2)
 +            plot(object, --x1, y1, reverse, color);
 +        } else {
 +          /* pattern 3 */
 +          plot(object, ++x, y += step, reverse, color);
 +          if (pixels_left > 1)
 +            plot(object, ++x, y, reverse, color);
 +          if (pixels_left > 2)
 +            plot(object, --x1, y1 -= step, reverse, color);
 +        }
        }
 -      x += sx; d += ay;
 -    }
 +    }      /* end if pixels_left */
    }
 -  else {					/* y dominant */
 -    d = ax-(ay>>1);
 -    for (;;) {
 -      VGLSetXY(object, x, y, color);
 -      if (y==y2) 
 -	break;
 -      if (d>=0) {
 -	x += sx; d -= ay;
 +  /* end slope < 1/2 */
 +  else {        /* slope greater than 1/2 */
 +    c = 2 * (dy - dx);
 +    incr1 = 2 * c;
 +    D = incr1 + dx;
 +    for (i = 0; i < xend; i++) {
 +      ++x;
 +      --x1;
 +      if (D > 0) {
 +        /* pattern 4 forwards */
 +        plot(object, x, y += step, reverse, color);
 +        plot(object, ++x, y += step, reverse, color);
 +        /* pattern 4 backwards */
 +        plot(object, x1, y1 -= step, reverse, color);
 +        plot(object, --x1, y1 -= step, reverse, color);
 +        D += incr1;
 +      } else {
 +        if (D < c) {
 +          /* pattern 2 forwards */
 +          plot(object, x, y, reverse, color);
 +          plot(object, ++x, y += step, reverse,
 +              color);
 +
 +          /* pattern 2 backwards */
 +          plot(object, x1, y1, reverse, color);
 +          plot(object, --x1, y1 -= step, reverse,
 +              color);
 +        } else {
 +          /* pattern 3 forwards */
 +          plot(object, x, y += step, reverse, color);
 +          plot(object, ++x, y, reverse, color);
 +          /* pattern 3 backwards */
 +          plot(object, x1, y1 -= step, reverse, color);
 +          plot(object, --x1, y1, reverse, color);
 +        }
 +        D += incr2;
 +      }
 +    }      /* end for */
 +    /* plot last pattern */
 +    if (pixels_left) {
 +      if (D > 0) {
 +        plot(object, ++x, y += step, reverse, color);  /* pattern 4 */
 +        if (pixels_left > 1)
 +          plot(object, ++x, y += step, reverse,
 +              color);
 +        if (pixels_left > 2)
 +          plot(object, --x1, y1 -= step, reverse,
 +              color);
 +      } else {
 +        if (D < c) {
 +          plot(object, ++x, y, reverse, color);  /* pattern 2  */
 +          if (pixels_left > 1)
 +            plot(object, ++x, y += step, reverse, color);
 +          if (pixels_left > 2)
 +            plot(object, --x1, y1, reverse, color);
 +        } else {
 +          /* pattern 3 */
 +          plot(object, ++x, y += step, reverse, color);
 +          if (pixels_left > 1)
 +            plot(object, ++x, y, reverse, color);
 +          if (pixels_left > 2) {
 +            if (D > c)  /* step 3 */
 +              plot(object, --x1, y1 -= step, reverse, color);
 +            else  /* step 2 */
 +              plot(object, --x1, y1, reverse, color);
 +          }
 +        }
        }
 -      y += sy; d += ax;
      }
    }
  }
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: open->patched 
State-Changed-By: pfg 
State-Changed-When: Wed Jan 11 21:36:11 UTC 2012 
State-Changed-Why:  
Commited to head. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=18769 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: misc/18769: commit references a PR
Date: Sat,  4 Feb 2012 04:31:49 +0000 (UTC)

 Author: pfg
 Date: Sat Feb  4 04:31:28 2012
 New Revision: 230975
 URL: http://svn.freebsd.org/changeset/base/230975
 
 Log:
   MFC:	r229415, r229516
   
   Integrate the line drawing algorithm from the book "Graphic Gems 1".
   
   http://www.graphicsgems.org/
   
   At the time it claimed to be 3-4 times faster than the traditional
   algorithm.
   
   Make sure this doesn't give problems to clang.
   
   PR:		18769
   Approved by:	jhb (mentor)
 
 Modified:
   stable/9/lib/libvgl/simple.c
 Directory Properties:
   stable/9/lib/libvgl/   (props changed)
 
 Modified: stable/9/lib/libvgl/simple.c
 ==============================================================================
 --- stable/9/lib/libvgl/simple.c	Sat Feb  4 03:08:23 2012	(r230974)
 +++ stable/9/lib/libvgl/simple.c	Sat Feb  4 04:31:28 2012	(r230975)
 @@ -198,36 +198,205 @@ get_planar:
    return 0;		/* XXX black? */
  }
  
 + /*
 +  * Symmetric Double Step Line Algorithm by Brian Wyvill from
 +  * "Graphics Gems", Academic Press, 1990.
 +  */
 +
 +#define SL_SWAP(a,b)           {a^=b; b^=a; a^=b;}
 +#define SL_ABSOLUTE(i,j,k)     ( (i-j)*(k = ( (i-j)<0 ? -1 : 1)))
 +
 +void
 +plot(VGLBitmap * object, int x, int y, int flag, byte color)
 +{
 +  /* non-zero flag indicates the pixels need swapping back. */
 +  if (flag)
 +    VGLSetXY(object, y, x, color);
 +  else
 +    VGLSetXY(object, x, y, color);
 +}
 +
 +
  void
  VGLLine(VGLBitmap *object, int x1, int y1, int x2, int y2, u_long color)
  {
 -  int d, x, y, ax, ay, sx, sy, dx, dy;
 +  int dx, dy, incr1, incr2, D, x, y, xend, c, pixels_left;
 +  int sign_x, sign_y, step, reverse, i;
  
 -  dx = x2-x1; ax = ABS(dx)<<1; sx = SGN(dx); x = x1;
 -  dy = y2-y1; ay = ABS(dy)<<1; sy = SGN(dy); y = y1;
 +  dx = SL_ABSOLUTE(x2, x1, sign_x);
 +  dy = SL_ABSOLUTE(y2, y1, sign_y);
 +  /* decide increment sign by the slope sign */
 +  if (sign_x == sign_y)
 +    step = 1;
 +  else
 +    step = -1;
 +
 +  if (dy > dx) {	/* chooses axis of greatest movement (make dx) */
 +    SL_SWAP(x1, y1);
 +    SL_SWAP(x2, y2);
 +    SL_SWAP(dx, dy);
 +    reverse = 1;
 +  } else
 +    reverse = 0;
 +  /* note error check for dx==0 should be included here */
 +  if (x1 > x2) {      /* start from the smaller coordinate */
 +    x = x2;
 +    y = y2;
 +/*  x1 = x1;
 +    y1 = y1; */
 +  } else {
 +    x = x1;
 +    y = y1;
 +    x1 = x2;
 +    y1 = y2;
 +  }
 +
 +
 +  /* Note dx=n implies 0 - n or (dx+1) pixels to be set */
 +  /* Go round loop dx/4 times then plot last 0,1,2 or 3 pixels */
 +  /* In fact (dx-1)/4 as 2 pixels are already plotted */
 +  xend = (dx - 1) / 4;
 +  pixels_left = (dx - 1) % 4;  /* number of pixels left over at the
 +           * end */
 +  plot(object, x, y, reverse, color);
 +  if (pixels_left < 0)
 +    return;      /* plot only one pixel for zero length
 +           * vectors */
 +  plot(object, x1, y1, reverse, color);  /* plot first two points */
 +  incr2 = 4 * dy - 2 * dx;
 +  if (incr2 < 0) {    /* slope less than 1/2 */
 +    c = 2 * dy;
 +    incr1 = 2 * c;
 +    D = incr1 - dx;
 +
 +    for (i = 0; i < xend; i++) {  /* plotting loop */
 +      ++x;
 +      --x1;
 +      if (D < 0) {
 +        /* pattern 1 forwards */
 +        plot(object, x, y, reverse, color);
 +        plot(object, ++x, y, reverse, color);
 +        /* pattern 1 backwards */
 +        plot(object, x1, y1, reverse, color);
 +        plot(object, --x1, y1, reverse, color);
 +        D += incr1;
 +      } else {
 +        if (D < c) {
 +          /* pattern 2 forwards */
 +          plot(object, x, y, reverse, color);
 +          plot(object, ++x, y += step, reverse,
 +              color);
 +          /* pattern 2 backwards */
 +          plot(object, x1, y1, reverse, color);
 +          plot(object, --x1, y1 -= step, reverse,
 +              color);
 +        } else {
 +          /* pattern 3 forwards */
 +          plot(object, x, y += step, reverse, color);
 +          plot(object, ++x, y, reverse, color);
 +          /* pattern 3 backwards */
 +          plot(object, x1, y1 -= step, reverse,
 +              color);
 +          plot(object, --x1, y1, reverse, color);
 +        }
 +        D += incr2;
 +      }
 +    }      /* end for */
  
 -  if (ax>ay) {					/* x dominant */
 -    d = ay-(ax>>1);
 -    for (;;) {
 -      VGLSetXY(object, x, y, color);
 -      if (x==x2)
 -	break;
 -      if (d>=0) {
 -	y += sy; d -= ax;
 +    /* plot last pattern */
 +    if (pixels_left) {
 +      if (D < 0) {
 +        plot(object, ++x, y, reverse, color);  /* pattern 1 */
 +        if (pixels_left > 1)
 +          plot(object, ++x, y, reverse, color);
 +        if (pixels_left > 2)
 +          plot(object, --x1, y1, reverse, color);
 +      } else {
 +        if (D < c) {
 +          plot(object, ++x, y, reverse, color);  /* pattern 2  */
 +          if (pixels_left > 1)
 +            plot(object, ++x, y += step, reverse, color);
 +          if (pixels_left > 2)
 +            plot(object, --x1, y1, reverse, color);
 +        } else {
 +          /* pattern 3 */
 +          plot(object, ++x, y += step, reverse, color);
 +          if (pixels_left > 1)
 +            plot(object, ++x, y, reverse, color);
 +          if (pixels_left > 2)
 +            plot(object, --x1, y1 -= step, reverse, color);
 +        }
        }
 -      x += sx; d += ay;
 -    }
 +    }      /* end if pixels_left */
    }
 -  else {					/* y dominant */
 -    d = ax-(ay>>1);
 -    for (;;) {
 -      VGLSetXY(object, x, y, color);
 -      if (y==y2) 
 -	break;
 -      if (d>=0) {
 -	x += sx; d -= ay;
 +  /* end slope < 1/2 */
 +  else {        /* slope greater than 1/2 */
 +    c = 2 * (dy - dx);
 +    incr1 = 2 * c;
 +    D = incr1 + dx;
 +    for (i = 0; i < xend; i++) {
 +      ++x;
 +      --x1;
 +      if (D > 0) {
 +        /* pattern 4 forwards */
 +        plot(object, x, y += step, reverse, color);
 +        plot(object, ++x, y += step, reverse, color);
 +        /* pattern 4 backwards */
 +        plot(object, x1, y1 -= step, reverse, color);
 +        plot(object, --x1, y1 -= step, reverse, color);
 +        D += incr1;
 +      } else {
 +        if (D < c) {
 +          /* pattern 2 forwards */
 +          plot(object, x, y, reverse, color);
 +          plot(object, ++x, y += step, reverse,
 +              color);
 +
 +          /* pattern 2 backwards */
 +          plot(object, x1, y1, reverse, color);
 +          plot(object, --x1, y1 -= step, reverse,
 +              color);
 +        } else {
 +          /* pattern 3 forwards */
 +          plot(object, x, y += step, reverse, color);
 +          plot(object, ++x, y, reverse, color);
 +          /* pattern 3 backwards */
 +          plot(object, x1, y1 -= step, reverse, color);
 +          plot(object, --x1, y1, reverse, color);
 +        }
 +        D += incr2;
 +      }
 +    }      /* end for */
 +    /* plot last pattern */
 +    if (pixels_left) {
 +      if (D > 0) {
 +        plot(object, ++x, y += step, reverse, color);  /* pattern 4 */
 +        if (pixels_left > 1)
 +          plot(object, ++x, y += step, reverse,
 +              color);
 +        if (pixels_left > 2)
 +          plot(object, --x1, y1 -= step, reverse,
 +              color);
 +      } else {
 +        if (D < c) {
 +          plot(object, ++x, y, reverse, color);  /* pattern 2  */
 +          if (pixels_left > 1)
 +            plot(object, ++x, y += step, reverse, color);
 +          if (pixels_left > 2)
 +            plot(object, --x1, y1, reverse, color);
 +        } else {
 +          /* pattern 3 */
 +          plot(object, ++x, y += step, reverse, color);
 +          if (pixels_left > 1)
 +            plot(object, ++x, y, reverse, color);
 +          if (pixels_left > 2) {
 +            if (D > c)  /* step 3 */
 +              plot(object, --x1, y1 -= step, reverse, color);
 +            else  /* step 2 */
 +              plot(object, --x1, y1, reverse, color);
 +          }
 +        }
        }
 -      y += sy; d += ax;
      }
    }
  }
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: patched->closed 
State-Changed-By: pfg 
State-Changed-When: Sat Feb 4 04:42:30 UTC 2012 
State-Changed-Why:  
Line drawing algorith was MFC/9 

http://www.freebsd.org/cgi/query-pr.cgi?pr=18769 
>Unformatted:
