Best Hardware for Photopaint, Video card, CPu or more RAM?

Specifically I want to speed up the scrolling of an image at very close magnification, particularly when drawing large masks. I have 4mb ram, Win 10, ATI Video, and an intel CPU (forget the type), running X7 .

Often the scrolling is so slow when drawing a large mask in a straight line to the edge of an image I push the mouse off the screen and do other things while the view pans along.

So if I want to increase the scroll speed when working at the pixel level, what will give me the biggest bang for the buck?