-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix for adobe/svg-native-viewer#189 as a diff, for building SVG Nativ…
…e against Skia m116
- Loading branch information
Showing
1 changed file
with
58 additions
and
0 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
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); |