Add ImageToColorSpace helper in SkImageFilter

Share this logic among a couple filters that need it. This also fixes a
bug that showed up in the morhpology GM for GPU color space configs.

BUG=skia:

Change-Id: Ic686b07aff80e58e14a86108703bfbb3cf524979
Reviewed-on: https://skia-review.googlesource.com/6475
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
4 files changed