MCPcopy
hub / github.com/fogleman/nes / load

Method load

ui/texture.go:94–108  ·  view source on GitHub ↗
(path string)

Source from the content-addressed store, hash-verified

92}
93
94func (t *Texture) load(path string) int {
95 index := t.lru()
96 delete(t.lookup, t.reverse[index])
97 t.mark(index)
98 t.lookup[path] = index
99 t.reverse[index] = path
100 x := int32((index % textureDim) * 256)
101 y := int32((index / textureDim) * 256)
102 im := copyImage(t.loadThumbnail(path))
103 size := im.Rect.Size()
104 gl.TexSubImage2D(
105 gl.TEXTURE_2D, 0, x, y, int32(size.X), int32(size.Y),
106 gl.RGBA, gl.UNSIGNED_BYTE, gl.Ptr(im.Pix))
107 return index
108}
109
110func (t *Texture) loadThumbnail(romPath string) image.Image {
111 _, name := path.Split(romPath)

Callers 1

LookupMethod · 0.95

Calls 4

lruMethod · 0.95
markMethod · 0.95
loadThumbnailMethod · 0.95
copyImageFunction · 0.85

Tested by

no test coverage detected