graphics: Don't use GeoM/ColorM in pixels. Use graphics.Matrix instead

This commit is contained in:
Hajime Hoshi 2016-07-24 06:46:47 +09:00
parent 3ea6033c3d
commit 62acfb5b0a
2 changed files with 8 additions and 8 deletions

View File

@ -174,21 +174,21 @@ func (i *imageImpl) DrawImage(image *Image, options *DrawImageOptions) error {
if i.disposed { if i.disposed {
return errors.New("ebiten: image is already disposed") return errors.New("ebiten: image is already disposed")
} }
geom := options.GeoM
colorm := options.ColorM
c := &drawImageHistoryItem{ c := &drawImageHistoryItem{
image: image.impl.image, image: image.impl.image,
vertices: vertices, vertices: vertices,
geom: options.GeoM, geom: &geom,
colorm: options.ColorM, colorm: &colorm,
mode: opengl.CompositeMode(options.CompositeMode), mode: opengl.CompositeMode(options.CompositeMode),
} }
if image.impl.pixels.inconsistent { if image.impl.pixels.inconsistent {
i.pixels.makeInconsistent() i.pixels.makeInconsistent()
} }
i.pixels.appendDrawImageHistory(c) i.pixels.appendDrawImageHistory(c)
geom := &options.GeoM
colorm := &options.ColorM
mode := opengl.CompositeMode(options.CompositeMode) mode := opengl.CompositeMode(options.CompositeMode)
if err := i.image.DrawImage(image.impl.image, vertices, geom, colorm, mode); err != nil { if err := i.image.DrawImage(image.impl.image, vertices, &geom, &colorm, mode); err != nil {
return err return err
} }
return nil return nil

View File

@ -25,8 +25,8 @@ import (
type drawImageHistoryItem struct { type drawImageHistoryItem struct {
image *graphics.Image image *graphics.Image
vertices []int16 vertices []int16
geom GeoM geom graphics.Matrix
colorm ColorM colorm graphics.Matrix
mode opengl.CompositeMode mode opengl.CompositeMode
} }
@ -181,7 +181,7 @@ func (p *pixels) restore(context *opengl.Context, width, height int, filter Filt
/*if c.image.impl.hasHistory() { /*if c.image.impl.hasHistory() {
panic("not reach") panic("not reach")
}*/ }*/
if err := gimg.DrawImage(c.image, c.vertices, &c.geom, &c.colorm, c.mode); err != nil { if err := gimg.DrawImage(c.image, c.vertices, c.geom, c.colorm, c.mode); err != nil {
return nil, err return nil, err
} }
} }