drawPalette() improvements (see doc for testcase)