From 00ea1b298281382f9abf8e15c19786184d14f096 Mon Sep 17 00:00:00 2001 From: elasota Date: Fri, 3 Jul 2020 04:18:08 -0400 Subject: [PATCH] Fix invert image draw not working correctly if the image is partially out of bounds (happens when moving a tiki torch in the editor) --- PortabilityLayer/PLQDraw.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PortabilityLayer/PLQDraw.cpp b/PortabilityLayer/PLQDraw.cpp index 2289103..173414c 100644 --- a/PortabilityLayer/PLQDraw.cpp +++ b/PortabilityLayer/PLQDraw.cpp @@ -1911,8 +1911,8 @@ void ImageInvert(const PixMap *invertMask, PixMap *targetBitmap, const Rect &src const int32_t firstDestRow = destRect.top - targetBitmapRect.top + topInset; const int32_t firstDestCol = destRect.left - targetBitmapRect.left + leftInset; - const uint16_t numRows = destRect.Height(); - const uint16_t numCols = destRect.Width(); + const uint16_t numRows = constrainedDestRect.Height(); + const uint16_t numCols = constrainedDestRect.Width(); const size_t invertPitch = invertMask->m_pitch; const uint8_t *invertPixelDataFirstRow = static_cast(invertMask->m_data) + firstSrcRow * invertPitch;