feat(资源管理): 完善资源管理与校验,优化性能
build.yaml / build (push) Successful in 50s

This commit is contained in:
xiaoqidun committed 2026-10-13 14:24:37 +08:00
1 parent 0e423c9713
commit 7bdb03f7bd
12 files changed
+319 -68

No files matched your search

+1 -10
View File
@@ -15,12 +15,10 @@
package ofdgo
import (
"bytes"
"context"
"crypto/sha256"
"fmt"
"image"
"io"
"math"
)
@@ -127,14 +125,7 @@ func (e *Editor) addImagePage(ctx context.Context, data []byte, options ImagePag
var decoded image.Image
checksum := sha256.Sum256(data)
if !verified[checksum] {
if format == "bmp" || format == "tiff" {
decoded, _, err = decodeImageDataContext(ctx, data)
} else {
decoded, _, err = image.Decode(imageInput{ReadCloser: io.NopCloser(bytes.NewReader(data)), context: ctx})
}
if cancelErr := ctx.Err(); cancelErr != nil {
return 0, cancelErr
}
decoded, _, err = decodeImagePixelsContext(ctx, data)
if err != nil {
return 0, err
}