readme
This commit is contained in:
parent
d4aec6bcaf
commit
73d114ef5b
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,4 @@
|
|||||||
child_porn
|
child_porn
|
||||||
imageutils.test
|
imageutils.test
|
||||||
cpu.out
|
cpu.out
|
||||||
|
profile.out
|
||||||
|
3
scale.go
3
scale.go
@ -10,6 +10,8 @@ type rescaled struct {
|
|||||||
scale int
|
scale int
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func Render(
|
||||||
|
|
||||||
// ColorModel implements image.Image interface
|
// ColorModel implements image.Image interface
|
||||||
func (r rescaled) ColorModel() color.Model {
|
func (r rescaled) ColorModel() color.Model {
|
||||||
return r.src.ColorModel()
|
return r.src.ColorModel()
|
||||||
@ -43,4 +45,5 @@ func Scale(img image.Image, scale int) image.Image {
|
|||||||
scale = 1
|
scale = 1
|
||||||
}
|
}
|
||||||
return rescaled{img, scale}
|
return rescaled{img, scale}
|
||||||
|
1
|
||||||
}
|
}
|
||||||
|
@ -23,8 +23,8 @@ func BenchmarkScale(b *testing.B) {
|
|||||||
err := png.Encode(io.Discard,
|
err := png.Encode(io.Discard,
|
||||||
Scale(Render(
|
Scale(Render(
|
||||||
texture.New(color.White, color.Black, 2),
|
texture.New(color.White, color.Black, 2),
|
||||||
image.Rect(0, 0, 32, 32),
|
image.Rect(0, 0, 64, 64),
|
||||||
), 32),
|
), 64),
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
|
Loading…
Reference in New Issue
Block a user