http://bugs.winehq.org/show_bug.cgi?id=14762
--- Comment #43 from Stefan Dösinger stefandoesinger@gmx.at 2008-12-04 18:14:43 --- I'll look at your code, but I don't think you want to access an IWineD3DSurfaceImpl anywhere here. You probably have an IWineD3DBaseTexture * and are casting it to an IWineD3DSurfaceImpl *, which as you guessed is not correct. If you know that it is a RECT texture, you know you have an IWineD3DTexture *, so you can safely cast it to IWineD3DTextureImpl *. In there you have the np2 correction matrix, and you'll want to use element 0 and 5 from it.
This is the matrix:
w 0 0 0 0 h 0 0 0 0 1 0 0 0 0 1
This shows why you want elements 0 and 5