]> git.zerfleddert.de Git - micropolis/commitdiff
only swap bytes in mini map when needed
authorMichael Gernoth <michael@gernoth.net>
Sun, 13 Jan 2008 15:23:06 +0000 (16:23 +0100)
committerMichael Gernoth <michael@gernoth.net>
Sun, 13 Jan 2008 15:23:06 +0000 (16:23 +0100)
src/sim/g_smmaps.c
src/sim/headers/view.h
src/sim/w_x.c

index b29199b092f11d4199144caddbe09cfc8378f9ff..4ca499a2c97bcc1e16fa37a7c5c8fe99cf256c55 100644 (file)
@@ -141,10 +141,10 @@ int DynamicData[32];
 #define BE_ROW3_24 BE_ROW1_24(0) BE_ROW1_24(1) BE_ROW1_24(2)
 #define BE_ROW3_32 BE_ROW1_32(0) BE_ROW1_32(1) BE_ROW1_32(2)
 
-#define ROW3_8 if (view->x->big_endian) { BE_ROW3_8 } else { LE_ROW3_8 }
-#define ROW3_16 if (view->x->big_endian) { BE_ROW3_16 } else { LE_ROW3_16 }
-#define ROW3_24 if (view->x->big_endian) { BE_ROW3_24 } else { LE_ROW3_24 }
-#define ROW3_32 if (view->x->big_endian) { BE_ROW3_32 } else { LE_ROW3_32 }
+#define ROW3_8 if (view->x->needs_swap) { BE_ROW3_8 } else { LE_ROW3_8 }
+#define ROW3_16 if (view->x->needs_swap) { BE_ROW3_16 } else { LE_ROW3_16 }
+#define ROW3_24 if (view->x->needs_swap) { BE_ROW3_24 } else { LE_ROW3_24 }
+#define ROW3_32 if (view->x->needs_swap) { BE_ROW3_32 } else { LE_ROW3_32 }
 
 #define ROW3 \
          switch (view->x->depth) { \
index aabdafe8b100a91fd4d237bd7087dfd46f21cb0e..8f87fe0f7dd5e9e4f44a1a0dcea571436ca5e907 100644 (file)
@@ -113,7 +113,7 @@ typedef struct XDisplay {
   Pixmap vert_stipple;
   Pixmap horiz_stipple;
   Pixmap diag_stipple;
-  int big_endian;
+  int needs_swap;
 } XDisplay;
 
 
index 76e9ff6eb6392a87b4f551f7feed35d2d178094e..513072e5a55aa5daa55d67ed96b28d55b2416388 100644 (file)
@@ -490,6 +490,7 @@ SimView *
 InitNewView(SimView *view, char *title, int class, int w, int h)
 {
   int type, i;
+  int test = 1;
   int d = 8;
   unsigned long valuemask = 0;
   char *t;
@@ -584,7 +585,11 @@ InitNewView(SimView *view, char *title, int class, int w, int h)
     view->type = X_Mem_View;
   }
 
-  view->x->big_endian = (ImageByteOrder(view->x->dpy) == MSBFirst);
+  if ((ImageByteOrder(view->x->dpy) == MSBFirst) == !(*(unsigned char*) (&test)))
+    view->x->needs_swap = 0;
+  else
+    view->x->needs_swap = 1;
+
 
   GetPixmaps(view->x);
   view->pixels = view->x->pixels;
Impressum, Datenschutz