go /
image /
db892dd957d40ea8bf3c998d50941e243fcb9e76 draw: clip scaling to the dst bounds.
This is necessary for the upcoming RGBA dst fast path. The RGBA.Set slow
path will clip automatically. Accessing RGBA.Pix directly will not.
Benchmarks look like noise to me:
benchmark old ns/op new ns/op delta
BenchmarkScaleLargeDownNN 6212108 6131166 -1.30%
BenchmarkScaleLargeDownAB 15586042 15656681 +0.45%
BenchmarkScaleLargeDownBL 1518783517 1508124217 -0.70%
BenchmarkScaleLargeDownCR 2998969089 2978114154 -0.70%
BenchmarkScaleDownNN 1821187 1809314 -0.65%
BenchmarkScaleDownAB 4286983 4248974 -0.89%
BenchmarkScaleDownBL 29396818 30181926 +2.67%
BenchmarkScaleDownCR 56441945 57952417 +2.68%
BenchmarkScaleUpNN 90325384 89734496 -0.65%
BenchmarkScaleUpAB 211613922 211625435 +0.01%
BenchmarkScaleUpBL 119730880 120817135 +0.91%
BenchmarkScaleUpCR 178592665 182305702 +2.08%
BenchmarkScaleSrcNRGBA 13271034 13210760 -0.45%
BenchmarkScaleSrcRGBA 13082234 12997551 -0.65%
BenchmarkScaleSrcUniform 4003966 3934184 -1.74%
BenchmarkScaleSrcYCbCr 15939182 15900123 -0.25%
Change-Id: Ibf2843bb3c4eb695b58030e7314053c669533016
Reviewed-on: https://go-review.googlesource.com/6073
Reviewed-by: Rob Pike <r@golang.org>
3 files changed