diff options
author | 2017-02-06 09:51:42 -0500 | |
---|---|---|
committer | 2017-02-06 19:00:28 +0000 | |
commit | 5e221e7ca26130393a0527bb9b5155d6685b74ba (patch) | |
tree | cbb8e6de7ac74aed54d8292b2d9448329aaa2bdf /include/core | |
parent | 604971e39a20392fd4c74a56bcdc187311cf86dc (diff) |
SkXPS: new document API.
Now requires a IXpsOMObjectFactory pointer. This will allow sandboxing
to be used in Chromium. (Chrome will create a IXpsOMObjectFactory, then
go into sandbox mode, then call SkDocumenent::MakeXPS().)
Change-Id: Ic4b48d4b148c44e188d12a9481fb74735546528a
Reviewed-on: https://skia-review.googlesource.com/8052
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
Diffstat (limited to 'include/core')
-rw-r--r-- | include/core/SkDocument.h | 35 |
1 files changed, 27 insertions, 8 deletions
diff --git a/include/core/SkDocument.h b/include/core/SkDocument.h index 64291fb17c..6594511df8 100644 --- a/include/core/SkDocument.h +++ b/include/core/SkDocument.h @@ -19,6 +19,10 @@ class SkCanvas; class SkWStream; +#ifdef SK_BUILD_FOR_WIN +struct IXpsOMObjectFactory; +#endif + /** SK_ScalarDefaultDPI is 72 DPI. */ #define SK_ScalarDefaultRasterDPI 72.0f @@ -141,19 +145,34 @@ public: static sk_sp<SkDocument> MakePDF(const char outputFilePath[], SkScalar dpi = SK_ScalarDefaultRasterDPI); +#ifdef SK_BUILD_FOR_WIN /** * Create a XPS-backed document, writing the results into the stream. - * Returns NULL if XPS is not supported. + * + * @param stream A XPS document will be written to this stream. The + * document may write to the stream at anytime during its + * lifetime, until either close() or abort() are called or + * the document is deleted. + * @param xpsFactory A pointer to a COM XPS factory. Must be non-null. + * The document will take a ref to the factory. See + * dm/DMSrcSink.cpp for an example. + * @param dpi The DPI (pixels-per-inch) at which features without + * native XPS support will be rasterized (e.g. draw image + * with perspective, draw text with perspective, ...) A + * larger DPI would create a XPS that reflects the + * original intent with better fidelity, but it can make + * for larger XPS files too, which would use more memory + * while rendering, and it would be slower to be processed + * or sent online or to printer. + * + * @returns nullptr if XPS is not supported. */ static sk_sp<SkDocument> MakeXPS(SkWStream* stream, + IXpsOMObjectFactory* xpsFactory, SkScalar dpi = SK_ScalarDefaultRasterDPI); - - /** - * Create a XPS-backed document, writing the results into a file. - * Returns NULL if XPS is not supported. - */ - static sk_sp<SkDocument> MakeXPS(const char path[], - SkScalar dpi = SK_ScalarDefaultRasterDPI); +#endif + // DEPRECATED; TODO(halcanary): remove this function after Chromium switches to new API. + static sk_sp<SkDocument> MakeXPS(SkWStream*) { return nullptr; } /** * Begin a new page for the document, returning the canvas that will draw |