When was FloodFill introduced?

I had a look at the RGBSurface and the FloodFill function got my attention. I using an open source class called Simple Paint as a template for my drawing system. It is really slow at FloodFilling and there is a function called Fill. Here is the code:

Sub Fill(g as graphics, x as integer, y as integer, col as Color)
  if x < 0 or x >= g.width or y < 0 or y >= g.height then
    return
  end
  
  dim match as color = g.pixel(x,y)
  if match = col then return
  
  dim qx(), qy() as integer
  qx.Append x
  qy.Append y
  for i as integer = 0 to ubound(qx)
    x = qx(i)
    y = qy(i)
    if g.pixel(x,y) = match then g.pixel(x,y) = col
    if y > 0 and g.pixel(x,y-1) = match then
      g.pixel(x,y-1) = col
      qx.Append x
      qy.Append y-1
    end
    if y < g.height - 1 and g.pixel(x,y+1) = match then
      g.pixel(x,y+1) = col
      qx.Append x
      qy.Append y+1
    end
    if x > 0 and g.pixel(x-1,y) = match then
      g.pixel(x-1,y) = col
      qx.Append x-1
      qy.Append y
    end
    if x < g.Width - 1 and g.pixel(x+1,y) = match then
      g.pixel(x+1,y) = col
      qx.Append x+1
      qy.Append y
    end
  next
  
  Refresh
End Sub

I changed the code and wrote one line of code with the FloodFill function and it seemed to do exactly the same thing with the same results but much faster. Here is the code I changed it to:

Sub Fill(x as integer, y as integer, col as color)
ImageCanvas1.Image.RGBSurface.FloodFill(x, y, col)
Refresh
End Sub

There is only one difference I noticed and that was a flash but I am sure it won’t take me long to fix this. It is probably because I have EraseBackground enabled or something like that? So does anybody have any idea why this person did not use FloodFill. When was this function introduced to Xojo? Did the person who write the code simply not know of a built-in flood fill (you think)? Or is there something really bad about using this function?

THANKS

many many years ago
it’s documented as far back as 2007 (maybe before but I didn’t look further back)

Instead of using Refresh, try ImageCanvas1.Invalidate

not my code. was planning on changes this. but thanks anyway. What is refreshed even used for?

It forces a repaint. Way back when, it was preferred due to issues with Invalidate (which have long since been resolved).