Fix Normal-Selective-Area fills filling partially painted objects
This commit is contained in:
parent
b9ea823143
commit
a1a9695f57
1 changed files with 9 additions and 6 deletions
|
@ -48,7 +48,7 @@ inline TPoint nearestInkNotDiagonal(const TRasterCM32P &r, const TPoint &p) {
|
|||
|
||||
void fillRow(const TRasterCM32P &r, const TPoint &p, int &xa, int &xb,
|
||||
int paint, TPalette *palette, TTileSaverCM32 *saver,
|
||||
bool prevailing = true) {
|
||||
bool prevailing = true, bool emptyOnly = false) {
|
||||
int tone, oldtone;
|
||||
TPixelCM32 *pix, *pix0, *limit, *tmp_limit;
|
||||
|
||||
|
@ -62,6 +62,7 @@ void fillRow(const TRasterCM32P &r, const TPoint &p, int &xa, int &xb,
|
|||
tone = oldtone;
|
||||
for (; pix <= limit; pix++) {
|
||||
if (pix->getPaint() == paint) break;
|
||||
if (emptyOnly && pix->getPaint() != 0) break;
|
||||
tone = pix->getTone();
|
||||
if (tone == 0) break;
|
||||
// prevent fill area from protruding behind the colored line
|
||||
|
@ -112,6 +113,7 @@ void fillRow(const TRasterCM32P &r, const TPoint &p, int &xa, int &xb,
|
|||
tone = oldtone;
|
||||
for (pix--; pix >= limit; pix--) {
|
||||
if (pix->getPaint() == paint) break;
|
||||
if (emptyOnly && pix->getPaint() != 0) break;
|
||||
tone = pix->getTone();
|
||||
if (tone == 0) break;
|
||||
// prevent fill area from protruding behind the colored line
|
||||
|
@ -444,7 +446,7 @@ bool fill(const TRasterCM32P &r, const FillParameters ¶ms,
|
|||
std::stack<FillSeed> seeds;
|
||||
|
||||
fillRow(tempRaster, p, xa, xb, paint, params.m_palette, saver,
|
||||
params.m_prevailing);
|
||||
params.m_prevailing, params.m_emptyOnly);
|
||||
seeds.push(FillSeed(xa, xb, y, 1));
|
||||
seeds.push(FillSeed(xa, xb, y, -1));
|
||||
// Set the ink on gaps that were used to 4095
|
||||
|
@ -482,11 +484,12 @@ bool fill(const TRasterCM32P &r, const FillParameters ¶ms,
|
|||
tone = threshTone(*pix, fillDepth);
|
||||
// the last condition is added in order to prevent fill area from
|
||||
// protruding behind the colored line
|
||||
if (pix->getPaint() != paint && tone <= oldtone && tone != 0 &&
|
||||
(pix->getPaint() != pix->getInk() ||
|
||||
if (pix->getPaint() != paint &&
|
||||
(!params.m_emptyOnly || pix->getPaint() == 0) && tone <= oldtone &&
|
||||
tone != 0 && (pix->getPaint() != pix->getInk() ||
|
||||
pix->getPaint() == paintAtClickedPos)) {
|
||||
fillRow(tempRaster, TPoint(x, y), xc, xd, paint, params.m_palette,
|
||||
saver, params.m_prevailing);
|
||||
saver, params.m_prevailing, params.m_emptyOnly);
|
||||
// Set the ink on gaps that were used to 4095
|
||||
{
|
||||
TPixelCM32 *tempPix = tempRaster->pixels(0);
|
||||
|
|
Loading…
Reference in a new issue