[cairo-commit] cairo-demo/png write_png.c, 1.5, 1.6 ChangeLog, 1.10, 1.11

Carl Worth commit at pdx.freedesktop.org
Wed Apr 28 22:39:00 PDT 2004


Committed by: cworth

Update of /cvs/cairo/cairo-demo/png
In directory pdx:/tmp/cvs-serv25581

Modified Files:
	write_png.c ChangeLog 
Log Message:

        * write_png.c (unpremultiply_data): Use memcpy rather than
        assignment to avoid problems with unaligned pointers on particular
        machines.


Index: write_png.c
===================================================================
RCS file: /cvs/cairo/cairo-demo/png/write_png.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** a/write_png.c	29 Apr 2004 05:36:01 -0000	1.5
--- b/write_png.c	29 Apr 2004 05:38:57 -0000	1.6
***************
*** 39,47 ****
      for (i = 0; i < row_info->rowbytes; i += 4) {
          unsigned char *b = &data[i];
-         unsigned int *p = (unsigned int *) &data[i];
          unsigned int pixel;
          unsigned char alpha;
  
! 	memcpy (&pixel, p, sizeof (unsigned int));
  	alpha = (pixel & 0xff000000) >> 24;
          if (alpha == 0) {
--- 39,46 ----
      for (i = 0; i < row_info->rowbytes; i += 4) {
          unsigned char *b = &data[i];
          unsigned int pixel;
          unsigned char alpha;
  
! 	memcpy (&pixel, b, sizeof (unsigned int));
  	alpha = (pixel & 0xff000000) >> 24;
          if (alpha == 0) {

Index: ChangeLog
===================================================================
RCS file: /cvs/cairo/cairo-demo/png/ChangeLog,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** a/ChangeLog	29 Apr 2004 05:36:01 -0000	1.10
--- b/ChangeLog	29 Apr 2004 05:38:57 -0000	1.11
***************
*** 5,8 ****
--- 5,9 ----
  	machines.
  	(unpremultiply_data): Missed one.
+ 	(unpremultiply_data): Take three.
  
  2004-04-06  David Reveman  <c99drn at cs.umu.se>





More information about the cairo-commit mailing list