internal/restorable: refactoring

This commit is contained in:
Hajime Hoshi 2023-05-26 01:44:13 +09:00
parent 0f4066e7ac
commit 8de08295e9

View File

@ -34,10 +34,10 @@ func (p *pixelsRecord) readPixels(pixels []byte, region image.Rectangle, imageWi
dstBaseX := r.Min.X - region.Min.X dstBaseX := r.Min.X - region.Min.X
dstBaseY := r.Min.Y - region.Min.Y dstBaseY := r.Min.Y - region.Min.Y
srcBaseX := r.Min.X - p.rect.Min.X
srcBaseY := r.Min.Y - p.rect.Min.Y
lineWidth := 4 * r.Dx() lineWidth := 4 * r.Dx()
if p.pix != nil { if p.pix != nil {
srcBaseX := r.Min.X - p.rect.Min.X
srcBaseY := r.Min.Y - p.rect.Min.Y
for j := 0; j < r.Dy(); j++ { for j := 0; j < r.Dy(); j++ {
dstX := 4 * ((dstBaseY+j)*region.Dx() + dstBaseX) dstX := 4 * ((dstBaseY+j)*region.Dx() + dstBaseX)
srcX := 4 * ((srcBaseY+j)*p.rect.Dx() + srcBaseX) srcX := 4 * ((srcBaseY+j)*p.rect.Dx() + srcBaseX)