Index: src/pdf/SkPDFUtils.h |
diff --git a/src/pdf/SkPDFUtils.h b/src/pdf/SkPDFUtils.h |
index 124e19961481a6d48da583f8a00c923fe1ef0b03..e655d9e984ed4a3b55d4038ffd53ad3ae81463bb 100644 |
--- a/src/pdf/SkPDFUtils.h |
+++ b/src/pdf/SkPDFUtils.h |
@@ -57,6 +57,15 @@ void DrawFormXObject(int objectIndex, SkWStream* content); |
void ApplyGraphicState(int objectIndex, SkWStream* content); |
void ApplyPattern(int objectIndex, SkWStream* content); |
+// Converts (value / 255.0) with three significant digits of accuracy. |
+// Writes value as string into result. Returns strlen() of result. |
+size_t ColorToDecimal(uint8_t value, char result[5]); |
+inline void AppendColorComponent(uint8_t value, SkWStream* wStream) { |
+ char buffer[5]; |
+ size_t len = SkPDFUtils::ColorToDecimal(value, buffer); |
+ wStream->write(buffer, len); |
+} |
+ |
// 3 = '-', '.', and '\0' characters. |
// 9 = number of significant digits |
// abs(FLT_MIN_10_EXP) = number of zeros in FLT_MIN |