mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 02:38:53 +01:00
doc: Remove 'concurrent-safe' comments from most of non-global functions
This commit is contained in:
parent
4d3ad434b3
commit
858824821f
@ -271,8 +271,6 @@ func (c *Context) Update() error {
|
||||
|
||||
// SampleRate returns the sample rate.
|
||||
// All audio source must have the same sample rate.
|
||||
//
|
||||
// This function is concurrent-safe.
|
||||
func (c *Context) SampleRate() int {
|
||||
return c.sampleRate
|
||||
}
|
||||
@ -325,8 +323,6 @@ type Player struct {
|
||||
//
|
||||
// NewPlayer tries to rewind src by calling Seek to get the current position.
|
||||
// NewPlayer returns error when the Seek returns error.
|
||||
//
|
||||
// This function is concurrent-safe.
|
||||
func NewPlayer(context *Context, src ReadSeekCloser) (*Player, error) {
|
||||
if context.players.hasSource(src) {
|
||||
return nil, errors.New("audio: src cannot be shared with another Player")
|
||||
@ -356,8 +352,6 @@ func NewPlayer(context *Context, src ReadSeekCloser) (*Player, error) {
|
||||
// The format of src should be same as noted at NewPlayer.
|
||||
//
|
||||
// NewPlayerFromBytes returns error in the same situation of NewPlayer.
|
||||
//
|
||||
// This function is concurrent-safe.
|
||||
func NewPlayerFromBytes(context *Context, src []byte) (*Player, error) {
|
||||
b := BytesReadSeekCloser(src)
|
||||
return NewPlayer(context, b)
|
||||
@ -368,8 +362,6 @@ func NewPlayerFromBytes(context *Context, src []byte) (*Player, error) {
|
||||
// When closing, the stream owned by the player will also be closed by calling its Close.
|
||||
//
|
||||
// Close returns error when closing the source returns error.
|
||||
//
|
||||
// This function is concurrent-safe.
|
||||
func (p *Player) Close() error {
|
||||
p.players.removePlayer(p)
|
||||
runtime.SetFinalizer(p, nil)
|
||||
@ -406,16 +398,12 @@ func (p *Player) bufferLength() int {
|
||||
// Play plays the stream.
|
||||
//
|
||||
// Play always returns nil.
|
||||
//
|
||||
// This function is concurrent-safe.
|
||||
func (p *Player) Play() error {
|
||||
p.players.addPlayer(p)
|
||||
return nil
|
||||
}
|
||||
|
||||
// IsPlaying returns boolean indicating whether the player is playing.
|
||||
//
|
||||
// This function is concurrent-safe.
|
||||
func (p *Player) IsPlaying() bool {
|
||||
return p.players.hasPlayer(p)
|
||||
}
|
||||
@ -423,8 +411,6 @@ func (p *Player) IsPlaying() bool {
|
||||
// Rewind rewinds the current position to the start.
|
||||
//
|
||||
// Rewind returns error when seeking the source returns error.
|
||||
//
|
||||
// This function is concurrent-safe.
|
||||
func (p *Player) Rewind() error {
|
||||
return p.Seek(0)
|
||||
}
|
||||
@ -432,8 +418,6 @@ func (p *Player) Rewind() error {
|
||||
// Seek seeks the position with the given offset.
|
||||
//
|
||||
// Seek returns error when seeking the source returns error.
|
||||
//
|
||||
// This function is concurrent-safe.
|
||||
func (p *Player) Seek(offset time.Duration) error {
|
||||
p.players.addSeeking(p)
|
||||
defer p.players.removeSeeking(p)
|
||||
@ -451,16 +435,12 @@ func (p *Player) Seek(offset time.Duration) error {
|
||||
// Pause pauses the playing.
|
||||
//
|
||||
// Pause always returns nil.
|
||||
//
|
||||
// This function is concurrent-safe.
|
||||
func (p *Player) Pause() error {
|
||||
p.players.removePlayer(p)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Current returns the current position.
|
||||
//
|
||||
// This function is concurrent-safe.
|
||||
func (p *Player) Current() time.Duration {
|
||||
sample := p.pos / bytesPerSample / channelNum
|
||||
return time.Duration(sample) * time.Second / time.Duration(p.sampleRate)
|
||||
|
24
image.go
24
image.go
@ -139,8 +139,6 @@ type Image struct {
|
||||
}
|
||||
|
||||
// Size returns the size of the image.
|
||||
//
|
||||
// This function is concurrent-safe.
|
||||
func (i *Image) Size() (width, height int) {
|
||||
return i.impl.restorable.Size()
|
||||
}
|
||||
@ -150,8 +148,6 @@ func (i *Image) Size() (width, height int) {
|
||||
// When the image is disposed, Clear does nothing.
|
||||
//
|
||||
// Clear always returns nil as of 1.5.0-alpha.
|
||||
//
|
||||
// This function is concurrent-safe.
|
||||
func (i *Image) Clear() error {
|
||||
theImagesForRestoring.resetPixelsIfDependingOn(i, glContext())
|
||||
i.impl.Fill(color.Transparent)
|
||||
@ -163,8 +159,6 @@ func (i *Image) Clear() error {
|
||||
// When the image is disposed, Fill does nothing.
|
||||
//
|
||||
// Fill always returns nil as of 1.5.0-alpha.
|
||||
//
|
||||
// This function is concurrent-safe.
|
||||
func (i *Image) Fill(clr color.Color) error {
|
||||
theImagesForRestoring.resetPixelsIfDependingOn(i, glContext())
|
||||
i.impl.Fill(clr)
|
||||
@ -193,8 +187,6 @@ func (i *Image) Fill(clr color.Color) error {
|
||||
// When image is as same as i, DrawImage panics.
|
||||
//
|
||||
// DrawImage always returns nil as of 1.5.0-alpha.
|
||||
//
|
||||
// This function is concurrent-safe.
|
||||
func (i *Image) DrawImage(image *Image, options *DrawImageOptions) error {
|
||||
theImagesForRestoring.resetPixelsIfDependingOn(i, glContext())
|
||||
i.impl.DrawImage(image, options)
|
||||
@ -202,16 +194,12 @@ func (i *Image) DrawImage(image *Image, options *DrawImageOptions) error {
|
||||
}
|
||||
|
||||
// Bounds returns the bounds of the image.
|
||||
//
|
||||
// This function is concurrent-safe.
|
||||
func (i *Image) Bounds() image.Rectangle {
|
||||
w, h := i.impl.restorable.Size()
|
||||
return image.Rect(0, 0, w, h)
|
||||
}
|
||||
|
||||
// ColorModel returns the color model of the image.
|
||||
//
|
||||
// This function is concurrent-safe.
|
||||
func (i *Image) ColorModel() color.Model {
|
||||
return color.RGBAModel
|
||||
}
|
||||
@ -221,8 +209,6 @@ func (i *Image) ColorModel() color.Model {
|
||||
// This method loads pixels from VRAM to system memory if necessary.
|
||||
//
|
||||
// This method can't be called before the main loop (ebiten.Run) starts (as of version 1.4.0-alpha).
|
||||
//
|
||||
// This function is concurrent-safe.
|
||||
func (i *Image) At(x, y int) color.Color {
|
||||
return i.impl.At(x, y, glContext())
|
||||
}
|
||||
@ -235,8 +221,6 @@ func (i *Image) At(x, y int) color.Color {
|
||||
// When the image is disposed, Dipose does nothing.
|
||||
//
|
||||
// Dipose always return nil as of 1.5.0-alpha.
|
||||
//
|
||||
// This function is concurrent-safe.
|
||||
func (i *Image) Dispose() error {
|
||||
if i.impl.isDisposed() {
|
||||
return nil
|
||||
@ -257,8 +241,6 @@ func (i *Image) Dispose() error {
|
||||
// When the image is disposed, ReplacePixels does nothing.
|
||||
//
|
||||
// ReplacePixels always returns nil as of 1.5.0-alpha.
|
||||
//
|
||||
// This function is concurrent-safe.
|
||||
func (i *Image) ReplacePixels(p []uint8) error {
|
||||
theImagesForRestoring.resetPixelsIfDependingOn(i, glContext())
|
||||
i.impl.ReplacePixels(p)
|
||||
@ -281,8 +263,6 @@ type DrawImageOptions struct {
|
||||
// If width or height is less than 1 or more than MaxImageSize, NewImage panics.
|
||||
//
|
||||
// Error returned by NewImage is always nil as of 1.5.0-alpha.
|
||||
//
|
||||
// This function is concurrent-safe.
|
||||
func NewImage(width, height int, filter Filter) (*Image, error) {
|
||||
checkSize(width, height)
|
||||
img := newImageImpl(width, height, filter, false)
|
||||
@ -303,8 +283,6 @@ func NewImage(width, height int, filter Filter) (*Image, error) {
|
||||
// If width or height is less than 1 or more than MaxImageSize, newVolatileImage panics.
|
||||
//
|
||||
// Error returned by newVolatileImage is always nil as of 1.5.0-alpha.
|
||||
//
|
||||
// This function is concurrent-safe.
|
||||
func newVolatileImage(width, height int, filter Filter) (*Image, error) {
|
||||
checkSize(width, height)
|
||||
img := newImageImpl(width, height, filter, true)
|
||||
@ -317,8 +295,6 @@ func newVolatileImage(width, height int, filter Filter) (*Image, error) {
|
||||
// If source's width or height is less than 1 or more than MaxImageSize, NewImageFromImage panics.
|
||||
//
|
||||
// Error returned by NewImageFromImage is always nil as of 1.5.0-alpha.
|
||||
//
|
||||
// This function is concurrent-safe.
|
||||
func NewImageFromImage(source image.Image, filter Filter) (*Image, error) {
|
||||
size := source.Bounds().Size()
|
||||
checkSize(size.X, size.Y)
|
||||
|
Loading…
Reference in New Issue
Block a user