go /
image /
8e3389fa81abf8e318abefa17054df807e5c5692 draw: have Scale and Transform recognize straight copies.
This is only for the NearestNeighbor and ApproxBiLinear Interpolators. A
Kernel interpolator will add blur even when the dst and src rectangles
are the same size.
We do not bother recognizing Transforms that are Scales. The performance
difference is minimal, as you still need to do a per-dst-pixel inverse
mapping either way.
benchmark old ns/op new ns/op delta
BenchmarkSimpleScaleCopy-8 4866297 29586 -99.39%
BenchmarkSimpleTransformCopy-8 4875991 29531 -99.39%
BenchmarkSimpleTransformScale-8 1208147 1223206 +1.25%
Change-Id: If649ad27a4e81bcbb24b18315745c02c9186a5b7
Reviewed-on: https://go-review.googlesource.com/13004
Reviewed-by: Rob Pike <r@golang.org>
3 files changed