Handle thumbnails of 0 width or height without crashing

This commit is contained in:
baldurk
2019-12-02 14:08:46 +00:00
parent 397ea679f5
commit fde74d4710
+12
View File
@@ -966,6 +966,12 @@ bool RenderDoc::ShouldTriggerCapture(uint32_t frameNumber)
void RenderDoc::ResamplePixels(const FramePixels &in, RDCThumb &out)
{
if(in.width == 0 || in.height == 0)
{
out = RDCThumb();
return;
}
// code below assumes pitch_requirement is a power of 2 number
RDCASSERT((in.pitch_requirement & (in.pitch_requirement - 1)) == 0);
@@ -1076,6 +1082,12 @@ void RenderDoc::ResamplePixels(const FramePixels &in, RDCThumb &out)
}
void RenderDoc::EncodePixelsPNG(const RDCThumb &in, RDCThumb &out)
{
if(in.width == 0 || in.height == 0)
{
out = RDCThumb();
return;
}
struct WriteCallbackData
{
std::vector<byte> buffer;