Fixed #2445 refactor code for rendering classes to optimize performance

refactor code for rendering classes to optimize performance