add logging to setImage

This commit is contained in:
Nick Fisher
2025-03-10 22:22:07 +08:00
parent e1446c7eb8
commit a16c3c7580

View File

@@ -199,20 +199,25 @@ namespace thermion
{ {
case PixelBufferDescriptor::PixelDataFormat::RGB: case PixelBufferDescriptor::PixelDataFormat::RGB:
case PixelBufferDescriptor::PixelDataFormat::RGBA: case PixelBufferDescriptor::PixelDataFormat::RGBA:
if (size != width * height * channels * sizeof(float)) {
size_t expectedSize = width * height * channels * sizeof(float);
if (size != expectedSize)
{ {
Log("Size mismatch"); Log("Size mismatch (expected %d, got %d)", expectedSize, size);
return false; return false;
} }
break; break;
}
case PixelBufferDescriptor::PixelDataFormat::RGB_INTEGER: case PixelBufferDescriptor::PixelDataFormat::RGB_INTEGER:
case PixelBufferDescriptor::PixelDataFormat::RGBA_INTEGER: case PixelBufferDescriptor::PixelDataFormat::RGBA_INTEGER:
{
if (size != width * height * channels * sizeof(uint8_t)) if (size != width * height * channels * sizeof(uint8_t))
{ {
Log("Size mismatch"); Log("Size mismatch");
// return false; // return false;
} }
break; break;
}
default: default:
Log("Unsupported buffer format type : %d", bufferFormat); Log("Unsupported buffer format type : %d", bufferFormat);
return false; return false;