[cairo-commit] cairo-demo/png write_png.c, 1.3, 1.4 ChangeLog, 1.8, 1.9

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


Committed by: cworth

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

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.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** a/write_png.c	13 Mar 2004 11:57:33 -0000	1.3
--- b/write_png.c	29 Apr 2004 05:28:31 -0000	1.4
***************
*** 39,45 ****
      for (i = 0; i < row_info->rowbytes; i += 4) {
          unsigned char *b = &data[i];
!         unsigned long *p = (unsigned long *) &data[i];
!         unsigned long pixel = *p;
!         unsigned char alpha = (pixel & 0xff000000) >> 24;
          if (alpha == 0) {
              *p = 0;
--- 39,48 ----
      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) {
              *p = 0;

Index: ChangeLog
===================================================================
RCS file: /cvs/cairo/cairo-demo/png/ChangeLog,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** a/ChangeLog	6 Apr 2004 20:08:20 -0000	1.8
--- b/ChangeLog	29 Apr 2004 05:28:31 -0000	1.9
***************
*** 1,2 ****
--- 1,8 ----
+ 2004-04-28  Carl Worth  <cworth at isi.edu>
+ 
+ 	* write_png.c (unpremultiply_data): Use memcpy rather than
+ 	assignment to avoid problems with unaligned pointers on particular
+ 	machines.
+ 
  2004-04-06  David Reveman  <c99drn at cs.umu.se>
  





More information about the cairo-commit mailing list