使用memcpy的图像工件

时间:2015-02-15 21:38:16

标签: c++ framebuffer

我正在为非常古老的游戏(7个王国)添加自定义分辨率,并且我有问题,带有artifacted输出。这个游戏使用SDL框架

enter image description here

负责此事的代码:

void IMGcall IMGcopy(char* imageBuf, int imgPitch, char* backBuf, int backPitch, int x1, int y1, int x2, int y2)
{

    std::cout << imageBuf << "\n" << imgPitch << "\n" << backBuf << "\n" << backPitch << "\n" << x1 << "\n" << y1 << "\n" << x2 << "\n" << y2 << "\n";
    int width = x2 - x1 + 1;
    int height = y2 - y1 + 1;
    int dest = y1*imgPitch + x1;
    int src = y1*backPitch + x1;
    for (int j=0; j<height; ++j, dest+=imgPitch, src+=backPitch)
    {
        memcpy( &imageBuf[ dest ], &backBuf[ src ], width );
    }
}

args值是:

???
1440
//here goes binary backBuf
1440
0
0
1439
899

我缺少什么?

P.S。很抱歉可能是noobish问题,但我是脚本语言(ruby,python)的主要编码,但是想要为旧游戏添加功能,因为我和我的朋友一起玩

0 个答案:

没有答案