Ticket #8156: tv2x-20030118.diff

File tv2x-20030118.diff, 1.6 KB (added by cyxx, 18 years ago)

patch against a January 18 CVS snapshot

  • common/scaler.cpp

    diff -ur scummvm-20030118/common/scaler.cpp scummvm-20030118_tv2x/common/scaler.cpp
    old new  
    721721        unsigned int nextlineSrc = srcPitch / sizeof(short);
    722722        short *p = (short *)srcPtr;
    723723
    724         unsigned nextlineDst = dstPitch / sizeof(short);
     724        unsigned int nextlineDst = dstPitch / sizeof(short);
    725725        short *q = (short *)dstPtr;
    726726
    727727        while (height--) {
     
    805805}
    806806
    807807void TV2x(uint8 *srcPtr, uint32 srcPitch, uint8 *null, uint8 *dstPtr, uint32 dstPitch,
    808             int width, int height)
     808                                        int width, int height)
    809809{
    810         unsigned int nextlineSrc = srcPitch / sizeof(short);
    811         short *p = (short *)srcPtr;
     810        unsigned int nextlineSrc = srcPitch / sizeof(uint16);
     811        uint16 *p = (uint16 *)srcPtr;
    812812
    813         unsigned int nextlineDst = dstPitch / sizeof(short);
    814         short *q = (short *)dstPtr;
     813        unsigned int nextlineDst = dstPitch / sizeof(uint16);
     814        uint16 *q = (uint16 *)dstPtr;
    815815
    816816        while(height--) {
    817817                for (int i = 0, j = 0; i < width; ++i, j += 2) {
    818                         unsigned short p1 = *(p + i);
    819                         unsigned short p2 = *(p + i + nextlineSrc);
    820                         unsigned short pi = (unsigned short)((INTERPOLATE(p1, p2) & colorMask) >> 1);
     818                        uint16 p1 = *(p + i);
     819                        uint32 pi;
     820
     821                        pi = (((p1 & redblueMask) * 7) >> 3) & redblueMask;
     822                        pi |= (((p1 & greenMask) * 7) >> 3) & greenMask;
    821823
    822824                        *(q + j) = p1;
    823825                        *(q + j + 1) = p1;
    824                         *(q + j + nextlineDst) = pi;
    825                         *(q + j + nextlineDst + 1) = pi;
     826                        *(q + j + nextlineDst) = (uint16)pi;
     827                        *(q + j + nextlineDst + 1) = (uint16)pi;
    826828                }
    827829                p += nextlineSrc;
    828830                q += nextlineDst << 1;