SkPDF: treat alpha as color component.

Before this change, we converted the paint's alpha from a float to a
byte, then serialized it as a float in the range 0-1, with
full single-precision precision (~8 decimals).  This was stupid.

Now, we store a float, and then serialize it with 4 decimals of
precision, like other color components.

Change-Id: I05c6ecf7e6a156087c1964ee0c1ebdedcff0cda5
Reviewed-on: https://skia-review.googlesource.com/c/161142
Commit-Queue: Hal Canary <halcanary@google.com>
Auto-Submit: Hal Canary <halcanary@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
diff --git a/src/pdf/SkPDFGraphicState.h b/src/pdf/SkPDFGraphicState.h
index a9f79ad..86f4eab 100644
--- a/src/pdf/SkPDFGraphicState.h
+++ b/src/pdf/SkPDFGraphicState.h
@@ -50,10 +50,11 @@
 struct SkPDFStrokeGraphicState {
     SkScalar fStrokeWidth;
     SkScalar fStrokeMiter;
+    SkScalar fAlpha;
     uint8_t fStrokeCap;   // SkPaint::Cap
     uint8_t fStrokeJoin;  // SkPaint::Join
-    uint8_t fAlpha;
-    uint8_t fBlendMode;
+    uint8_t fBlendMode;   // SkBlendMode
+    uint8_t fPADDING = 0;
     bool operator==(const SkPDFStrokeGraphicState& o) const { return !memcmp(this, &o, sizeof(o)); }
     bool operator!=(const SkPDFStrokeGraphicState& o) const { return !(*this == o); }
 };
@@ -61,8 +62,9 @@
 
 SK_BEGIN_REQUIRE_DENSE
 struct SkPDFFillGraphicState {
-    uint8_t fAlpha;
+    SkScalar fAlpha;
     uint8_t fBlendMode;
+    uint8_t fPADDING[3] = {0, 0, 0};
     bool operator==(const SkPDFFillGraphicState& o) const { return !memcmp(this, &o, sizeof(o)); }
     bool operator!=(const SkPDFFillGraphicState& o) const { return !(*this == o); }
 };