1 Star 0 Fork 0

橙子/psd

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
compress_js.go 902 Bytes
一键复制 编辑 原始数据 按行查看 历史
oov 提交于 2022-01-22 02:26 . go fmt
//go:build !wasm && js
// +build !wasm,js
package psd
import (
"errors"
"io"
"github.com/gopherjs/gopherjs/js"
)
func decodePackBits(dest []byte, r io.Reader, width int, lines int, large bool) (read int, err error) {
intSize := get4or8(large) >> 1
b := make([]byte, lines*intSize)
var l int
if l, err = io.ReadFull(r, b); err != nil {
return
}
read += l
lens := js.Global.Get("$github.com/oov/psd$").Call("decodePackBitsLines", b, lines, large).Interface().([]uint)
if lens == nil {
return read, errors.New("psd: error occurred in decodePackBitsLines")
}
total := uint(0)
for _, ln := range lens {
total += ln
}
b = make([]byte, total)
if l, err = io.ReadFull(r, b); err != nil {
return
}
read += l
if !js.Global.Get("$github.com/oov/psd$").Call("decodePackBits", dest, b, lens).Bool() {
return read, errors.New("psd: error occurred in decodePackBits")
}
return
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/xuchengzhi/psd.git
[email protected]:xuchengzhi/psd.git
xuchengzhi
psd
psd
master

搜索帮助