                     secondBestColor = shade
                     secondBestColorDistance = distance
 
-              @_destinationColor = bestColor
+              destinationColor = bestColor
 
               # Apply dithering.
 


              if ditherPercentage > 1 - (paletteColor?.dither or 0)
                if Math.abs(pixel.x % 2) + Math.abs(pixel.y % 2) is 1
                  @_destinationColor = secondBestColor

              ### Smooth shading routine
              #closest = THREE.Color.fromObject bestColor

    # On the server we need to manually request pixel maps.
    spriteData.requirePixelMaps() if Meteor.isServer

    palette = spriteData.customPalette or LOI.Assets.Palette.documents.findOne(spriteData.palette?._id)

    # Build a new canvas if needed.
    unless @_canvas?.width is spriteData.bounds.width and @_canvas?.height is spriteData.bounds.height
