Skip to content

Commit

Permalink
Fix for adobe/svg-native-viewer#189 as a diff, for building SVG Nativ…
Browse files Browse the repository at this point in the history
…e against Skia m116
  • Loading branch information
HinTak committed Jul 26, 2023
1 parent 7bc9f5f commit 7b27850
Showing 1 changed file with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions skia-adventure/svgnative-m116.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
diff --git a/svgnative/src/ports/skia/SkiaSVGRenderer.cpp b/svgnative/src/ports/skia/SkiaSVGRenderer.cpp
index 6ee1fd9..2ae0f91 100644
--- a/svgnative/src/ports/skia/SkiaSVGRenderer.cpp
+++ b/svgnative/src/ports/skia/SkiaSVGRenderer.cpp
@@ -127,7 +127,7 @@ inline sk_sp<SkImage> getOrientedImage(sk_sp<SkImage> srcImg, SkEncodedOrigin or
return nullptr;
}

- auto skRasterSurface = SkSurface::MakeRasterN32Premul(width, height);
+ auto skRasterSurface = SkSurfaces::Raster(SkImageInfo::MakeN32Premul(width, height));
auto skRasterCanvas = skRasterSurface->getCanvas();
if (offsetX != 0 || offsetY != 0)
skRasterCanvas->translate(offsetX, offsetY);
@@ -151,10 +151,10 @@ SkiaSVGImageData::SkiaSVGImageData(const std::string& base64, ImageEncoding /*en
return;
SkEncodedOrigin origin = codec->getOrigin();
if (origin == SkEncodedOrigin::kTopLeft_SkEncodedOrigin)
- mImageData = SkImage::MakeFromEncoded(skData);
+ mImageData = SkImages::DeferredFromEncodedData(skData);
else
{
- auto rawImg = SkImage::MakeFromEncoded(skData);
+ auto rawImg = SkImages::DeferredFromEncodedData(skData);
mImageData = getOrientedImage(rawImg, origin);
}
}
diff --git a/svgnative/tests/CMakeLists.txt b/svgnative/tests/CMakeLists.txt
index 4eee589..2b4f29c 100644
--- a/svgnative/tests/CMakeLists.txt
+++ b/svgnative/tests/CMakeLists.txt
@@ -38,4 +38,5 @@ if (USE_SKIA)
target_include_directories(boundsTests PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/../../third_party/skia/include/gpu")
target_include_directories(boundsTests PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/../ports/skia")
target_link_libraries(boundsTests SVGNativeViewerLib "${SKIA_LIBRARY_PATH}")
+ target_link_libraries(boundsTests SVGNativeViewerLib "${SKIA_PATHKIT_LIBRARY_PATH}")
endif()
diff --git a/svgnative/tests/bounds-tests.cpp b/svgnative/tests/bounds-tests.cpp
index 592685b..1f7a5fd 100644
--- a/svgnative/tests/bounds-tests.cpp
+++ b/svgnative/tests/bounds-tests.cpp
@@ -32,7 +32,7 @@ using namespace SVGNative;

TEST(bounds_tests, bounds_basic_test)
{
- auto surface = SkSurface::MakeNull(1000, 1000);
+ auto surface = SkSurfaces::Null(1000, 1000);
auto canvas = surface->getCanvas();
SkiaSVGRenderer renderer;
renderer.SetSkCanvas(canvas);
@@ -53,7 +53,7 @@ TEST(bounds_tests, bounds_basic_test)
TEST(bounds_tests, bounds_functional_test)
{
// get the surface and the canvas
- auto surface = SkSurface::MakeNull(1000, 1000);
+ auto surface = SkSurfaces::Null(1000, 1000);
auto canvas = surface->getCanvas();
auto renderer = std::make_shared<SVGNative::SkiaSVGRenderer>();
renderer->SetSkCanvas(canvas);

0 comments on commit 7b27850

Please sign in to comment.