mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-02-03 14:34:26 +01:00
Add comments
This commit is contained in:
parent
676a023a30
commit
1a898dd1b9
@ -27,6 +27,8 @@ import (
|
|||||||
// If origImg is a paletted image, an optimized copying method is used.
|
// If origImg is a paletted image, an optimized copying method is used.
|
||||||
//
|
//
|
||||||
// CopyImage is used only internally but it is exposed for testing.
|
// CopyImage is used only internally but it is exposed for testing.
|
||||||
|
//
|
||||||
|
// TODO: CopyImage should return []byte (#521)
|
||||||
func CopyImage(origImg image.Image) *image.RGBA {
|
func CopyImage(origImg image.Image) *image.RGBA {
|
||||||
size := origImg.Bounds().Size()
|
size := origImg.Bounds().Size()
|
||||||
w, h := size.X, size.Y
|
w, h := size.X, size.Y
|
||||||
|
@ -164,7 +164,11 @@ func (i *Image) ReplacePixels(pixels []byte, x, y, width, height int) {
|
|||||||
if x < 0 || y < 0 || w <= x || h <= y || x+width <= 0 || y+height <= 0 || w < x+width || h < y+height {
|
if x < 0 || y < 0 || w <= x || h <= y || x+width <= 0 || y+height <= 0 || w < x+width || h < y+height {
|
||||||
panic(fmt.Sprintf("restorable: out of range x: %d, y: %d, width: %d, height: %d", x, y, width, height))
|
panic(fmt.Sprintf("restorable: out of range x: %d, y: %d, width: %d, height: %d", x, y, width, height))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: Avoid making other images stale if possible.
|
||||||
|
// For this purpuse, images should remember which part of that is used for DrawImage.
|
||||||
theImages.makeStaleIfDependingOn(i)
|
theImages.makeStaleIfDependingOn(i)
|
||||||
|
|
||||||
i.image.ReplacePixels(pixels, x, y, width, height)
|
i.image.ReplacePixels(pixels, x, y, width, height)
|
||||||
|
|
||||||
// Copy the pixels so that this works even p is modified just after ReplacePixels.
|
// Copy the pixels so that this works even p is modified just after ReplacePixels.
|
||||||
|
Loading…
Reference in New Issue
Block a user