Apply thumbnail resampling fix to d3d11.

See CL fb4ec5c7e32905b4bc1c7a66a1074e1e8f8e59c8
for full description.
This commit is contained in:
akharlamov
2018-11-14 18:32:07 +00:00
committed by Baldur Karlsson
parent a1a0b1a7ec
commit 6182c005b9
+4 -10
View File
@@ -1565,17 +1565,12 @@ bool WrappedID3D11Device::EndFrameCapture(void *dev, void *wnd)
{
byte *data = (byte *)mapped.pData;
float aspect = float(desc.Width) / float(desc.Height);
thwidth = (uint16_t)RDCMIN(maxSize, desc.Width);
thwidth &= ~0x7; // align down to multiple of 8
thheight = uint16_t(float(thwidth) / aspect);
thheight = uint16_t(thwidth * desc.Height / desc.Width);
thpixels = new byte[3U * thwidth * thheight];
float widthf = float(desc.Width);
float heightf = float(desc.Height);
uint32_t stride = fmt.compByteWidth * fmt.compCount;
bool buf1010102 = false;
@@ -1593,11 +1588,10 @@ bool WrappedID3D11Device::EndFrameCapture(void *dev, void *wnd)
{
for(uint32_t x = 0; x < thwidth; x++)
{
float xf = float(x) / float(thwidth);
float yf = float(y) / float(thheight);
uint32_t xSource = x * desc.Width / thwidth;
uint32_t ySource = y * desc.Height / thheight;
byte *src =
&data[stride * uint32_t(xf * widthf) + mapped.RowPitch * uint32_t(yf * heightf)];
byte *src = &data[stride * xSource + mapped.RowPitch * ySource];
if(buf1010102)
{