added subpixel sampling code