Changeset 16391
- Timestamp:
- Feb 9, 2008, 10:11:49 AM (18 years ago)
- Location:
- trunk/Ohana/src/kapa2/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/kapa2/src/Remap16.c
r16256 r16391 1 1 # include "Ximage.h" 2 3 # define MY_SWAP_BYTE(W) { \ 4 char tmp, *X; \ 5 X = (char *) &W; \ 6 tmp = X[0]; X[0] = X[1]; X[1] = tmp; } 2 7 3 8 void Remap16 (Graphic *graphic, KapaImageWidget *image, Picture *picture, Matrix *matrix) { … … 13 18 unsigned short *pixel, pixvalue; 14 19 unsigned short back; 20 int swap_client, swap_server, swap_bytes; 15 21 16 22 ALLOCATE (pixel, unsigned short, graphic[0].Npixels); 23 24 # ifdef BYTE_SWAP 25 swap_client = 1; 26 # else 27 swap_client = 0; 28 # endif 29 30 swap_server = ImageByteOrder (graphic[0].display); 31 swap_bytes = !(swap_client ^ swap_server); 17 32 18 33 // local array for pixel values (is this working??) 19 34 for (i = 0; i < graphic[0].Npixels; i++) { /* set up pixel array */ 20 35 pixel[i] = 0xffff & graphic[0].cmap[i].pixel; 36 if (swap_bytes) MY_SWAP_BYTE (pixel[i]); 21 37 } 22 38 back = 0xffff & graphic[0].back; 39 if (swap_bytes) MY_SWAP_BYTE (back); 40 // XXX not certain this is the correct solution... 23 41 24 42 // set up expansions -
trunk/Ohana/src/kapa2/src/Remap32.c
r16389 r16391 1 1 # include "Ximage.h" 2 3 # define MY_SWAP_INT(A,B) { int tmp; tmp = A; A = B; B = tmp; } 2 4 3 5 # define MY_SWAP_WORD(W) { \ … … 66 68 Picture_Upper (&i_end, &j_end, matrix, picture); 67 69 68 if (i_end < i_start) ISWAP(i_start, i_end);69 if (j_end < j_start) ISWAP(j_start, j_end);70 if (i_end < i_start) MY_SWAP_INT (i_start, i_end); 71 if (j_end < j_start) MY_SWAP_INT (j_start, j_end); 70 72 71 73 // Ix,Iy are the first displayed image pixel
Note:
See TracChangeset
for help on using the changeset viewer.
