singel pixel test
This commit is contained in:
parent
a78768aeb8
commit
a49ce499e2
@ -18,6 +18,20 @@ func Render(img image.Image, rect image.Rectangle) image.Image {
|
||||
return newimg
|
||||
}
|
||||
|
||||
type SinglePixel struct{}
|
||||
|
||||
func (s SinglePixel) At(x, y int) color.Color {
|
||||
return color.White
|
||||
}
|
||||
|
||||
func (s SinglePixel) ColorModel() color.Model {
|
||||
return color.RGBAModel
|
||||
}
|
||||
|
||||
func (s SinglePixel) Bounds() image.Rectangle {
|
||||
return image.Rect(0,0,1,1)
|
||||
}
|
||||
|
||||
func BenchmarkScale(b *testing.B) {
|
||||
for i := 0; i < b.N; i++ {
|
||||
err := png.Encode(io.Discard,
|
||||
@ -31,3 +45,14 @@ func BenchmarkScale(b *testing.B) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkSinglePixel(b *testing.B) {
|
||||
instance := SinglePixel{}
|
||||
err := png.Encode(io.Discard,
|
||||
Scale(instance, b.N),
|
||||
)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user