Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit d6cf56f

Browse files
rphilliSkia Commit-Bot
authored andcommitted
Revert "[svg] Relocate out of experimental"
This reverts commit 6fc4106. Reason for revert: Blocking the Android roll Original change's description: > [svg] Relocate out of experimental > > Move the SVG rendering code to modules/svg, and componentize. > Also split into include/src/utils. > > As external clients still reference the old header locations, > introduce temporary forwarding headers to facilitate the migration. > > Change-Id: Ib289dbdcd80c16a01c47805e7242f2e08bebc165 > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/326948 > Reviewed-by: Tyler Denniston <tdenniston@google.com> > Commit-Queue: Florin Malita <fmalita@google.com> TBR=fmalita@chromium.org,fmalita@google.com,tdenniston@google.com Change-Id: I386cf77a15a9e1d392029804abaf937dae53f435 No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://skia-review.googlesource.com/c/skia/+/327342 Reviewed-by: Robert Phillips <robertphillips@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com>
1 parent ede793a commit d6cf56f

File tree

100 files changed

+1732
-2093
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+1732
-2093
lines changed

BUILD.gn

Lines changed: 62 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1801,8 +1801,8 @@ if (skia_enable_tools) {
18011801
defines += [ "SK_TOOLS_REQUIRE_RESOURCES" ]
18021802
}
18031803
deps = [
1804+
":experimental_svg_model",
18041805
":flags",
1805-
"modules/svg",
18061806
]
18071807
public_deps = [ ":gpu_tool_utils" ]
18081808
}
@@ -1866,6 +1866,7 @@ if (skia_enable_tools) {
18661866
sources -= [ "//tests/FontMgrFontConfigTest.cpp" ]
18671867
}
18681868
deps = [
1869+
":experimental_svg_model",
18691870
":flags",
18701871
":skia",
18711872
":skvm_builders",
@@ -1900,6 +1901,52 @@ if (skia_enable_tools) {
19001901
]
19011902
}
19021903

1904+
# TODO(fmalita): componentize & relocate
1905+
test_lib("experimental_svg_model") {
1906+
if (skia_use_expat) {
1907+
sources = [
1908+
"experimental/svg/model/SkSVGAttribute.cpp",
1909+
"experimental/svg/model/SkSVGAttributeParser.cpp",
1910+
"experimental/svg/model/SkSVGCircle.cpp",
1911+
"experimental/svg/model/SkSVGClipPath.cpp",
1912+
"experimental/svg/model/SkSVGContainer.cpp",
1913+
"experimental/svg/model/SkSVGDOM.cpp",
1914+
"experimental/svg/model/SkSVGEllipse.cpp",
1915+
"experimental/svg/model/SkSVGGradient.cpp",
1916+
"experimental/svg/model/SkSVGLine.cpp",
1917+
"experimental/svg/model/SkSVGLinearGradient.cpp",
1918+
"experimental/svg/model/SkSVGNode.cpp",
1919+
"experimental/svg/model/SkSVGPath.cpp",
1920+
"experimental/svg/model/SkSVGPattern.cpp",
1921+
"experimental/svg/model/SkSVGPoly.cpp",
1922+
"experimental/svg/model/SkSVGRadialGradient.cpp",
1923+
"experimental/svg/model/SkSVGRect.cpp",
1924+
"experimental/svg/model/SkSVGRenderContext.cpp",
1925+
"experimental/svg/model/SkSVGSVG.cpp",
1926+
"experimental/svg/model/SkSVGShape.cpp",
1927+
"experimental/svg/model/SkSVGStop.cpp",
1928+
"experimental/svg/model/SkSVGText.cpp",
1929+
"experimental/svg/model/SkSVGTransformableNode.cpp",
1930+
"experimental/svg/model/SkSVGUse.cpp",
1931+
"experimental/svg/model/SkSVGValue.cpp",
1932+
]
1933+
deps = [
1934+
":skia",
1935+
":xml",
1936+
]
1937+
}
1938+
}
1939+
1940+
if (skia_use_expat && !skia_use_wuffs) {
1941+
test_app("svg_tool") {
1942+
sources = [ "experimental/svg/utils/SvgTool.cpp" ]
1943+
deps = [
1944+
":experimental_svg_model",
1945+
":flags",
1946+
]
1947+
}
1948+
}
1949+
19031950
test_lib("experimental_xform") {
19041951
sources = [
19051952
"experimental/xform/SkShape.cpp",
@@ -1913,9 +1960,6 @@ if (skia_enable_tools) {
19131960
test_app("skottie_tool") {
19141961
deps = [ "modules/skottie:tool" ]
19151962
}
1916-
test_app("svg_tool") {
1917-
deps = [ "modules/svg:tool" ]
1918-
}
19191963
}
19201964

19211965
test_app("make_skqp_model") {
@@ -1931,6 +1975,7 @@ if (skia_enable_tools) {
19311975
}
19321976
public_deps = [ ":tool_utils" ]
19331977
deps = [
1978+
":experimental_svg_model",
19341979
":flags",
19351980
":gpu_tool_utils",
19361981
":xml",
@@ -1970,6 +2015,7 @@ if (skia_enable_tools) {
19702015
deps = [
19712016
":common_flags_aa",
19722017
":common_flags_gpu",
2018+
":experimental_svg_model",
19732019
":flags",
19742020
":gm",
19752021
":gpu_tool_utils",
@@ -1980,7 +2026,6 @@ if (skia_enable_tools) {
19802026
":trace",
19812027
"modules/skottie",
19822028
"modules/skottie:utils",
1983-
"modules/svg",
19842029
]
19852030
}
19862031
test_app("dm") {
@@ -1995,6 +2040,7 @@ if (skia_enable_tools) {
19952040
":common_flags_config",
19962041
":common_flags_gpu",
19972042
":common_flags_images",
2043+
":experimental_svg_model",
19982044
":flags",
19992045
":gm",
20002046
":gpu_tool_utils",
@@ -2006,7 +2052,6 @@ if (skia_enable_tools) {
20062052
"experimental/skrive",
20072053
"modules/skottie",
20082054
"modules/skottie:utils",
2009-
"modules/svg",
20102055
]
20112056
}
20122057
}
@@ -2033,6 +2078,7 @@ if (skia_enable_tools) {
20332078
":common_flags_config",
20342079
":common_flags_gpu",
20352080
":common_flags_images",
2081+
":experimental_svg_model",
20362082
":flags",
20372083
":gm",
20382084
":gpu_tool_utils",
@@ -2532,6 +2578,7 @@ if (skia_enable_tools) {
25322578

25332579
deps = [
25342580
":common_flags_gpu",
2581+
":experimental_svg_model",
25352582
":flags",
25362583
":gm",
25372584
":gpu_tool_utils",
@@ -2546,7 +2593,6 @@ if (skia_enable_tools) {
25462593
"modules/skottie",
25472594
"modules/skottie:utils",
25482595
"modules/sksg:samples",
2549-
"modules/svg",
25502596
"//third_party/imgui",
25512597
]
25522598
if (skia_use_experimental_xform) {
@@ -2737,7 +2783,7 @@ if (skia_enable_tools) {
27372783
"tools/fonts/TestSVGTypeface.cpp",
27382784
"tools/fonts/TestTypeface.cpp",
27392785
]
2740-
deps = [ "modules/svg" ]
2786+
deps = [ ":experimental_svg_model" ]
27412787
}
27422788

27432789
libfuzzer_app("region_set_path") {
@@ -2757,7 +2803,7 @@ if (skia_enable_tools) {
27572803
"tools/fonts/TestSVGTypeface.cpp",
27582804
"tools/fonts/TestTypeface.cpp",
27592805
]
2760-
deps = [ "modules/svg" ]
2806+
deps = [ ":experimental_svg_model" ]
27612807
}
27622808

27632809
libfuzzer_app("path_deserialize") {
@@ -2794,7 +2840,7 @@ if (skia_enable_tools) {
27942840
"tools/fonts/TestTypeface.cpp",
27952841
]
27962842
deps = [
2797-
"modules/svg",
2843+
":experimental_svg_model",
27982844
"//third_party/libpng",
27992845
]
28002846
}
@@ -2868,7 +2914,7 @@ if (skia_enable_tools) {
28682914
"tools/fonts/TestTypeface.cpp",
28692915
]
28702916
deps = [
2871-
"modules/svg",
2917+
":experimental_svg_model",
28722918
"//third_party/libpng",
28732919
]
28742920
}
@@ -2895,7 +2941,7 @@ if (skia_enable_tools) {
28952941
"tools/fonts/TestTypeface.cpp",
28962942
]
28972943
deps = [
2898-
"modules/svg",
2944+
":experimental_svg_model",
28992945
"//third_party/libpng",
29002946
]
29012947
}
@@ -2921,7 +2967,7 @@ if (skia_enable_tools) {
29212967
"tools/fonts/TestTypeface.cpp",
29222968
]
29232969
deps = [
2924-
"modules/svg",
2970+
":experimental_svg_model",
29252971
"//third_party/libpng",
29262972
]
29272973
}
@@ -2945,7 +2991,7 @@ if (skia_enable_tools) {
29452991
"tools/fonts/TestTypeface.cpp",
29462992
]
29472993
deps = [
2948-
"modules/svg",
2994+
":experimental_svg_model",
29492995
"//third_party/libpng",
29502996
]
29512997
}
@@ -2983,8 +3029,8 @@ if (skia_enable_tools) {
29833029
"tools/fonts/TestTypeface.cpp",
29843030
]
29853031
deps = [
3032+
":experimental_svg_model",
29863033
"modules/skottie:skottie",
2987-
"modules/svg",
29883034
]
29893035
}
29903036

@@ -3038,7 +3084,7 @@ if (skia_enable_tools) {
30383084

30393085
libfuzzer_app("svg_dom") {
30403086
sources = [ "fuzz/oss_fuzz/FuzzSVG.cpp" ]
3041-
deps = [ "modules/svg" ]
3087+
deps = [ ":experimental_svg_model" ]
30423088
}
30433089

30443090
libfuzzer_app("skruntimeeffect") {

bench/nanobench.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
#include "tools/trace/SkDebugfTracer.h"
4949

5050
#ifdef SK_XML
51-
#include "modules/svg/include/SkSVGDOM.h"
51+
#include "experimental/svg/model/SkSVGDOM.h"
5252
#endif // SK_XML
5353

5454
#ifdef SK_ENABLE_ANDROID_UTILS

dm/DMSrcSink.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@
7171
#endif
7272

7373
#if defined(SK_XML)
74+
#include "experimental/svg/model/SkSVGDOM.h"
7475
#include "include/svg/SkSVGCanvas.h"
75-
#include "modules/svg/include/SkSVGDOM.h"
7676
#include "src/xml/SkXMLWriter.h"
7777
#endif
7878

@@ -2339,8 +2339,8 @@ Result ViaPicture::draw(const Src& src, SkBitmap* bitmap, SkWStream* stream, SkS
23392339
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
23402340

23412341
#ifdef TEST_VIA_SVG
2342+
#include "experimental/svg/model/SkSVGDOM.h"
23422343
#include "include/svg/SkSVGCanvas.h"
2343-
#include "modules/svg/include/SkSVGDOM.h"
23442344
#include "src/xml/SkXMLWriter.h"
23452345

23462346
Result ViaSVG::draw(const Src& src, SkBitmap* bitmap, SkWStream* stream, SkString* log) const {

modules/svg/src/SkSVGAttribute.cpp renamed to experimental/svg/model/SkSVGAttribute.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* found in the LICENSE file.
66
*/
77

8-
#include "modules/svg/include/SkSVGAttribute.h"
8+
#include "experimental/svg/model/SkSVGAttribute.h"
99

1010
SkSVGPresentationAttributes SkSVGPresentationAttributes::MakeInitial() {
1111
SkSVGPresentationAttributes result;
Lines changed: 92 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,99 @@
11
/*
2-
* Copyright 2020 Google Inc.
2+
* Copyright 2016 Google Inc.
33
*
44
* Use of this source code is governed by a BSD-style license that can be
55
* found in the LICENSE file.
66
*/
77

8-
// Transitional forwarding header. To be removed.
9-
#include "modules/svg/include/SkSVGAttribute.h"
8+
#ifndef SkSVGAttribute_DEFINED
9+
#define SkSVGAttribute_DEFINED
1010

11+
#include "experimental/svg/model/SkSVGTypes.h"
12+
#include "src/core/SkTLazy.h"
13+
14+
class SkSVGRenderContext;
15+
16+
enum class SkSVGAttribute {
17+
kClipPath,
18+
kClipRule,
19+
kColor,
20+
kCx, // <circle>, <ellipse>, <radialGradient>: center x position
21+
kCy, // <circle>, <ellipse>, <radialGradient>: center y position
22+
kD,
23+
kFill,
24+
kFillOpacity,
25+
kFillRule,
26+
kFontFamily,
27+
kFontSize,
28+
kFontStyle,
29+
kFontWeight,
30+
kFx, // <radialGradient>: focal point x position
31+
kFy, // <radialGradient>: focal point y position
32+
kGradientTransform,
33+
kHeight,
34+
kHref,
35+
kOffset,
36+
kOpacity,
37+
kPatternTransform,
38+
kPoints,
39+
kR, // <circle>, <radialGradient>: radius
40+
kRx, // <ellipse>,<rect>: horizontal (corner) radius
41+
kRy, // <ellipse>,<rect>: vertical (corner) radius
42+
kSpreadMethod,
43+
kStopColor,
44+
kStopOpacity,
45+
kStroke,
46+
kStrokeDashArray,
47+
kStrokeDashOffset,
48+
kStrokeOpacity,
49+
kStrokeLineCap,
50+
kStrokeLineJoin,
51+
kStrokeMiterLimit,
52+
kStrokeWidth,
53+
kTransform,
54+
kText,
55+
kTextAnchor,
56+
kViewBox,
57+
kVisibility,
58+
kWidth,
59+
kX,
60+
kX1, // <line>: first endpoint x
61+
kX2, // <line>: second endpoint x
62+
kY,
63+
kY1, // <line>: first endpoint y
64+
kY2, // <line>: second endpoint y
65+
66+
kUnknown,
67+
};
68+
69+
struct SkSVGPresentationAttributes {
70+
static SkSVGPresentationAttributes MakeInitial();
71+
72+
// TODO: SkTLazy adds an extra ptr per attribute; refactor to reduce overhead.
73+
74+
SkTLazy<SkSVGPaint> fFill;
75+
SkTLazy<SkSVGNumberType> fFillOpacity;
76+
SkTLazy<SkSVGFillRule> fFillRule;
77+
SkTLazy<SkSVGFillRule> fClipRule;
78+
79+
SkTLazy<SkSVGPaint> fStroke;
80+
SkTLazy<SkSVGDashArray> fStrokeDashArray;
81+
SkTLazy<SkSVGLength> fStrokeDashOffset;
82+
SkTLazy<SkSVGLineCap> fStrokeLineCap;
83+
SkTLazy<SkSVGLineJoin> fStrokeLineJoin;
84+
SkTLazy<SkSVGNumberType> fStrokeMiterLimit;
85+
SkTLazy<SkSVGNumberType> fStrokeOpacity;
86+
SkTLazy<SkSVGLength> fStrokeWidth;
87+
88+
SkTLazy<SkSVGVisibility> fVisibility;
89+
90+
SkTLazy<SkSVGColorType> fColor;
91+
92+
// TODO(tdenniston): add SkSVGStopColor
93+
94+
// uninherited
95+
SkTLazy<SkSVGNumberType> fOpacity;
96+
SkTLazy<SkSVGClip> fClipPath;
97+
};
98+
99+
#endif // SkSVGAttribute_DEFINED

modules/svg/src/SkSVGAttributeParser.cpp renamed to experimental/svg/model/SkSVGAttributeParser.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
* found in the LICENSE file.
66
*/
77

8+
#include "experimental/svg/model/SkSVGAttributeParser.h"
9+
#include "experimental/svg/model/SkSVGTypes.h"
810
#include "include/utils/SkParse.h"
9-
#include "modules/svg/include/SkSVGAttributeParser.h"
10-
#include "modules/svg/include/SkSVGTypes.h"
1111

1212
namespace {
1313

0 commit comments

Comments
 (0)