Type RectType2
Field RLeft%, RTop%, Width%, Height%, id%
End Type
Const MAX_DIRTY_RECTS = 1000
Type DirtyRects
Field Items.RectType2[MAX_DIRTY_RECTS]
Field Count
End Type
Function DirtyRectsCreate.DirtyRects()
d.DirtyRects = New DirtyRects
For i = 0 To MAX_DIRTY_RECTS
dItems[i] = New RectType2
Next
dCount = 0
Return d
End Function
Function DirtyRectsDelete(d.DirtyRects)
If d = Null Then Return 0
For i = 0 To MAX_DIRTY_RECTS
Delete ditems[i]
Next
Delete d
Return 1
End Function
Function DirtyRectsAdd(d.DirtyRects, x, y, w, h)
Local i = dCount
ditems[i]RLeft = x
ditems[i]RTop = y
ditems[i]Width = w
ditems[i]Height = h
ditems[i]id = 0
dCount = dCount + 1
End Function
Function DirtyRectsAddImage(d.DirtyRects, x, y, image)
Local w = ImageWidth(image)
Local h = ImageHeight(image)
Local i = dCount
ditems[i]RLeft = x
ditems[i]RTop = y
ditems[i]Width = w
ditems[i]Height = h
ditems[i]id = 0
dCount = dCount + 1
End Function
Function DirtyRectsAddSpecial(d.DirtyRects, x, y, w, h, id%)
Local i = dCount
ditems[i]RLeft = x
ditems[i]RTop = y
ditems[i]Width = w
ditems[i]Height = h
ditems[i]id = id
dCount = dCount + 1
End Function
Function DirtyRectsDrawAll(d.DirtyRects, background%)
;pass in background image, it draws on current buffer
ib = ImageBuffer(background)
For i = 0 To dcount-1
Local r.RectType2 = ditems[i]
CopyRect(rRLeft, rRTop, rWidth, rHeight, rRLeft, rRTop, ib) ;dest buffer not specified
Next
End Function
Function DirtyRectsDrawSpecial(d.DirtyRects, background%, id%)
;pass in background image, it draws on current buffer
ib = ImageBuffer(background)
For i = 0 To dcount-1
Local r.RectType2 = ditems[i]
If rid = id Then
CopyRect(rRLeft, rRTop, rWidth, rHeight, rRLeft, rRTop, ib) ;dest buffer not specified
;move everything in the list above this down
dCount = dcount-1
For j = i To dCount-1
dest.RectType2 = ditems[j]
s.RectType2 = ditems[j+1]
destRLeft = sRLeft
destRTop = sRTop
destWidth = sWidth
destHeight = sHeight
destid = sid
Next
EndIf
Next
End Function