Make XML compilation conditional.

Only enabled for gyp-based builds at this time.

R=dogben@google.com,mtklein@google.com
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2150353002

Review-Url: https://codereview.chromium.org/2150353002
This commit is contained in:
fmalita 2016-07-15 10:33:29 -07:00 committed by Commit bot
parent cd4051e1c4
commit 718df0ae3c
3 changed files with 17 additions and 2 deletions

View File

@ -34,7 +34,6 @@
#include "SkSVGCanvas.h"
#include "SkStream.h"
#include "SkTLogic.h"
#include "SkXMLWriter.h"
#include "SkSwizzler.h"
#include <functional>
@ -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<SkXMLWriter> xmlWriter(new SkXMLStreamWriter(dst));
SkAutoTUnref<SkCanvas> 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
}
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/

View File

@ -35,6 +35,9 @@
'include_dirs': [
'../include/xml',
],
'defines' : [
'SK_XML',
],
},
},
],

View File

@ -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[] =
"<root a='1' b='2'>"
@ -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