[PDF] Restrict scalars to the range that PDF understands.
* Add a config flag to ignore the restrictions
* Apply restriction to both SkPDFScalar and scalars used in content streams.
* +/- 32,767 for the integer part.
* +/1 1/65536 for the fraction part.
Review URL: http://codereview.appspot.com/4240050
git-svn-id: http://skia.googlecode.com/svn/trunk@882 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/include/config/SkUserConfig.h b/include/config/SkUserConfig.h
index c0bbb4b..13169ca 100644
--- a/include/config/SkUserConfig.h
+++ b/include/config/SkUserConfig.h
@@ -123,6 +123,11 @@
*/
//#define SK_ZLIB_INCLUDE <zlib.h>
+/* Define this to allow PDF scalars above 32k. The PDF/A spec doesn't allow
+ them, but modern PDF interpreters should handle them just fine.
+ */
+//#define SK_ALLOW_LARGE_PDF_SCALARS
+
/* Define this to remove dimension checks on bitmaps. Not all blits will be
correct yet, so this is mostly for debugging the implementation.
*/
diff --git a/include/pdf/SkPDFTypes.h b/include/pdf/SkPDFTypes.h
index 7d59634..efa03c3 100644
--- a/include/pdf/SkPDFTypes.h
+++ b/include/pdf/SkPDFTypes.h
@@ -151,6 +151,8 @@
explicit SkPDFScalar(SkScalar value);
virtual ~SkPDFScalar();
+ static void Append(SkScalar value, SkString* string);
+
// The SkPDFObject interface.
virtual void emitObject(SkWStream* stream, SkPDFCatalog* catalog,
bool indirect);