@shopify/react-native-skia 2.2.4 → 2.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,7 +2,7 @@ project(RNSkia)
2
2
  cmake_minimum_required(VERSION 3.4.1)
3
3
 
4
4
  set (CMAKE_VERBOSE_MAKEFILE ON)
5
- set (CMAKE_CXX_STANDARD 17)
5
+ set (CMAKE_CXX_STANDARD 20)
6
6
 
7
7
  # Import prebuilt SKIA libraries path
8
8
  set (SKIA_LIBS_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../libs/android/${ANDROID_ABI}")
@@ -50,7 +50,8 @@ else()
50
50
  message("-- SK_GRAPHITE: OFF (Graphite symbols not found in libskia)")
51
51
  endif()
52
52
 
53
- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DSK_BUILD_FOR_ANDROID -DSK_DISABLE_LEGACY_SHAPER_FACTORY -DSK_IMAGE_READ_PIXELS_DISABLE_LEGACY_API -DFOLLY_NO_CONFIG=1 -DFOLLY_HAVE_CLOCK_GETTIME=1 -DFOLLY_HAVE_MEMRCHR=1 -DFOLLY_USE_LIBCPP=1 -DFOLLY_MOBILE=1 -DON_ANDROID -DONANDROID")
53
+ string(APPEND CMAKE_CXX_FLAGS " -DSK_BUILD_FOR_ANDROID -DSK_DISABLE_LEGACY_SHAPER_FACTORY -DSK_IMAGE_READ_PIXELS_DISABLE_LEGACY_API -DFOLLY_NO_CONFIG=1 -DFOLLY_HAVE_CLOCK_GETTIME=1 -DFOLLY_HAVE_MEMRCHR=1 -DFOLLY_USE_LIBCPP=1 -DFOLLY_MOBILE=1 -DON_ANDROID -DONANDROID")
54
+
54
55
  set (PACKAGE_NAME "rnskia")
55
56
  set (SKIA_LIB "skia")
56
57
  set (SKIA_SVG_LIB "svg")
@@ -301,8 +302,12 @@ message("-- TURBO : " ${TURBOMODULES_LIB})
301
302
  add_definitions(-DREACT_NATIVE_VERSION=${REACT_NATIVE_VERSION})
302
303
 
303
304
  # Set RN_SERIALIZABLE_STATE and C++ flags for React Native 0.81+
304
- if(${REACT_NATIVE_VERSION} GREATER_EQUAL 81)
305
+ if(${REACT_NATIVE_VERSION} GREATER_EQUAL 80)
306
+ include("${REACT_NATIVE_DIR}/ReactCommon/cmake-utils/react-native-flags.cmake")
305
307
  target_compile_reactnative_options(${PACKAGE_NAME} PRIVATE)
308
+ else()
309
+ string(APPEND CMAKE_CXX_FLAGS
310
+ " -fexceptions -frtti -std=c++${CMAKE_CXX_STANDARD} -Wall -Werror -Wunused-function -Wunused-private-field -Woverloaded-virtual -Wreorder-ctor -Wdelete-non-abstract-non-virtual-dtor -Wmismatched-tags -Wunused-variable -Wpessimizing-move -Wswitch -Wdeprecated-declarations -Werror=deprecated-this-capture")
306
311
  endif()
307
312
 
308
313
  # Link
@@ -155,6 +155,7 @@ android {
155
155
  abiFilters (*reactNativeArchitectures())
156
156
  arguments '-DANDROID_STL=c++_shared',
157
157
  "-DREACT_NATIVE_VERSION=${REACT_NATIVE_VERSION}",
158
+ "-DREACT_NATIVE_DIR=${defaultDir}",
158
159
  "-DNODE_MODULES_DIR=${nodeModules}",
159
160
  "-DPREBUILT_DIR=${prebuiltDir}",
160
161
  "-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON"
@@ -136,7 +136,7 @@ void JniPlatformContext::performStreamOperation(
136
136
  static auto method = javaPart_->getClass()->getMethod<jbyteArray(jstring)>(
137
137
  "getJniStreamFromSource");
138
138
 
139
- auto loader = [=]() -> void {
139
+ auto loader = [=, this]() -> void {
140
140
  jni::ThreadScope ts;
141
141
  jstring jstr =
142
142
  (*jni::Environment::current()).NewStringUTF(sourceUri.c_str());
@@ -36,8 +36,7 @@ public:
36
36
  OpenGLWindowContext(GrDirectContext *directContext, gl::Display *display,
37
37
  gl::Context *glContext, ANativeWindow *window,
38
38
  EGLConfig config)
39
- : _directContext(directContext), _display(display), _glContext(glContext),
40
- _window(window) {
39
+ : _directContext(directContext), _glContext(glContext), _window(window) {
41
40
  ANativeWindow_acquire(_window);
42
41
  _glSurface = display->makeWindowSurface(config, _window);
43
42
  }
@@ -67,7 +66,6 @@ public:
67
66
 
68
67
  private:
69
68
  GrDirectContext *_directContext;
70
- gl::Display *_display;
71
69
  gl::Context *_glContext = nullptr;
72
70
  ANativeWindow *_window;
73
71
  sk_sp<SkSurface> _skSurface = nullptr;
@@ -19,7 +19,7 @@ public:
19
19
  std::function<void()> requestRedraw,
20
20
  std::shared_ptr<RNSkia::RNSkPlatformContext> platformContext);
21
21
 
22
- ~RNSkOpenGLCanvasProvider();
22
+ virtual ~RNSkOpenGLCanvasProvider();
23
23
 
24
24
  int getWidth() override;
25
25
 
@@ -2,6 +2,42 @@
2
2
 
3
3
  #include "RNSkLog.h"
4
4
 
5
+ static const char *EGLErrorToString(EGLint error) {
6
+ switch (error) {
7
+ case EGL_SUCCESS:
8
+ return "Success";
9
+ case EGL_NOT_INITIALIZED:
10
+ return "Not Initialized";
11
+ case EGL_BAD_ACCESS:
12
+ return "Bad Access";
13
+ case EGL_BAD_ALLOC:
14
+ return "Bad Alloc";
15
+ case EGL_BAD_ATTRIBUTE:
16
+ return "Bad Attribute";
17
+ case EGL_BAD_CONTEXT:
18
+ return "Bad Context";
19
+ case EGL_BAD_CONFIG:
20
+ return "Bad Config";
21
+ case EGL_BAD_CURRENT_SURFACE:
22
+ return "Bad Current Surface";
23
+ case EGL_BAD_DISPLAY:
24
+ return "Bad Display";
25
+ case EGL_BAD_SURFACE:
26
+ return "Bad Surface";
27
+ case EGL_BAD_MATCH:
28
+ return "Bad Match";
29
+ case EGL_BAD_PARAMETER:
30
+ return "Bad Parameter";
31
+ case EGL_BAD_NATIVE_PIXMAP:
32
+ return "Bad Native Pixmap";
33
+ case EGL_BAD_NATIVE_WINDOW:
34
+ return "Bad Native Window";
35
+ case EGL_CONTEXT_LOST:
36
+ return "Context Lost";
37
+ }
38
+ return "Unknown";
39
+ }
40
+
5
41
  void LogEGLError(const char *file, int line) {
6
42
  const auto error = eglGetError();
7
43
  RNSkia::RNSkLogger::logToConsole("EGL Error: %s (%d) in %s:%d",
@@ -5,40 +5,4 @@
5
5
 
6
6
  #define LOG_EGL_ERROR LogEGLError(__FILE__, __LINE__);
7
7
 
8
- static const char *EGLErrorToString(EGLint error) {
9
- switch (error) {
10
- case EGL_SUCCESS:
11
- return "Success";
12
- case EGL_NOT_INITIALIZED:
13
- return "Not Initialized";
14
- case EGL_BAD_ACCESS:
15
- return "Bad Access";
16
- case EGL_BAD_ALLOC:
17
- return "Bad Alloc";
18
- case EGL_BAD_ATTRIBUTE:
19
- return "Bad Attribute";
20
- case EGL_BAD_CONTEXT:
21
- return "Bad Context";
22
- case EGL_BAD_CONFIG:
23
- return "Bad Config";
24
- case EGL_BAD_CURRENT_SURFACE:
25
- return "Bad Current Surface";
26
- case EGL_BAD_DISPLAY:
27
- return "Bad Display";
28
- case EGL_BAD_SURFACE:
29
- return "Bad Surface";
30
- case EGL_BAD_MATCH:
31
- return "Bad Match";
32
- case EGL_BAD_PARAMETER:
33
- return "Bad Parameter";
34
- case EGL_BAD_NATIVE_PIXMAP:
35
- return "Bad Native Pixmap";
36
- case EGL_BAD_NATIVE_WINDOW:
37
- return "Bad Native Window";
38
- case EGL_CONTEXT_LOST:
39
- return "Context Lost";
40
- }
41
- return "Unknown";
42
- }
43
-
44
8
  void LogEGLError(const char *file, int line);
@@ -112,11 +112,13 @@ public:
112
112
  }
113
113
  }
114
114
 
115
- std::unique_ptr<RNSkia::WindowContext> MakeWindow(CALayer *window, int width,
116
- int height, bool useP3ColorSpace = true) {
115
+ std::unique_ptr<RNSkia::WindowContext>
116
+ MakeWindow(CALayer *window, int width, int height,
117
+ bool useP3ColorSpace = true) {
117
118
  auto device = MetalSharedContext::getInstance().getDevice();
118
- return std::make_unique<MetalWindowContext>(
119
- _directContext.get(), device, _commandQueue, window, width, height, useP3ColorSpace);
119
+ return std::make_unique<MetalWindowContext>(_directContext.get(), device,
120
+ _commandQueue, window, width,
121
+ height, useP3ColorSpace);
120
122
  }
121
123
 
122
124
  GrDirectContext *getDirectContext() { return _directContext.get(); }
@@ -27,8 +27,8 @@ MetalWindowContext::MetalWindowContext(GrDirectContext *directContext,
27
27
  BOOL supportsWideColor = NO;
28
28
  if (useP3ColorSpace) {
29
29
  if (@available(iOS 10.0, *)) {
30
- supportsWideColor =
31
- [UIScreen mainScreen].traitCollection.displayGamut == UIDisplayGamutP3;
30
+ supportsWideColor = [UIScreen mainScreen].traitCollection.displayGamut ==
31
+ UIDisplayGamutP3;
32
32
  }
33
33
  }
34
34
  if (supportsWideColor) {
@@ -17,9 +17,9 @@ public:
17
17
  template <class T> class RNSkAppleView : public RNSkBaseAppleView, public T {
18
18
  public:
19
19
  RNSkAppleView(std::shared_ptr<RNSkia::RNSkPlatformContext> context)
20
- : T(context,
21
- std::make_shared<RNSkMetalCanvasProvider>(
22
- std::bind(&RNSkia::RNSkView::requestRedraw, this), context, true)) {}
20
+ : T(context, std::make_shared<RNSkMetalCanvasProvider>(
21
+ std::bind(&RNSkia::RNSkView::requestRedraw, this),
22
+ context, true)) {}
23
23
 
24
24
  CALayer *getLayer() override {
25
25
  return std::static_pointer_cast<RNSkMetalCanvasProvider>(
@@ -23,9 +23,9 @@
23
23
 
24
24
  RNSkMetalCanvasProvider::RNSkMetalCanvasProvider(
25
25
  std::function<void()> requestRedraw,
26
- std::shared_ptr<RNSkia::RNSkPlatformContext> context,
27
- bool useP3ColorSpace)
28
- : RNSkCanvasProvider(requestRedraw), _context(context), _useP3ColorSpace(useP3ColorSpace) {
26
+ std::shared_ptr<RNSkia::RNSkPlatformContext> context, bool useP3ColorSpace)
27
+ : RNSkCanvasProvider(requestRedraw), _context(context),
28
+ _useP3ColorSpace(useP3ColorSpace) {
29
29
  #pragma clang diagnostic push
30
30
  #pragma clang diagnostic ignored "-Wunguarded-availability-new"
31
31
  _layer = [CAMetalLayer layer];
@@ -65,7 +65,6 @@ public:
65
65
  SkTextEncoding::kUTF8);
66
66
  std::vector<SkGlyphID> glyphs;
67
67
  glyphs.resize(numGlyphIDs);
68
- int glyphsSize = static_cast<int>(numGlyphIDs);
69
68
  auto g = SkSpan(glyphs.data(), glyphs.size());
70
69
  getObject()->textToGlyphs(str.c_str(), str.length(), SkTextEncoding::kUTF8,
71
70
  g);
@@ -37,17 +37,20 @@ public:
37
37
  return object.asHostObject<JsiSkFontStyle>(runtime)->getObject();
38
38
  } else {
39
39
  auto weightProp = object.getProperty(runtime, "weight");
40
- auto weight = static_cast<int>(weightProp.isUndefined()
41
- ? SkFontStyle::Weight::kNormal_Weight
42
- : weightProp.asNumber());
40
+ auto weight = static_cast<int>(
41
+ weightProp.isUndefined()
42
+ ? static_cast<double>(SkFontStyle::Weight::kNormal_Weight)
43
+ : weightProp.asNumber());
43
44
  auto widthProp = object.getProperty(runtime, "width");
44
- auto width = static_cast<int>(widthProp.isUndefined()
45
- ? SkFontStyle::Width::kNormal_Width
46
- : widthProp.asNumber());
45
+ auto width = static_cast<int>(
46
+ widthProp.isUndefined()
47
+ ? static_cast<double>(SkFontStyle::Width::kNormal_Width)
48
+ : widthProp.asNumber());
47
49
  auto slantProp = object.getProperty(runtime, "slant");
48
50
  auto slant = static_cast<SkFontStyle::Slant>(
49
- slantProp.isUndefined() ? SkFontStyle::Slant::kUpright_Slant
50
- : slantProp.asNumber());
51
+ slantProp.isUndefined()
52
+ ? static_cast<double>(SkFontStyle::Slant::kUpright_Slant)
53
+ : slantProp.asNumber());
51
54
  SkFontStyle style(weight, width, slant);
52
55
  return std::make_shared<SkFontStyle>(style);
53
56
  }
@@ -185,6 +185,9 @@ public:
185
185
  }
186
186
 
187
187
  JSI_HOST_FUNCTION(readPixels) {
188
+ #if defined(SK_GRAPHITE)
189
+ throw std::runtime_error("Not implemented yet");
190
+ #else
188
191
  int srcX = 0;
189
192
  int srcY = 0;
190
193
  if (count > 0 && !arguments[0].isUndefined()) {
@@ -217,16 +220,14 @@ public:
217
220
  .asObject(runtime)
218
221
  .getArrayBuffer(runtime);
219
222
  auto bfrPtr = reinterpret_cast<void *>(buffer.data(runtime));
220
- #if defined(SK_GRAPHITE)
221
- throw std::runtime_error("Not implemented yet");
222
- #else
223
+
223
224
  auto grContext = getContext()->getDirectContext();
224
225
  if (!getObject()->readPixels(grContext, info, bfrPtr, bytesPerRow, srcX,
225
226
  srcY)) {
226
227
  return jsi::Value::null();
227
228
  }
228
- #endif
229
229
  return dest;
230
+ #endif
230
231
  }
231
232
 
232
233
  JSI_HOST_FUNCTION(makeNonTextureImage) {
@@ -127,6 +127,8 @@ public:
127
127
  return thisValue.asObject(runtime);
128
128
  }
129
129
 
130
+ #pragma clang diagnostic push
131
+ #pragma clang diagnostic ignored "-Woverloaded-virtual"
130
132
  JSI_HOST_FUNCTION(get) {
131
133
  auto values = jsi::Array(runtime, 9);
132
134
  for (auto i = 0; i < 9; i++) {
@@ -134,6 +136,7 @@ public:
134
136
  }
135
137
  return values;
136
138
  }
139
+ #pragma clang diagnostic pop
137
140
 
138
141
  EXPORT_JSI_API_TYPENAME(JsiSkMatrix, Matrix)
139
142
 
@@ -141,7 +141,7 @@ public:
141
141
  explicit JsiSkParagraph(std::shared_ptr<RNSkPlatformContext> context,
142
142
  para::ParagraphBuilder *paragraphBuilder)
143
143
  : JsiSkWrappingSharedPtrHostObject<para::Paragraph>(
144
- std::move(context), std::move(paragraphBuilder->Build())) {}
144
+ std::move(context), paragraphBuilder->Build()) {}
145
145
  };
146
146
 
147
147
  } // namespace RNSkia
@@ -117,8 +117,11 @@ private:
117
117
  static void fromUTF8(
118
118
  const std::string &source,
119
119
  std::basic_string<T, std::char_traits<T>, std::allocator<T>> &result) {
120
+ #pragma clang diagnostic push
121
+ #pragma clang diagnostic ignored "-Wdeprecated-declarations"
120
122
  std::wstring_convert<std::codecvt_utf8_utf16<T>, T> convertor;
121
123
  result = convertor.from_bytes(source);
124
+ #pragma clang diagnostic pop
122
125
  }
123
126
  };
124
127
 
@@ -40,6 +40,8 @@ public:
40
40
  return jsi::Value(SkScalarToDouble(getObject()->fTy));
41
41
  }
42
42
 
43
+ #pragma clang diagnostic push
44
+ #pragma clang diagnostic ignored "-Woverloaded-virtual"
43
45
  JSI_HOST_FUNCTION(set) {
44
46
  auto scos = arguments[0].asNumber();
45
47
  auto ssin = arguments[1].asNumber();
@@ -48,6 +50,7 @@ public:
48
50
  getObject()->set(scos, ssin, tx, ty);
49
51
  return jsi::Value::undefined();
50
52
  }
53
+ #pragma clang diagnostic pop
51
54
 
52
55
  JSI_EXPORT_PROPERTY_GETTERS(JSI_EXPORT_PROP_GET(JsiSkRSXform, __typename__),
53
56
  JSI_EXPORT_PROP_GET(JsiSkRSXform, scos),
@@ -110,17 +110,17 @@ public:
110
110
  auto weight = static_cast<SkFontStyle::Weight>(
111
111
  propValue.hasProperty(runtime, "weight")
112
112
  ? propValue.getProperty(runtime, "weight").asNumber()
113
- : SkFontStyle::Weight::kNormal_Weight);
113
+ : static_cast<double>(SkFontStyle::Weight::kNormal_Weight));
114
114
 
115
115
  auto width = static_cast<SkFontStyle::Width>(
116
116
  propValue.hasProperty(runtime, "width")
117
117
  ? propValue.getProperty(runtime, "width").asNumber()
118
- : SkFontStyle::Width::kNormal_Width);
118
+ : static_cast<double>(SkFontStyle::Width::kNormal_Width));
119
119
 
120
120
  auto slant = static_cast<SkFontStyle::Slant>(
121
121
  propValue.hasProperty(runtime, "slant")
122
122
  ? propValue.getProperty(runtime, "slant").asNumber()
123
- : SkFontStyle::Slant::kUpright_Slant);
123
+ : static_cast<double>(SkFontStyle::Slant::kUpright_Slant));
124
124
 
125
125
  retVal.setFontStyle(SkFontStyle(weight, width, slant));
126
126
  }
@@ -631,6 +631,10 @@ public:
631
631
  skottieCmd->draw(ctx);
632
632
  break;
633
633
  }
634
+ default:
635
+ // Context commands (Group, SavePaint, RestorePaint, etc.) are not
636
+ // handled here
637
+ break;
634
638
  }
635
639
 
636
640
  ctx->restorePaint();
@@ -21,21 +21,23 @@
21
21
  struct SkSize;
22
22
 
23
23
  namespace skottie {
24
- class MarkerObserver;
24
+ class MarkerObserver;
25
25
 
26
- inline void PropertyObserver::onColorProperty(
27
- const char node_name[], const LazyHandle<ColorPropertyHandle> &) {}
26
+ inline void
27
+ PropertyObserver::onColorProperty(const char node_name[],
28
+ const LazyHandle<ColorPropertyHandle> &) {}
28
29
 
29
30
  inline void PropertyObserver::onOpacityProperty(
30
31
  const char node_name[], const LazyHandle<OpacityPropertyHandle> &) {}
31
- inline void PropertyObserver::onTextProperty(const char node_name[],
32
- const LazyHandle<TextPropertyHandle> &) {}
32
+ inline void
33
+ PropertyObserver::onTextProperty(const char node_name[],
34
+ const LazyHandle<TextPropertyHandle> &) {}
33
35
  inline void PropertyObserver::onTransformProperty(
34
36
  const char node_name[], const LazyHandle<TransformPropertyHandle> &) {}
35
- inline void PropertyObserver::onEnterNode(const char node_name[], NodeType node_type) {
36
- }
37
+ inline void PropertyObserver::onEnterNode(const char node_name[],
38
+ NodeType node_type) {}
37
39
  inline void PropertyObserver::onLeavingNode(const char node_name[],
38
- NodeType node_type) {}
40
+ NodeType node_type) {}
39
41
 
40
42
  } // namespace skottie
41
43
 
@@ -169,4 +171,3 @@ private:
169
171
  };
170
172
 
171
173
  } // namespace RNSkia
172
-
@@ -3,9 +3,9 @@
3
3
  #include <memory>
4
4
  #include <mutex>
5
5
 
6
+ #include "RNDawnUtils.h"
6
7
  #include "RNDawnWindowContext.h"
7
8
  #include "RNImageProvider.h"
8
- #include "RNDawnUtils.h"
9
9
 
10
10
  #include "include/core/SkData.h"
11
11
  #include "include/gpu/graphite/BackendTexture.h"
@@ -234,15 +234,13 @@ public:
234
234
 
235
235
  JSI_HOST_FUNCTION(size) {
236
236
  if (count != 1) {
237
- _platformContext->raiseError(
238
- std::string("size: Expected 1 argument, got " +
239
- std::to_string(count) + "."));
237
+ _platformContext->raiseError(std::string(
238
+ "size: Expected 1 argument, got " + std::to_string(count) + "."));
240
239
  return jsi::Value::undefined();
241
240
  }
242
241
 
243
242
  if (!arguments[0].isNumber()) {
244
- _platformContext->raiseError(
245
- "size: First argument must be a number");
243
+ _platformContext->raiseError("size: First argument must be a number");
246
244
  return jsi::Value::undefined();
247
245
  }
248
246
 
@@ -254,11 +252,13 @@ public:
254
252
  if (view != nullptr) {
255
253
  auto pixelDensity = _platformContext->getPixelDensity();
256
254
  auto sizeObj = jsi::Object(runtime);
257
- sizeObj.setProperty(runtime, "width", view->getScaledWidth() / pixelDensity);
258
- sizeObj.setProperty(runtime, "height", view->getScaledHeight() / pixelDensity);
255
+ sizeObj.setProperty(runtime, "width",
256
+ view->getScaledWidth() / pixelDensity);
257
+ sizeObj.setProperty(runtime, "height",
258
+ view->getScaledHeight() / pixelDensity);
259
259
  return sizeObj;
260
260
  }
261
-
261
+
262
262
  // Return default size if view not found
263
263
  auto sizeObj = jsi::Object(runtime);
264
264
  sizeObj.setProperty(runtime, "width", 0);
@@ -18,8 +18,8 @@ RNSkManager::RNSkManager(
18
18
  jsi::Runtime *jsRuntime,
19
19
  std::shared_ptr<facebook::react::CallInvoker> jsCallInvoker,
20
20
  std::shared_ptr<RNSkPlatformContext> platformContext)
21
- : _jsRuntime(jsRuntime), _jsCallInvoker(jsCallInvoker),
22
- _platformContext(platformContext),
21
+ : _jsRuntime(jsRuntime), _platformContext(platformContext),
22
+ _jsCallInvoker(jsCallInvoker),
23
23
  _viewApi(std::make_shared<RNSkJsiViewApi>(platformContext)) {
24
24
 
25
25
  // Register main runtime
@@ -27,7 +27,7 @@
27
27
  #pragma clang diagnostic pop
28
28
 
29
29
  class SkPicture;
30
- class SkRect;
30
+ struct SkRect;
31
31
  class SkImage;
32
32
 
33
33
  namespace RNSkia {
@@ -43,6 +43,8 @@ public:
43
43
  : RNSkRenderer(std::move(requestRedraw)),
44
44
  _platformContext(std::move(context)) {}
45
45
 
46
+ virtual ~RNSkPictureRenderer() = default;
47
+
46
48
  void
47
49
  renderImmediate(std::shared_ptr<RNSkCanvasProvider> canvasProvider) override {
48
50
  performDraw(canvasProvider);
@@ -55,7 +57,7 @@ public:
55
57
 
56
58
  private:
57
59
  bool performDraw(std::shared_ptr<RNSkCanvasProvider> canvasProvider) {
58
- return canvasProvider->renderToCanvas([=](SkCanvas *canvas) {
60
+ return canvasProvider->renderToCanvas([=, this](SkCanvas *canvas) {
59
61
  // Make sure to scale correctly
60
62
  auto pd = _platformContext->getPixelDensity();
61
63
  canvas->clear(SK_ColorTRANSPARENT);
@@ -69,15 +69,17 @@ protected:
69
69
 
70
70
  class RNSkOffscreenCanvasProvider : public RNSkCanvasProvider {
71
71
  public:
72
- RNSkOffscreenCanvasProvider(std::shared_ptr<RNSkPlatformContext> context,
73
- std::function<void()> requestRedraw, float width,
74
- float height)
75
- : RNSkCanvasProvider(requestRedraw), _context(context), _width(width),
76
- _height(height) {
72
+ RNSkOffscreenCanvasProvider(
73
+ const std::shared_ptr<RNSkPlatformContext> &context,
74
+ std::function<void()> requestRedraw, float width, float height)
75
+ : RNSkCanvasProvider(std::move(requestRedraw)), _width(width),
76
+ _height(height), _context(context) {
77
77
  _surface = context->makeOffscreenSurface(_width, _height);
78
78
  _pd = context->getPixelDensity();
79
79
  }
80
80
 
81
+ virtual ~RNSkOffscreenCanvasProvider() = default;
82
+
81
83
  /**
82
84
  Returns a snapshot of the current surface/canvas
83
85
  */
@@ -90,7 +90,6 @@ private:
90
90
  _frameCount++;
91
91
  }
92
92
 
93
- double _lastTimeStamp;
94
93
  long _lastDurations[NUMBER_OF_DURATION_SAMPLES];
95
94
  int _lastDurationIndex;
96
95
  int _lastDurationsCount;
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "setup-skia-web": "scripts/setup-canvaskit.js"
9
9
  },
10
10
  "title": "React Native Skia",
11
- "version": "2.2.4",
11
+ "version": "2.2.6",
12
12
  "description": "High-performance React Native Graphics using Skia",
13
13
  "main": "lib/module/index.js",
14
14
  "react-native": "src/index.ts",
@@ -45,13 +45,13 @@
45
45
  "clean-skia": "yarn rimraf ./libs && yarn rimraf ../../externals/skia/out",
46
46
  "build-skia": "ts-node ./scripts/build-skia.ts",
47
47
  "copy-skia-headers": "ts-node ./scripts/copy-skia-headers.ts",
48
+ "install-skia": "ts-node ./scripts/download-artifacts.ts && yarn copy-skia-headers",
48
49
  "clang-format": "yarn clang-format-ios && yarn clang-format-android && yarn clang-format-common",
49
50
  "clang-format-ios": "find apple/ -iname '*.h' -o -iname '*.mm' -o -iname '*.cpp' | xargs clang-format -i",
50
51
  "clang-format-android": "find android/cpp/ -iname '*.h' -o -iname '*.m' -o -iname '*.cpp' | xargs clang-format -i",
51
52
  "clang-format-common": "find cpp/ \\( -path 'cpp//skia' -prune \\) -o \\( -iname '*.h' -o -iname '*.m' -o -iname '*.cpp' \\) -print | xargs clang-format -i",
52
53
  "workflow-copy-libs": "yarn ts-node ./scripts/workflow-copy-libs.ts",
53
- "cpplint": "cpplint --linelength=230 --filter=-legal/copyright,-whitespace/indent,-whitespace/comments,-whitespace/ending_newline,-build/include_order,-runtime/references,-readability/todo,-whitespace/blank_line,-whitespace/todo,-runtime/int,-build/c++11,-whitespace/parens --exclude=package/cpp/skia --exclude=package/ios --exclude=package/android/build --exclude=package/node_modules --recursive package",
54
- "download-artifacts": "ts-node ./scripts/download-artifacts.ts"
54
+ "cpplint": "cpplint --linelength=230 --filter=-legal/copyright,-whitespace/indent,-whitespace/comments,-whitespace/ending_newline,-build/include_order,-runtime/references,-readability/todo,-whitespace/blank_line,-whitespace/todo,-runtime/int,-build/c++11,-whitespace/parens --exclude=package/cpp/skia --exclude=package/ios --exclude=package/android/build --exclude=package/node_modules --recursive package"
55
55
  },
56
56
  "repository": {
57
57
  "type": "git",
@@ -78,7 +78,7 @@
78
78
  "peerDependencies": {
79
79
  "react": ">=19.0",
80
80
  "react-native": ">=0.78",
81
- "react-native-reanimated": ">=3.0"
81
+ "react-native-reanimated": ">=3.19.1"
82
82
  },
83
83
  "peerDependenciesMeta": {
84
84
  "react-native": {
@@ -112,7 +112,7 @@
112
112
  "react": "19.0.0",
113
113
  "react-native": "0.78.0",
114
114
  "react-native-builder-bob": "0.18.2",
115
- "react-native-reanimated": "^3.0",
115
+ "react-native-reanimated": "3.19.1",
116
116
  "rimraf": "3.0.2",
117
117
  "semantic-release": "^24.1.0",
118
118
  "semantic-release-yarn": "^3.0.2",
@@ -77,7 +77,7 @@ Pod::Spec.new do |s|
77
77
  "Christian Falch" => "christian.falch@gmail.com",
78
78
  "William Candillon" => "wcandillon@gmail.com"
79
79
  }
80
- s.platforms = { :ios => "13.0", :tvos => "13.0", :osx => "11" }
80
+ s.platforms = { :ios => "14.0", :tvos => "13.0", :osx => "11" }
81
81
  s.source = { :git => "https://github.com/shopify/react-native-skia/react-native-skia.git", :tag => "#{s.version}" }
82
82
 
83
83
  s.requires_arc = true