mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 03:08:54 +01:00
internal/atlas: optimization
This commit is contained in:
parent
72983d966b
commit
61cabbf2e7
@ -418,8 +418,8 @@ func (i *Image) drawTriangles(srcs [graphics.ShaderImageCount]*Image, vertices [
|
|||||||
}
|
}
|
||||||
|
|
||||||
x, y, _, _ := i.regionWithPadding()
|
x, y, _, _ := i.regionWithPadding()
|
||||||
dx := float32(x + i.paddingSize())
|
ps := i.paddingSize()
|
||||||
dy := float32(y + i.paddingSize())
|
dx, dy := float32(x+ps), float32(y+ps)
|
||||||
// TODO: Check if dstRegion does not to violate the region.
|
// TODO: Check if dstRegion does not to violate the region.
|
||||||
|
|
||||||
dstRegion.X += dx
|
dstRegion.X += dx
|
||||||
@ -428,9 +428,8 @@ func (i *Image) drawTriangles(srcs [graphics.ShaderImageCount]*Image, vertices [
|
|||||||
var oxf, oyf float32
|
var oxf, oyf float32
|
||||||
if srcs[0] != nil {
|
if srcs[0] != nil {
|
||||||
ox, oy, _, _ := srcs[0].regionWithPadding()
|
ox, oy, _, _ := srcs[0].regionWithPadding()
|
||||||
ox += srcs[0].paddingSize()
|
ps := srcs[0].paddingSize()
|
||||||
oy += srcs[0].paddingSize()
|
oxf, oyf = float32(ox+ps), float32(oy+ps)
|
||||||
oxf, oyf = float32(ox), float32(oy)
|
|
||||||
sw, sh := srcs[0].backend.restorable.InternalSize()
|
sw, sh := srcs[0].backend.restorable.InternalSize()
|
||||||
swf, shf := float32(sw), float32(sh)
|
swf, shf := float32(sw), float32(sh)
|
||||||
n := len(vertices)
|
n := len(vertices)
|
||||||
@ -462,8 +461,9 @@ func (i *Image) drawTriangles(srcs [graphics.ShaderImageCount]*Image, vertices [
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
ox, oy, _, _ := src.regionWithPadding()
|
ox, oy, _, _ := src.regionWithPadding()
|
||||||
offsets[i][0] = float32(ox+src.paddingSize()) - oxf + subimageOffset[0]
|
ps := src.paddingSize()
|
||||||
offsets[i][1] = float32(oy+src.paddingSize()) - oyf + subimageOffset[1]
|
offsets[i][0] = float32(ox+ps) - oxf + subimageOffset[0]
|
||||||
|
offsets[i][1] = float32(oy+ps) - oyf + subimageOffset[1]
|
||||||
}
|
}
|
||||||
for i, src := range srcs {
|
for i, src := range srcs {
|
||||||
if src == nil {
|
if src == nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user