Ticket #4880: iphone-grabPalette.patch

File iphone-grabPalette.patch, 975 bytes (added by fingolfin, 10 years ago)

Attempt to implement grabPalette

  • backends/platform/iphone/osys_video.cpp

    diff -r a1eddce45d35 backends/platform/iphone/osys_video.cpp
    a b int16 OSystem_IPHONE::getWidth() {  
    8686}
    8787
    8888void OSystem_IPHONE::setPalette(const byte *colors, uint start, uint num) {
    89         //printf("setPalette()\n");
     89        assert(start + num <= 256);
    9090        const byte *b = colors;
    9191
    9292        for (uint i = start; i < start + num; ++i) {
    void OSystem_IPHONE::setPalette(const by  
    9898}
    9999
    100100void OSystem_IPHONE::grabPalette(byte *colors, uint start, uint num) {
    101         //printf("grabPalette()\n");
     101        assert(start + num <= 256);
     102        const byte *b = colors;
     103
     104        for (uint i = start; i < start + num; ++i) {
     105                Graphics::colorToRGB<Graphics::ColorMasks<565> >(_palette[i], b[0], b[1], b[2]);
     106                b[3] = 0xFF;
     107                b += 4;
     108        }
    102109}
    103110
    104111void OSystem_IPHONE::copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) {