Only use the transparent image generation if there where any transparent blocks.

This commit is contained in:
Sascha L. Teichmann 2014-10-26 22:36:57 +01:00
parent b8bae923ec
commit f5d84f0b7b

View File

@ -166,7 +166,8 @@ func (r *Renderer) Reset() {
r.yMin[i] = math.MinInt32
}
if r.tBuffer != nil {
if r.TransparentBlocks > 0 {
r.TransparentBlocks = 0
for i, t := range r.tBuffer {
if t != nil {
r.spans.FreeAll(t)
@ -174,6 +175,8 @@ func (r *Renderer) Reset() {
}
}
}
r.SolidBlocks = 0
r.RejectedBlocks = 0
}
func (r *Renderer) IsFilled() bool {
@ -416,7 +419,7 @@ func (r *Renderer) CreateShadedImage(
pix := image.Pix
if r.tBuffer != nil { // Fast path for transparent images.
if r.TransparentBlocks > 0 { // Fast path for transparent images.
for z := height - 1; z >= 0; z-- {
for x := 0; x < width; x++ {
colIdx := r.cBuffer[ofs]