Fixed background context sharing

The background context must use the same pixel format as the foreground
context, otherwise context construction may fail.