Revert "Fix compilation w/ "skia_enable_svg = false" (take 2)"
This reverts commit 30a6b101f4
.
Reason for revert: Maybe blocking G3 roll?
Original change's description:
> Fix compilation w/ "skia_enable_svg = false" (take 2)
>
> Change-Id: I036ae171809af56cc9594704b44705ebd095ec80
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/443898
> Reviewed-by: Florin Malita <fmalita@chromium.org>
> Commit-Queue: Robert Phillips <robertphillips@google.com>
TBR=robertphillips@google.com,fmalita@chromium.org,fmalita@google.com,skcq-be@skia-corp.google.com.iam.gserviceaccount.com
Change-Id: Ibee3819e073b04efdf9736058c1f9b288249620c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/444216
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
This commit is contained in:
parent
51b4b86da6
commit
44b7568c8a
@ -51,10 +51,9 @@
|
||||
#include "tools/trace/EventTracingPriv.h"
|
||||
#include "tools/trace/SkDebugfTracer.h"
|
||||
|
||||
#if defined(SK_ENABLE_SVG)
|
||||
#ifdef SK_XML
|
||||
#include "modules/svg/include/SkSVGDOM.h"
|
||||
#include "modules/svg/include/SkSVGNode.h"
|
||||
#endif
|
||||
#endif // SK_XML
|
||||
|
||||
#ifdef SK_ENABLE_ANDROID_UTILS
|
||||
#include "bench/BitmapRegionDecoderBench.h"
|
||||
@ -727,7 +726,7 @@ public:
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
#if defined(SK_ENABLE_SVG)
|
||||
#ifdef SK_XML
|
||||
SkMemoryStream stream(std::move(data));
|
||||
sk_sp<SkSVGDOM> svgDom = SkSVGDOM::MakeFromStream(stream);
|
||||
if (!svgDom) {
|
||||
@ -747,7 +746,7 @@ public:
|
||||
return recorder.finishRecordingAsPicture();
|
||||
#else
|
||||
return nullptr;
|
||||
#endif // defined(SK_ENABLE_SVG)
|
||||
#endif // SK_XML
|
||||
}
|
||||
|
||||
Benchmark* next() {
|
||||
|
@ -877,7 +877,7 @@ static bool gather_srcs() {
|
||||
#if defined(SK_ENABLE_SKRIVE)
|
||||
gather_file_srcs<SkRiveSrc>(FLAGS_rives, "flr", "rive");
|
||||
#endif
|
||||
#if defined(SK_ENABLE_SVG)
|
||||
#if defined(SK_XML)
|
||||
gather_file_srcs<SVGSrc>(FLAGS_svgs, "svg");
|
||||
#endif
|
||||
if (!FLAGS_bisect.isEmpty()) {
|
||||
|
@ -72,10 +72,9 @@
|
||||
#include "experimental/skrive/include/SkRive.h"
|
||||
#endif
|
||||
|
||||
#if defined(SK_ENABLE_SVG)
|
||||
#if defined(SK_XML)
|
||||
#include "include/svg/SkSVGCanvas.h"
|
||||
#include "modules/svg/include/SkSVGDOM.h"
|
||||
#include "modules/svg/include/SkSVGNode.h"
|
||||
#include "src/xml/SkXMLWriter.h"
|
||||
#endif
|
||||
|
||||
@ -1305,7 +1304,7 @@ bool SkRiveSrc::veto(SinkFlags flags) const {
|
||||
#endif
|
||||
|
||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||
#if defined(SK_ENABLE_SVG)
|
||||
#if defined(SK_XML)
|
||||
// Used when the image doesn't have an intrinsic size.
|
||||
static const SkSize kDefaultSVGSize = {1000, 1000};
|
||||
|
||||
@ -1374,7 +1373,7 @@ bool SVGSrc::veto(SinkFlags flags) const {
|
||||
return !type_ok || flags.approach != SinkFlags::kDirect;
|
||||
}
|
||||
|
||||
#endif // defined(SK_ENABLE_SVG)
|
||||
#endif // defined(SK_XML)
|
||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||
|
||||
MSKPSrc::MSKPSrc(Path path) : fPath(path) {
|
||||
@ -2071,7 +2070,7 @@ Result DebugSink::draw(const Src& src, SkBitmap*, SkWStream* dst, SkString*) con
|
||||
SVGSink::SVGSink(int pageIndex) : fPageIndex(pageIndex) {}
|
||||
|
||||
Result SVGSink::draw(const Src& src, SkBitmap*, SkWStream* dst, SkString*) const {
|
||||
#if defined(SK_ENABLE_SVG)
|
||||
#if defined(SK_XML)
|
||||
if (src.pageCount() > 1) {
|
||||
int pageCount = src.pageCount();
|
||||
if (fPageIndex > pageCount - 1) {
|
||||
@ -2087,7 +2086,7 @@ Result SVGSink::draw(const Src& src, SkBitmap*, SkWStream* dst, SkString*) const
|
||||
#else
|
||||
(void)fPageIndex;
|
||||
return Result::Fatal("SVG sink is disabled.");
|
||||
#endif // SK_ENABLE_SVG
|
||||
#endif // SK_XML
|
||||
}
|
||||
|
||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||
|
@ -329,7 +329,7 @@ private:
|
||||
};
|
||||
#endif
|
||||
|
||||
#if defined(SK_ENABLE_SVG)
|
||||
#if defined(SK_XML)
|
||||
} // namespace DM
|
||||
|
||||
class SkSVGDOM;
|
||||
@ -352,7 +352,7 @@ private:
|
||||
|
||||
using INHERITED = Src;
|
||||
};
|
||||
#endif // SK_ENABLE_SVG
|
||||
#endif // SK_XML
|
||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||
|
||||
class MSKPSrc : public Src {
|
||||
|
@ -93,14 +93,11 @@ static void fuzz_sksl2glsl(sk_sp<SkData>);
|
||||
static void fuzz_sksl2metal(sk_sp<SkData>);
|
||||
static void fuzz_sksl2pipeline(sk_sp<SkData>);
|
||||
static void fuzz_sksl2spirv(sk_sp<SkData>);
|
||||
static void fuzz_svg_dom(sk_sp<SkData>);
|
||||
static void fuzz_textblob_deserialize(sk_sp<SkData>);
|
||||
|
||||
static void print_api_names();
|
||||
|
||||
#if defined(SK_ENABLE_SVG)
|
||||
static void fuzz_svg_dom(sk_sp<SkData>);
|
||||
#endif
|
||||
|
||||
#if defined(SK_ENABLE_SKOTTIE)
|
||||
static void fuzz_skottie_json(sk_sp<SkData>);
|
||||
#endif
|
||||
@ -252,12 +249,10 @@ static int fuzz_file(SkString path, SkString type) {
|
||||
fuzz_sksl2pipeline(bytes);
|
||||
return 0;
|
||||
}
|
||||
#if defined(SK_ENABLE_SVG)
|
||||
if (type.equals("svg_dom")) {
|
||||
fuzz_svg_dom(bytes);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
if (type.equals("textblob")) {
|
||||
fuzz_textblob_deserialize(bytes);
|
||||
return 0;
|
||||
@ -309,9 +304,7 @@ static std::map<std::string, std::string> cf_map = {
|
||||
#if defined(SK_ENABLE_SKOTTIE)
|
||||
{"skottie_json", "skottie_json"},
|
||||
#endif
|
||||
#if defined(SK_ENABLE_SVG)
|
||||
{"svg_dom", "svg_dom"},
|
||||
#endif
|
||||
{"textblob_deserialize", "textblob"}
|
||||
};
|
||||
|
||||
@ -362,14 +355,11 @@ static void fuzz_skottie_json(sk_sp<SkData> bytes){
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(SK_ENABLE_SVG)
|
||||
void FuzzSVG(sk_sp<SkData> bytes);
|
||||
|
||||
static void fuzz_svg_dom(sk_sp<SkData> bytes){
|
||||
FuzzSVG(bytes);
|
||||
SkDebugf("[terminated] Done DOM!\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
// This adds up the first 1024 bytes and returns it as an 8 bit integer. This allows afl-fuzz to
|
||||
// deterministically excercise different paths, or *options* (such as different scaling sizes or
|
||||
|
@ -9,9 +9,6 @@
|
||||
#include "include/core/SkStream.h"
|
||||
#include "include/core/SkSurface.h"
|
||||
#include "modules/svg/include/SkSVGDOM.h"
|
||||
#include "modules/svg/include/SkSVGNode.h"
|
||||
|
||||
#if defined(SK_ENABLE_SVG)
|
||||
|
||||
void FuzzSVG(sk_sp<SkData> bytes) {
|
||||
uint8_t w = 100;
|
||||
@ -44,5 +41,3 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // SK_ENABLE_SVG
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
import("../../gn/skia.gni")
|
||||
|
||||
if (skia_enable_svg && skia_use_expat) {
|
||||
if (skia_enable_svg) {
|
||||
config("public_config") {
|
||||
defines = [ "SK_ENABLE_SVG" ]
|
||||
include_dirs = [ "include" ]
|
||||
|
@ -10,7 +10,6 @@
|
||||
#include "include/core/SkStream.h"
|
||||
#include "include/utils/SkNoDrawCanvas.h"
|
||||
#include "modules/svg/include/SkSVGDOM.h"
|
||||
#include "modules/svg/include/SkSVGNode.h"
|
||||
#include "tests/Test.h"
|
||||
|
||||
DEF_TEST(Svg_Filters_NonePaintInputs, r) {
|
||||
|
@ -7,13 +7,12 @@
|
||||
|
||||
#include "include/core/SkTypes.h"
|
||||
|
||||
#if defined(SK_ENABLE_SVG)
|
||||
#ifdef SK_XML
|
||||
|
||||
#include "include/core/SkCanvas.h"
|
||||
#include "include/core/SkRect.h"
|
||||
#include "include/core/SkStream.h"
|
||||
#include "modules/svg/include/SkSVGDOM.h"
|
||||
#include "modules/svg/include/SkSVGNode.h"
|
||||
#include "samplecode/Sample.h"
|
||||
#include "src/core/SkOSFile.h"
|
||||
#include "src/utils/SkOSPath.h"
|
||||
@ -120,4 +119,4 @@ private:
|
||||
|
||||
DEF_SAMPLE( return new AnimatedSVGSample("Cowboy.svg", "SampleCowboy"); )
|
||||
|
||||
#endif // defined(SK_ENABLE_SVG)
|
||||
#endif // SK_XML
|
||||
|
@ -7,12 +7,11 @@
|
||||
|
||||
#include "include/core/SkTypes.h"
|
||||
|
||||
#if defined(SK_ENABLE_SVG)
|
||||
#ifdef SK_XML
|
||||
|
||||
#include "include/core/SkCanvas.h"
|
||||
#include "include/core/SkStream.h"
|
||||
#include "modules/svg/include/SkSVGDOM.h"
|
||||
#include "modules/svg/include/SkSVGNode.h"
|
||||
#include "samplecode/Sample.h"
|
||||
#include "src/core/SkOSFile.h"
|
||||
#include "src/utils/SkOSPath.h"
|
||||
@ -70,4 +69,4 @@ Sample* CreateSampleSVGFileView(const SkString& filename);
|
||||
Sample* CreateSampleSVGFileView(const SkString& filename) {
|
||||
return new SVGFileView(filename);
|
||||
}
|
||||
#endif // defined(SK_ENABLE_SVG)
|
||||
#endif // SK_XML
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include "include/gpu/GrContextOptions.h"
|
||||
#include "include/gpu/GrDirectContext.h"
|
||||
#include "include/private/SkTHash.h"
|
||||
#include "modules/svg/include/SkSVGDOM.h"
|
||||
#include "src/core/SkColorSpacePriv.h"
|
||||
#include "src/core/SkMD5.h"
|
||||
#include "src/core/SkOSFile.h"
|
||||
@ -37,11 +38,6 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#if defined(SK_ENABLE_SVG)
|
||||
#include "modules/svg/include/SkSVGDOM.h"
|
||||
#include "modules/svg/include/SkSVGNode.h"
|
||||
#endif
|
||||
|
||||
#if defined(SK_ENABLE_SKOTTIE)
|
||||
#include "modules/skottie/include/Skottie.h"
|
||||
#include "modules/skresources/include/SkResources.h"
|
||||
@ -190,7 +186,6 @@ static void init(Source* source, std::shared_ptr<SkCodec> codec) {
|
||||
};
|
||||
}
|
||||
|
||||
#if defined(SK_ENABLE_SVG)
|
||||
static void init(Source* source, sk_sp<SkSVGDOM> svg) {
|
||||
if (svg->containerSize().isEmpty()) {
|
||||
svg->setContainerSize({1000,1000});
|
||||
@ -201,7 +196,6 @@ static void init(Source* source, sk_sp<SkSVGDOM> svg) {
|
||||
return ok;
|
||||
};
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(SK_ENABLE_SKOTTIE)
|
||||
static void init(Source* source, sk_sp<skottie::Animation> animation) {
|
||||
@ -460,16 +454,13 @@ int main(int argc, char** argv) {
|
||||
init(source, pic);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
#if defined(SK_ENABLE_SVG)
|
||||
else if (name.endsWith(".svg")) {
|
||||
} else if (name.endsWith(".svg")) {
|
||||
SkMemoryStream stream{blob};
|
||||
if (sk_sp<SkSVGDOM> svg = SkSVGDOM::MakeFromStream(stream)) {
|
||||
init(source, svg);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#if defined(SK_ENABLE_SKOTTIE)
|
||||
else if (name.endsWith(".json")) {
|
||||
const SkString dir = SkOSPath::Dirname(name.c_str());
|
||||
|
@ -95,7 +95,7 @@ public:
|
||||
}
|
||||
}
|
||||
}
|
||||
#if defined(SK_ENABLE_SVG)
|
||||
#ifdef SK_XML
|
||||
fFamilies.emplace_back(sk_make_sp<FontStyleSet>("Emoji"));
|
||||
fFamilies.back()->fTypefaces.emplace_back(
|
||||
TestSVGTypeface::Default(), SkFontStyle::Normal(), "Normal");
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
#include "tools/fonts/TestSVGTypeface.h"
|
||||
|
||||
#if defined(SK_ENABLE_SVG)
|
||||
#ifdef SK_XML
|
||||
|
||||
#include "include/core/SkBitmap.h"
|
||||
#include "include/core/SkCanvas.h"
|
||||
@ -30,7 +30,6 @@
|
||||
#include "include/private/SkTemplates.h"
|
||||
#include "include/utils/SkNoDrawCanvas.h"
|
||||
#include "modules/svg/include/SkSVGDOM.h"
|
||||
#include "modules/svg/include/SkSVGNode.h"
|
||||
#include "src/core/SkAdvancedTypefaceMetrics.h"
|
||||
#include "src/core/SkFontDescriptor.h"
|
||||
#include "src/core/SkFontPriv.h"
|
||||
@ -1435,4 +1434,4 @@ void TestSVGTypeface::exportTtxColr(SkWStream* out) const {
|
||||
|
||||
out->writeText("</ttFont>\n");
|
||||
}
|
||||
#endif // SK_ENABLE_SVG
|
||||
#endif // SK_XML
|
||||
|
@ -40,8 +40,6 @@ struct SkAdvancedTypefaceMetrics;
|
||||
struct SkScalerContextEffects;
|
||||
struct SkScalerContextRec;
|
||||
|
||||
#ifdef SK_ENABLE_SVG
|
||||
|
||||
struct SkSVGTestTypefaceGlyphData {
|
||||
const char* fSvgResourcePath;
|
||||
SkPoint fOrigin; // y-down
|
||||
@ -159,6 +157,4 @@ private:
|
||||
friend class SkTestSVGScalerContext;
|
||||
};
|
||||
|
||||
#endif // SK_ENABLE_SVG
|
||||
|
||||
#endif // TestSVGTypeface_DEFINED
|
||||
#endif
|
||||
|
@ -14,8 +14,6 @@
|
||||
#include "tools/flags/CommandLineFlags.h"
|
||||
#include "tools/fonts/TestSVGTypeface.h"
|
||||
|
||||
#if defined(SK_ENABLE_SVG)
|
||||
|
||||
static void export_ttx(sk_sp<TestSVGTypeface> typeface,
|
||||
SkString prefix,
|
||||
SkSpan<unsigned> cbdtStrikeSizes,
|
||||
@ -51,12 +49,3 @@ int main(int argc, char** argv) {
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
SkDebugf("compile with SVG enabled\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif // SK_ENABLE_SVG
|
||||
|
@ -33,7 +33,7 @@
|
||||
#include "tools/gpu/GpuTimer.h"
|
||||
#include "tools/gpu/GrContextFactory.h"
|
||||
|
||||
#if defined(SK_ENABLE_SVG)
|
||||
#ifdef SK_XML
|
||||
#include "modules/svg/include/SkSVGDOM.h"
|
||||
#include "src/xml/SkDOM.h"
|
||||
#endif
|
||||
@ -699,7 +699,7 @@ static sk_sp<SkPicture> create_warmup_skp() {
|
||||
}
|
||||
|
||||
static sk_sp<SkPicture> create_skp_from_svg(SkStream* stream, const char* filename) {
|
||||
#if defined(SK_ENABLE_SVG)
|
||||
#ifdef SK_XML
|
||||
sk_sp<SkSVGDOM> svg = SkSVGDOM::MakeFromStream(*stream);
|
||||
if (!svg) {
|
||||
exitf(ExitErr::kData, "failed to build svg dom from file %s", filename);
|
||||
@ -714,7 +714,7 @@ static sk_sp<SkPicture> create_skp_from_svg(SkStream* stream, const char* filena
|
||||
|
||||
return recorder.finishRecordingAsPicture();
|
||||
#endif
|
||||
exitf(ExitErr::kData, "SK_ENABLE_SVG is disabled; cannot open svg file %s", filename);
|
||||
exitf(ExitErr::kData, "SK_XML is disabled; cannot open svg file %s", filename);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -13,9 +13,8 @@
|
||||
|
||||
#include <utility>
|
||||
|
||||
#if defined(SK_ENABLE_SVG)
|
||||
#ifdef SK_XML
|
||||
#include "modules/svg/include/SkSVGDOM.h"
|
||||
#include "modules/svg/include/SkSVGNode.h"
|
||||
#include "src/xml/SkDOM.h"
|
||||
#endif
|
||||
|
||||
@ -28,7 +27,7 @@ sk_sp<BisectSlide> BisectSlide::Create(const char filepath[]) {
|
||||
|
||||
sk_sp<BisectSlide> bisect(new BisectSlide(filepath));
|
||||
if (bisect->fFilePath.endsWith(".svg")) {
|
||||
#if defined(SK_ENABLE_SVG)
|
||||
#ifdef SK_XML
|
||||
sk_sp<SkSVGDOM> svg = SkSVGDOM::MakeFromStream(stream);
|
||||
if (!svg) {
|
||||
SkDebugf("BISECT: couldn't load svg at \"%s\"\n", filepath);
|
||||
|
@ -7,13 +7,12 @@
|
||||
|
||||
#include "tools/viewer/SvgSlide.h"
|
||||
|
||||
#if defined(SK_ENABLE_SVG)
|
||||
#if defined(SK_XML)
|
||||
|
||||
#include "include/core/SkCanvas.h"
|
||||
#include "include/core/SkStream.h"
|
||||
#include "modules/skresources/include/SkResources.h"
|
||||
#include "modules/svg/include/SkSVGDOM.h"
|
||||
#include "modules/svg/include/SkSVGNode.h"
|
||||
#include "src/utils/SkOSPath.h"
|
||||
|
||||
SvgSlide::SvgSlide(const SkString& name, const SkString& path)
|
||||
@ -64,4 +63,4 @@ void SvgSlide::draw(SkCanvas* canvas) {
|
||||
}
|
||||
}
|
||||
|
||||
#endif // defined(SK_ENABLE_SVG)
|
||||
#endif // SK_XML
|
||||
|
@ -764,7 +764,7 @@ void Viewer::initSlides() {
|
||||
return sk_make_sp<SkRiveSlide>(name, path);}
|
||||
},
|
||||
#endif
|
||||
#if defined(SK_ENABLE_SVG)
|
||||
#if defined(SK_XML)
|
||||
{ ".svg", "svg-dir", FLAGS_svgs,
|
||||
[](const SkString& name, const SkString& path) -> sk_sp<Slide> {
|
||||
return sk_make_sp<SvgSlide>(name, path);}
|
||||
|
Loading…
Reference in New Issue
Block a user