mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
Revert "internal/restorable: integrate some functions into internal/atlas"
This reverts commit c5d0ec3de7
.
Updates #3803
This commit is contained in:
parent
d533461936
commit
62ed5bed4b
@ -414,7 +414,7 @@ func (i *Image) drawTriangles(srcs [graphics.ShaderSrcImageCount]*Image, vertice
|
|||||||
vertices[i+3] += oyf
|
vertices[i+3] += oyf
|
||||||
}
|
}
|
||||||
if shader.ir.Unit == shaderir.Texels {
|
if shader.ir.Unit == shaderir.Texels {
|
||||||
sw, sh := srcs[0].backend.restorable.Image.InternalSize()
|
sw, sh := srcs[0].backend.restorable.InternalSize()
|
||||||
swf, shf := float32(sw), float32(sh)
|
swf, shf := float32(sw), float32(sh)
|
||||||
for i := 0; i < n; i += graphics.VertexFloatCount {
|
for i := 0; i < n; i += graphics.VertexFloatCount {
|
||||||
vertices[i+2] /= swf
|
vertices[i+2] /= swf
|
||||||
@ -613,8 +613,7 @@ func (i *Image) deallocate() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
i.backend.restorable.Image.Dispose()
|
i.backend.restorable.Dispose()
|
||||||
i.backend.restorable.Image = nil
|
|
||||||
|
|
||||||
for idx, sh := range theBackends {
|
for idx, sh := range theBackends {
|
||||||
if sh == i.backend {
|
if sh == i.backend {
|
||||||
@ -756,7 +755,7 @@ func (i *Image) DumpScreenshot(graphicsDriver graphicsdriver.Graphics, path stri
|
|||||||
panic("atlas: DumpScreenshots must be called in between BeginFrame and EndFrame")
|
panic("atlas: DumpScreenshots must be called in between BeginFrame and EndFrame")
|
||||||
}
|
}
|
||||||
|
|
||||||
return i.backend.restorable.Image.Dump(graphicsDriver, path, blackbg, image.Rect(0, 0, i.width, i.height))
|
return i.backend.restorable.Dump(graphicsDriver, path, blackbg, image.Rect(0, 0, i.width, i.height))
|
||||||
}
|
}
|
||||||
|
|
||||||
func EndFrame() error {
|
func EndFrame() error {
|
||||||
|
@ -73,8 +73,7 @@ func (i *Image) Extend(width, height int) *Image {
|
|||||||
is := graphics.QuadIndices()
|
is := graphics.QuadIndices()
|
||||||
dr := image.Rect(0, 0, sw, sh)
|
dr := image.Rect(0, 0, sw, sh)
|
||||||
newImg.DrawTriangles(srcs, vs, is, graphicsdriver.BlendCopy, dr, [graphics.ShaderSrcImageCount]image.Rectangle{}, NearestFilterShader, nil, graphicsdriver.FillRuleFillAll)
|
newImg.DrawTriangles(srcs, vs, is, graphicsdriver.BlendCopy, dr, [graphics.ShaderSrcImageCount]image.Rectangle{}, NearestFilterShader, nil, graphicsdriver.FillRuleFillAll)
|
||||||
i.Image.Dispose()
|
i.Dispose()
|
||||||
i.Image = nil
|
|
||||||
|
|
||||||
return newImg
|
return newImg
|
||||||
}
|
}
|
||||||
@ -148,3 +147,19 @@ func (i *Image) ReadPixels(graphicsDriver graphicsdriver.Graphics, pixels []byte
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Dispose disposes the image.
|
||||||
|
//
|
||||||
|
// After disposing, calling the function of the image causes unexpected results.
|
||||||
|
func (i *Image) Dispose() {
|
||||||
|
i.Image.Dispose()
|
||||||
|
i.Image = nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (i *Image) Dump(graphicsDriver graphicsdriver.Graphics, path string, blackbg bool, rect image.Rectangle) (string, error) {
|
||||||
|
return i.Image.Dump(graphicsDriver, path, blackbg, rect)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (i *Image) InternalSize() (int, int) {
|
||||||
|
return i.Image.InternalSize()
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user