Ticket #8079: codec5-cleanup.diff

File codec5-cleanup.diff, 3.1 KB (added by eriktorbjorn, 22 years ago)

Patch against an October 7 CVS snapshot

  • scummvm/scumm/akos.cpp

    diff -ur ScummVM-cvs20021007/scummvm/scumm/akos.cpp ScummVM-cvs20021007+hack/scummvm/scumm/akos.cpp
    old new  
    859859
    860860void AkosRenderer::codec5()
    861861{
    862         VirtScreen *vs;
    863 
    864862        int left, right, top, bottom;
    865         int clip_left, clip_right, clip_top, clip_bottom;
     863        int clip_top, clip_bottom;
     864        int screen_width = (int) outwidth;
     865        int screen_height = (int) outheight;
    866866
    867867        byte *src, *dest;
    868868        int src_x, src_y;
     
    880880        // What I do know is that drawBomp() doesn't care about masking and
    881881        // shadows, and these are both needed for Full Throttle and The Dig.
    882882       
    883         vs = &_vm->virtscr[0];
    884 
    885883        if (!mirror) {
    886884                left = (x - move_x_cur - width) + 1;
    887885        } else {
     
    892890        top = y + move_y_cur;
    893891        bottom = top + height;
    894892
    895         if (left >= _vm->_realWidth || top >= _vm->_realHeight)
     893        if (left >= screen_width || top >= screen_height)
    896894                return;
    897895
     896        _vm->updateDirtyRect(0, left, right, top, bottom, 1 << dirty_id);
     897
    898898        // The actual drawing code shouldn't survive even if the image is
    899         // partially outside the screen, but something before that seems to
    900         // be less tolerant...
     899        // partially outside the screen, but I used to have trouble with
     900        // crashes here so other functions may be less tolerant...
    901901
    902         clip_left = (left >= 0) ? left : 0;
    903         clip_right = (right > _vm->_realWidth) ? _vm->_realWidth : right;
    904902        clip_top = (top >= 0) ? top : 0;
    905         clip_bottom = (bottom > _vm->_realHeight) ? _vm->_realHeight : bottom;
    906        
     903        clip_bottom = (bottom > screen_height) ? screen_height : bottom;
     904
    907905        if (clip_top < draw_top)
    908906                draw_top = clip_top;
    909907        if (clip_bottom > draw_bottom)
    910908                draw_bottom = clip_bottom;
    911909
    912         _vm->updateDirtyRect(0, clip_left, clip_right, clip_top, clip_bottom, 1 << dirty_id);
    913 
    914910        masking = false;
    915911        if (clipping) {
    916                 masking = _vm->isMaskActiveAt(clip_left, clip_top, clip_right, clip_bottom,
     912                masking = _vm->isMaskActiveAt(left, top, right, clip_bottom,
    917913                        _vm->getResourceAddress(rtBuffer, 9) +
    918914                        _vm->gdi._imgBufOffs[clipping] +
    919915                        _vm->_screenStartStrip) != 0;
     
    936932        for (src_y = 0, dst_y = top; src_y < height; src_y++) {
    937933                byte code, color;
    938934                uint num, i;
    939                 byte *d = dest + dst_y * _vm->_realWidth + left;
     935                byte *d = dest + dst_y * screen_width + left;
    940936                byte *s;
    941937                uint data_length;
    942938
    943939                data_length = READ_LE_UINT16(src) + 2;
    944940
    945                 if (dst_y < 0 || dst_y >= _vm->_realHeight) {
     941                if (dst_y < 0 || dst_y >= screen_height) {
    946942                        src += data_length;
    947943                        dst_y++;
    948944                        continue;
     
    958954                        if (code & 1) {
    959955                                color = *s++;
    960956                                for (i = 0; i < num; i++) {
    961                                         if (dst_x >= 0 && dst_x < _vm->_realWidth) {
     957                                        if (dst_x >= 0 && dst_x < screen_width) {
    962958                                                if (color != 255) {
    963959                                                        if (v1.mask_ptr)
    964960                                                                mask = v1.mask_ptr + 40 * dst_y + (dst_x >> 3);
     
    976972                        } else {
    977973                                for (i = 0; i < num; i++) {
    978974                                        color = s[i];
    979                                         if (dst_x >= 0 && dst_x < _vm->_realWidth) {
     975                                        if (dst_x >= 0 && dst_x < screen_width) {
    980976                                                if (color != 255) {
    981977                                                        if (v1.mask_ptr)
    982978                                                                mask = v1.mask_ptr + 40 * dst_y + (dst_x >> 3);