bitblt.c

changeset 72
cddd6226b509
parent 57
b2a2f61135bb
child 96
25c6b1a63f93
     1.1 diff -r 3e2d23e25fc3 -r cddd6226b509 bitblt.c
     1.2 --- a/bitblt.c	Sat Feb 22 10:02:06 2003 +0000
     1.3 +++ b/bitblt.c	Sun Feb 23 17:40:41 2003 +0000
     1.4 @@ -4,7 +4,7 @@
     1.5   *      will be compressed using ITU-T T.6 (G4) fax encoding.
     1.6   *
     1.7   * bitblt routines
     1.8 - * $Id: bitblt.c,v 1.12 2003/02/20 04:11:06 eric Exp $
     1.9 + * $Id: bitblt.c,v 1.13 2003/02/23 09:40:41 eric Exp $
    1.10   * Copyright 2001, 2002, 2003 Eric Smith <eric@brouhaha.com>
    1.11   *
    1.12   * This program is free software; you can redistribute it and/or modify
    1.13 @@ -730,7 +730,7 @@
    1.14  			     int32_t y,
    1.15  			     int32_t min_x, int32_t max_x,
    1.16  			     int32_t max_runs,
    1.17 -			     uint32_t *run_length)
    1.18 +			     run_t *runs)
    1.19  {
    1.20    uint8_t *byte_ptr;
    1.21    uint8_t byte;
    1.22 @@ -742,6 +742,7 @@
    1.23  
    1.24    uint8_t pol = 0x00;  /* 0x00 = counting zeros (white),
    1.25  			  0xff = counting ones (black) */
    1.26 +  int32_t left = 0;  /* left x coordinate of current run, relative */
    1.27  
    1.28    uint32_t rl;
    1.29    int32_t i = 0;
    1.30 @@ -780,7 +781,11 @@
    1.31  	  if (last_flag)
    1.32  	    {
    1.33  	      if (rl)
    1.34 -		run_length [i++] = rl;
    1.35 +		{
    1.36 +		  runs [i].value = pol;
    1.37 +		  runs [i].left = left;
    1.38 +		  runs [i++].width = rl;
    1.39 +		}
    1.40  	      return (i);
    1.41  	    }
    1.42  	  bit_pos = 0;
    1.43 @@ -794,7 +799,10 @@
    1.44  	}
    1.45        else
    1.46  	{
    1.47 -	  run_length [i++] = rl;
    1.48 +	  runs [i].value = pol;
    1.49 +	  runs [i].left = left;
    1.50 +	  runs [i++].width = rl;
    1.51 +	  left += rl;
    1.52  	  if (i == max_runs)
    1.53  	    return (-i);
    1.54  	  rl = 0;