BUILD: build when !skia_use_expat

Change-Id: I17a695c64be0e2081ad4937b23038b7ce88ae293
Reviewed-on: https://skia-review.googlesource.com/115988
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Hal Canary <halcanary@google.com>
This commit is contained in:
Hal Canary 2018-03-22 15:21:12 -04:00 committed by Skia Commit-Bot
parent 43e64c7ba8
commit 0f66681ff1
5 changed files with 60 additions and 34 deletions

View File

@ -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") {

View File

@ -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() {

View File

@ -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

View File

@ -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

View File

@ -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) {