In SkPixmap.cpp, change SkAlphaMul to SkMulDiv255.

Add a test that we get the same color back after calling SkBitmap::eraseColor, modulo rounding.

Also update some incorrect docs.

BUG=skia:4297

Review URL: https://codereview.chromium.org/1521673002
diff --git a/tests/BitmapTest.cpp b/tests/BitmapTest.cpp
index 2bd8490..58e3c8b 100644
--- a/tests/BitmapTest.cpp
+++ b/tests/BitmapTest.cpp
@@ -145,3 +145,24 @@
         REPORTER_ASSERT(r, source.getColor(0, 0) == copy.getColor(0, 0));
     }
 }
+
+static void test_erasecolor_premul(skiatest::Reporter* reporter, SkColorType ct, SkColor input,
+                                   SkColor expected) {
+  SkBitmap bm;
+  bm.allocPixels(SkImageInfo::Make(1, 1, ct, kPremul_SkAlphaType));
+  bm.eraseColor(input);
+  SkDebugf("expected: %x actual: %x\n", expected, bm.getColor(0, 0));
+  REPORTER_ASSERT(reporter, bm.getColor(0, 0) == expected);
+}
+
+/**
+ *  This test checks that eraseColor premultiplies the color correctly.
+ */
+DEF_TEST(Bitmap_eraseColor_Premul, r) {
+    SkColor color = 0x80FF0080;
+    test_erasecolor_premul(r, kAlpha_8_SkColorType, color, 0x80000000);
+    test_erasecolor_premul(r, kRGB_565_SkColorType, color, 0xFF840042);
+    test_erasecolor_premul(r, kARGB_4444_SkColorType, color, 0x88FF0080);
+    test_erasecolor_premul(r, kRGBA_8888_SkColorType, color, color);
+    test_erasecolor_premul(r, kBGRA_8888_SkColorType, color, color);
+}