diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp index 258e94e7e6..78fa140b31 100644 --- a/dm/DMSrcSink.cpp +++ b/dm/DMSrcSink.cpp @@ -34,7 +34,6 @@ #include "SkSVGCanvas.h" #include "SkStream.h" #include "SkTLogic.h" -#include "SkXMLWriter.h" #include "SkSwizzler.h" #include @@ -46,6 +45,10 @@ #include "qcms.h" #endif +#if defined(SK_XML) + #include "SkXMLWriter.h" +#endif + DEFINE_bool(multiPage, false, "For document-type backends, render the source" " into multiple pages"); DEFINE_bool(RAW_threading, true, "Allow RAW decodes to run on multiple threads?"); @@ -1205,11 +1208,15 @@ Error SKPSink::draw(const Src& src, SkBitmap*, SkWStream* dst, SkString*) const SVGSink::SVGSink() {} Error SVGSink::draw(const Src& src, SkBitmap*, SkWStream* dst, SkString*) const { +#if defined(SK_XML) SkAutoTDelete xmlWriter(new SkXMLStreamWriter(dst)); SkAutoTUnref canvas(SkSVGCanvas::Create( SkRect::MakeWH(SkIntToScalar(src.size().width()), SkIntToScalar(src.size().height())), xmlWriter)); return src.draw(canvas); +#else + return Error("SVG sink is disabled."); +#endif // SK_XML } /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ diff --git a/gyp/xml.gyp b/gyp/xml.gyp index f7cb429dc0..6529d0c471 100644 --- a/gyp/xml.gyp +++ b/gyp/xml.gyp @@ -35,6 +35,9 @@ 'include_dirs': [ '../include/xml', ], + 'defines' : [ + 'SK_XML', + ], }, }, ], diff --git a/tests/SkDOMTest.cpp b/tests/SkDOMTest.cpp index aca2c4870b..34bd8dd8b3 100644 --- a/tests/SkDOMTest.cpp +++ b/tests/SkDOMTest.cpp @@ -5,9 +5,12 @@ * found in the LICENSE file. */ -#include "SkDOM.h" #include "Test.h" +#if defined(SK_XML) + +#include "SkDOM.h" + DEF_TEST(SkDOM_test, r) { static const char gDoc[] = "" @@ -37,3 +40,5 @@ DEF_TEST(SkDOM_test, r) { REPORTER_ASSERT(r, dom.getFirstChild(root, "elem1")); REPORTER_ASSERT(r, !dom.getFirstChild(root, "subelem1")); } + +#endif // SK_XML