wined3d: Optimize d3dfmt_convert_surface.
This commit is contained in:
parent
98179f0656
commit
dc743d82ff
|
@ -936,7 +936,7 @@ static void flush_to_framebuffer_drawpixels(IWineD3DSurfaceImpl *This) {
|
||||||
case WINED3DFMT_P8:
|
case WINED3DFMT_P8:
|
||||||
{
|
{
|
||||||
UINT pitch = IWineD3DSurface_GetPitch((IWineD3DSurface *) This); /* target is argb, 4 byte */
|
UINT pitch = IWineD3DSurface_GetPitch((IWineD3DSurface *) This); /* target is argb, 4 byte */
|
||||||
int row;
|
int height = This->glRect.bottom - This->glRect.top;
|
||||||
type = GL_UNSIGNED_BYTE;
|
type = GL_UNSIGNED_BYTE;
|
||||||
fmt = GL_RGBA;
|
fmt = GL_RGBA;
|
||||||
|
|
||||||
|
@ -945,12 +945,11 @@ static void flush_to_framebuffer_drawpixels(IWineD3DSurfaceImpl *This) {
|
||||||
ERR("Out of memory\n");
|
ERR("Out of memory\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for(row = This->dirtyRect.top; row < This->dirtyRect.bottom; row++) {
|
d3dfmt_convert_surface(This->resource.allocatedMemory,
|
||||||
d3dfmt_convert_surface(This->resource.allocatedMemory + row * pitch + This->lockedRect.left,
|
mem,
|
||||||
(BYTE *) mem + row * pitch * 4 + This->lockedRect.left * 4,
|
pitch*height,
|
||||||
This->lockedRect.right - This->lockedRect.left,
|
CONVERT_PALETTED,
|
||||||
CONVERT_PALETTED, This);
|
This);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1813,11 +1812,10 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_LoadTexture(IWineD3DSurface *iface) {
|
||||||
else This->Flags &= ~SFLAG_GLCKEY;
|
else This->Flags &= ~SFLAG_GLCKEY;
|
||||||
d3dfmt_get_conv(This, TRUE /* We need color keying */, &format, &internal, &type, &convert, &bpp);
|
d3dfmt_get_conv(This, TRUE /* We need color keying */, &format, &internal, &type, &convert, &bpp);
|
||||||
|
|
||||||
if((convert != NO_CONVERSION) &&
|
if((convert != NO_CONVERSION) && This->resource.allocatedMemory) {
|
||||||
This->resource.allocatedMemory) {
|
|
||||||
int width = This->glRect.right - This->glRect.left;
|
int width = This->glRect.right - This->glRect.left;
|
||||||
int height = This->glRect.bottom - This->glRect.top;
|
int height = This->glRect.bottom - This->glRect.top;
|
||||||
int row;
|
int pitch = IWineD3DSurface_GetPitch(iface);
|
||||||
|
|
||||||
mem = HeapAlloc(GetProcessHeap(), 0, width * height * bpp);
|
mem = HeapAlloc(GetProcessHeap(), 0, width * height * bpp);
|
||||||
if(!mem) {
|
if(!mem) {
|
||||||
|
@ -1825,14 +1823,14 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_LoadTexture(IWineD3DSurface *iface) {
|
||||||
return WINED3DERR_OUTOFVIDEOMEMORY;
|
return WINED3DERR_OUTOFVIDEOMEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(row = This->glRect.top; row < This->glRect.bottom; row++) {
|
d3dfmt_convert_surface(This->resource.allocatedMemory,
|
||||||
BYTE *cur = This->resource.allocatedMemory + row * This->pow2Width * This->bytesPerPixel;
|
mem,
|
||||||
d3dfmt_convert_surface(cur + This->glRect.left * This->bytesPerPixel,
|
pitch*height,
|
||||||
mem + row * width * bpp,
|
convert,
|
||||||
width,
|
This);
|
||||||
convert,
|
/* Make sure the correct pitch is used */
|
||||||
This);
|
glPixelStorei(GL_UNPACK_ROW_LENGTH, pitch);
|
||||||
}
|
|
||||||
This->Flags |= SFLAG_CONVERTED;
|
This->Flags |= SFLAG_CONVERTED;
|
||||||
} else {
|
} else {
|
||||||
This->Flags &= ~SFLAG_CONVERTED;
|
This->Flags &= ~SFLAG_CONVERTED;
|
||||||
|
|
Loading…
Reference in New Issue