add local var for dvi->width
define const values for frame height and width
combine common cases in orientation map switch
remove inner if clause form gradient calculations loop
MP: remove control code and function calls from gradient loop