Brush/Pen optimizations, nearly ready for adopting XCSoar's portable Brush/Pen classes