mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-12 22:17:26 +01:00
restorable: Refactoring: Use the smaller empty image
This commit is contained in:
parent
9464dc2f58
commit
831c7ca6f4
@ -111,10 +111,8 @@ type Image struct {
|
|||||||
var emptyImage *Image
|
var emptyImage *Image
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
// Use a big-enough image as an rendering source. By enlarging with x128, this can reach to 16384.
|
// w and h are the empty image's size. They indicate the 1x1 image with 1px padding around.
|
||||||
// See #907 for details.
|
const w, h = 3, 3
|
||||||
// TODO: This doesn't have to be 128 due to the 1px padding. 3x3 should be enough.
|
|
||||||
const w, h = 128, 128
|
|
||||||
emptyImage = &Image{
|
emptyImage = &Image{
|
||||||
image: graphicscommand.NewImage(w, h),
|
image: graphicscommand.NewImage(w, h),
|
||||||
width: w,
|
width: w,
|
||||||
@ -266,8 +264,7 @@ func fillImage(i *graphicscommand.Image, clr color.RGBA) {
|
|||||||
//
|
//
|
||||||
// TODO: Can we unexport InternalSize()?
|
// TODO: Can we unexport InternalSize()?
|
||||||
dw, dh := i.InternalSize()
|
dw, dh := i.InternalSize()
|
||||||
sw, sh := emptyImage.image.InternalSize()
|
sw, sh := emptyImage.width, emptyImage.height
|
||||||
// Add 1 pixels for paddings.
|
|
||||||
vs := quadVertices(0, 0, float32(dw), float32(dh), 1, 1, float32(sw-1), float32(sh-1), rf, gf, bf, af)
|
vs := quadVertices(0, 0, float32(dw), float32(dh), 1, 1, float32(sw-1), float32(sh-1), rf, gf, bf, af)
|
||||||
is := graphics.QuadIndices()
|
is := graphics.QuadIndices()
|
||||||
srcs := [graphics.ShaderImageNum]*graphicscommand.Image{emptyImage.image}
|
srcs := [graphics.ShaderImageNum]*graphicscommand.Image{emptyImage.image}
|
||||||
|
Loading…
Reference in New Issue
Block a user