My first patch!
Sorry this took so long for such a simple patch, I have just been run off my feet until now.
Before I submit this to wine-patches, is anyone able to do some further testing for me, to make sure it doesn't break any currently working games?
This patch fixes a bug that causes a crash for direct draw games when using opengl as the DirectDrawRenderer.
I wanted to make sure this works and is safe, before I venture into making it optimized as Stefan suggested.
On 3/25/07, Stefan Dösinger stefandoesinger@gmx.at wrote:
case WINED3DFMT_P8: { int height = This->glRect.bottom - This->glRect.top; <--!!! type = GL_UNSIGNED_BYTE; fmt = GL_RGBA;
mem = HeapAlloc(GetProcessHeap(), 0, This->resource.size * sizeof(DWORD)); if(!mem) { ERR("Out of memory\n"); return; } memory_allocated = TRUE; d3dfmt_convert_surface(This->resource.allocatedMemory, ...
I think the int height = This->glRect.bottom - This->glRect.top is the problem. It should use This->currentDesc.Height instead. The opengl rectangle is a helper for surfaces which are bigger than the max size supported by opengl If they are used for 2D blits. For example swat3 creates a 3000x32 surface to blit text in 32x32 rectangles. In this case only the needed area is uploaded to gl and used for blits.
Here the gl rectangle does not apply. For the sake of optimization you may change the code to only convert the dirty rectangle instead of the whole surface.