perf(双端优化): 优化双端加载与资源复用
build.yaml / build (push) Successful in 47s

This commit is contained in:
xiaoqidun committed 2026-10-19 20:34:17 +08:00
1 parent 010ab9f314
commit 66aa87304b
10 files changed
+365 -79

No files matched your search

+5 -8
View File
@@ -320,16 +320,13 @@ func (r *Renderer) cachedImageResource(resPath string) (image.Image, error) {
}
}
resPath = cleanPackagePath(r.Reader.ResPath(resPath))
img, ok := r.imageCache.get(resPath)
if !ok {
var err error
img, err = r.readImageResource(resPath)
return r.imageCache.load(r.pageContext, resPath, func() (image.Image, int, error) {
img, err := r.readImageResource(resPath)
if err != nil {
return nil, err
return nil, 0, err
}
r.imageCache.put(resPath, img, baseimage.StorageCost(img, r.imageCache.limit))
}
return img, nil
return img, baseimage.StorageCost(img, r.imageCache.limit), nil
})
}
// decodeImageResource 读取或复用图片资源,按输出需要解码像素