From 2cf96a872a36dbd8cd750fdd0158c16ba55ba297 Mon Sep 17 00:00:00 2001 From: xiaoqidun Date: Fri, 16 Oct 2026 09:31:07 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E5=9B=BE=E5=83=8F=E9=A2=9C=E8=89=B2):=20?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=B7=B7=E5=90=88=E5=9B=BE=E5=83=8F=E9=A2=9C?= =?UTF-8?q?=E8=89=B2=E8=BD=AC=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/base/image/tiff_profile.go | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/internal/base/image/tiff_profile.go b/internal/base/image/tiff_profile.go index 22720a8..7439ffd 100644 --- a/internal/base/image/tiff_profile.go +++ b/internal/base/image/tiff_profile.go @@ -104,7 +104,6 @@ func applyImageColorProfile(ctx context.Context, source image.Image, profile *pd var previous [4]float64 var previousPixel color.NRGBA64 for y := bounds.Min.Y; y < bounds.Max.Y; y++ { - misses := 0 for x := bounds.Min.X; x < bounds.Max.X; x++ { if (x-bounds.Min.X)&255 == 0 { if err := ctx.Err(); err != nil { @@ -155,17 +154,13 @@ func applyImageColorProfile(ctx context.Context, source image.Image, profile *pd alpha = pixel.A values = [4]float64{float64(pixel.R) / 65535, float64(pixel.G) / 65535, float64(pixel.B) / 65535} } - if misses < 32 { - if previousPixel.A != 0 && values == previous { - pixel := previousPixel - pixel.A = alpha - result.SetNRGBA64(x, y, pixel) - misses = 0 - continue - } - previous = values - misses++ + if previousPixel.A != 0 && values == previous { + pixel := previousPixel + pixel.A = alpha + result.SetNRGBA64(x, y, pixel) + continue } + previous = values if linearSRGB { for i := range 3 { if values[i] <= 0.04045 { @@ -183,11 +178,7 @@ func applyImageColorProfile(ctx context.Context, source image.Image, profile *pd for i, value := range rgb { channels[i] = uint16(math.Round(max(0, min(1, value)) * 65535)) } - if misses < 32 { - previousPixel = color.NRGBA64{R: channels[0], G: channels[1], B: channels[2], A: 65535} - } else { - previousPixel.A = 0 - } + previousPixel = color.NRGBA64{R: channels[0], G: channels[1], B: channels[2], A: 65535} if slot >= 0 { table[slot] = color.NRGBA64{R: channels[0], G: channels[1], B: channels[2], A: 65535} }