consolidate logic for matrix stage

Bug: skia:
Change-Id: Id1559b31692a1aed9aa4d15620b2019ae9c7c22b
Reviewed-on: https://skia-review.googlesource.com/21404
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
5 files changed