bluescan / tacentview

An image and texture viewer for tga, png, apng, exr, dds, pvr, ktx, ktx2, astc, pkm, qoi, gif, hdr, jpg, tif, ico, webp, and bmp files. Uses Dear ImGui, OpenGL, and Tacent. Useful for game devs as it displays information like the presence of an alpha channel and querying specific pixels for their colour.
ISC License
344 stars 33 forks source link

Images are incorrectly centered at some window sizes #40

Closed Oddwarg closed 2 years ago

Oddwarg commented 2 years ago

Small images appear blurry at some window sizes because the image centering logic at TacentView.cpp line 975 is incorrect. This can be fixed by replacing the block with the following:

float offsetW = tMath::tRound((draww - w) / 2.0f);
left    += offsetW;
right   = left+w;

float offsetH = tMath::tRound((drawh - h) / 2.0f);
bottom  += offsetH;
top     = bottom+h;

Blurry, incorrect: blurry Clear, correct: correct

bluescan commented 2 years ago

Thanks for the fix. It has been tested/pushed in 332a17c62024225cb6247f8014cdce1fcb8d7bba