Combine some duplicate code in AA using template

BUG=skia:

Change-Id: Id048425e8199167feba0268f89f526bbf5b7242b
Reviewed-on: https://skia-review.googlesource.com/9832
Reviewed-by: Cary Clark <caryclark@google.com>
Commit-Queue: Yuqian Li <liyuqian@google.com>
3 files changed