Changeset 561


Ignore:
Timestamp:
Jul 12, 2006, 5:03:11 PM (16 years ago)
Author:
titer
Message:

Don't repeatedly call htonl

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/TorrentCell.m

    r537 r561  
    4444
    4545// Used to optimize drawing. They contain packed RGBA pixels for every color needed.
     46#define BE OSSwapBigToHostConstInt32
    4647static uint32_t kBorder[] =
    47     { 0x00000005, 0x00000010, 0x00000015, 0x00000015,
    48       0x00000015, 0x00000015, 0x00000015, 0x00000015,
    49       0x00000015, 0x00000015, 0x00000010, 0x00000005 };
    50 
    51 static uint32_t kBack[] = { 0xB4B4B4FF, 0xE3E3E3FF };
    52 
    53 static uint32_t kRed = 0xFF6450FF, //255, 100, 80
    54                 kBlue1 = 0xA0DCFFFF, //160, 220, 255
    55                 kBlue2 = 0x78BEFFFF, //120, 190, 255
    56                 kBlue3 = 0x50A0FFFF, //80, 160, 255
    57                 kBlue4 = 0x1E46B4FF, //30, 70, 180
    58                 kGray = 0x828282FF, //130, 130, 130
    59                 kGreen = 0x00FF00FF; //0, 255, 0
     48    { BE(0x00000005), BE(0x00000010), BE(0x00000015), BE(0x00000015),
     49      BE(0x00000015), BE(0x00000015), BE(0x00000015), BE(0x00000015),
     50      BE(0x00000015), BE(0x00000015), BE(0x00000010), BE(0x00000005) };
     51
     52static uint32_t kBack[] = { BE(0xB4B4B4FF), BE(0xE3E3E3FF) };
     53
     54static uint32_t kRed   = BE(0xFF6450FF), //255, 100, 80
     55                kBlue1 = BE(0xA0DCFFFF), //160, 220, 255
     56                kBlue2 = BE(0x78BEFFFF), //120, 190, 255
     57                kBlue3 = BE(0x50A0FFFF), //80, 160, 255
     58                kBlue4 = BE(0x1E46B4FF), //30, 70, 180
     59                kGray  = BE(0x828282FF), //130, 130, 130
     60                kGreen = BE(0x00FF00FF); //0, 255, 0
    6061
    6162- (id) init
     
    200201    for( h = 0; h < BAR_HEIGHT; h++ )
    201202    {
    202         p[0] = htonl( kBorder[h] );
    203         p[width - 1] = htonl( kBorder[h] );
     203        p[0] = kBorder[h];
     204        p[width - 1] = kBorder[h];
    204205        p += bytesPerRow / 4;
    205206    }
     
    214215        p = (uint32_t *) ( bitmapData + h * bytesPerRow ) + 1;
    215216        for( w = 0; w < end; w++ )
    216             p[w] = htonl( kBlue4 );
     217            p[w] = kBlue4;
    217218        for( w = end; w < width - 2; w++ )
    218             p[w] = htonl( kBack[h] );
     219            p[w] = kBack[h];
    219220    }
    220221
     
    241242        for( h = 2; h < BAR_HEIGHT; h++ )
    242243        {
    243             p[0] = htonl( color );
     244            p[0] = color;
    244245            p = (uint32_t *) ( (uint8_t *) p + bytesPerRow );
    245246        }
Note: See TracChangeset for help on using the changeset viewer.