1
0
forked from MTSR/mapserver

Replaced Draw rectangle with simple pixel set

This commit is contained in:
Pierre-Yves Rollo 2019-09-25 10:57:33 +02:00
parent 3d64bdd2c5
commit 1e8a1cedc2

View File

@ -4,7 +4,6 @@ import (
"errors" "errors"
"image" "image"
"image/color" "image/color"
"image/draw"
"mapserver/colormapping" "mapserver/colormapping"
"mapserver/coords" "mapserver/coords"
"mapserver/mapblockaccessor" "mapserver/mapblockaccessor"
@ -209,10 +208,21 @@ func (r *MapBlockRenderer) Render(pos1, pos2 *coords.MapBlockCoords) (*image.NRG
imgX := x * IMG_SCALE imgX := x * IMG_SCALE
imgY := (15 - z) * IMG_SCALE imgY := (15 - z) * IMG_SCALE
rect := image.Rect( r32, g32, b32, a32 := c.RGBA()
imgX, imgY, r8, g8, b8, a8 := uint8(r32), uint8(g32), uint8(b32), uint8(a32)
imgX+IMG_SCALE, imgY+IMG_SCALE, for Y := imgY; Y < imgY + IMG_SCALE; Y++ {
) ix := (Y * IMG_SIZE + imgX) << 2
for X := 0; X < IMG_SCALE; X++ {
img.Pix[ix] = r8
ix++
img.Pix[ix] = g8
ix++
img.Pix[ix] = b8
ix++
img.Pix[ix] = a8
ix++
}
}
if c.A != 0xFF || !r.enableTransparency { if c.A != 0xFF || !r.enableTransparency {
//not transparent, mark as rendered //not transparent, mark as rendered
@ -220,8 +230,6 @@ func (r *MapBlockRenderer) Render(pos1, pos2 *coords.MapBlockCoords) (*image.NRG
xzOccupationMap[x][z] = true xzOccupationMap[x][z] = true
} }
draw.Draw(img, rect, &image.Uniform{c}, image.ZP, draw.Src)
if foundBlocks == EXPECTED_BLOCKS_PER_FLAT_MAPBLOCK { if foundBlocks == EXPECTED_BLOCKS_PER_FLAT_MAPBLOCK {
return img, nil return img, nil
} }