I guess there is a bug in FillArea() when the drawing output is clipped.
Code: Select all
EnableExplicit
OpenWindow(0, 0, 0, 400, 400, "FillArea() Bug", #PB_Window_ScreenCentered | #PB_Window_SystemMenu)
CanvasGadget(0, 0, 0, 400, 400)
If StartDrawing(CanvasOutput(0))
Box(0, 0, 400, 400, #Green)
ClipOutput(100, 100, 200, 200) ; Clips the output to a 200x200 square
FillArea(50, 50, #Blue, #Blue) ; The 200x200 square should be painted blue (but nothing is painted blue)
UnclipOutput()
StopDrawing()
EndIf
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
If you remove the "ClipOutput()", the whole window is painted blue.
So when clipping the output, there should be an inner square painted blue? Where is it?
In my real program (which is a bit more complex than this sample program) the program even crashes at this point with a "random" memory error or the executable ends unexpectedly. Unfortunately I could not reproduce this crash specifically in a sample program, but I am relatively sure that the crash comes from FillArea(). If I comment out FillArea() in my real program, it no longer crashes.
EDIT: Now I am able to reproduce the crash in a sample program. See posting below.
Maybe someone who has insight into the implementation of FillArea() can check this?
// Moved from "Bugs - Windows" to "Coding Questions" (Kiffi)