@shopify/react-native-skia 1.5.3 → 1.5.5

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.
Files changed (99) hide show
  1. package/android/CMakeLists.txt +53 -13
  2. package/android/build.gradle +3 -0
  3. package/android/cpp/rnskia-android/OpenGLContext.h +122 -11
  4. package/android/cpp/rnskia-android/OpenGLWindowContext.cpp +73 -0
  5. package/android/cpp/rnskia-android/OpenGLWindowContext.h +74 -0
  6. package/android/cpp/rnskia-android/RNSkAndroidPlatformContext.h +18 -1
  7. package/android/cpp/rnskia-android/RNSkAndroidVideo.cpp +12 -1
  8. package/android/cpp/rnskia-android/RNSkOpenGLCanvasProvider.cpp +13 -1
  9. package/android/cpp/rnskia-android/opengl/Context.h +77 -0
  10. package/android/cpp/rnskia-android/opengl/Display.h +117 -0
  11. package/android/cpp/rnskia-android/opengl/Error.cpp +9 -0
  12. package/android/cpp/rnskia-android/opengl/Error.h +44 -0
  13. package/android/cpp/rnskia-android/opengl/Surface.h +43 -0
  14. package/android/src/main/java/com/shopify/reactnative/skia/SkiaBaseView.java +0 -1
  15. package/cpp/api/JsiSkImage.h +15 -2
  16. package/cpp/api/JsiSkSurface.h +18 -3
  17. package/cpp/rnskia/DawnContext.h +241 -0
  18. package/cpp/rnskia/DawnUtils.h +127 -0
  19. package/cpp/rnskia/DawnWindowContext.cpp +19 -0
  20. package/cpp/rnskia/DawnWindowContext.h +77 -0
  21. package/cpp/rnskia/ImageProvider.h +100 -0
  22. package/cpp/rnskia/RNSkView.h +6 -0
  23. package/cpp/skia/include/android/SkAnimatedImage.h +14 -0
  24. package/cpp/skia/include/codec/SkAvifDecoder.h +39 -3
  25. package/cpp/skia/include/codec/SkCodec.h +16 -0
  26. package/cpp/skia/include/config/SkUserConfig.h +3 -2
  27. package/cpp/skia/include/core/SkCanvas.h +55 -10
  28. package/cpp/skia/include/core/SkContourMeasure.h +76 -0
  29. package/cpp/skia/include/core/SkFontScanner.h +48 -0
  30. package/cpp/skia/include/core/SkMilestone.h +1 -1
  31. package/cpp/skia/include/core/SkPath.h +11 -0
  32. package/cpp/skia/include/core/SkPathEffect.h +0 -23
  33. package/cpp/skia/include/core/SkRect.h +2 -0
  34. package/cpp/skia/include/core/SkString.h +4 -0
  35. package/cpp/skia/include/core/SkTypeface.h +5 -0
  36. package/cpp/skia/include/core/SkTypes.h +8 -3
  37. package/cpp/skia/include/docs/SkPDFDocument.h +3 -3
  38. package/cpp/skia/include/effects/SkOverdrawColorFilter.h +1 -0
  39. package/cpp/skia/include/effects/SkRuntimeEffect.h +2 -1
  40. package/cpp/skia/include/encode/SkJpegEncoder.h +4 -0
  41. package/cpp/skia/include/gpu/ganesh/GrContextOptions.h +8 -1
  42. package/cpp/skia/include/gpu/ganesh/GrDirectContext.h +18 -3
  43. package/cpp/skia/include/gpu/ganesh/GrTypes.h +11 -0
  44. package/cpp/skia/include/gpu/ganesh/gl/GrGLFunctions.h +5 -1
  45. package/cpp/skia/include/gpu/ganesh/gl/GrGLInterface.h +0 -1
  46. package/cpp/skia/include/gpu/graphite/GraphiteTypes.h +8 -0
  47. package/cpp/skia/include/gpu/graphite/Recorder.h +0 -2
  48. package/cpp/skia/include/gpu/graphite/precompile/PaintOptions.h +7 -4
  49. package/cpp/skia/include/gpu/graphite/precompile/PrecompileImageFilter.h +2 -0
  50. package/cpp/skia/include/gpu/graphite/precompile/PrecompileMaskFilter.h +2 -0
  51. package/cpp/skia/include/ports/SkFontMgr_android_ndk.h +25 -0
  52. package/cpp/skia/include/ports/SkFontMgr_fontconfig.h +4 -2
  53. package/cpp/skia/include/ports/SkFontScanner_Fontations.h +15 -0
  54. package/cpp/skia/include/ports/SkFontScanner_FreeType.h +15 -0
  55. package/cpp/skia/include/private/SkExif.h +14 -0
  56. package/cpp/skia/include/private/SkPathRef.h +36 -0
  57. package/cpp/skia/include/private/base/SkFeatures.h +4 -0
  58. package/cpp/skia/include/private/base/SkSpan_impl.h +1 -3
  59. package/cpp/skia/modules/skcms/src/skcms_internals.h +3 -0
  60. package/cpp/skia/src/base/SkMathPriv.h +1 -8
  61. package/ios/RNSkia-iOS/RNSkMetalCanvasProvider.h +1 -2
  62. package/ios/RNSkia-iOS/RNSkMetalCanvasProvider.mm +25 -19
  63. package/ios/RNSkia-iOS/RNSkiOSPlatformContext.mm +23 -0
  64. package/ios/RNSkia-iOS/SkiaCVPixelBufferUtils.mm +4 -8
  65. package/ios/RNSkia-iOS/SkiaMetalSurfaceFactory.h +26 -8
  66. package/ios/RNSkia-iOS/SkiaMetalSurfaceFactory.mm +0 -20
  67. package/libs/android/arm64-v8a/libskia.a +0 -0
  68. package/libs/android/arm64-v8a/libskottie.a +0 -0
  69. package/libs/android/armeabi-v7a/libskia.a +0 -0
  70. package/libs/android/armeabi-v7a/libskottie.a +0 -0
  71. package/libs/android/x86/libskia.a +0 -0
  72. package/libs/android/x86/libskottie.a +0 -0
  73. package/libs/android/x86_64/libskia.a +0 -0
  74. package/libs/android/x86_64/libskottie.a +0 -0
  75. package/libs/ios/libskia.xcframework/ios-arm64_arm64e/libskia.a +0 -0
  76. package/libs/ios/libskia.xcframework/ios-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
  77. package/libs/ios/libskottie.xcframework/ios-arm64_arm64e/libskottie.a +0 -0
  78. package/libs/ios/libskottie.xcframework/ios-arm64_arm64e_x86_64-simulator/libskottie.a +0 -0
  79. package/libs/ios/libskparagraph.xcframework/ios-arm64_arm64e/libskparagraph.a +0 -0
  80. package/libs/ios/libskparagraph.xcframework/ios-arm64_arm64e_x86_64-simulator/libskparagraph.a +0 -0
  81. package/libs/ios/libsksg.xcframework/ios-arm64_arm64e/libsksg.a +0 -0
  82. package/libs/ios/libsksg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsksg.a +0 -0
  83. package/libs/ios/libskshaper.xcframework/Info.plist +5 -5
  84. package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e/libskshaper.a +0 -0
  85. package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e_x86_64-simulator/libskshaper.a +0 -0
  86. package/libs/ios/libskunicode_core.xcframework/Info.plist +5 -5
  87. package/libs/ios/libskunicode_core.xcframework/ios-arm64_arm64e/libskunicode_core.a +0 -0
  88. package/libs/ios/libskunicode_core.xcframework/ios-arm64_arm64e_x86_64-simulator/libskunicode_core.a +0 -0
  89. package/libs/ios/libskunicode_libgrapheme.xcframework/Info.plist +5 -5
  90. package/libs/ios/libskunicode_libgrapheme.xcframework/ios-arm64_arm64e/libskunicode_libgrapheme.a +0 -0
  91. package/libs/ios/libskunicode_libgrapheme.xcframework/ios-arm64_arm64e_x86_64-simulator/libskunicode_libgrapheme.a +0 -0
  92. package/libs/ios/libsvg.xcframework/ios-arm64_arm64e/libsvg.a +0 -0
  93. package/libs/ios/libsvg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsvg.a +0 -0
  94. package/package.json +1 -1
  95. package/react-native-skia.podspec +35 -9
  96. package/src/renderer/__tests__/e2e/SVG.spec.tsx +2 -1
  97. package/android/cpp/rnskia-android/SkiaOpenGLHelper.h +0 -310
  98. package/android/cpp/rnskia-android/SkiaOpenGLSurfaceFactory.cpp +0 -188
  99. package/android/cpp/rnskia-android/SkiaOpenGLSurfaceFactory.h +0 -100
@@ -10,14 +10,12 @@
10
10
 
11
11
  #include "include/core/SkFlattenable.h"
12
12
  #include "include/core/SkRefCnt.h"
13
- #include "include/core/SkScalar.h"
14
13
  #include "include/private/base/SkAPI.h"
15
14
 
16
15
  // TODO(kjlubick) update clients and remove this unnecessary #include
17
16
  #include "include/core/SkPath.h" // IWYU pragma: keep
18
17
 
19
18
  #include <cstddef>
20
- #include <cstdint>
21
19
 
22
20
  class SkMatrix;
23
21
  class SkStrokeRec;
@@ -55,27 +53,6 @@ public:
55
53
  return kSkPathEffect_Type;
56
54
  }
57
55
 
58
- // move to base?
59
-
60
- enum DashType {
61
- kNone_DashType, //!< ignores the info parameter
62
- kDash_DashType, //!< fills in all of the info parameter
63
- };
64
-
65
- struct DashInfo {
66
- DashInfo() : fIntervals(nullptr), fCount(0), fPhase(0) {}
67
- DashInfo(SkScalar* intervals, int32_t count, SkScalar phase)
68
- : fIntervals(intervals), fCount(count), fPhase(phase) {}
69
-
70
- SkScalar* fIntervals; //!< Length of on/off intervals for dashed lines
71
- // Even values represent ons, and odds offs
72
- int32_t fCount; //!< Number of intervals in the dash. Should be even number
73
- SkScalar fPhase; //!< Offset into the dashed interval pattern
74
- // mod the sum of all intervals
75
- };
76
-
77
- DashType asADash(DashInfo* info) const;
78
-
79
56
  /**
80
57
  * Given a src path (input) and a stroke-rec (input and output), apply
81
58
  * this effect to the src path, returning the new path in dst, and return
@@ -21,6 +21,7 @@
21
21
  #include <cstring>
22
22
 
23
23
  struct SkRect;
24
+ class SkString;
24
25
 
25
26
  /** \struct SkIRect
26
27
  SkIRect holds four 32-bit integer coordinates describing the upper and
@@ -1347,6 +1348,7 @@ public:
1347
1348
  example: https://fiddle.skia.org/c/@Rect_dump
1348
1349
  */
1349
1350
  void dump(bool asHex) const;
1351
+ SkString dumpToString(bool asHex) const;
1350
1352
 
1351
1353
  /** Writes text representation of SkRect to standard output. The representation may be
1352
1354
  directly compiled as C++ code. Floating point values are written
@@ -132,6 +132,8 @@ public:
132
132
  const char* data() const { return fRec->data(); }
133
133
  const char* c_str() const { return fRec->data(); }
134
134
  char operator[](size_t n) const { return this->c_str()[n]; }
135
+ const char* begin() const { return data(); }
136
+ const char* end() const { return data() + size(); }
135
137
 
136
138
  bool equals(const SkString&) const;
137
139
  bool equals(const char text[]) const;
@@ -177,6 +179,8 @@ public:
177
179
 
178
180
  char* data();
179
181
  char& operator[](size_t n) { return this->data()[n]; }
182
+ char* begin() { return data(); }
183
+ char* end() { return data() + size(); }
180
184
 
181
185
  void reset();
182
186
  /** String contents are preserved on resize. (For destructive resize, `set(nullptr, length)`.)
@@ -352,6 +352,10 @@ protected:
352
352
  // Must return a valid scaler context. It can not return nullptr.
353
353
  virtual std::unique_ptr<SkScalerContext> onCreateScalerContext(const SkScalerContextEffects&,
354
354
  const SkDescriptor*) const = 0;
355
+ virtual std::unique_ptr<SkScalerContext> onCreateScalerContextAsProxyTypeface
356
+ (const SkScalerContextEffects&,
357
+ const SkDescriptor*,
358
+ sk_sp<SkTypeface>) const;
355
359
  virtual void onFilterRec(SkScalerContextRec*) const = 0;
356
360
  friend class SkScalerContext; // onFilterRec
357
361
 
@@ -420,6 +424,7 @@ private:
420
424
  std::unique_ptr<SkAdvancedTypefaceMetrics> getAdvancedMetrics() const;
421
425
  friend class SkRandomTypeface; // getAdvancedMetrics
422
426
  friend class SkPDFFont; // getAdvancedMetrics
427
+ friend class SkTypeface_fontconfig;
423
428
 
424
429
  friend class SkFontPriv; // getGlyphToUnicodeMap
425
430
 
@@ -96,7 +96,8 @@
96
96
  #if defined(SK_HISTOGRAM_ENUMERATION) || \
97
97
  defined(SK_HISTOGRAM_BOOLEAN) || \
98
98
  defined(SK_HISTOGRAM_EXACT_LINEAR) || \
99
- defined(SK_HISTOGRAM_MEMORY_KB)
99
+ defined(SK_HISTOGRAM_MEMORY_KB) || \
100
+ defined(SK_HISTOGRAM_CUSTOM_MICROSECONDS_TIMES)
100
101
  # define SK_HISTOGRAMS_ENABLED 1
101
102
  #else
102
103
  # define SK_HISTOGRAMS_ENABLED 0
@@ -107,17 +108,21 @@
107
108
  #endif
108
109
 
109
110
  #ifndef SK_HISTOGRAM_ENUMERATION
110
- # define SK_HISTOGRAM_ENUMERATION(name, sample, enum_size)
111
+ # define SK_HISTOGRAM_ENUMERATION(name, sampleEnum, enumSize)
111
112
  #endif
112
113
 
113
114
  #ifndef SK_HISTOGRAM_EXACT_LINEAR
114
- # define SK_HISTOGRAM_EXACT_LINEAR(name, sample, value_max)
115
+ # define SK_HISTOGRAM_EXACT_LINEAR(name, sample, valueMax)
115
116
  #endif
116
117
 
117
118
  #ifndef SK_HISTOGRAM_MEMORY_KB
118
119
  # define SK_HISTOGRAM_MEMORY_KB(name, sample)
119
120
  #endif
120
121
 
122
+ #ifndef SK_HISTOGRAM_CUSTOM_MICROSECONDS_TIMES
123
+ # define SK_HISTOGRAM_CUSTOM_MICROSECONDS_TIMES(name, sampleUSec, minUSec, maxUSec, bucketCount)
124
+ #endif
125
+
121
126
  #define SK_HISTOGRAM_PERCENTAGE(name, percent_as_int) \
122
127
  SK_HISTOGRAM_EXACT_LINEAR(name, percent_as_int, 101)
123
128
 
@@ -18,7 +18,7 @@
18
18
  class SkCanvas;
19
19
  class SkExecutor;
20
20
  class SkPDFArray;
21
- class SkPDFTagTree;
21
+ class SkPDFStructTree;
22
22
  class SkWStream;
23
23
 
24
24
  #define SKPDF_STRING(X) SKPDF_STRING_IMPL(X)
@@ -46,9 +46,10 @@ public:
46
46
  const std::vector<int>& nodeIds);
47
47
 
48
48
  private:
49
- friend class ::SkPDFTagTree;
49
+ friend class ::SkPDFStructTree;
50
50
 
51
51
  std::unique_ptr<SkPDFArray> fAttrs;
52
+ std::vector<int> fElemIds; // element identifiers referenced by fAttrs
52
53
  };
53
54
 
54
55
  /** A node in a PDF structure tree, giving a semantic representation
@@ -60,7 +61,6 @@ struct StructureElementNode {
60
61
  SkString fTypeString;
61
62
  std::vector<std::unique_ptr<StructureElementNode>> fChildVector;
62
63
  int fNodeId = 0;
63
- std::vector<int> fAdditionalNodeIds;
64
64
  AttributeList fAttributes;
65
65
  SkString fAlt;
66
66
  SkString fLang;
@@ -21,6 +21,7 @@ class SkColorFilter;
21
21
  * ...
22
22
  * 5 (or larger) -> colors[5]
23
23
  *
24
+ * https://fiddle.skia.org/c/@overdrawcolorfilter_grid
24
25
  */
25
26
  class SK_API SkOverdrawColorFilter {
26
27
  public:
@@ -162,6 +162,7 @@ public:
162
162
 
163
163
  // Color filter SkSL requires an entry point that looks like:
164
164
  // vec4 main(vec4 inColor) { ... }
165
+ // https://fiddle.skia.org/c/@runtimeeffect_colorfilter_grid
165
166
  static Result MakeForColorFilter(SkString sksl, const Options&);
166
167
  static Result MakeForColorFilter(SkString sksl) {
167
168
  return MakeForColorFilter(std::move(sksl), Options{});
@@ -352,7 +353,7 @@ private:
352
353
  * Note that SkRuntimeEffectBuilder is built entirely on the public API of SkRuntimeEffect,
353
354
  * so can be used as-is or serve as inspiration for other interfaces or binding techniques.
354
355
  */
355
- class SkRuntimeEffectBuilder {
356
+ class SK_API SkRuntimeEffectBuilder {
356
357
  public:
357
358
  explicit SkRuntimeEffectBuilder(sk_sp<SkRuntimeEffect> effect)
358
359
  : fEffect(std::move(effect))
@@ -8,10 +8,12 @@
8
8
  #ifndef SkJpegEncoder_DEFINED
9
9
  #define SkJpegEncoder_DEFINED
10
10
 
11
+ #include "include/codec/SkEncodedOrigin.h"
11
12
  #include "include/core/SkRefCnt.h"
12
13
  #include "include/private/base/SkAPI.h"
13
14
 
14
15
  #include <memory>
16
+ #include <optional>
15
17
 
16
18
  class SkColorSpace;
17
19
  class SkData;
@@ -86,6 +88,8 @@ struct Options {
86
88
  */
87
89
  const skcms_ICCProfile* fICCProfile = nullptr;
88
90
  const char* fICCProfileDescription = nullptr;
91
+
92
+ std::optional<SkEncodedOrigin> fOrigin;
89
93
  };
90
94
 
91
95
  /**
@@ -11,9 +11,9 @@
11
11
  #include "include/core/SkData.h"
12
12
  #include "include/core/SkString.h"
13
13
  #include "include/core/SkTypes.h"
14
+ #include "include/gpu/ShaderErrorHandler.h"
14
15
  #include "include/gpu/ganesh/GrDriverBugWorkarounds.h"
15
16
  #include "include/gpu/ganesh/GrTypes.h"
16
- #include "include/gpu/ShaderErrorHandler.h"
17
17
  #include "include/private/gpu/ganesh/GrTypesPriv.h"
18
18
 
19
19
  #include <optional>
@@ -176,6 +176,13 @@ struct SK_API GrContextOptions {
176
176
  */
177
177
  bool fAvoidStencilBuffers = false;
178
178
 
179
+ /**
180
+ * If true, texture fetches from mip-mapped textures will be biased to read larger MIP levels.
181
+ * This has the effect of sharpening those textures, at the cost of some aliasing, and possible
182
+ * performance impact.
183
+ */
184
+ bool fSharpenMipmappedTextures = true;
185
+
179
186
  /**
180
187
  * Enables driver workaround to use draws instead of HW clears, e.g. glClear on the GL backend.
181
188
  */
@@ -479,10 +479,25 @@ public:
479
479
  * If it returns false, then those same semaphores will not have been submitted and we will not
480
480
  * try to submit them again. The caller is free to delete the semaphores at any time.
481
481
  *
482
- * If sync flag is GrSyncCpu::kYes, this function will return once the gpu has finished with all
483
- * submitted work.
482
+ * If GrSubmitInfo::fSync flag is GrSyncCpu::kYes, this function will return once the gpu has
483
+ * finished with all submitted work.
484
+ *
485
+ * If GrSubmitInfo::fMarkBoundary flag is GrMarkFrameBoundary::kYes and the GPU supports a way
486
+ * to be notified about frame boundaries, then we will notify the GPU during/after the
487
+ * submission of work to the GPU. GrSubmitInfo::fFrameID is a frame ID that is passed to the
488
+ * GPU when marking a boundary. Ideally this value should be unique for each frame. Currently
489
+ * marking frame boundaries is only supported with the Vulkan backend and only if the
490
+ * VK_EXT_frame_boudnary extenstion is available.
484
491
  */
485
- bool submit(GrSyncCpu sync = GrSyncCpu::kNo);
492
+ bool submit(const GrSubmitInfo&);
493
+
494
+ bool submit(GrSyncCpu sync = GrSyncCpu::kNo) {
495
+ GrSubmitInfo info;
496
+ info.fSync = sync;
497
+
498
+ return this->submit(info);
499
+ }
500
+
486
501
 
487
502
  /**
488
503
  * Checks whether any asynchronous work is complete and if so calls related callbacks.
@@ -174,4 +174,15 @@ enum class GrSyncCpu : bool {
174
174
  kYes = true,
175
175
  };
176
176
 
177
+ enum class GrMarkFrameBoundary : bool {
178
+ kNo = false,
179
+ kYes = true,
180
+ };
181
+
182
+ struct GrSubmitInfo {
183
+ GrSyncCpu fSync = GrSyncCpu::kNo;
184
+ GrMarkFrameBoundary fMarkBoundary = GrMarkFrameBoundary::kNo;
185
+ uint64_t fFrameID = 0;
186
+ };
187
+
177
188
  #endif
@@ -104,7 +104,6 @@ using GrGLGetProgramInfoLogFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLuint program, G
104
104
  using GrGLGetProgramivFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLuint program, GrGLenum pname, GrGLint* params);
105
105
  using GrGLGetQueryivFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum GLtarget, GrGLenum pname, GrGLint* params);
106
106
  using GrGLGetQueryObjecti64vFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLuint id, GrGLenum pname, GrGLint64* params);
107
- using GrGLGetQueryObjectivFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLuint id, GrGLenum pname, GrGLint* params);
108
107
  using GrGLGetQueryObjectui64vFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLuint id, GrGLenum pname, GrGLuint64* params);
109
108
  using GrGLGetQueryObjectuivFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLuint id, GrGLenum pname, GrGLuint* params);
110
109
  using GrGLGetRenderbufferParameterivFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum target, GrGLenum pname, GrGLint* params);
@@ -219,8 +218,13 @@ using GrGLMultiDrawElementsInstancedBaseVertexBaseInstanceFn = GrGLvoid GR_GL_FU
219
218
  /* ARB_sync */
220
219
  using GrGLFenceSyncFn = GrGLsync GR_GL_FUNCTION_TYPE(GrGLenum condition, GrGLbitfield flags);
221
220
  using GrGLIsSyncFn = GrGLboolean GR_GL_FUNCTION_TYPE(GrGLsync sync);
221
+ #if defined(__EMSCRIPTEN__)
222
+ using GrGLClientWaitSyncFn = GrGLenum GR_GL_FUNCTION_TYPE(GrGLsync sync, GrGLbitfield flags, GrGLint timeoutLo, GrGLint timeoutHi);
223
+ using GrGLWaitSyncFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLsync sync, GrGLbitfield flags, GrGLuint timeoutLo, GrGLuint timeoutHi);
224
+ #else
222
225
  using GrGLClientWaitSyncFn = GrGLenum GR_GL_FUNCTION_TYPE(GrGLsync sync, GrGLbitfield flags, GrGLuint64 timeout);
223
226
  using GrGLWaitSyncFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLsync sync, GrGLbitfield flags, GrGLuint64 timeout);
227
+ #endif
224
228
  using GrGLDeleteSyncFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLsync sync);
225
229
 
226
230
  /* ARB_internalformat_query */
@@ -174,7 +174,6 @@ public:
174
174
  GrGLFunction<GrGLGetProgramInfoLogFn> fGetProgramInfoLog;
175
175
  GrGLFunction<GrGLGetProgramivFn> fGetProgramiv;
176
176
  GrGLFunction<GrGLGetQueryObjecti64vFn> fGetQueryObjecti64v;
177
- GrGLFunction<GrGLGetQueryObjectivFn> fGetQueryObjectiv;
178
177
  GrGLFunction<GrGLGetQueryObjectui64vFn> fGetQueryObjectui64v;
179
178
  GrGLFunction<GrGLGetQueryObjectuivFn> fGetQueryObjectuiv;
180
179
  GrGLFunction<GrGLGetQueryivFn> fGetQueryiv;
@@ -9,6 +9,7 @@
9
9
  #define skgpu_graphite_GraphiteTypes_DEFINED
10
10
 
11
11
  #include "include/core/SkPoint.h"
12
+ #include "include/core/SkRect.h"
12
13
  #include "include/core/SkTypes.h"
13
14
  #include "include/gpu/GpuTypes.h"
14
15
 
@@ -44,6 +45,9 @@ using GpuFinishedProc = void (*)(GpuFinishedContext finishedContext, CallbackRes
44
45
  *
45
46
  * fTargetTranslation is an additional translation applied to draws targeting fTargetSurface.
46
47
  *
48
+ * fTargetClip is an additional clip applied to draws targeting fTargetSurface. It is defined in the
49
+ * local replay space, that is, with fTargetTranslation applied. An empty clip will not be applied.
50
+ *
47
51
  * The client may pass in two arrays of initialized BackendSemaphores to be included in the
48
52
  * command stream. At some time before issuing commands in the Recording, the fWaitSemaphores will
49
53
  * be waited on by the gpu. We only guarantee these wait semaphores block transfer and fragment
@@ -62,6 +66,7 @@ struct InsertRecordingInfo {
62
66
 
63
67
  SkSurface* fTargetSurface = nullptr;
64
68
  SkIVector fTargetTranslation = {0, 0};
69
+ SkIRect fTargetClip = {0, 0, 0, 0};
65
70
  MutableTextureState* fTargetTextureState = nullptr;
66
71
 
67
72
  size_t fNumWaitSemaphores = 0;
@@ -150,7 +155,10 @@ enum DrawTypeFlags : uint16_t {
150
155
  // TessellateCurvesRenderStep[*] for [even-odd], [winding]
151
156
  // MiddleOutFanRenderStep[*] for [even-odd], [winding]
152
157
  kNonSimpleShape = 0b10000000,
158
+
159
+ kLast = kNonSimpleShape,
153
160
  };
161
+ static constexpr int kDrawTypeFlagsCnt = static_cast<int>(DrawTypeFlags::kLast) + 1;
154
162
 
155
163
  } // namespace skgpu::graphite
156
164
 
@@ -58,7 +58,6 @@ class UploadBufferManager;
58
58
  class UploadList;
59
59
 
60
60
  template<typename T> class PipelineDataCache;
61
- using UniformDataCache = PipelineDataCache<UniformDataBlock>;
62
61
  using TextureDataCache = PipelineDataCache<TextureDataBlock>;
63
62
 
64
63
  struct SK_API RecorderOptions final {
@@ -262,7 +261,6 @@ private:
262
261
  // Aggregated one-time uploads that preceed all tasks in the root task list.
263
262
  std::unique_ptr<UploadList> fRootUploads;
264
263
 
265
- std::unique_ptr<UniformDataCache> fUniformDataCache;
266
264
  std::unique_ptr<TextureDataCache> fTextureDataCache;
267
265
  std::unique_ptr<DrawBufferManager> fDrawBufferManager;
268
266
  std::unique_ptr<UploadBufferManager> fUploadBufferManager;
@@ -32,6 +32,7 @@ class KeyContext;
32
32
  class PaintOptionsPriv;
33
33
  class PaintParamsKeyBuilder;
34
34
  class PipelineDataGatherer;
35
+ struct RenderPassDesc;
35
36
  class UniquePaintParamsID;
36
37
 
37
38
  /** \class PaintOptions
@@ -171,14 +172,16 @@ private:
171
172
  typedef std::function<void(UniquePaintParamsID id,
172
173
  DrawTypeFlags,
173
174
  bool withPrimitiveBlender,
174
- Coverage)> ProcessCombination;
175
+ Coverage,
176
+ const RenderPassDesc&)> ProcessCombination;
175
177
 
176
178
  void buildCombinations(const KeyContext&,
177
179
  PipelineDataGatherer*,
178
- DrawTypeFlags drawTypes,
180
+ DrawTypeFlags,
179
181
  bool addPrimitiveBlender,
180
- Coverage coverage,
181
- const ProcessCombination& processCombination) const;
182
+ Coverage,
183
+ const RenderPassDesc&,
184
+ const ProcessCombination&) const;
182
185
 
183
186
  skia_private::TArray<sk_sp<PrecompileShader>> fShaderOptions;
184
187
  skia_private::TArray<sk_sp<PrecompileColorFilter>> fColorFilterOptions;
@@ -61,10 +61,12 @@ private:
61
61
 
62
62
  virtual void onCreatePipelines(const KeyContext&,
63
63
  PipelineDataGatherer*,
64
+ const RenderPassDesc&,
64
65
  const PaintOptions::ProcessCombination&) const = 0;
65
66
 
66
67
  void createPipelines(const KeyContext&,
67
68
  PipelineDataGatherer*,
69
+ const RenderPassDesc&,
68
70
  const PaintOptions::ProcessCombination&);
69
71
 
70
72
  skia_private::AutoSTArray<2, sk_sp<PrecompileImageFilter>> fInputs;
@@ -31,6 +31,8 @@ protected:
31
31
 
32
32
  virtual void createPipelines(const KeyContext&,
33
33
  PipelineDataGatherer*,
34
+ const PaintOptions&,
35
+ const RenderPassDesc&,
34
36
  const PaintOptions::ProcessCombination&) const = 0;
35
37
  };
36
38
 
@@ -0,0 +1,25 @@
1
+ /*
2
+ * Copyright 2024 Google LLC.
3
+ *
4
+ * Use of this source code is governed by a BSD-style license that can be
5
+ * found in the LICENSE file.
6
+ */
7
+
8
+ #ifndef SkFontMgr_android_ndk_DEFINED
9
+ #define SkFontMgr_android_ndk_DEFINED
10
+
11
+ #include "include/core/SkRefCnt.h"
12
+ #include "include/core/SkTypes.h"
13
+
14
+ #include <memory>
15
+
16
+ class SkFontMgr;
17
+ class SkFontScanner;
18
+
19
+ /** Create a font manager for Android NDK. May return nullptr if unavailable (API < 29). */
20
+ SK_API sk_sp<SkFontMgr> SkFontMgr_New_AndroidNDK(bool cacheFontFiles);
21
+
22
+ SK_API sk_sp<SkFontMgr> SkFontMgr_New_AndroidNDK(bool cacheFontFiles,
23
+ std::unique_ptr<SkFontScanner> scanner);
24
+
25
+ #endif // SkFontMgr_android_ndk_DEFINED
@@ -8,8 +8,9 @@
8
8
  #ifndef SkFontMgr_fontconfig_DEFINED
9
9
  #define SkFontMgr_fontconfig_DEFINED
10
10
 
11
- #include "include/core/SkRefCnt.h"
12
11
  #include <fontconfig/fontconfig.h>
12
+ #include "include/core/SkRefCnt.h"
13
+ #include <memory>
13
14
 
14
15
  class SkFontMgr;
15
16
 
@@ -17,6 +18,7 @@ class SkFontMgr;
17
18
  * If 'fc' is NULL, will use a new default config.
18
19
  * Takes ownership of 'fc' and will call FcConfigDestroy on it.
19
20
  */
21
+ class SkFontScanner;
22
+ SK_API sk_sp<SkFontMgr> SkFontMgr_New_FontConfig(FcConfig* fc, std::unique_ptr<SkFontScanner> scanner);
20
23
  SK_API sk_sp<SkFontMgr> SkFontMgr_New_FontConfig(FcConfig* fc);
21
-
22
24
  #endif // #ifndef SkFontMgr_fontconfig_DEFINED
@@ -0,0 +1,15 @@
1
+ /*
2
+ * Copyright 2024 Google Inc.
3
+ *
4
+ * Use of this source code is governed by a BSD-style license that can be
5
+ * found in the LICENSE file.
6
+ */
7
+
8
+ #ifndef SKFONTSCANNER_FONTATIONS_H_
9
+ #define SKFONTSCANNER_FONTATIONS_H_
10
+
11
+ #include "include/core/SkFontScanner.h"
12
+
13
+ SK_API std::unique_ptr<SkFontScanner> SkFontScanner_Make_Fontations();
14
+
15
+ #endif // SKFONTSCANNER_FONTATIONS_H_
@@ -0,0 +1,15 @@
1
+ /*
2
+ * Copyright 2024 Google Inc.
3
+ *
4
+ * Use of this source code is governed by a BSD-style license that can be
5
+ * found in the LICENSE file.
6
+ */
7
+
8
+ #ifndef SKFONTSCANNER_FREETYPE_H_
9
+ #define SKFONTSCANNER_FREETYPE_H_
10
+
11
+ #include "include/core/SkFontScanner.h"
12
+
13
+ SK_API std::unique_ptr<SkFontScanner> SkFontScanner_Make_FreeType();
14
+
15
+ #endif // SKFONTSCANNER_FREETYPE_H_
@@ -9,6 +9,7 @@
9
9
  #define SkExif_DEFINED
10
10
 
11
11
  #include "include/codec/SkEncodedOrigin.h"
12
+ #include "include/core/SkRefCnt.h"
12
13
  #include "include/private/base/SkAPI.h"
13
14
 
14
15
  #include <cstdint>
@@ -50,6 +51,19 @@ struct Metadata {
50
51
  */
51
52
  void SK_API Parse(Metadata& metadata, const SkData* data);
52
53
 
54
+ /*
55
+ * Write exif data that includes the values in |metadata| and returns it as SkData
56
+ * untruncated. Return nullptr if a write to the data stream fails or if
57
+ * |metadata.fHdrHeadroom| has value.
58
+ * This function cannot write an IFD entry based on the HdrHeadroom value because
59
+ * the information of maker33 and maker48 are lost in decoding.
60
+ * For metadata that belongs in a subIFD the function will write it to one and
61
+ * store it after the root IFD.
62
+ * Data that does not fit within kSizeEntry, is appended to the end of the data,
63
+ * after the subIFD if it exists.
64
+ */
65
+ sk_sp<SkData> WriteExif(Metadata& metadata);
66
+
53
67
  } // namespace SkExif
54
68
 
55
69
  #endif
@@ -8,6 +8,7 @@
8
8
  #ifndef SkPathRef_DEFINED
9
9
  #define SkPathRef_DEFINED
10
10
 
11
+ #include "include/core/SkArc.h"
11
12
  #include "include/core/SkPoint.h"
12
13
  #include "include/core/SkRect.h"
13
14
  #include "include/core/SkRefCnt.h"
@@ -63,6 +64,7 @@ public:
63
64
  kGeneral,
64
65
  kOval,
65
66
  kRRect,
67
+ kArc,
66
68
  };
67
69
 
68
70
  SkPathRef(SkSpan<const SkPoint> points, SkSpan<const uint8_t> verbs,
@@ -78,6 +80,9 @@ public:
78
80
  // The next two values don't matter unless fType is kOval or kRRect
79
81
  fRRectOrOvalIsCCW = false;
80
82
  fRRectOrOvalStartIdx = 0xAC;
83
+ fArcOval.setEmpty();
84
+ fArcStartAngle = fArcSweepAngle = 0.0f;
85
+ fArcType = SkArc::Type::kArc;
81
86
  SkDEBUGCODE(fEditorsAttached.store(0);)
82
87
 
83
88
  this->computeBounds(); // do this now, before we worry about multiple owners/threads
@@ -160,6 +165,10 @@ public:
160
165
  fPathRef->setIsRRect(isCCW, start);
161
166
  }
162
167
 
168
+ void setIsArc(const SkArc& arc) {
169
+ fPathRef->setIsArc(arc);
170
+ }
171
+
163
172
  void setBounds(const SkRect& rect) { fPathRef->setBounds(rect); }
164
173
 
165
174
  private:
@@ -249,6 +258,16 @@ public:
249
258
 
250
259
  bool isRRect(SkRRect* rrect, bool* isCCW, unsigned* start) const;
251
260
 
261
+ bool isArc(SkArc* arc) const {
262
+ if (fType == PathType::kArc) {
263
+ if (arc) {
264
+ *arc = SkArc::Make(fArcOval, fArcStartAngle, fArcSweepAngle, fArcType);
265
+ }
266
+ }
267
+
268
+ return fType == PathType::kArc;
269
+ }
270
+
252
271
  bool hasComputedBounds() const {
253
272
  return !fBoundsIsDirty;
254
273
  }
@@ -365,6 +384,9 @@ private:
365
384
  // The next two values don't matter unless fType is kOval or kRRect
366
385
  fRRectOrOvalIsCCW = false;
367
386
  fRRectOrOvalStartIdx = 0xAC;
387
+ fArcOval.setEmpty();
388
+ fArcStartAngle = fArcSweepAngle = 0.0f;
389
+ fArcType = SkArc::Type::kArc;
368
390
  if (numPoints > 0) {
369
391
  fPoints.reserve_exact(numPoints);
370
392
  }
@@ -497,6 +519,14 @@ private:
497
519
  fRRectOrOvalStartIdx = SkToU8(start);
498
520
  }
499
521
 
522
+ void setIsArc(const SkArc& arc) {
523
+ fType = PathType::kArc;
524
+ fArcOval = arc.fOval;
525
+ fArcStartAngle = arc.fStartAngle;
526
+ fArcSweepAngle = arc.fSweepAngle;
527
+ fArcType = arc.fType;
528
+ }
529
+
500
530
  // called only by the editor. Note that this is not a const function.
501
531
  SkPoint* getWritablePoints() {
502
532
  SkDEBUGCODE(this->validate();)
@@ -534,6 +564,12 @@ private:
534
564
  bool fRRectOrOvalIsCCW;
535
565
  uint8_t fRRectOrOvalStartIdx;
536
566
  uint8_t fSegmentMask;
567
+ // If the path is an arc, these four variables store that information.
568
+ // We should just store an SkArc, but alignment would cost us 8 more bytes.
569
+ SkArc::Type fArcType;
570
+ SkRect fArcOval;
571
+ SkScalar fArcStartAngle;
572
+ SkScalar fArcSweepAngle;
537
573
 
538
574
  friend class PathRefTest_Private;
539
575
  friend class ForceIsRRect_Private; // unit test isRRect
@@ -69,6 +69,10 @@
69
69
  #define SK_CPU_LOONGARCH 1
70
70
  #endif
71
71
 
72
+ #if defined(__powerpc__) || defined (__powerpc64__)
73
+ #define SK_CPU_PPC 1
74
+ #endif
75
+
72
76
  /**
73
77
  * SK_CPU_SSE_LEVEL
74
78
  *
@@ -69,7 +69,7 @@ public:
69
69
  template <typename Integer, std::enable_if_t<std::is_integral_v<Integer>, bool> = true>
70
70
  constexpr SkSpan(T* ptr, Integer size) : fPtr{ptr}, fSize{SkToSizeT(size)} {
71
71
  SkASSERT(ptr || fSize == 0); // disallow nullptr + a nonzero size
72
- SkASSERT(fSize < kMaxSize);
72
+ SkASSERT(fSize < (std::numeric_limits<size_t>::max() / sizeof(T)));
73
73
  }
74
74
  template <typename U, typename = std::enable_if_t<std::is_same_v<const U, T>>>
75
75
  constexpr SkSpan(const SkSpan<U>& that) : fPtr(std::data(that)), fSize(std::size(that)) {}
@@ -118,8 +118,6 @@ public:
118
118
  }
119
119
 
120
120
  private:
121
- static constexpr size_t kMaxSize = std::numeric_limits<size_t>::max() / sizeof(T);
122
-
123
121
  T* fPtr;
124
122
  size_t fSize;
125
123
  };