Dispersion of Magnetic Excitations in the Cuprate La2CuO4 and CaCuO2 Compounds Measured Using Resonant X-Ray Scattering