Rename create* -> new*

This commit is contained in:
Hajime Hoshi 2014-12-08 00:53:23 +09:00
parent ca99e94b5c
commit 43fbffebfb
4 changed files with 15 additions and 15 deletions

View File

@ -55,9 +55,9 @@ func newContext(screenWidth, screenHeight, screenScale int) *context {
c.defaultId = idsInstance.addRenderTarget(defaultRenderTarget)
var err error
c.screenId, err = idsInstance.createRenderTarget(screenWidth, screenHeight, graphics.FilterNearest)
c.screenId, err = idsInstance.newRenderTarget(screenWidth, screenHeight, graphics.FilterNearest)
if err != nil {
panic("opengl.NewContext: initializing the offscreen failed: " + err.Error())
panic("opengl.newContext: initializing the offscreen failed: " + err.Error())
}
c.ResetOffscreen()
c.Clear()

View File

@ -27,11 +27,11 @@ var idsInstance = &ids{
}
func NewRenderTargetID(width, height int, filter graphics.Filter) (graphics.RenderTargetID, error) {
return idsInstance.createRenderTarget(width, height, filter)
return idsInstance.newRenderTarget(width, height, filter)
}
func NewTextureID(img image.Image, filter graphics.Filter) (graphics.TextureID, error) {
return idsInstance.createTexture(img, filter)
return idsInstance.newTexture(img, filter)
}
func (i *ids) textureAt(id graphics.TextureID) *texture {
@ -52,8 +52,8 @@ func (i *ids) toTexture(id graphics.RenderTargetID) graphics.TextureID {
return i.renderTargetToTexture[id]
}
func (i *ids) createTexture(img image.Image, filter graphics.Filter) (graphics.TextureID, error) {
texture, err := createTextureFromImage(img, filter)
func (i *ids) newTexture(img image.Image, filter graphics.Filter) (graphics.TextureID, error) {
texture, err := newTextureFromImage(img, filter)
if err != nil {
return 0, err
}
@ -66,12 +66,12 @@ func (i *ids) createTexture(img image.Image, filter graphics.Filter) (graphics.T
return textureId, nil
}
func (i *ids) createRenderTarget(width, height int, filter graphics.Filter) (graphics.RenderTargetID, error) {
texture, err := createTexture(width, height, filter)
func (i *ids) newRenderTarget(width, height int, filter graphics.Filter) (graphics.RenderTargetID, error) {
texture, err := newTexture(width, height, filter)
if err != nil {
return 0, err
}
framebuffer := createFramebuffer(gl.Texture(texture.native))
framebuffer := newFramebuffer(gl.Texture(texture.native))
// The current binded framebuffer can be changed.
i.currentRenderTargetId = -1
r := &renderTarget{

View File

@ -27,7 +27,7 @@ type renderTarget struct {
flipY bool
}
func createFramebuffer(nativeTexture gl.Texture) gl.Framebuffer {
func newFramebuffer(nativeTexture gl.Texture) gl.Framebuffer {
framebuffer := gl.GenFramebuffer()
framebuffer.Bind()

View File

@ -37,7 +37,7 @@ type texture struct {
height int
}
func createNativeTexture(textureWidth, textureHeight int, pixels []uint8, filter graphics.Filter) gl.Texture {
func newNativeTexture(textureWidth, textureHeight int, pixels []uint8, filter graphics.Filter) gl.Texture {
nativeTexture := gl.GenTexture()
if nativeTexture < 0 {
panic("glGenTexture failed")
@ -67,17 +67,17 @@ func createNativeTexture(textureWidth, textureHeight int, pixels []uint8, filter
return nativeTexture
}
func createTexture(width, height int, filter graphics.Filter) (*texture, error) {
func newTexture(width, height int, filter graphics.Filter) (*texture, error) {
w := shader.AdjustSizeForTexture(width)
h := shader.AdjustSizeForTexture(height)
native := createNativeTexture(w, h, nil, filter)
native := newNativeTexture(w, h, nil, filter)
return &texture{native, width, height}, nil
}
func createTextureFromImage(img image.Image, filter graphics.Filter) (*texture, error) {
func newTextureFromImage(img image.Image, filter graphics.Filter) (*texture, error) {
adjustedImage := adjustImageForTexture(img)
size := adjustedImage.Bounds().Size()
native := createNativeTexture(size.X, size.Y, adjustedImage.Pix, filter)
native := newNativeTexture(size.X, size.Y, adjustedImage.Pix, filter)
return &texture{native, size.X, size.Y}, nil
}