Module: wine Branch: master Commit: 2e119a2718ccb3cdf32277c5985bc2bb55c52a34 URL: http://source.winehq.org/git/wine.git/?a=commit;h=2e119a2718ccb3cdf32277c598...
Author: Michael Abbott michael@araneidae.co.uk Date: Tue Jun 16 16:20:05 2009 +0100
wined3d: Remove division from inner loop.
---
dlls/wined3d/surface.c | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c index eedc257..400a652 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c @@ -2461,9 +2461,11 @@ static HRESULT d3dfmt_convert_surface(const BYTE *src, BYTE *dst, UINT pitch, UI
for (x = 0; x < width; ++x) { - /* The depth data is normalized, so needs to be scaled, the stencil data isn't. */ - WORD d15 = source[x] & 0xfffe; - DWORD d24 = d15 * 0x100 + (d15 * 0xff80 + 0x3fff80) / 0x7fff00; + /* The depth data is normalized, so needs to be scaled, + * the stencil data isn't. Scale depth data by + * (2^24-1)/(2^15-1) ~~ (2^9 + 2^-6). */ + WORD d15 = source[x] >> 1; + DWORD d24 = (d15 << 9) + (d15 >> 6); dest[x] = (d24 << 8) | (source[x] & 0x1); } }