mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 03:08:54 +01:00
image: Bug fix: pixels must be reset after any drawing (TODO: add test)
This commit is contained in:
parent
1fa39e3b8a
commit
afe4c76b50
3
image.go
3
image.go
@ -103,6 +103,7 @@ func (i *Image) DrawLine(x0, y0, x1, y1 int, clr color.Color) error {
|
|||||||
|
|
||||||
// DrawLines draws lines.
|
// DrawLines draws lines.
|
||||||
func (i *Image) DrawLines(lines Lines) (err error) {
|
func (i *Image) DrawLines(lines Lines) (err error) {
|
||||||
|
i.pixels = nil
|
||||||
ui.Use(func(c *opengl.Context) {
|
ui.Use(func(c *opengl.Context) {
|
||||||
err = i.framebuffer.DrawLines(c, lines)
|
err = i.framebuffer.DrawLines(c, lines)
|
||||||
})
|
})
|
||||||
@ -126,6 +127,7 @@ func (i *Image) DrawFilledRect(x, y, width, height int, clr color.Color) error {
|
|||||||
|
|
||||||
// DrawFilledRects draws filled rectangles on the image.
|
// DrawFilledRects draws filled rectangles on the image.
|
||||||
func (i *Image) DrawFilledRects(rects Rects) (err error) {
|
func (i *Image) DrawFilledRects(rects Rects) (err error) {
|
||||||
|
i.pixels = nil
|
||||||
ui.Use(func(c *opengl.Context) {
|
ui.Use(func(c *opengl.Context) {
|
||||||
err = i.framebuffer.DrawFilledRects(c, rects)
|
err = i.framebuffer.DrawFilledRects(c, rects)
|
||||||
})
|
})
|
||||||
@ -169,6 +171,7 @@ func (i *Image) At(x, y int) color.Color {
|
|||||||
//
|
//
|
||||||
// This function may be slow (as for implementation, this calls glTexSubImage2D).
|
// This function may be slow (as for implementation, this calls glTexSubImage2D).
|
||||||
func (i *Image) ReplacePixels(p []uint8) error {
|
func (i *Image) ReplacePixels(p []uint8) error {
|
||||||
|
i.pixels = nil
|
||||||
w, h := i.Size()
|
w, h := i.Size()
|
||||||
l := 4 * w * h
|
l := 4 * w * h
|
||||||
if len(p) != l {
|
if len(p) != l {
|
||||||
|
Loading…
Reference in New Issue
Block a user