-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #134 from kyamagu/implement-svgdom
Implement SVGDOM API
- Loading branch information
Showing
10 changed files
with
128 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
diff --git a/tools/git-sync-deps b/tools/git-sync-deps | ||
index ca1ba47a75..92ff8ef7bc 100755 | ||
--- a/tools/git-sync-deps | ||
+++ b/tools/git-sync-deps | ||
@@ -235,9 +235,9 @@ def git_sync_deps(deps_file_path, command_line_os_requests, verbose): | ||
|
||
|
||
def multithread(function, list_of_arg_lists): | ||
- # for args in list_of_arg_lists: | ||
- # function(*args) | ||
- # return | ||
+ for args in list_of_arg_lists: | ||
+ function(*args) | ||
+ return | ||
threads = [] | ||
for args in list_of_arg_lists: | ||
thread = threading.Thread(None, function, None, args) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#include "common.h" | ||
#include "experimental/svg/model/SkSVGDOM.h" | ||
#include "experimental/svg/model/SkSVGNode.h" | ||
|
||
void initSVGDOM(py::module &m) { | ||
py::class_<SkSVGDOM, sk_sp<SkSVGDOM>, SkRefCnt> SVGDOM(m, "SVGDOM"); | ||
|
||
SVGDOM.def(py::init<>()) | ||
// .def_static("MakeFromDOM", &SkSVGDOM::MakeFromDOM, py::arg("dom")) | ||
.def_static("MakeFromStream", &SkSVGDOM::MakeFromStream, py::arg("stream")) | ||
.def("containerSize", &SkSVGDOM::containerSize) | ||
.def("setContainerSize", &SkSVGDOM::setContainerSize) | ||
// .def("setRoot", &SkSVGDOM::setRoot) | ||
// .def("findNodeById", &SkSVGDOM::findNodeById) | ||
.def("render", &SkSVGDOM::render) | ||
; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import os | ||
import pytest | ||
import skia | ||
|
||
|
||
@pytest.fixture | ||
def svgdom(resource_path): | ||
stream = skia.FILEStream(os.path.join(resource_path, 'Cowboy.svg')) | ||
return skia.SVGDOM.MakeFromStream(stream) | ||
|
||
|
||
def test_SVGDOM_MakeFromStream(resource_path): | ||
stream = skia.FILEStream(os.path.join(resource_path, 'Cowboy.svg')) | ||
assert isinstance(skia.SVGDOM.MakeFromStream(stream), skia.SVGDOM) | ||
|
||
|
||
def test_SVGDOM_containerSize(svgdom): | ||
assert isinstance(svgdom.containerSize(), skia.Size) | ||
|
||
|
||
def test_SVGDOM_setContainerSize(svgdom): | ||
svgdom.setContainerSize((100, 100)) | ||
|
||
|
||
def test_SVGDOM_render(svgdom, canvas): | ||
svgdom.render(canvas) |