mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
internal/restorable: rename ImageTypeScreenFramebuffer -> ImageTypeScreen
This commit is contained in:
parent
d3e3df812a
commit
b8e8d72377
@ -760,7 +760,7 @@ func (i *Image) allocate(putOnAtlas bool) {
|
|||||||
if i.screen {
|
if i.screen {
|
||||||
// A screen image doesn't have a padding.
|
// A screen image doesn't have a padding.
|
||||||
i.backend = &backend{
|
i.backend = &backend{
|
||||||
restorable: restorable.NewImage(i.width, i.height, restorable.ImageTypeScreenFramebuffer),
|
restorable: restorable.NewImage(i.width, i.height, restorable.ImageTypeScreen),
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -86,8 +86,8 @@ const (
|
|||||||
// ImageTypeRegular indicates the image is a regular image.
|
// ImageTypeRegular indicates the image is a regular image.
|
||||||
ImageTypeRegular ImageType = iota
|
ImageTypeRegular ImageType = iota
|
||||||
|
|
||||||
// ImageTypeScreenFramebuffer indicates the image is used as an actual screen.
|
// ImageTypeScreen indicates the image is used as an actual screen.
|
||||||
ImageTypeScreenFramebuffer
|
ImageTypeScreen
|
||||||
|
|
||||||
// ImageTypeVolatile indicates the image is cleared whenever a frame starts.
|
// ImageTypeVolatile indicates the image is cleared whenever a frame starts.
|
||||||
ImageTypeVolatile
|
ImageTypeVolatile
|
||||||
@ -155,7 +155,7 @@ func NewImage(width, height int, imageType ImageType) *Image {
|
|||||||
}
|
}
|
||||||
|
|
||||||
i := &Image{
|
i := &Image{
|
||||||
image: graphicscommand.NewImage(width, height, imageType == ImageTypeScreenFramebuffer),
|
image: graphicscommand.NewImage(width, height, imageType == ImageTypeScreen),
|
||||||
width: width,
|
width: width,
|
||||||
height: height,
|
height: height,
|
||||||
imageType: imageType,
|
imageType: imageType,
|
||||||
@ -313,7 +313,7 @@ func (i *Image) ReplacePixels(pixels []byte, mask []byte, x, y, width, height in
|
|||||||
i.image.ReplacePixels(make([]byte, 4*width*height), nil, x, y, width, height)
|
i.image.ReplacePixels(make([]byte, 4*width*height), nil, x, y, width, height)
|
||||||
}
|
}
|
||||||
|
|
||||||
if !NeedsRestoring() || i.imageType == ImageTypeScreenFramebuffer || i.imageType == ImageTypeVolatile {
|
if !NeedsRestoring() || i.imageType == ImageTypeScreen || i.imageType == ImageTypeVolatile {
|
||||||
i.makeStale()
|
i.makeStale()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -387,7 +387,7 @@ func (i *Image) DrawTriangles(srcs [graphics.ShaderImageNum]*Image, offsets [gra
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if srcstale || i.imageType == ImageTypeScreenFramebuffer || !NeedsRestoring() || i.imageType == ImageTypeVolatile {
|
if srcstale || i.imageType == ImageTypeScreen || !NeedsRestoring() || i.imageType == ImageTypeVolatile {
|
||||||
i.makeStale()
|
i.makeStale()
|
||||||
} else {
|
} else {
|
||||||
i.appendDrawTrianglesHistory(srcs, offsets, vertices, indices, colorm, mode, filter, address, dstRegion, srcRegion, shader, uniforms, evenOdd)
|
i.appendDrawTrianglesHistory(srcs, offsets, vertices, indices, colorm, mode, filter, address, dstRegion, srcRegion, shader, uniforms, evenOdd)
|
||||||
@ -412,7 +412,7 @@ func (i *Image) DrawTriangles(srcs [graphics.ShaderImageNum]*Image, offsets [gra
|
|||||||
|
|
||||||
// appendDrawTrianglesHistory appends a draw-image history item to the image.
|
// appendDrawTrianglesHistory appends a draw-image history item to the image.
|
||||||
func (i *Image) appendDrawTrianglesHistory(srcs [graphics.ShaderImageNum]*Image, offsets [graphics.ShaderImageNum - 1][2]float32, vertices []float32, indices []uint16, colorm affine.ColorM, mode graphicsdriver.CompositeMode, filter graphicsdriver.Filter, address graphicsdriver.Address, dstRegion, srcRegion graphicsdriver.Region, shader *Shader, uniforms [][]float32, evenOdd bool) {
|
func (i *Image) appendDrawTrianglesHistory(srcs [graphics.ShaderImageNum]*Image, offsets [graphics.ShaderImageNum - 1][2]float32, vertices []float32, indices []uint16, colorm affine.ColorM, mode graphicsdriver.CompositeMode, filter graphicsdriver.Filter, address graphicsdriver.Address, dstRegion, srcRegion graphicsdriver.Region, shader *Shader, uniforms [][]float32, evenOdd bool) {
|
||||||
if i.stale || i.imageType == ImageTypeVolatile || i.imageType == ImageTypeScreenFramebuffer {
|
if i.stale || i.imageType == ImageTypeVolatile || i.imageType == ImageTypeScreen {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// TODO: Would it be possible to merge draw image history items?
|
// TODO: Would it be possible to merge draw image history items?
|
||||||
@ -518,7 +518,7 @@ func (i *Image) resolveStale(graphicsDriver graphicsdriver.Graphics) error {
|
|||||||
if i.imageType == ImageTypeVolatile {
|
if i.imageType == ImageTypeVolatile {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if i.imageType == ImageTypeScreenFramebuffer {
|
if i.imageType == ImageTypeScreen {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if !i.stale {
|
if !i.stale {
|
||||||
@ -580,7 +580,7 @@ func (i *Image) restore(graphicsDriver graphicsdriver.Graphics) error {
|
|||||||
// Do not dispose the image here. The image should be already disposed.
|
// Do not dispose the image here. The image should be already disposed.
|
||||||
|
|
||||||
switch i.imageType {
|
switch i.imageType {
|
||||||
case ImageTypeScreenFramebuffer:
|
case ImageTypeScreen:
|
||||||
// The screen image should also be recreated because framebuffer might
|
// The screen image should also be recreated because framebuffer might
|
||||||
// be changed.
|
// be changed.
|
||||||
i.image = graphicscommand.NewImage(w, h, true)
|
i.image = graphicscommand.NewImage(w, h, true)
|
||||||
|
@ -94,7 +94,7 @@ func RestoreIfNeeded(graphicsDriver graphicsdriver.Graphics) error {
|
|||||||
// This assumes that if there is one image that is invalidated, all images are invalidated.
|
// This assumes that if there is one image that is invalidated, all images are invalidated.
|
||||||
for img := range theImages.images {
|
for img := range theImages.images {
|
||||||
// The screen image might not have a texture. Skip this.
|
// The screen image might not have a texture. Skip this.
|
||||||
if img.imageType == ImageTypeScreenFramebuffer {
|
if img.imageType == ImageTypeScreen {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
var err error
|
var err error
|
||||||
|
Loading…
Reference in New Issue
Block a user