Cache empty tiles to speed up seeding. Enforce Go 1.4 for the ability to compress better.

This commit is contained in:
Sascha L. Teichmann
2015-07-22 01:11:14 +02:00
parent 8b4f4b1401
commit e8e4d6afeb
4 changed files with 50 additions and 11 deletions

View File

@ -8,6 +8,7 @@ import (
"container/heap"
"image"
"image/color"
"image/draw"
"math"
)
@ -181,6 +182,10 @@ func (r *Renderer) IsFilled() bool {
return true
}
func (r *Renderer) IsEmpty() bool {
return r.SolidBlocks == 0 && r.TransparentBlocks == 0
}
func (r *Renderer) RenderBlock(block *Block, colors *Colors) (err error) {
bx := block.Coord.X - r.xOfs
@ -392,6 +397,12 @@ func safeColor(x int32) uint8 {
}
}
func BackgroundImage(width, height int, bg color.RGBA) *image.RGBA {
m := image.NewRGBA(image.Rect(0, 0, width, height))
draw.Draw(m, m.Bounds(), &image.Uniform{bg}, image.ZP, draw.Src)
return m
}
func (r *Renderer) CreateShadedImage(
xOfs, zOfs, width, height int,
cols *Colors, background color.RGBA) *image.RGBA {