mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 03:08:54 +01:00
Revert "buffered: Defer ReplacePixels when possible"
This reverts commit 1395ab5e84
.
Reason: This increases the number of ReplacePixels aggressively.
This commit is contained in:
parent
36515eb1f5
commit
aea4630b5f
@ -197,12 +197,9 @@ func (i *Image) ReplacePixels(pix []byte, x, y, width, height int) error {
|
|||||||
if x == 0 && y == 0 && width == i.width && height == i.height {
|
if x == 0 && y == 0 && width == i.width && height == i.height {
|
||||||
i.invalidatePendingPixels()
|
i.invalidatePendingPixels()
|
||||||
|
|
||||||
// Don't call (*mipmap.Mipmap).ReplacePixels here. Let's defer it to reduce GPU operations as much as
|
// Call ReplacePixels immediately. If a lot of new images are created but they are used at different
|
||||||
// posssible.
|
// timings, pixels are sent to GPU at different timings, which is very inefficient.
|
||||||
copied := make([]byte, len(pix))
|
i.img.ReplacePixels(pix)
|
||||||
copy(copied, pix)
|
|
||||||
i.pixels = copied
|
|
||||||
i.needsToResolvePixels = true
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user