draw: actually use type-specific Transform code paths.

I simply forgot to do this in the previous change.

Change-Id: I0ea5d6bb0a09154cb995a665476ffceb155bd49e
Reviewed-on: https://go-review.googlesource.com/7651
Reviewed-by: Rob Pike <r@golang.org>
This commit is contained in:
Nigel Tao 2015-03-17 10:57:00 +11:00
parent 87013da148
commit 9b6f4595fb
2 changed files with 45 additions and 3 deletions

View File

@ -444,7 +444,7 @@ const (
return return
} }
d2s := invert(s2d) d2s := invert(s2d)
z.transform_Image_Image(dst, dr, adr, &d2s, src, sr) $switch z.transform_$dTypeRN_$sTypeRN(dst, dr, adr, &d2s, src, sr)
} }
` `

View File

@ -55,7 +55,28 @@ func (z nnInterpolator) Transform(dst Image, s2d *f64.Aff3, src image.Image, sr
return return
} }
d2s := invert(s2d) d2s := invert(s2d)
z.transform_Image_Image(dst, dr, adr, &d2s, src, sr) switch dst := dst.(type) {
case *image.RGBA:
switch src := src.(type) {
case *image.Gray:
z.transform_RGBA_Gray(dst, dr, adr, &d2s, src, sr)
case *image.NRGBA:
z.transform_RGBA_NRGBA(dst, dr, adr, &d2s, src, sr)
case *image.RGBA:
z.transform_RGBA_RGBA(dst, dr, adr, &d2s, src, sr)
case *image.Uniform:
z.transform_RGBA_Uniform(dst, dr, adr, &d2s, src, sr)
case *image.YCbCr:
z.transform_RGBA_YCbCr(dst, dr, adr, &d2s, src, sr)
default:
z.transform_RGBA_Image(dst, dr, adr, &d2s, src, sr)
}
default:
switch src := src.(type) {
default:
z.transform_Image_Image(dst, dr, adr, &d2s, src, sr)
}
}
} }
func (nnInterpolator) scale_RGBA_Gray(dst *image.RGBA, dr, adr image.Rectangle, src *image.Gray, sr image.Rectangle) { func (nnInterpolator) scale_RGBA_Gray(dst *image.RGBA, dr, adr image.Rectangle, src *image.Gray, sr image.Rectangle) {
@ -388,7 +409,28 @@ func (z ablInterpolator) Transform(dst Image, s2d *f64.Aff3, src image.Image, sr
return return
} }
d2s := invert(s2d) d2s := invert(s2d)
z.transform_Image_Image(dst, dr, adr, &d2s, src, sr) switch dst := dst.(type) {
case *image.RGBA:
switch src := src.(type) {
case *image.Gray:
z.transform_RGBA_Gray(dst, dr, adr, &d2s, src, sr)
case *image.NRGBA:
z.transform_RGBA_NRGBA(dst, dr, adr, &d2s, src, sr)
case *image.RGBA:
z.transform_RGBA_RGBA(dst, dr, adr, &d2s, src, sr)
case *image.Uniform:
z.transform_RGBA_Uniform(dst, dr, adr, &d2s, src, sr)
case *image.YCbCr:
z.transform_RGBA_YCbCr(dst, dr, adr, &d2s, src, sr)
default:
z.transform_RGBA_Image(dst, dr, adr, &d2s, src, sr)
}
default:
switch src := src.(type) {
default:
z.transform_Image_Image(dst, dr, adr, &d2s, src, sr)
}
}
} }
func (ablInterpolator) scale_RGBA_Gray(dst *image.RGBA, dr, adr image.Rectangle, src *image.Gray, sr image.Rectangle) { func (ablInterpolator) scale_RGBA_Gray(dst *image.RGBA, dr, adr image.Rectangle, src *image.Gray, sr image.Rectangle) {