Bug 962288 - Don't call DeprecatedGetAsSurface unless it's Cairo. r=mattwoodrow

Changeset from Bug 959123 caused a performance decrease because
DeprecatedGetAsSurface was being called on an image that may not
be a CAIRO_SURFACE.