refactor(重构提升): 优化JPEG图像处理性能,减少内存分配
build.yaml / build (push) Successful in 38s

This commit is contained in:
xiaoqidun committed 2026-09-10 15:36:52 +08:00
1 parent ce6a9c8ec0
commit 8d553709ba
1 file changed
+4
+4
View File
@@ -395,6 +395,10 @@ func imageNRGBAAt(img image.Image, x, y int) color.NRGBA {
if src, ok := img.(*image.NRGBA); ok { if src, ok := img.(*image.NRGBA); ok {
return src.NRGBAAt(x, y) return src.NRGBAAt(x, y)
} }
if src, ok := img.(*image.YCbCr); ok {
r, g, b, _ := src.YCbCrAt(x, y).RGBA()
return color.NRGBA{R: uint8(r >> 8), G: uint8(g >> 8), B: uint8(b >> 8), A: 255}
}
return color.NRGBAModel.Convert(img.At(x, y)).(color.NRGBA) return color.NRGBAModel.Convert(img.At(x, y)).(color.NRGBA)
} }