mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
internal/atlas: rename ReplacePixels -> WritePixels
This commit is contained in:
parent
af894d5c83
commit
8ce84c6596
@ -228,7 +228,7 @@ type Image struct {
|
|||||||
// usedAsSourceCount is increased if the image is used as a rendering source, or set to 0 if the image is
|
// usedAsSourceCount is increased if the image is used as a rendering source, or set to 0 if the image is
|
||||||
// modified.
|
// modified.
|
||||||
//
|
//
|
||||||
// ReplacePixels doesn't affect this value since ReplacePixels can be done on images on an atlas.
|
// WritePixels doesn't affect this value since WritePixels can be done on images on an atlas.
|
||||||
usedAsSourceCount int
|
usedAsSourceCount int
|
||||||
|
|
||||||
// isolatedCount represents how many times the image on a texture atlas is changed into an isolated image.
|
// isolatedCount represents how many times the image on a texture atlas is changed into an isolated image.
|
||||||
@ -494,8 +494,8 @@ func (i *Image) drawTriangles(srcs [graphics.ShaderImageCount]*Image, vertices [
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReplacePixels replaces the pixels on the image.
|
// WritePixels replaces the pixels on the image.
|
||||||
func (i *Image) ReplacePixels(pix []byte, x, y, width, height int) {
|
func (i *Image) WritePixels(pix []byte, x, y, width, height int) {
|
||||||
backendsM.Lock()
|
backendsM.Lock()
|
||||||
defer backendsM.Unlock()
|
defer backendsM.Unlock()
|
||||||
i.replacePixels(pix, x, y, width, height)
|
i.replacePixels(pix, x, y, width, height)
|
||||||
|
@ -63,17 +63,17 @@ func TestEnsureIsolated(t *testing.T) {
|
|||||||
img1 := atlas.NewImage(bigSize, 100, atlas.ImageTypeRegular)
|
img1 := atlas.NewImage(bigSize, 100, atlas.ImageTypeRegular)
|
||||||
defer img1.MarkDisposed()
|
defer img1.MarkDisposed()
|
||||||
// Ensure img1's region is allocated.
|
// Ensure img1's region is allocated.
|
||||||
img1.ReplacePixels(make([]byte, 4*bigSize*100), 0, 0, bigSize, 100)
|
img1.WritePixels(make([]byte, 4*bigSize*100), 0, 0, bigSize, 100)
|
||||||
|
|
||||||
img2 := atlas.NewImage(100, bigSize, atlas.ImageTypeRegular)
|
img2 := atlas.NewImage(100, bigSize, atlas.ImageTypeRegular)
|
||||||
defer img2.MarkDisposed()
|
defer img2.MarkDisposed()
|
||||||
img2.ReplacePixels(make([]byte, 4*100*bigSize), 0, 0, 100, bigSize)
|
img2.WritePixels(make([]byte, 4*100*bigSize), 0, 0, 100, bigSize)
|
||||||
|
|
||||||
const size = 32
|
const size = 32
|
||||||
|
|
||||||
img3 := atlas.NewImage(size/2, size/2, atlas.ImageTypeRegular)
|
img3 := atlas.NewImage(size/2, size/2, atlas.ImageTypeRegular)
|
||||||
defer img3.MarkDisposed()
|
defer img3.MarkDisposed()
|
||||||
img3.ReplacePixels(make([]byte, (size/2)*(size/2)*4), 0, 0, size/2, size/2)
|
img3.WritePixels(make([]byte, (size/2)*(size/2)*4), 0, 0, size/2, size/2)
|
||||||
|
|
||||||
img4 := atlas.NewImage(size, size, atlas.ImageTypeRegular)
|
img4 := atlas.NewImage(size, size, atlas.ImageTypeRegular)
|
||||||
defer img4.MarkDisposed()
|
defer img4.MarkDisposed()
|
||||||
@ -90,7 +90,7 @@ func TestEnsureIsolated(t *testing.T) {
|
|||||||
pix[4*(i+j*size)+3] = byte(i + j)
|
pix[4*(i+j*size)+3] = byte(i + j)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
img4.ReplacePixels(pix, 0, 0, size, size)
|
img4.WritePixels(pix, 0, 0, size, size)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
dx0 = size / 4
|
dx0 = size / 4
|
||||||
@ -157,11 +157,11 @@ func TestReputOnAtlas(t *testing.T) {
|
|||||||
|
|
||||||
img0 := atlas.NewImage(size, size, atlas.ImageTypeRegular)
|
img0 := atlas.NewImage(size, size, atlas.ImageTypeRegular)
|
||||||
defer img0.MarkDisposed()
|
defer img0.MarkDisposed()
|
||||||
img0.ReplacePixels(make([]byte, 4*size*size), 0, 0, size, size)
|
img0.WritePixels(make([]byte, 4*size*size), 0, 0, size, size)
|
||||||
|
|
||||||
img1 := atlas.NewImage(size, size, atlas.ImageTypeRegular)
|
img1 := atlas.NewImage(size, size, atlas.ImageTypeRegular)
|
||||||
defer img1.MarkDisposed()
|
defer img1.MarkDisposed()
|
||||||
img1.ReplacePixels(make([]byte, 4*size*size), 0, 0, size, size)
|
img1.WritePixels(make([]byte, 4*size*size), 0, 0, size, size)
|
||||||
if got, want := img1.IsOnAtlasForTesting(), true; got != want {
|
if got, want := img1.IsOnAtlasForTesting(), true; got != want {
|
||||||
t.Errorf("got: %v, want: %v", got, want)
|
t.Errorf("got: %v, want: %v", got, want)
|
||||||
}
|
}
|
||||||
@ -177,12 +177,12 @@ func TestReputOnAtlas(t *testing.T) {
|
|||||||
pix[4*(i+j*size)+3] = byte(i + j)
|
pix[4*(i+j*size)+3] = byte(i + j)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
img2.ReplacePixels(pix, 0, 0, size, size)
|
img2.WritePixels(pix, 0, 0, size, size)
|
||||||
|
|
||||||
// Create a volatile image. This should always be isolated.
|
// Create a volatile image. This should always be isolated.
|
||||||
img3 := atlas.NewImage(size, size, atlas.ImageTypeVolatile)
|
img3 := atlas.NewImage(size, size, atlas.ImageTypeVolatile)
|
||||||
defer img3.MarkDisposed()
|
defer img3.MarkDisposed()
|
||||||
img1.ReplacePixels(make([]byte, 4*size*size), 0, 0, size, size)
|
img1.WritePixels(make([]byte, 4*size*size), 0, 0, size, size)
|
||||||
if got, want := img3.IsOnAtlasForTesting(), false; got != want {
|
if got, want := img3.IsOnAtlasForTesting(), false; got != want {
|
||||||
t.Errorf("got: %v, want: %v", got, want)
|
t.Errorf("got: %v, want: %v", got, want)
|
||||||
}
|
}
|
||||||
@ -265,13 +265,13 @@ func TestReputOnAtlas(t *testing.T) {
|
|||||||
t.Errorf("got: %v, want: %v", got, want)
|
t.Errorf("got: %v, want: %v", got, want)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use img1 as a render source, but call ReplacePixels.
|
// Use img1 as a render source, but call WritePixels.
|
||||||
// Now use 4x count as img1 became an isolated image again.
|
// Now use 4x count as img1 became an isolated image again.
|
||||||
for i := 0; i < atlas.BaseCountToPutOnAtlas*4; i++ {
|
for i := 0; i < atlas.BaseCountToPutOnAtlas*4; i++ {
|
||||||
if err := atlas.PutImagesOnAtlasForTesting(ui.GraphicsDriverForTesting()); err != nil {
|
if err := atlas.PutImagesOnAtlasForTesting(ui.GraphicsDriverForTesting()); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
img1.ReplacePixels(make([]byte, 4*size*size), 0, 0, size, size)
|
img1.WritePixels(make([]byte, 4*size*size), 0, 0, size, size)
|
||||||
img0.DrawTriangles([graphics.ShaderImageCount]*atlas.Image{img1}, vs, is, affine.ColorMIdentity{}, graphicsdriver.CompositeModeCopy, graphicsdriver.FilterNearest, graphicsdriver.AddressUnsafe, dr, graphicsdriver.Region{}, [graphics.ShaderImageCount - 1][2]float32{}, nil, nil, false)
|
img0.DrawTriangles([graphics.ShaderImageCount]*atlas.Image{img1}, vs, is, affine.ColorMIdentity{}, graphicsdriver.CompositeModeCopy, graphicsdriver.FilterNearest, graphicsdriver.AddressUnsafe, dr, graphicsdriver.Region{}, [graphics.ShaderImageCount - 1][2]float32{}, nil, nil, false)
|
||||||
if got, want := img1.IsOnAtlasForTesting(), false; got != want {
|
if got, want := img1.IsOnAtlasForTesting(), false; got != want {
|
||||||
t.Errorf("got: %v, want: %v", got, want)
|
t.Errorf("got: %v, want: %v", got, want)
|
||||||
@ -281,7 +281,7 @@ func TestReputOnAtlas(t *testing.T) {
|
|||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// img1 is not on an atlas due to ReplacePixels.
|
// img1 is not on an atlas due to WritePixels.
|
||||||
img0.DrawTriangles([graphics.ShaderImageCount]*atlas.Image{img1}, vs, is, affine.ColorMIdentity{}, graphicsdriver.CompositeModeCopy, graphicsdriver.FilterNearest, graphicsdriver.AddressUnsafe, dr, graphicsdriver.Region{}, [graphics.ShaderImageCount - 1][2]float32{}, nil, nil, false)
|
img0.DrawTriangles([graphics.ShaderImageCount]*atlas.Image{img1}, vs, is, affine.ColorMIdentity{}, graphicsdriver.CompositeModeCopy, graphicsdriver.FilterNearest, graphicsdriver.AddressUnsafe, dr, graphicsdriver.Region{}, [graphics.ShaderImageCount - 1][2]float32{}, nil, nil, false)
|
||||||
if got, want := img1.IsOnAtlasForTesting(), false; got != want {
|
if got, want := img1.IsOnAtlasForTesting(), false; got != want {
|
||||||
t.Errorf("got: %v, want: %v", got, want)
|
t.Errorf("got: %v, want: %v", got, want)
|
||||||
@ -313,7 +313,7 @@ func TestExtend(t *testing.T) {
|
|||||||
p0[4*i+2] = byte(i)
|
p0[4*i+2] = byte(i)
|
||||||
p0[4*i+3] = byte(i)
|
p0[4*i+3] = byte(i)
|
||||||
}
|
}
|
||||||
img0.ReplacePixels(p0, 0, 0, w0, h0)
|
img0.WritePixels(p0, 0, 0, w0, h0)
|
||||||
|
|
||||||
const w1, h1 = minImageSizeForTesting + 1, 100
|
const w1, h1 = minImageSizeForTesting + 1, 100
|
||||||
img1 := atlas.NewImage(w1, h1, atlas.ImageTypeRegular)
|
img1 := atlas.NewImage(w1, h1, atlas.ImageTypeRegular)
|
||||||
@ -327,7 +327,7 @@ func TestExtend(t *testing.T) {
|
|||||||
p1[4*i+3] = byte(i)
|
p1[4*i+3] = byte(i)
|
||||||
}
|
}
|
||||||
// Ensure to allocate
|
// Ensure to allocate
|
||||||
img1.ReplacePixels(p1, 0, 0, w1, h1)
|
img1.WritePixels(p1, 0, 0, w1, h1)
|
||||||
|
|
||||||
pix0 := make([]byte, 4*w0*h0)
|
pix0 := make([]byte, 4*w0*h0)
|
||||||
if err := img0.ReadPixels(ui.GraphicsDriverForTesting(), pix0); err != nil {
|
if err := img0.ReadPixels(ui.GraphicsDriverForTesting(), pix0); err != nil {
|
||||||
@ -368,7 +368,7 @@ func TestExtend(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestReplacePixelsAfterDrawTriangles(t *testing.T) {
|
func TestWritePixelsAfterDrawTriangles(t *testing.T) {
|
||||||
const w, h = 256, 256
|
const w, h = 256, 256
|
||||||
src := atlas.NewImage(w, h, atlas.ImageTypeRegular)
|
src := atlas.NewImage(w, h, atlas.ImageTypeRegular)
|
||||||
defer src.MarkDisposed()
|
defer src.MarkDisposed()
|
||||||
@ -382,7 +382,7 @@ func TestReplacePixelsAfterDrawTriangles(t *testing.T) {
|
|||||||
pix[4*i+2] = byte(i)
|
pix[4*i+2] = byte(i)
|
||||||
pix[4*i+3] = byte(i)
|
pix[4*i+3] = byte(i)
|
||||||
}
|
}
|
||||||
src.ReplacePixels(pix, 0, 0, w, h)
|
src.WritePixels(pix, 0, 0, w, h)
|
||||||
|
|
||||||
vs := quadVertices(w, h, 0, 0, 1)
|
vs := quadVertices(w, h, 0, 0, 1)
|
||||||
is := graphics.QuadIndices()
|
is := graphics.QuadIndices()
|
||||||
@ -393,7 +393,7 @@ func TestReplacePixelsAfterDrawTriangles(t *testing.T) {
|
|||||||
Height: h,
|
Height: h,
|
||||||
}
|
}
|
||||||
dst.DrawTriangles([graphics.ShaderImageCount]*atlas.Image{src}, vs, is, affine.ColorMIdentity{}, graphicsdriver.CompositeModeCopy, graphicsdriver.FilterNearest, graphicsdriver.AddressUnsafe, dr, graphicsdriver.Region{}, [graphics.ShaderImageCount - 1][2]float32{}, nil, nil, false)
|
dst.DrawTriangles([graphics.ShaderImageCount]*atlas.Image{src}, vs, is, affine.ColorMIdentity{}, graphicsdriver.CompositeModeCopy, graphicsdriver.FilterNearest, graphicsdriver.AddressUnsafe, dr, graphicsdriver.Region{}, [graphics.ShaderImageCount - 1][2]float32{}, nil, nil, false)
|
||||||
dst.ReplacePixels(pix, 0, 0, w, h)
|
dst.WritePixels(pix, 0, 0, w, h)
|
||||||
|
|
||||||
pix = make([]byte, 4*w*h)
|
pix = make([]byte, 4*w*h)
|
||||||
if err := dst.ReadPixels(ui.GraphicsDriverForTesting(), pix); err != nil {
|
if err := dst.ReadPixels(ui.GraphicsDriverForTesting(), pix); err != nil {
|
||||||
@ -430,7 +430,7 @@ func TestSmallImages(t *testing.T) {
|
|||||||
pix[4*i+2] = 0xff
|
pix[4*i+2] = 0xff
|
||||||
pix[4*i+3] = 0xff
|
pix[4*i+3] = 0xff
|
||||||
}
|
}
|
||||||
src.ReplacePixels(pix, 0, 0, w, h)
|
src.WritePixels(pix, 0, 0, w, h)
|
||||||
|
|
||||||
vs := quadVertices(w, h, 0, 0, 1)
|
vs := quadVertices(w, h, 0, 0, 1)
|
||||||
is := graphics.QuadIndices()
|
is := graphics.QuadIndices()
|
||||||
@ -477,7 +477,7 @@ func TestLongImages(t *testing.T) {
|
|||||||
pix[4*i+2] = 0xff
|
pix[4*i+2] = 0xff
|
||||||
pix[4*i+3] = 0xff
|
pix[4*i+3] = 0xff
|
||||||
}
|
}
|
||||||
src.ReplacePixels(pix, 0, 0, w, h)
|
src.WritePixels(pix, 0, 0, w, h)
|
||||||
|
|
||||||
const scale = 120
|
const scale = 120
|
||||||
vs := quadVertices(w, h, 0, 0, scale)
|
vs := quadVertices(w, h, 0, 0, scale)
|
||||||
@ -509,7 +509,7 @@ func TestLongImages(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestDisposeImmediately(t *testing.T) {
|
func TestDisposeImmediately(t *testing.T) {
|
||||||
// This tests restorable.Image.ClearPixels is called but ReplacePixels is not called.
|
// This tests restorable.Image.ClearPixels is called but WritePixels is not called.
|
||||||
|
|
||||||
img0 := atlas.NewImage(16, 16, atlas.ImageTypeRegular)
|
img0 := atlas.NewImage(16, 16, atlas.ImageTypeRegular)
|
||||||
img0.EnsureIsolatedForTesting()
|
img0.EnsureIsolatedForTesting()
|
||||||
@ -527,12 +527,12 @@ func TestExtendWithBigImage(t *testing.T) {
|
|||||||
img0 := atlas.NewImage(1, 1, atlas.ImageTypeRegular)
|
img0 := atlas.NewImage(1, 1, atlas.ImageTypeRegular)
|
||||||
defer img0.MarkDisposed()
|
defer img0.MarkDisposed()
|
||||||
|
|
||||||
img0.ReplacePixels(make([]byte, 4*1*1), 0, 0, 1, 1)
|
img0.WritePixels(make([]byte, 4*1*1), 0, 0, 1, 1)
|
||||||
|
|
||||||
img1 := atlas.NewImage(minImageSizeForTesting+1, minImageSizeForTesting+1, atlas.ImageTypeRegular)
|
img1 := atlas.NewImage(minImageSizeForTesting+1, minImageSizeForTesting+1, atlas.ImageTypeRegular)
|
||||||
defer img1.MarkDisposed()
|
defer img1.MarkDisposed()
|
||||||
|
|
||||||
img1.ReplacePixels(make([]byte, 4*(minImageSizeForTesting+1)*(minImageSizeForTesting+1)), 0, 0, minImageSizeForTesting+1, minImageSizeForTesting+1)
|
img1.WritePixels(make([]byte, 4*(minImageSizeForTesting+1)*(minImageSizeForTesting+1)), 0, 0, minImageSizeForTesting+1, minImageSizeForTesting+1)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Issue #1217
|
// Issue #1217
|
||||||
@ -545,7 +545,7 @@ func TestMaxImageSize(t *testing.T) {
|
|||||||
s := maxImageSizeForTesting - 2*paddingSize
|
s := maxImageSizeForTesting - 2*paddingSize
|
||||||
img1 := atlas.NewImage(s, s, atlas.ImageTypeRegular)
|
img1 := atlas.NewImage(s, s, atlas.ImageTypeRegular)
|
||||||
defer img1.MarkDisposed()
|
defer img1.MarkDisposed()
|
||||||
img1.ReplacePixels(make([]byte, 4*s*s), 0, 0, s, s)
|
img1.WritePixels(make([]byte, 4*s*s), 0, 0, s, s)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Issue #1217 (disabled)
|
// Issue #1217 (disabled)
|
||||||
@ -558,7 +558,7 @@ func Disable_TestMinImageSize(t *testing.T) {
|
|||||||
s := minImageSizeForTesting
|
s := minImageSizeForTesting
|
||||||
img := atlas.NewImage(s, s, atlas.ImageTypeRegular)
|
img := atlas.NewImage(s, s, atlas.ImageTypeRegular)
|
||||||
defer img.MarkDisposed()
|
defer img.MarkDisposed()
|
||||||
img.ReplacePixels(make([]byte, 4*s*s), 0, 0, s, s)
|
img.WritePixels(make([]byte, 4*s*s), 0, 0, s, s)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestMaxImageSizeJust(t *testing.T) {
|
func TestMaxImageSizeJust(t *testing.T) {
|
||||||
@ -567,7 +567,7 @@ func TestMaxImageSizeJust(t *testing.T) {
|
|||||||
// TODO: Should we allow such this size for ImageTypeRegular?
|
// TODO: Should we allow such this size for ImageTypeRegular?
|
||||||
img := atlas.NewImage(s, s, atlas.ImageTypeUnmanaged)
|
img := atlas.NewImage(s, s, atlas.ImageTypeUnmanaged)
|
||||||
defer img.MarkDisposed()
|
defer img.MarkDisposed()
|
||||||
img.ReplacePixels(make([]byte, 4*s*s), 0, 0, s, s)
|
img.WritePixels(make([]byte, 4*s*s), 0, 0, s, s)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestMaxImageSizeExceeded(t *testing.T) {
|
func TestMaxImageSizeExceeded(t *testing.T) {
|
||||||
@ -578,11 +578,11 @@ func TestMaxImageSizeExceeded(t *testing.T) {
|
|||||||
|
|
||||||
defer func() {
|
defer func() {
|
||||||
if err := recover(); err == nil {
|
if err := recover(); err == nil {
|
||||||
t.Errorf("ReplacePixels must panic but not")
|
t.Errorf("WritePixels must panic but not")
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
img.ReplacePixels(make([]byte, 4*(s+1)*s), 0, 0, s+1, s)
|
img.WritePixels(make([]byte, 4*(s+1)*s), 0, 0, s+1, s)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Issue #1421
|
// Issue #1421
|
||||||
@ -690,7 +690,7 @@ func TestImageIsNotReputOnAtlasWithoutUsingAsSource(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestImageReplacePixelsModify(t *testing.T) {
|
func TestImageWritePixelsModify(t *testing.T) {
|
||||||
for _, typ := range []atlas.ImageType{atlas.ImageTypeRegular, atlas.ImageTypeVolatile, atlas.ImageTypeUnmanaged} {
|
for _, typ := range []atlas.ImageType{atlas.ImageTypeRegular, atlas.ImageTypeVolatile, atlas.ImageTypeUnmanaged} {
|
||||||
const size = 16
|
const size = 16
|
||||||
img := atlas.NewImage(size, size, typ)
|
img := atlas.NewImage(size, size, typ)
|
||||||
@ -704,9 +704,9 @@ func TestImageReplacePixelsModify(t *testing.T) {
|
|||||||
pix[4*(i+j*size)+3] = byte(i + j)
|
pix[4*(i+j*size)+3] = byte(i + j)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
img.ReplacePixels(pix, 0, 0, size, size)
|
img.WritePixels(pix, 0, 0, size, size)
|
||||||
|
|
||||||
// Modify pix after ReplacePixels.
|
// Modify pix after WritePixels.
|
||||||
for j := 0; j < size; j++ {
|
for j := 0; j < size; j++ {
|
||||||
for i := 0; i < size; i++ {
|
for i := 0; i < size; i++ {
|
||||||
pix[4*(i+j*size)] = 0
|
pix[4*(i+j*size)] = 0
|
||||||
|
@ -62,9 +62,9 @@ func TestImageDrawTwice(t *testing.T) {
|
|||||||
|
|
||||||
dst := atlas.NewImage(w, h, atlas.ImageTypeRegular)
|
dst := atlas.NewImage(w, h, atlas.ImageTypeRegular)
|
||||||
src0 := atlas.NewImage(w, h, atlas.ImageTypeRegular)
|
src0 := atlas.NewImage(w, h, atlas.ImageTypeRegular)
|
||||||
src0.ReplacePixels([]byte{0xff, 0xff, 0xff, 0xff}, 0, 0, w, h)
|
src0.WritePixels([]byte{0xff, 0xff, 0xff, 0xff}, 0, 0, w, h)
|
||||||
src1 := atlas.NewImage(w, h, atlas.ImageTypeRegular)
|
src1 := atlas.NewImage(w, h, atlas.ImageTypeRegular)
|
||||||
src1.ReplacePixels([]byte{0x80, 0x80, 0x80, 0xff}, 0, 0, w, h)
|
src1.WritePixels([]byte{0x80, 0x80, 0x80, 0xff}, 0, 0, w, h)
|
||||||
|
|
||||||
vs := quadVertices(w, h, 0, 0, 1)
|
vs := quadVertices(w, h, 0, 0, 1)
|
||||||
is := graphics.QuadIndices()
|
is := graphics.QuadIndices()
|
||||||
|
@ -135,7 +135,7 @@ func (i *Image) ReplacePixels(pix []byte, x, y, width, height int) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
i.invalidatePixels()
|
i.invalidatePixels()
|
||||||
i.img.ReplacePixels(pix, x, y, width, height)
|
i.img.WritePixels(pix, x, y, width, height)
|
||||||
}
|
}
|
||||||
|
|
||||||
// DrawTriangles draws the src image with the given vertices.
|
// DrawTriangles draws the src image with the given vertices.
|
||||||
|
Loading…
Reference in New Issue
Block a user