Add an option to set device pixel ratio

This is part of the fix for #2276. r? @metajack