Fix savebox referenced fills

This commit is contained in:
manongjohn 2021-08-14 22:02:53 -04:00
parent 8dcd9f3250
commit 88618608a3
3 changed files with 12 additions and 3 deletions

View file

@ -32,6 +32,8 @@ public:
bool m_prevailing;
bool m_fillOnlySavebox;
bool m_referenced;
TDimension m_imageSize;
TPoint m_imageOffset;
FillParameters()
: m_styleId(0)
@ -58,7 +60,9 @@ public:
, m_palette(params.m_palette)
, m_prevailing(params.m_prevailing)
, m_fillOnlySavebox(params.m_fillOnlySavebox)
, m_referenced(params.m_referenced) {}
, m_referenced(params.m_referenced)
, m_imageSize(params.m_imageSize)
, m_imageOffset(params.m_imageOffset) {}
};
//=============================================================================

View file

@ -1122,6 +1122,10 @@ void doFill(const TImageP &img, const TPointD &pos, FillParameters &params,
ras = ti->getRaster()->extract(ibbox);
}
// Save image dimension in case we are working in a savebox and need it
params.m_imageSize = ti->getSize();
params.m_imageOffset = offs;
bool recomputeSavebox = false;
TPalette *plt = ti->getPalette();

View file

@ -458,8 +458,9 @@ bool fill(const TRasterCM32P &r, const FillParameters &params,
TCamera *camera = scene->getCurrentCamera();
TRaster32P tmpRaster(camera->getRes());
scene->renderFrame(tmpRaster, frameIndex);
TPoint offset((refRaster->getLx() - tmpRaster->getLx()) / 2,
(refRaster->getLy() - tmpRaster->getLy()) / 2);
TPoint offset((params.m_imageSize.lx - tmpRaster->getLx()) / 2,
(params.m_imageSize.ly - tmpRaster->getLy()) / 2);
offset -= params.m_imageOffset;
refRaster->fill(color);
refRaster->copy(tmpRaster, offset);
refRaster->lock();