Simplify SkCodecs' call to SkColorSpaceXform::apply

Most SkCodec subclasses did the following to apply their
SkColorSpaceXform:
  dstFormat = select_xform_format(dstInfo.colorType());
  srcFormat = select_xform_format(<something that doesn't change>);
  xformAlphaType = select_xform_alpha(dstInfo.alphaType(),
                                      this->getInfo().alphaType());
  this->colorXform()->apply(dstFormat, dst, srcFormat, src, width,
                            xformAlphaType);

Consolidate the computation of these parameters into SkCodec and add a
new method to SkCodec that calls apply() with those parameters.

Add a SkColorSpaceXform::ColorFormat to SkCodec. This allows the new
method SkCodec::applyColorXform to supply the ColorFormat.

TBR=reed@google.com
(No change to public API.)

Change-Id: I8ea7ba4c0024be827a9f9359796c778744330f6e
Reviewed-on: https://skia-review.googlesource.com/18523
Reviewed-by: Leon Scroggins <scroggo@google.com>
Reviewed-by: Matt Sarett <msarett@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
diff --git a/src/codec/SkBmpCodec.cpp b/src/codec/SkBmpCodec.cpp
index 0525d95..c21a863 100644
--- a/src/codec/SkBmpCodec.cpp
+++ b/src/codec/SkBmpCodec.cpp
@@ -602,7 +602,7 @@
 
 SkBmpCodec::SkBmpCodec(int width, int height, const SkEncodedInfo& info, SkStream* stream,
         uint16_t bitsPerPixel, SkCodec::SkScanlineOrder rowOrder)
-    : INHERITED(width, height, info, stream, SkColorSpace::MakeSRGB())
+    : INHERITED(width, height, info, kXformSrcColorFormat, stream, SkColorSpace::MakeSRGB())
     , fBitsPerPixel(bitsPerPixel)
     , fRowOrder(rowOrder)
     , fSrcRowBytes(SkAlign4(compute_row_bytes(width, fBitsPerPixel)))
@@ -653,15 +653,3 @@
 bool SkBmpCodec::onSkipScanlines(int count) {
     return this->skipRows(count);
 }
-
-void SkBmpCodec::applyColorXform(const SkImageInfo& dstInfo, void* dst, void* src) const {
-    SkColorSpaceXform* xform = this->colorXform();
-    if (xform) {
-        const SkColorSpaceXform::ColorFormat dstFormat = select_xform_format(dstInfo.colorType());
-        const SkColorSpaceXform::ColorFormat srcFormat = select_xform_format(kXformSrcColorType);
-        const SkAlphaType alphaType = select_xform_alpha(dstInfo.alphaType(),
-                                                         this->getInfo().alphaType());
-        SkAssertResult(xform->apply(dstFormat, dst, srcFormat, src, dstInfo.width(),
-                                    alphaType));
-    }
-}