mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
d3d9: Use a half-pixel offset when drawing a tex.
Fixes half pixel offset issues (center of pixels is 0,0 in d3d9, but texels are at 0.5/w,0.5/h.)
This commit is contained in:
parent
8d4a642787
commit
6d08b363c2
1 changed files with 4 additions and 2 deletions
|
@ -323,9 +323,11 @@ namespace DX9 {
|
|||
|
||||
float invDestW = 1.0f / (destW * 0.5f);
|
||||
float invDestH = 1.0f / (destH * 0.5f);
|
||||
float halfPixelX = invDestW * 0.5f;
|
||||
float halfPixelY = invDestH * 0.5f;
|
||||
for (int i = 0; i < 4; i++) {
|
||||
coord[i * 5] = coord[i * 5] * invDestW - 1.0f;
|
||||
coord[i * 5 + 1] = -(coord[i * 5 + 1] * invDestH - 1.0f);
|
||||
coord[i * 5] = coord[i * 5] * invDestW - 1.0f + halfPixelX;
|
||||
coord[i * 5 + 1] = -(coord[i * 5 + 1] * invDestH - 1.0f - halfPixelY);
|
||||
}
|
||||
|
||||
//pD3Ddevice->SetRenderState(D3DRS_FILLMODE, D3DFILL_WIREFRAME);
|
||||
|
|
Loading…
Add table
Reference in a new issue