summaryrefslogtreecommitdiff
path: root/graphics/glide3/files/patch-h5-glide3-src-glfb_c
blob: 9a523dd7e18496aba072d95ba8d0896a4a6fdb55 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
--- h5/glide3/src/glfb.c.orig	Thu Jan 16 01:23:50 2003
+++ h5/glide3/src/glfb.c	Sun Jul  1 03:06:16 2007
@@ -1308,17 +1308,28 @@
                  FXFALSE,
                  &info))
    {
-      FxU32 *src,*dst;
+      union {
+         FxU32 *src;
+         FxU16 *src16;
+         FxU8 *src8;
+      } s;
+
+      union {
+         FxU32 *dst;
+         FxU16 *dst16;
+         FxU8 *dst8;
+      } d;
+
       FxI32 length,scanline;
       FxU32 src_adjust,dst_adjust,tmp;
 
-      src=(FxU32 *) (((char*)info.lfbPtr)+
+      s.src=(FxU32 *) (((char*)info.lfbPtr)+
                      (src_y*info.strideInBytes) + (src_x * bpp));
-      dst=dst_data;
+      d.dst=dst_data;
       scanline=src_height;
 
       /* set length - alignment fix*/
-      tmp=(((AnyPtr)src)&2);
+      tmp=(((AnyPtr)s.src)&2);
       length=src_width * bpp - tmp;
       src_adjust=info.strideInBytes - tmp;
       dst_adjust=dst_stride - tmp;
@@ -1329,8 +1340,8 @@
       while(src_height--)
       {
          /* adjust starting alignment */
-         if (((AnyPtr)src)&3)
-            *((FxU16 *)dst)++=*((FxU16 *)src)++;
+         if (((AnyPtr)s.src)&3)
+            *d.dst16++ = *s.src16++;
 
          /* read in dwords of pixels */
          if(length)
@@ -1341,16 +1352,21 @@
             /* copies aligned dwords */
             do
             {
-               *((FxU32 *)(((AnyPtr)dst) + byte_index))=*((FxU32 *)(((AnyPtr)src) + byte_index));
+               FxU32 *dst = (FxU32 *)(((AnyPtr)dst) + byte_index);
+               FxU32 *src = (FxU32 *)(((AnyPtr)src) + byte_index);
+               *dst = *src;
             }while((byte_index+=4)<aligned);
 
             /* handle backend misalignment */
-            if (byte_index!=(FxU32)length)
-               *((FxU16 *)(((AnyPtr)dst) + byte_index))=*((FxU16 *)(((AnyPtr)src) + byte_index));
+            if (byte_index!=(FxU32)length) {
+               FxU16 *dst = (FxU16 *)(((AnyPtr)dst) + byte_index);
+               FxU16 *src = (FxU16 *)(((AnyPtr)src) + byte_index);
+               *dst = *src;
+            }
          }
          /* adjust for next line */
-         ((FxU8 *)src)+=src_adjust;
-         ((FxU8 *)dst)+=dst_adjust;
+         s.src8+=src_adjust;
+         d.dst8+=dst_adjust;
       }
       rv=FXTRUE;
       /* unlock buffer */