Ai
1 Star 0 Fork 0

studvc/go-flutter

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
texture.go 1.22 KB
一键复制 编辑 原始数据 按行查看 历史
Pierre Champion | Drakirus 提交于 2020-05-25 20:03 +08:00 . Clean up (#435)
package flutter
import (
"github.com/pkg/errors"
)
// Texture is an identifier for texture declaration
type Texture struct {
ID int64
registry *TextureRegistry
}
// Register registers a textureID with his associated handler
func (t *Texture) Register(handler ExternalTextureHanlderFunc) error {
t.registry.setTextureHandler(t.ID, handler)
err := t.registry.engine.RegisterExternalTexture(t.ID)
if err != nil {
t.registry.setTextureHandler(t.ID, nil)
return errors.Errorf("'go-flutter' couldn't register texture with id: '%v': %v", t.ID, err)
}
return nil
}
// FrameAvailable mark a texture buffer is ready to be draw in the flutter scene
func (t *Texture) FrameAvailable() error {
err := t.registry.engine.MarkExternalTextureFrameAvailable(t.ID)
if err != nil {
return errors.Errorf("'go-flutter' couldn't mark frame available of texture with id: '%v': %v", t.ID, err)
}
return nil
}
// UnRegister unregisters a textureID with his associated handler
func (t *Texture) UnRegister() error {
err := t.registry.engine.UnregisterExternalTexture(t.ID)
if err != nil {
return errors.Errorf("'go-flutter' couldn't unregisters texture with id: '%v': %v", t.ID, err)
}
t.registry.setTextureHandler(t.ID, nil)
return nil
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/studvc/go-flutter.git
git@gitee.com:studvc/go-flutter.git
studvc
go-flutter
go-flutter
master

搜索帮助