SkPDF: fix scalar serialization
BUG=skia:4868
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1720863003
Review URL: https://codereview.chromium.org/1720863003
diff --git a/src/pdf/SkPDFUtils.h b/src/pdf/SkPDFUtils.h
index 0aa05a0..814d771 100644
--- a/src/pdf/SkPDFUtils.h
+++ b/src/pdf/SkPDFUtils.h
@@ -58,6 +58,14 @@
static void DrawFormXObject(int objectIndex, SkWStream* content);
static void ApplyGraphicState(int objectIndex, SkWStream* content);
static void ApplyPattern(int objectIndex, SkWStream* content);
+
+ // 3 = '-', '.', and '\0' characters.
+ // 9 = number of significant digits
+ // abs(FLT_MIN_10_EXP) = number of zeros in FLT_MIN
+ static const size_t kMaximumFloatDecimalLength = 3 + 9 - FLT_MIN_10_EXP;
+ // FloatToDecimal is exposed for unit tests.
+ static size_t FloatToDecimal(float value,
+ char output[kMaximumFloatDecimalLength]);
static void AppendScalar(SkScalar value, SkWStream* stream);
static SkString FormatString(const char* input, size_t len);
};