mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 18:58:54 +01:00
internal/restorable: remove empty regions at appendRegionsForDrawTriangles
This commit is contained in:
parent
f298b9541b
commit
da55397420
@ -690,6 +690,7 @@ func (i *Image) appendRegionsForDrawTriangles(regions []image.Rectangle) []image
|
||||
continue
|
||||
}
|
||||
|
||||
// Replace duplicated regions with empty regions.
|
||||
for i, rr := range regions[origIndex:] {
|
||||
if rr.Empty() {
|
||||
continue
|
||||
@ -702,7 +703,17 @@ func (i *Image) appendRegionsForDrawTriangles(regions []image.Rectangle) []image
|
||||
regions = append(regions, r)
|
||||
}
|
||||
|
||||
return regions
|
||||
// Remove empty regions.
|
||||
n := origIndex
|
||||
for _, r := range regions[origIndex:] {
|
||||
if r.Empty() {
|
||||
continue
|
||||
}
|
||||
regions[n] = r
|
||||
n++
|
||||
}
|
||||
|
||||
return regions[:n]
|
||||
}
|
||||
|
||||
func regionToRectangle(region graphicsdriver.Region) image.Rectangle {
|
||||
|
Loading…
Reference in New Issue
Block a user