mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-26 03:38:55 +01:00
all: use QuadVerticesFromDstAndSrc when possible
This commit is contained in:
parent
b6ab7a10c1
commit
9e208eee81
@ -345,7 +345,7 @@ func (i *Image) ensureIsolatedFromSource(backends []*backend) {
|
|||||||
|
|
||||||
w, h := float32(i.width), float32(i.height)
|
w, h := float32(i.width), float32(i.height)
|
||||||
vs := make([]float32, 4*graphics.VertexFloatCount)
|
vs := make([]float32, 4*graphics.VertexFloatCount)
|
||||||
graphics.QuadVerticesFromSrcAndMatrix(vs, 0, 0, w, h, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1)
|
graphics.QuadVerticesFromDstAndSrc(vs, 0, 0, w, h, 0, 0, w, h, 1, 1, 1, 1)
|
||||||
is := graphics.QuadIndices()
|
is := graphics.QuadIndices()
|
||||||
dr := image.Rect(0, 0, i.width, i.height)
|
dr := image.Rect(0, 0, i.width, i.height)
|
||||||
|
|
||||||
@ -376,7 +376,7 @@ func (i *Image) putOnSourceBackend() {
|
|||||||
|
|
||||||
w, h := float32(i.width), float32(i.height)
|
w, h := float32(i.width), float32(i.height)
|
||||||
vs := make([]float32, 4*graphics.VertexFloatCount)
|
vs := make([]float32, 4*graphics.VertexFloatCount)
|
||||||
graphics.QuadVerticesFromSrcAndMatrix(vs, 0, 0, w, h, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1)
|
graphics.QuadVerticesFromDstAndSrc(vs, 0, 0, w, h, 0, 0, w, h, 1, 1, 1, 1)
|
||||||
is := graphics.QuadIndices()
|
is := graphics.QuadIndices()
|
||||||
dr := image.Rect(0, 0, i.width, i.height)
|
dr := image.Rect(0, 0, i.width, i.height)
|
||||||
newI.drawTriangles([graphics.ShaderSrcImageCount]*Image{i}, vs, is, graphicsdriver.BlendCopy, dr, [graphics.ShaderSrcImageCount]image.Rectangle{}, NearestFilterShader, nil, graphicsdriver.FillRuleFillAll)
|
newI.drawTriangles([graphics.ShaderSrcImageCount]*Image{i}, vs, is, graphicsdriver.BlendCopy, dr, [graphics.ShaderSrcImageCount]image.Rectangle{}, NearestFilterShader, nil, graphicsdriver.FillRuleFillAll)
|
||||||
|
@ -52,7 +52,7 @@ func TestUnsyncedPixels(t *testing.T) {
|
|||||||
// Flush unsynced pixel cache.
|
// Flush unsynced pixel cache.
|
||||||
src := buffered.NewImage(16, 16, atlas.ImageTypeRegular)
|
src := buffered.NewImage(16, 16, atlas.ImageTypeRegular)
|
||||||
vs := make([]float32, 4*graphics.VertexFloatCount)
|
vs := make([]float32, 4*graphics.VertexFloatCount)
|
||||||
graphics.QuadVerticesFromSrcAndMatrix(vs, 0, 0, 16, 16, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1)
|
graphics.QuadVerticesFromDstAndSrc(vs, 0, 0, 16, 16, 0, 0, 16, 16, 1, 1, 1, 1)
|
||||||
is := graphics.QuadIndices()
|
is := graphics.QuadIndices()
|
||||||
dr := image.Rect(0, 0, 16, 16)
|
dr := image.Rect(0, 0, 16, 16)
|
||||||
sr := [graphics.ShaderSrcImageCount]image.Rectangle{image.Rect(0, 0, 16, 16)}
|
sr := [graphics.ShaderSrcImageCount]image.Rectangle{image.Rect(0, 0, 16, 16)}
|
||||||
|
Loading…
Reference in New Issue
Block a user