double roundToNearestPixel(double offset) { return (offset * devicePixelRatio).roundToDouble() / devicePixelRatio; }