aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--BUILD.gn66
-rw-r--r--bench/nanobench.cpp9
-rw-r--r--samplecode/SampleCowboy.cpp5
-rw-r--r--samplecode/SampleSVGFile.cpp5
-rw-r--r--tools/viewer/BisectSlide.cpp9
5 files changed, 60 insertions, 34 deletions
diff --git a/BUILD.gn b/BUILD.gn
index 3ff387a266..1c49e51921 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -1331,15 +1331,13 @@ if (skia_enable_tools) {
}
deps = [
":experimental_sksg",
+ ":experimental_svg_model",
":flags",
":skia",
":tool_utils",
"//third_party/libpng",
"//third_party/zlib",
]
- if (skia_use_expat) {
- deps += [ ":experimental_svg_model" ]
- }
public_deps = [
":gpu_tool_utils", # Test.h #includes headers from this target.
]
@@ -1375,35 +1373,39 @@ if (skia_enable_tools) {
}
test_lib("experimental_svg_model") {
- public_include_dirs = [ "experimental/svg/model" ]
- sources = [
- "experimental/svg/model/SkSVGAttribute.cpp",
- "experimental/svg/model/SkSVGAttributeParser.cpp",
- "experimental/svg/model/SkSVGCircle.cpp",
- "experimental/svg/model/SkSVGClipPath.cpp",
- "experimental/svg/model/SkSVGContainer.cpp",
- "experimental/svg/model/SkSVGDOM.cpp",
- "experimental/svg/model/SkSVGEllipse.cpp",
- "experimental/svg/model/SkSVGGradient.cpp",
- "experimental/svg/model/SkSVGLine.cpp",
- "experimental/svg/model/SkSVGLinearGradient.cpp",
- "experimental/svg/model/SkSVGNode.cpp",
- "experimental/svg/model/SkSVGPath.cpp",
- "experimental/svg/model/SkSVGPattern.cpp",
- "experimental/svg/model/SkSVGPoly.cpp",
- "experimental/svg/model/SkSVGRadialGradient.cpp",
- "experimental/svg/model/SkSVGRect.cpp",
- "experimental/svg/model/SkSVGRenderContext.cpp",
- "experimental/svg/model/SkSVGSVG.cpp",
- "experimental/svg/model/SkSVGShape.cpp",
- "experimental/svg/model/SkSVGStop.cpp",
- "experimental/svg/model/SkSVGTransformableNode.cpp",
- "experimental/svg/model/SkSVGUse.cpp",
- "experimental/svg/model/SkSVGValue.cpp",
- ]
- deps = [
- ":skia",
- ]
+ public_include_dirs = []
+ if (skia_use_expat) {
+ public_include_dirs += [ "experimental/svg/model" ]
+ sources = [
+ "experimental/svg/model/SkSVGAttribute.cpp",
+ "experimental/svg/model/SkSVGAttributeParser.cpp",
+ "experimental/svg/model/SkSVGCircle.cpp",
+ "experimental/svg/model/SkSVGClipPath.cpp",
+ "experimental/svg/model/SkSVGContainer.cpp",
+ "experimental/svg/model/SkSVGDOM.cpp",
+ "experimental/svg/model/SkSVGEllipse.cpp",
+ "experimental/svg/model/SkSVGGradient.cpp",
+ "experimental/svg/model/SkSVGLine.cpp",
+ "experimental/svg/model/SkSVGLinearGradient.cpp",
+ "experimental/svg/model/SkSVGNode.cpp",
+ "experimental/svg/model/SkSVGPath.cpp",
+ "experimental/svg/model/SkSVGPattern.cpp",
+ "experimental/svg/model/SkSVGPoly.cpp",
+ "experimental/svg/model/SkSVGRadialGradient.cpp",
+ "experimental/svg/model/SkSVGRect.cpp",
+ "experimental/svg/model/SkSVGRenderContext.cpp",
+ "experimental/svg/model/SkSVGSVG.cpp",
+ "experimental/svg/model/SkSVGShape.cpp",
+ "experimental/svg/model/SkSVGStop.cpp",
+ "experimental/svg/model/SkSVGTransformableNode.cpp",
+ "experimental/svg/model/SkSVGUse.cpp",
+ "experimental/svg/model/SkSVGValue.cpp",
+ ]
+ deps = [
+ ":skia",
+ ":xml",
+ ]
+ }
}
test_lib("experimental_sksg") {
diff --git a/bench/nanobench.cpp b/bench/nanobench.cpp
index ea0de3398e..c097a4d14e 100644
--- a/bench/nanobench.cpp
+++ b/bench/nanobench.cpp
@@ -39,7 +39,6 @@
#include "SkOSFile.h"
#include "SkOSPath.h"
#include "SkPictureRecorder.h"
-#include "SkSVGDOM.h"
#include "SkScan.h"
#include "SkString.h"
#include "SkSurface.h"
@@ -48,6 +47,10 @@
#include "Stats.h"
#include "ios_utils.h"
+#ifdef SK_XML
+#include "SkSVGDOM.h"
+#endif // SK_XML
+
#include <stdlib.h>
#include <thread>
@@ -685,6 +688,7 @@ public:
return nullptr;
}
+#ifdef SK_XML
sk_sp<SkSVGDOM> svgDom = SkSVGDOM::MakeFromStream(stream);
if (!svgDom) {
SkDebugf("Could not parse %s.\n", path);
@@ -701,6 +705,9 @@ public:
svgDom->render(recorder.beginRecording(svgDom->containerSize().width(),
svgDom->containerSize().height()));
return recorder.finishRecordingAsPicture();
+#else
+ return nullptr;
+#endif // SK_XML
}
Benchmark* next() {
diff --git a/samplecode/SampleCowboy.cpp b/samplecode/SampleCowboy.cpp
index bd8f7c909b..f9b9d6e10f 100644
--- a/samplecode/SampleCowboy.cpp
+++ b/samplecode/SampleCowboy.cpp
@@ -5,6 +5,10 @@
* found in the LICENSE file.
*/
+#include "SkTypes.h"
+
+#ifdef SK_XML
+
#include "SampleCode.h"
#include "Resources.h"
#include "SkCanvas.h"
@@ -143,3 +147,4 @@ private:
DEF_SAMPLE( return new CowboyView(); )
+#endif // SK_XML
diff --git a/samplecode/SampleSVGFile.cpp b/samplecode/SampleSVGFile.cpp
index 0be7944f8e..e03d9ff6cb 100644
--- a/samplecode/SampleSVGFile.cpp
+++ b/samplecode/SampleSVGFile.cpp
@@ -5,6 +5,10 @@
* found in the LICENSE file.
*/
+#include "SkTypes.h"
+
+#ifdef SK_XML
+
#include "SampleCode.h"
#include "SkCanvas.h"
#include "SkDOM.h"
@@ -78,3 +82,4 @@ SampleView* CreateSampleSVGFileView(const SkString& filename);
SampleView* CreateSampleSVGFileView(const SkString& filename) {
return new SVGFileView(filename);
}
+#endif // SK_XML
diff --git a/tools/viewer/BisectSlide.cpp b/tools/viewer/BisectSlide.cpp
index 63e69d278c..38ab3c3ffd 100644
--- a/tools/viewer/BisectSlide.cpp
+++ b/tools/viewer/BisectSlide.cpp
@@ -7,11 +7,14 @@
#include "BisectSlide.h"
-#include "SkDOM.h"
#include "SkOSPath.h"
#include "SkPicture.h"
#include "SkStream.h"
+
+#ifdef SK_XML
+#include "SkDOM.h"
#include "../experimental/svg/model/SkSVGDOM.h"
+#endif
sk_sp<BisectSlide> BisectSlide::Create(const char filepath[]) {
SkFILEStream stream(filepath);
@@ -22,6 +25,7 @@ sk_sp<BisectSlide> BisectSlide::Create(const char filepath[]) {
sk_sp<BisectSlide> bisect(new BisectSlide(filepath));
if (bisect->fFilePath.endsWith(".svg")) {
+#ifdef SK_XML
SkDOM xml;
if (!xml.build(stream)) {
SkDebugf("BISECT: XML parsing failed: \"%s\"\n", filepath);
@@ -34,6 +38,9 @@ sk_sp<BisectSlide> BisectSlide::Create(const char filepath[]) {
}
svg->setContainerSize(SkSize::Make(bisect->getDimensions()));
svg->render(bisect.get());
+#else
+ return nullptr;
+#endif
} else {
sk_sp<SkPicture> skp = SkPicture::MakeFromStream(&stream);
if (!skp) {