Use cairo API to calculate stride (bug 733357)

The cairo documentation recommends this because the stride maybe larger
than width * bytes_per_pixel to provide proper alignment for each pixel
and row.