Rename graphics -> graphicscommand

This commit is contained in:
Hajime Hoshi 2018-10-28 20:10:05 +09:00
parent 3349a2c520
commit 2da5192510
17 changed files with 81 additions and 81 deletions

View File

@ -15,7 +15,7 @@
package ebiten
import (
"github.com/hajimehoshi/ebiten/internal/graphics"
"github.com/hajimehoshi/ebiten/internal/graphicscommand"
"github.com/hajimehoshi/ebiten/internal/opengl"
)
@ -24,16 +24,16 @@ type Filter int
const (
// FilterDefault represents the default filter.
FilterDefault Filter = Filter(graphics.FilterDefault)
FilterDefault Filter = Filter(graphicscommand.FilterDefault)
// FilterNearest represents nearest (crisp-edged) filter
FilterNearest Filter = Filter(graphics.FilterNearest)
FilterNearest Filter = Filter(graphicscommand.FilterNearest)
// FilterLinear represents linear filter
FilterLinear Filter = Filter(graphics.FilterLinear)
FilterLinear Filter = Filter(graphicscommand.FilterLinear)
// filterScreen represents a special filter for screen. Inner usage only.
filterScreen Filter = Filter(graphics.FilterScreen)
filterScreen Filter = Filter(graphicscommand.FilterScreen)
)
// CompositeMode represents Porter-Duff composition mode.

View File

@ -20,7 +20,7 @@ import (
"math"
"runtime"
"github.com/hajimehoshi/ebiten/internal/graphics"
"github.com/hajimehoshi/ebiten/internal/graphicscommand"
"github.com/hajimehoshi/ebiten/internal/graphicsutil"
"github.com/hajimehoshi/ebiten/internal/opengl"
"github.com/hajimehoshi/ebiten/internal/shareable"
@ -92,7 +92,7 @@ func (m *mipmap) level(r image.Rectangle, level int) *shareable.Image {
vs = src.QuadVertices(0, 0, w, h, 0.5, 0, 0, 0.5, 0, 0, 1, 1, 1, 1)
}
is := graphicsutil.QuadIndices()
s.DrawImage(src, vs, is, nil, opengl.CompositeModeCopy, graphics.FilterLinear)
s.DrawImage(src, vs, is, nil, opengl.CompositeModeCopy, graphicscommand.FilterLinear)
imgs = append(imgs, s)
w = w2
h = h2
@ -376,17 +376,17 @@ func (i *Image) drawImage(img *Image, options *DrawImageOptions) {
mode := opengl.CompositeMode(options.CompositeMode)
filter := graphics.FilterNearest
filter := graphicscommand.FilterNearest
if options.Filter != FilterDefault {
filter = graphics.Filter(options.Filter)
filter = graphicscommand.Filter(options.Filter)
} else if img.filter != FilterDefault {
filter = graphics.Filter(img.filter)
filter = graphicscommand.Filter(img.filter)
}
a, b, c, d, tx, ty := geom.elements()
level := 0
if filter == graphics.FilterLinear {
if filter == graphicscommand.FilterLinear {
det := geom.det()
if det == 0 {
return
@ -511,11 +511,11 @@ func (i *Image) DrawTriangles(vertices []Vertex, indices []uint16, img *Image, o
mode := opengl.CompositeMode(options.CompositeMode)
filter := graphics.FilterNearest
filter := graphicscommand.FilterNearest
if options.Filter != FilterDefault {
filter = graphics.Filter(options.Filter)
filter = graphicscommand.Filter(options.Filter)
} else if img.filter != FilterDefault {
filter = graphics.Filter(img.filter)
filter = graphicscommand.Filter(img.filter)
}
vs := []float32{}

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package graphics
package graphicscommand
import (
"fmt"

View File

@ -14,7 +14,7 @@
// +build ebitendebug
package graphics
package graphicscommand
func recordLog() bool {
return true

View File

@ -14,7 +14,7 @@
// +build !ebitendebug
package graphics
package graphicscommand
func recordLog() bool {
return false

View File

@ -12,5 +12,5 @@
// See the License for the specific language governing permissions and
// limitations under the License.
// Package graphics represents a low layer for graphics using OpenGL.
package graphics
// Package graphicscommand represents a low layer for graphics using OpenGL.
package graphicscommand

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package graphics
package graphicscommand
import (
"github.com/hajimehoshi/ebiten/internal/opengl"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package graphics
package graphicscommand
import (
"github.com/hajimehoshi/ebiten/internal/affine"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package graphics
package graphicscommand
import (
"fmt"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package graphics
package graphicscommand
import (
"strings"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package graphics
package graphicscommand
import (
"github.com/hajimehoshi/ebiten/internal/opengl"

View File

@ -15,7 +15,7 @@
package graphicsutil
import (
"github.com/hajimehoshi/ebiten/internal/graphics"
"github.com/hajimehoshi/ebiten/internal/graphicscommand"
"github.com/hajimehoshi/ebiten/internal/opengl"
)
@ -30,7 +30,7 @@ type verticesBackend struct {
func (v *verticesBackend) sliceForOneQuad() []float32 {
const num = 256
size := 4 * graphics.VertexSizeInBytes() / opengl.Float.SizeInBytes()
size := 4 * graphicscommand.VertexSizeInBytes() / opengl.Float.SizeInBytes()
if v.backend == nil {
v.backend = make([]float32, size*num)
}

View File

@ -20,7 +20,7 @@ import (
"image/color"
"github.com/hajimehoshi/ebiten/internal/affine"
"github.com/hajimehoshi/ebiten/internal/graphics"
"github.com/hajimehoshi/ebiten/internal/graphicscommand"
"github.com/hajimehoshi/ebiten/internal/graphicsutil"
"github.com/hajimehoshi/ebiten/internal/math"
"github.com/hajimehoshi/ebiten/internal/opengl"
@ -33,12 +33,12 @@ type drawImageHistoryItem struct {
indices []uint16
colorm *affine.ColorM
mode opengl.CompositeMode
filter graphics.Filter
filter graphicscommand.Filter
}
// Image represents an image that can be restored when GL context is lost.
type Image struct {
image *graphics.Image
image *graphicscommand.Image
basePixels []byte
@ -66,7 +66,7 @@ var dummyImage = newImageWithoutInit(16, 16, false)
// Note that Dispose is not called automatically.
func newImageWithoutInit(width, height int, volatile bool) *Image {
i := &Image{
image: graphics.NewImage(width, height),
image: graphicscommand.NewImage(width, height),
volatile: volatile,
}
theImages.add(i)
@ -91,7 +91,7 @@ func NewImage(width, height int, volatile bool) *Image {
// Note that Dispose is not called automatically.
func NewScreenFramebufferImage(width, height int) *Image {
i := &Image{
image: graphics.NewScreenFramebufferImage(width, height),
image: graphicscommand.NewScreenFramebufferImage(width, height),
volatile: false,
screen: true,
}
@ -166,7 +166,7 @@ func (i *Image) ReplacePixels(pixels []byte, x, y, width, height int) {
float32(x), float32(y),
1, 1, 1, 1)
is := graphicsutil.QuadIndices()
i.image.DrawImage(dummyImage.image, vs, is, colorm, opengl.CompositeModeCopy, graphics.FilterNearest)
i.image.DrawImage(dummyImage.image, vs, is, colorm, opengl.CompositeModeCopy, graphicscommand.FilterNearest)
}
if x == 0 && y == 0 && width == w && height == h {
@ -203,7 +203,7 @@ func (i *Image) ReplacePixels(pixels []byte, x, y, width, height int) {
}
// DrawImage draws a given image img to the image.
func (i *Image) DrawImage(img *Image, vertices []float32, indices []uint16, colorm *affine.ColorM, mode opengl.CompositeMode, filter graphics.Filter) {
func (i *Image) DrawImage(img *Image, vertices []float32, indices []uint16, colorm *affine.ColorM, mode opengl.CompositeMode, filter graphicscommand.Filter) {
if len(vertices) == 0 {
return
}
@ -218,7 +218,7 @@ func (i *Image) DrawImage(img *Image, vertices []float32, indices []uint16, colo
}
// appendDrawImageHistory appends a draw-image history item to the image.
func (i *Image) appendDrawImageHistory(image *Image, vertices []float32, indices []uint16, colorm *affine.ColorM, mode opengl.CompositeMode, filter graphics.Filter) {
func (i *Image) appendDrawImageHistory(image *Image, vertices []float32, indices []uint16, colorm *affine.ColorM, mode opengl.CompositeMode, filter graphicscommand.Filter) {
if i.stale || i.volatile || i.screen {
return
}
@ -250,7 +250,7 @@ func (i *Image) At(x, y int) color.RGBA {
}
if i.basePixels == nil || i.drawImageHistory != nil || i.stale {
graphics.FlushCommands()
graphicscommand.FlushCommands()
i.readPixelsFromGPU()
i.drawImageHistory = nil
i.stale = false
@ -328,20 +328,20 @@ func (i *Image) hasDependency() bool {
return len(i.drawImageHistory) > 0
}
// Restore restores *graphics.Image from the pixels using its state.
// Restore restores *graphicscommand.Image from the pixels using its state.
func (i *Image) restore() error {
w, h := i.image.Size()
if i.screen {
// The screen image should also be recreated because framebuffer might
// be changed.
i.image = graphics.NewScreenFramebufferImage(w, h)
i.image = graphicscommand.NewScreenFramebufferImage(w, h)
i.basePixels = nil
i.drawImageHistory = nil
i.stale = false
return nil
}
if i.volatile {
i.image = graphics.NewImage(w, h)
i.image = graphicscommand.NewImage(w, h)
i.basePixels = nil
i.drawImageHistory = nil
i.stale = false
@ -351,7 +351,7 @@ func (i *Image) restore() error {
// TODO: panic here?
return errors.New("restorable: pixels must not be stale when restoring")
}
gimg := graphics.NewImage(w, h)
gimg := graphicscommand.NewImage(w, h)
if i.basePixels != nil {
gimg.ReplacePixels(i.basePixels, 0, 0, w, h)
} else {
@ -392,7 +392,7 @@ func (i *Image) Dispose() {
// If an image is invalidated, GL context is lost and all the images should be restored asap.
func (i *Image) IsInvalidated() (bool, error) {
// FlushCommands is required because c.offscreen.impl might not have an actual texture.
graphics.FlushCommands()
graphicscommand.FlushCommands()
if !IsRestoringEnabled() {
return false, nil
}

View File

@ -17,7 +17,7 @@ package restorable
import (
"image"
"github.com/hajimehoshi/ebiten/internal/graphics"
"github.com/hajimehoshi/ebiten/internal/graphicscommand"
)
// restoringEnabled indicates if restoring happens or not.
@ -54,7 +54,7 @@ var theImages = &images{
//
// ResolveStaleImages is intended to be called at the end of a frame.
func ResolveStaleImages() {
graphics.FlushCommands()
graphicscommand.FlushCommands()
if !restoringEnabled {
return
}
@ -63,9 +63,9 @@ func ResolveStaleImages() {
// Restore restores the images.
//
// Restoring means to make all *graphics.Image objects have their textures and framebuffers.
// Restoring means to make all *graphicscommand.Image objects have their textures and framebuffers.
func Restore() error {
if err := graphics.ResetGLState(); err != nil {
if err := graphicscommand.ResetGLState(); err != nil {
return err
}
return theImages.restore()
@ -144,7 +144,7 @@ func (i *images) makeStaleIfDependingOnImpl(target *Image) {
// restore restores the images.
//
// Restoring means to make all *graphics.Image objects have their textures and framebuffers.
// Restoring means to make all *graphicscommand.Image objects have their textures and framebuffers.
func (i *images) restore() error {
if !IsRestoringEnabled() {
panic("not reached")
@ -208,9 +208,9 @@ func (i *images) restore() error {
// InitializeGLState initializes the GL state.
func InitializeGLState() error {
return graphics.ResetGLState()
return graphicscommand.ResetGLState()
}
func Error() error {
return graphics.Error()
return graphicscommand.Error()
}

View File

@ -22,7 +22,7 @@ import (
"testing"
"github.com/hajimehoshi/ebiten"
"github.com/hajimehoshi/ebiten/internal/graphics"
"github.com/hajimehoshi/ebiten/internal/graphicscommand"
"github.com/hajimehoshi/ebiten/internal/graphicsutil"
"github.com/hajimehoshi/ebiten/internal/opengl"
. "github.com/hajimehoshi/ebiten/internal/restorable"
@ -118,7 +118,7 @@ func TestRestoreChain(t *testing.T) {
w, h := imgs[i].Size()
vs := graphicsutil.QuadVertices(w, h, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1)
is := graphicsutil.QuadIndices()
imgs[i+1].DrawImage(imgs[i], vs, is, nil, opengl.CompositeModeCopy, graphics.FilterNearest)
imgs[i+1].DrawImage(imgs[i], vs, is, nil, opengl.CompositeModeCopy, graphicscommand.FilterNearest)
}
ResolveStaleImages()
if err := Restore(); err != nil {
@ -160,10 +160,10 @@ func TestRestoreChain2(t *testing.T) {
vs := graphicsutil.QuadVertices(w, h, 0, 0, w, h, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1)
is := graphicsutil.QuadIndices()
imgs[8].DrawImage(imgs[7], vs, is, nil, opengl.CompositeModeCopy, graphics.FilterNearest)
imgs[9].DrawImage(imgs[8], vs, is, nil, opengl.CompositeModeCopy, graphics.FilterNearest)
imgs[8].DrawImage(imgs[7], vs, is, nil, opengl.CompositeModeCopy, graphicscommand.FilterNearest)
imgs[9].DrawImage(imgs[8], vs, is, nil, opengl.CompositeModeCopy, graphicscommand.FilterNearest)
for i := 0; i < 7; i++ {
imgs[i+1].DrawImage(imgs[i], vs, is, nil, opengl.CompositeModeCopy, graphics.FilterNearest)
imgs[i+1].DrawImage(imgs[i], vs, is, nil, opengl.CompositeModeCopy, graphicscommand.FilterNearest)
}
ResolveStaleImages()
@ -206,10 +206,10 @@ func TestRestoreOverrideSource(t *testing.T) {
fill(img1, clr0.R, clr0.G, clr0.B, clr0.A)
vs := graphicsutil.QuadVertices(w, h, 0, 0, w, h, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1)
is := graphicsutil.QuadIndices()
img2.DrawImage(img1, vs, is, nil, opengl.CompositeModeSourceOver, graphics.FilterNearest)
img3.DrawImage(img2, vs, is, nil, opengl.CompositeModeSourceOver, graphics.FilterNearest)
img2.DrawImage(img1, vs, is, nil, opengl.CompositeModeSourceOver, graphicscommand.FilterNearest)
img3.DrawImage(img2, vs, is, nil, opengl.CompositeModeSourceOver, graphicscommand.FilterNearest)
fill(img0, clr1.R, clr1.G, clr1.B, clr1.A)
img1.DrawImage(img0, vs, is, nil, opengl.CompositeModeSourceOver, graphics.FilterNearest)
img1.DrawImage(img0, vs, is, nil, opengl.CompositeModeSourceOver, graphicscommand.FilterNearest)
ResolveStaleImages()
if err := Restore(); err != nil {
t.Fatal(err)
@ -291,23 +291,23 @@ func TestRestoreComplexGraph(t *testing.T) {
}()
vs := graphicsutil.QuadVertices(w, h, 0, 0, w, h, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1)
is := graphicsutil.QuadIndices()
img3.DrawImage(img0, vs, is, nil, opengl.CompositeModeSourceOver, graphics.FilterNearest)
img3.DrawImage(img0, vs, is, nil, opengl.CompositeModeSourceOver, graphicscommand.FilterNearest)
vs = graphicsutil.QuadVertices(w, h, 0, 0, w, h, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1)
img3.DrawImage(img1, vs, is, nil, opengl.CompositeModeSourceOver, graphics.FilterNearest)
img3.DrawImage(img1, vs, is, nil, opengl.CompositeModeSourceOver, graphicscommand.FilterNearest)
vs = graphicsutil.QuadVertices(w, h, 0, 0, w, h, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1)
img4.DrawImage(img1, vs, is, nil, opengl.CompositeModeSourceOver, graphics.FilterNearest)
img4.DrawImage(img1, vs, is, nil, opengl.CompositeModeSourceOver, graphicscommand.FilterNearest)
vs = graphicsutil.QuadVertices(w, h, 0, 0, w, h, 1, 0, 0, 1, 2, 0, 1, 1, 1, 1)
img4.DrawImage(img2, vs, is, nil, opengl.CompositeModeSourceOver, graphics.FilterNearest)
img4.DrawImage(img2, vs, is, nil, opengl.CompositeModeSourceOver, graphicscommand.FilterNearest)
vs = graphicsutil.QuadVertices(w, h, 0, 0, w, h, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1)
img5.DrawImage(img3, vs, is, nil, opengl.CompositeModeSourceOver, graphics.FilterNearest)
img5.DrawImage(img3, vs, is, nil, opengl.CompositeModeSourceOver, graphicscommand.FilterNearest)
vs = graphicsutil.QuadVertices(w, h, 0, 0, w, h, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1)
img6.DrawImage(img3, vs, is, nil, opengl.CompositeModeSourceOver, graphics.FilterNearest)
img6.DrawImage(img3, vs, is, nil, opengl.CompositeModeSourceOver, graphicscommand.FilterNearest)
vs = graphicsutil.QuadVertices(w, h, 0, 0, w, h, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1)
img6.DrawImage(img4, vs, is, nil, opengl.CompositeModeSourceOver, graphics.FilterNearest)
img6.DrawImage(img4, vs, is, nil, opengl.CompositeModeSourceOver, graphicscommand.FilterNearest)
vs = graphicsutil.QuadVertices(w, h, 0, 0, w, h, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1)
img7.DrawImage(img2, vs, is, nil, opengl.CompositeModeSourceOver, graphics.FilterNearest)
img7.DrawImage(img2, vs, is, nil, opengl.CompositeModeSourceOver, graphicscommand.FilterNearest)
vs = graphicsutil.QuadVertices(w, h, 0, 0, w, h, 1, 0, 0, 1, 2, 0, 1, 1, 1, 1)
img7.DrawImage(img3, vs, is, nil, opengl.CompositeModeSourceOver, graphics.FilterNearest)
img7.DrawImage(img3, vs, is, nil, opengl.CompositeModeSourceOver, graphicscommand.FilterNearest)
ResolveStaleImages()
if err := Restore(); err != nil {
t.Fatal(err)
@ -399,8 +399,8 @@ func TestRestoreRecursive(t *testing.T) {
}()
vs := graphicsutil.QuadVertices(w, h, 0, 0, w, h, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1)
is := graphicsutil.QuadIndices()
img1.DrawImage(img0, vs, is, nil, opengl.CompositeModeSourceOver, graphics.FilterNearest)
img0.DrawImage(img1, vs, is, nil, opengl.CompositeModeSourceOver, graphics.FilterNearest)
img1.DrawImage(img0, vs, is, nil, opengl.CompositeModeSourceOver, graphicscommand.FilterNearest)
img0.DrawImage(img1, vs, is, nil, opengl.CompositeModeSourceOver, graphicscommand.FilterNearest)
ResolveStaleImages()
if err := Restore(); err != nil {
t.Fatal(err)
@ -487,7 +487,7 @@ func TestDrawImageAndReplacePixels(t *testing.T) {
vs := graphicsutil.QuadVertices(1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1)
is := graphicsutil.QuadIndices()
img1.DrawImage(img0, vs, is, nil, opengl.CompositeModeCopy, graphics.FilterNearest)
img1.DrawImage(img0, vs, is, nil, opengl.CompositeModeCopy, graphicscommand.FilterNearest)
img1.ReplacePixels([]byte{0xff, 0xff, 0xff, 0xff}, 1, 0, 1, 1)
ResolveStaleImages()
@ -519,8 +519,8 @@ func TestDispose(t *testing.T) {
vs := graphicsutil.QuadVertices(1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1)
is := graphicsutil.QuadIndices()
img1.DrawImage(img2, vs, is, nil, opengl.CompositeModeCopy, graphics.FilterNearest)
img0.DrawImage(img1, vs, is, nil, opengl.CompositeModeCopy, graphics.FilterNearest)
img1.DrawImage(img2, vs, is, nil, opengl.CompositeModeCopy, graphicscommand.FilterNearest)
img0.DrawImage(img1, vs, is, nil, opengl.CompositeModeCopy, graphicscommand.FilterNearest)
img1.Dispose()
ResolveStaleImages()
@ -547,7 +547,7 @@ func TestDoubleResolve(t *testing.T) {
vs := graphicsutil.QuadVertices(1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1)
is := graphicsutil.QuadIndices()
img0.DrawImage(img1, vs, is, nil, opengl.CompositeModeCopy, graphics.FilterNearest)
img0.DrawImage(img1, vs, is, nil, opengl.CompositeModeCopy, graphicscommand.FilterNearest)
img0.ReplacePixels([]uint8{0x00, 0xff, 0x00, 0xff}, 1, 1, 1, 1)
// Now img0 is stale.
ResolveStaleImages()

View File

@ -22,7 +22,7 @@ import (
"sync"
"github.com/hajimehoshi/ebiten/internal/affine"
"github.com/hajimehoshi/ebiten/internal/graphics"
"github.com/hajimehoshi/ebiten/internal/graphicscommand"
"github.com/hajimehoshi/ebiten/internal/graphicsutil"
"github.com/hajimehoshi/ebiten/internal/opengl"
"github.com/hajimehoshi/ebiten/internal/packing"
@ -65,7 +65,7 @@ func (b *backend) TryAlloc(width, height int) (*packing.Node, bool) {
w, h := oldImg.Size()
vs := graphicsutil.QuadVertices(w, h, 0, 0, w, h, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1)
is := graphicsutil.QuadIndices()
newImg.DrawImage(oldImg, vs, is, nil, opengl.CompositeModeCopy, graphics.FilterNearest)
newImg.DrawImage(oldImg, vs, is, nil, opengl.CompositeModeCopy, graphicscommand.FilterNearest)
oldImg.Dispose()
b.restorable = newImg
@ -131,7 +131,7 @@ func (i *Image) ensureNotShared() {
vw, vh := i.backend.restorable.Size()
vs := graphicsutil.QuadVertices(vw, vh, x, y, x+w, y+h, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1)
is := graphicsutil.QuadIndices()
newImg.DrawImage(i.backend.restorable, vs, is, nil, opengl.CompositeModeCopy, graphics.FilterNearest)
newImg.DrawImage(i.backend.restorable, vs, is, nil, opengl.CompositeModeCopy, graphicscommand.FilterNearest)
i.dispose(false)
i.backend = &backend{
@ -204,7 +204,7 @@ func (i *Image) Vertex(dx, dy, sx, sy float32, cr, cg, cb, ca float32) []float32
const MaxCountForShare = 10
func (i *Image) DrawImage(img *Image, vertices []float32, indices []uint16, colorm *affine.ColorM, mode opengl.CompositeMode, filter graphics.Filter) {
func (i *Image) DrawImage(img *Image, vertices []float32, indices []uint16, colorm *affine.ColorM, mode opengl.CompositeMode, filter graphicscommand.Filter) {
backendsM.Lock()
defer backendsM.Unlock()

View File

@ -22,7 +22,7 @@ import (
"testing"
"github.com/hajimehoshi/ebiten"
"github.com/hajimehoshi/ebiten/internal/graphics"
"github.com/hajimehoshi/ebiten/internal/graphicscommand"
"github.com/hajimehoshi/ebiten/internal/graphicsutil"
"github.com/hajimehoshi/ebiten/internal/opengl"
. "github.com/hajimehoshi/ebiten/internal/shareable"
@ -88,7 +88,7 @@ func TestEnsureNotShared(t *testing.T) {
// img4.ensureNotShared() should be called.
vs := img3.QuadVertices(0, 0, size/2, size/2, 1, 0, 0, 1, size/4, size/4, 1, 1, 1, 1)
is := graphicsutil.QuadIndices()
img4.DrawImage(img3, vs, is, nil, opengl.CompositeModeCopy, graphics.FilterNearest)
img4.DrawImage(img3, vs, is, nil, opengl.CompositeModeCopy, graphicscommand.FilterNearest)
want := false
if got := img4.IsSharedForTesting(); got != want {
t.Errorf("got: %v, want: %v", got, want)
@ -110,7 +110,7 @@ func TestEnsureNotShared(t *testing.T) {
// Check further drawing doesn't cause panic.
// This bug was fixed by 03dcd948.
img4.DrawImage(img3, vs, is, nil, opengl.CompositeModeCopy, graphics.FilterNearest)
img4.DrawImage(img3, vs, is, nil, opengl.CompositeModeCopy, graphicscommand.FilterNearest)
}
func Disabled_TestReshared(t *testing.T) {
@ -152,7 +152,7 @@ func Disabled_TestReshared(t *testing.T) {
// Use img1 as a render target.
vs := img2.QuadVertices(0, 0, size, size, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1)
is := graphicsutil.QuadIndices()
img1.DrawImage(img2, vs, is, nil, opengl.CompositeModeCopy, graphics.FilterNearest)
img1.DrawImage(img2, vs, is, nil, opengl.CompositeModeCopy, graphicscommand.FilterNearest)
want = false
if got := img1.IsSharedForTesting(); got != want {
t.Errorf("got: %v, want: %v", got, want)
@ -160,7 +160,7 @@ func Disabled_TestReshared(t *testing.T) {
// Use img1 as a render source.
for i := 0; i < MaxCountForShare-1; i++ {
img0.DrawImage(img1, vs, is, nil, opengl.CompositeModeCopy, graphics.FilterNearest)
img0.DrawImage(img1, vs, is, nil, opengl.CompositeModeCopy, graphicscommand.FilterNearest)
want := false
if got := img1.IsSharedForTesting(); got != want {
t.Errorf("got: %v, want: %v", got, want)
@ -177,7 +177,7 @@ func Disabled_TestReshared(t *testing.T) {
}
}
img0.DrawImage(img1, vs, is, nil, opengl.CompositeModeCopy, graphics.FilterNearest)
img0.DrawImage(img1, vs, is, nil, opengl.CompositeModeCopy, graphicscommand.FilterNearest)
want = true
if got := img1.IsSharedForTesting(); got != want {
t.Errorf("got: %v, want: %v", got, want)
@ -195,7 +195,7 @@ func Disabled_TestReshared(t *testing.T) {
// Use img3 as a render source. img3 never uses a shared texture.
for i := 0; i < MaxCountForShare*2; i++ {
img0.DrawImage(img3, vs, is, nil, opengl.CompositeModeCopy, graphics.FilterNearest)
img0.DrawImage(img3, vs, is, nil, opengl.CompositeModeCopy, graphicscommand.FilterNearest)
want := false
if got := img3.IsSharedForTesting(); got != want {
t.Errorf("got: %v, want: %v", got, want)