Ignore:
Timestamp:
Nov 10, 2005, 8:04:02 PM (17 years ago)
Author:
Sam Hocevar
Message:
  • fixed 64 bit issues in palette::getquad and palette::fade_to.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • abuse/trunk/src/imlib/palette.cpp

    r4 r15  
    8989}
    9090
    91 long palette::getquad(int x)
     91uint32_t palette::getquad(int x)
    9292{ char entry[4];
    9393  entry[3]=0;
     
    9595  entry[1]=pal[x].green;
    9696  entry[0]=pal[x].blue;
    97   return *((long *)entry);
     97  return *((uint32_t *)entry);
    9898}
    9999
     
    523523void palette::fade_to(int total_fades, int fade_on, int dest_r, int dest_g, int dest_b)
    524524{
    525   unsigned char *sl=(unsigned char *)addr();
    526   int i; 
     525  uint8_t *sl=(uint8_t *)addr();
     526  uint8_t x;
     527  int i;
    527528  for (i=0;i<ncolors;i++)
    528529  {
    529     *(sl++)=(( dest_r-(int)*sl)*fade_on/total_fades+*sl);
    530     *(sl++)=(( dest_g-(int)*sl)*fade_on/total_fades+*sl);
    531     *(sl++)=(( dest_b-(int)*sl)*fade_on/total_fades+*sl);   
     530    x=(( dest_r-(int)*sl)*fade_on/total_fades+*sl);
     531    *(sl++)=x;
     532    x=(( dest_g-(int)*sl)*fade_on/total_fades+*sl);
     533    *(sl++)=x;
     534    x=(( dest_b-(int)*sl)*fade_on/total_fades+*sl);   
     535    *(sl++)=x;
    532536  } 
    533537}
Note: See TracChangeset for help on using the changeset viewer.