~ubuntu-branches/ubuntu/karmic/xscreensaver/karmic

« back to all changes in this revision

Viewing changes to hacks/glx/xpm-ximage.c

  • Committer: Bazaar Package Importer
  • Author(s): Ralf Hildebrandt
  • Date: 2006-07-29 23:00:43 UTC
  • mfrom: (1.1.3 upstream)
  • mto: This revision was merged to the branch mainline in revision 15.
  • Revision ID: james.westby@ubuntu.com-20060729230043-3ergkicskbntet5n
Tags: 4.24-5
remove /usr/doc/xscreensaver link to finish /usr/doc ->
/usr/share/doc transition (closes: #380394)

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
extern char *progname;
24
24
 
25
25
 
 
26
static Bool
 
27
bigendian (void)
 
28
{
 
29
  union { int i; char c[sizeof(int)]; } u;
 
30
  u.i = 1;
 
31
  return !u.c[0];
 
32
}
 
33
 
 
34
 
26
35
#if defined(HAVE_GDK_PIXBUF)
27
36
 
28
37
# include <gdk-pixbuf/gdk-pixbuf.h>
86
95
 
87
96
      image = XCreateImage (dpy, visual, 32, ZPixmap, 0, 0, w, h, 32, 0);
88
97
      image->data = (char *) malloc(h * image->bytes_per_line);
 
98
 
 
99
      /* Set the bit order in the XImage structure to whatever the
 
100
         local host's native bit order is.
 
101
       */
 
102
      image->bitmap_bit_order =
 
103
        image->byte_order =
 
104
          (bigendian() ? MSBFirst : LSBFirst);
 
105
 
 
106
 
89
107
      if (!image->data)
90
108
        {
91
109
          fprintf (stderr, "%s: out of memory (%d x %d)\n", progname, w, h);
165
183
#undef countof
166
184
#define countof(x) (sizeof((x))/sizeof((*x)))
167
185
 
168
 
#if 0
169
 
static Bool
170
 
bigendian (void)
171
 
{
172
 
  union { int i; char c[sizeof(int)]; } u;
173
 
  u.i = 1;
174
 
  return !u.c[0];
175
 
}
176
 
#endif
177
186
 
178
187
 
179
188
/* The libxpm version of this function...
269
278
       things as necessary) OpenGL pretends everything is client-side, so
270
279
       we need to pack things in the right order for the client machine.
271
280
     */
 
281
 
 
282
    ximage->bitmap_bit_order =
 
283
      ximage->byte_order =
 
284
        (bigendian() ? MSBFirst : LSBFirst);
 
285
 
272
286
#if 0
273
287
    /* #### Cherub says that the little-endian case must be taken on MacOSX,
274
288
            or else the colors/alpha are the wrong way around.  How can