@@ -545,18 +545,18 @@ def paint(self, lcoord, pattern, c, border, background):
545
545
# check next scanlines and add intervals to the list
546
546
if ydir == 0 :
547
547
if y + 1 <= bound_y1 :
548
- line_seed = self .check_scanline (line_seed , x_left , x_right , y + 1 , c , tile , back , border , 1 )
548
+ line_seed = self .check_scanline (line_seed , x_left , x_right , y + 1 , c , tile , solid , back , border , 1 )
549
549
if y - 1 >= bound_y0 :
550
- line_seed = self .check_scanline (line_seed , x_left , x_right , y - 1 , c , tile , back , border , - 1 )
550
+ line_seed = self .check_scanline (line_seed , x_left , x_right , y - 1 , c , tile , solid , back , border , - 1 )
551
551
else :
552
552
# check the same interval one scanline onward in the same direction
553
553
if y + ydir <= bound_y1 and y + ydir >= bound_y0 :
554
- line_seed = self .check_scanline (line_seed , x_left , x_right , y + ydir , c , tile , back , border , ydir )
554
+ line_seed = self .check_scanline (line_seed , x_left , x_right , y + ydir , c , tile , solid , back , border , ydir )
555
555
# check any bit of the interval that was extended one scanline backward
556
556
# this is where the flood fill goes around corners.
557
557
if y - ydir <= bound_y1 and y - ydir >= bound_y0 :
558
- line_seed = self .check_scanline (line_seed , x_left , x_start - 1 , y - ydir , c , tile , back , border , - ydir )
559
- line_seed = self .check_scanline (line_seed , x_stop + 1 , x_right , y - ydir , c , tile , back , border , - ydir )
558
+ line_seed = self .check_scanline (line_seed , x_left , x_start - 1 , y - ydir , c , tile , solid , back , border , - ydir )
559
+ line_seed = self .check_scanline (line_seed , x_stop + 1 , x_right , y - ydir , c , tile , solid , back , border , - ydir )
560
560
# draw the pixels for the current interval
561
561
if solid :
562
562
self .screen .fill_interval (x_left , x_right , y , tile [0 ][0 ])
@@ -569,7 +569,7 @@ def paint(self, lcoord, pattern, c, border, background):
569
569
self .last_attr = c
570
570
571
571
def check_scanline (self , line_seed , x_start , x_stop , y ,
572
- c , tile , back , border , ydir ):
572
+ c , tile , is_solid , back , border , ydir ):
573
573
""" Append all subintervals between border colours to the scanning stack. """
574
574
if x_stop < x_start :
575
575
return line_seed
@@ -584,8 +584,10 @@ def check_scanline(self, line_seed, x_start, x_stop, y,
584
584
pattern = self .screen .get_until (x , x_stop + 1 , y , border )
585
585
x_stop_next = x + len (pattern ) - 1
586
586
x = x_stop_next + 1
587
- # never match zero pattern (special case)
588
- has_same_pattern = (rtile != [0 ]* 8 )
587
+ # don't match zero row unless pattern is solid (special case)
588
+ # - avoid breaking off pattern filling on zero rows
589
+ # - but also don't loop forever on solid background fills
590
+ has_same_pattern = (is_solid or rtile != [0 ]* 8 )
589
591
for pat_x in range (len (pattern )):
590
592
if not has_same_pattern :
591
593
break
0 commit comments