mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-08-19 21:16:34 +00:00
Resample thumbnails to fix JPEG shear distortion if(width % 4 != 0)
This commit is contained in:
@@ -2975,15 +2975,17 @@ WrappedOpenGL::BackbufferImage *WrappedOpenGL::SaveBackbufferImage()
|
||||
m_Real.glPixelStorei(eGL_PACK_ALIGNMENT, prevPackAlignment);
|
||||
|
||||
// scale down if necessary using simple point sampling
|
||||
if(thwidth > maxSize)
|
||||
uint32_t resample_width = RDCMIN(maxSize, thwidth);
|
||||
resample_width &= ~3; // JPEG encoder gives shear distortion if width is not divisible by 4.
|
||||
if(thwidth != resample_width)
|
||||
{
|
||||
float widthf = float(thwidth);
|
||||
float heightf = float(thheight);
|
||||
|
||||
float aspect = widthf / heightf;
|
||||
|
||||
// clamp dimensions to a width of maxSize
|
||||
thwidth = maxSize;
|
||||
// clamp dimensions to a width of resample_width
|
||||
thwidth = resample_width;
|
||||
thheight = uint32_t(float(thwidth) / aspect);
|
||||
|
||||
byte *src = thpixels;
|
||||
|
||||
Reference in New Issue
Block a user