mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-12 03:58:55 +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
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Replace duplicated regions with empty regions.
|
||||||
for i, rr := range regions[origIndex:] {
|
for i, rr := range regions[origIndex:] {
|
||||||
if rr.Empty() {
|
if rr.Empty() {
|
||||||
continue
|
continue
|
||||||
@ -702,7 +703,17 @@ func (i *Image) appendRegionsForDrawTriangles(regions []image.Rectangle) []image
|
|||||||
regions = append(regions, r)
|
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 {
|
func regionToRectangle(region graphicsdriver.Region) image.Rectangle {
|
||||||
|
Loading…
Reference in New Issue
Block a user