bitblt.c

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