Changeset 1204


Ignore:
Timestamp:
Apr 8, 2012, 3:28:26 PM (9 years ago)
Author:
sam
Message:

win32: shuffle bytes in GDI images to match what OpenGL supports.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/image/codec/gdiplus-image.cpp

    r1156 r1204  
    9696    }
    9797
     98    /* FIXME: GDI+ doesn't know about RGBA, only ARGB. And OpenGL doesn't
     99     * know about ARGB, only RGBA. So we swap bytes. We could also fix
     100     * this in the shader. */
     101    uint8_t *p = static_cast<uint8_t *>(bdata.Scan0);
     102    for (int y = 0; y < size.y; y++)
     103        for (int x = 0; x < size.x; x++)
     104        {
     105            uint8_t tmp = p[0];
     106            *p++ = p[1];
     107            *p++ = p[1];
     108            *p++ = p[1];
     109            *p++ = tmp;
     110        }
     111
    98112    return true;
    99113}
Note: See TracChangeset for help on using the changeset viewer.