Fix bugs in handling of global canvas subpixel rendering, and add a test.