@shopify/react-native-skia 1.5.2 → 1.5.4
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.
- package/android/CMakeLists.txt +52 -13
- package/android/build.gradle +3 -0
- package/android/cpp/rnskia-android/RNSkAndroidPlatformContext.h +18 -1
- package/android/cpp/rnskia-android/RNSkAndroidVideo.cpp +12 -1
- package/android/cpp/rnskia-android/RNSkOpenGLCanvasProvider.cpp +13 -0
- package/android/src/main/java/com/shopify/reactnative/skia/SkiaBaseView.java +0 -1
- package/cpp/api/JsiSkImage.h +15 -2
- package/cpp/api/JsiSkSurface.h +18 -3
- package/cpp/rnskia/DawnContext.h +241 -0
- package/cpp/rnskia/DawnUtils.h +127 -0
- package/cpp/rnskia/DawnWindowContext.cpp +19 -0
- package/cpp/rnskia/DawnWindowContext.h +77 -0
- package/cpp/rnskia/ImageProvider.h +100 -0
- package/cpp/rnskia/RNSkView.h +6 -0
- package/cpp/skia/include/android/SkAnimatedImage.h +14 -0
- package/cpp/skia/include/codec/SkAvifDecoder.h +39 -3
- package/cpp/skia/include/codec/SkCodec.h +16 -0
- package/cpp/skia/include/config/SkUserConfig.h +3 -2
- package/cpp/skia/include/core/SkCanvas.h +55 -10
- package/cpp/skia/include/core/SkContourMeasure.h +76 -0
- package/cpp/skia/include/core/SkFontScanner.h +48 -0
- package/cpp/skia/include/core/SkMilestone.h +1 -1
- package/cpp/skia/include/core/SkPath.h +11 -0
- package/cpp/skia/include/core/SkPathEffect.h +0 -23
- package/cpp/skia/include/core/SkRect.h +2 -0
- package/cpp/skia/include/core/SkString.h +4 -0
- package/cpp/skia/include/core/SkTypeface.h +5 -0
- package/cpp/skia/include/core/SkTypes.h +8 -3
- package/cpp/skia/include/docs/SkPDFDocument.h +3 -3
- package/cpp/skia/include/effects/SkOverdrawColorFilter.h +1 -0
- package/cpp/skia/include/effects/SkRuntimeEffect.h +2 -1
- package/cpp/skia/include/encode/SkJpegEncoder.h +4 -0
- package/cpp/skia/include/gpu/ganesh/GrContextOptions.h +8 -1
- package/cpp/skia/include/gpu/ganesh/GrDirectContext.h +18 -3
- package/cpp/skia/include/gpu/ganesh/GrTypes.h +11 -0
- package/cpp/skia/include/gpu/ganesh/gl/GrGLFunctions.h +5 -1
- package/cpp/skia/include/gpu/ganesh/gl/GrGLInterface.h +0 -1
- package/cpp/skia/include/gpu/graphite/GraphiteTypes.h +8 -0
- package/cpp/skia/include/gpu/graphite/Recorder.h +0 -2
- package/cpp/skia/include/gpu/graphite/precompile/PaintOptions.h +7 -4
- package/cpp/skia/include/gpu/graphite/precompile/PrecompileImageFilter.h +2 -0
- package/cpp/skia/include/gpu/graphite/precompile/PrecompileMaskFilter.h +2 -0
- package/cpp/skia/include/ports/SkFontMgr_android_ndk.h +25 -0
- package/cpp/skia/include/ports/SkFontMgr_fontconfig.h +4 -2
- package/cpp/skia/include/ports/SkFontScanner_Fontations.h +15 -0
- package/cpp/skia/include/ports/SkFontScanner_FreeType.h +15 -0
- package/cpp/skia/include/private/SkExif.h +14 -0
- package/cpp/skia/include/private/SkPathRef.h +36 -0
- package/cpp/skia/include/private/base/SkFeatures.h +4 -0
- package/cpp/skia/include/private/base/SkSpan_impl.h +1 -3
- package/cpp/skia/modules/skcms/src/skcms_internals.h +3 -0
- package/cpp/skia/src/base/SkMathPriv.h +1 -8
- package/ios/RNSkia-iOS/RNSkMetalCanvasProvider.h +1 -2
- package/ios/RNSkia-iOS/RNSkMetalCanvasProvider.mm +25 -19
- package/ios/RNSkia-iOS/RNSkiOSPlatformContext.mm +23 -0
- package/ios/RNSkia-iOS/SkiaMetalSurfaceFactory.h +23 -9
- package/ios/RNSkia-iOS/SkiaMetalSurfaceFactory.mm +0 -20
- package/libs/android/arm64-v8a/libskia.a +0 -0
- package/libs/android/arm64-v8a/libskottie.a +0 -0
- package/libs/android/armeabi-v7a/libskia.a +0 -0
- package/libs/android/armeabi-v7a/libskottie.a +0 -0
- package/libs/android/x86/libskia.a +0 -0
- package/libs/android/x86/libskottie.a +0 -0
- package/libs/android/x86_64/libskia.a +0 -0
- package/libs/android/x86_64/libskottie.a +0 -0
- package/libs/ios/libskia.xcframework/ios-arm64_arm64e/libskia.a +0 -0
- package/libs/ios/libskia.xcframework/ios-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
- package/libs/ios/libskottie.xcframework/ios-arm64_arm64e/libskottie.a +0 -0
- package/libs/ios/libskottie.xcframework/ios-arm64_arm64e_x86_64-simulator/libskottie.a +0 -0
- package/libs/ios/libskparagraph.xcframework/ios-arm64_arm64e/libskparagraph.a +0 -0
- package/libs/ios/libskparagraph.xcframework/ios-arm64_arm64e_x86_64-simulator/libskparagraph.a +0 -0
- package/libs/ios/libsksg.xcframework/ios-arm64_arm64e/libsksg.a +0 -0
- package/libs/ios/libsksg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsksg.a +0 -0
- package/libs/ios/libskshaper.xcframework/Info.plist +5 -5
- package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e/libskshaper.a +0 -0
- package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e_x86_64-simulator/libskshaper.a +0 -0
- package/libs/ios/libskunicode_core.xcframework/Info.plist +5 -5
- package/libs/ios/libskunicode_core.xcframework/ios-arm64_arm64e/libskunicode_core.a +0 -0
- package/libs/ios/libskunicode_core.xcframework/ios-arm64_arm64e_x86_64-simulator/libskunicode_core.a +0 -0
- package/libs/ios/libskunicode_libgrapheme.xcframework/Info.plist +5 -5
- package/libs/ios/libskunicode_libgrapheme.xcframework/ios-arm64_arm64e/libskunicode_libgrapheme.a +0 -0
- package/libs/ios/libskunicode_libgrapheme.xcframework/ios-arm64_arm64e_x86_64-simulator/libskunicode_libgrapheme.a +0 -0
- package/libs/ios/libsvg.xcframework/ios-arm64_arm64e/libsvg.a +0 -0
- package/libs/ios/libsvg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsvg.a +0 -0
- package/package.json +1 -1
- package/react-native-skia.podspec +35 -9
- package/src/renderer/__tests__/e2e/SVG.spec.tsx +2 -1
@@ -11,13 +11,17 @@
|
|
11
11
|
#include "include/core/SkPoint.h"
|
12
12
|
#include "include/core/SkRefCnt.h"
|
13
13
|
#include "include/core/SkScalar.h"
|
14
|
+
#include "include/core/SkSpan.h"
|
14
15
|
#include "include/private/base/SkAPI.h"
|
16
|
+
#include "include/private/base/SkAssert.h"
|
15
17
|
#include "include/private/base/SkTDArray.h"
|
16
18
|
|
19
|
+
#include <cstddef>
|
17
20
|
#include <memory>
|
18
21
|
|
19
22
|
class SkMatrix;
|
20
23
|
class SkPath;
|
24
|
+
enum class SkPathVerb;
|
21
25
|
|
22
26
|
class SK_API SkContourMeasure : public SkRefCnt {
|
23
27
|
public:
|
@@ -57,6 +61,78 @@ public:
|
|
57
61
|
*/
|
58
62
|
bool isClosed() const { return fIsClosed; }
|
59
63
|
|
64
|
+
/** Measurement data for individual verbs.
|
65
|
+
*/
|
66
|
+
struct VerbMeasure {
|
67
|
+
SkScalar fDistance; // Cumulative distance along the current contour.
|
68
|
+
SkPathVerb fVerb; // Verb type.
|
69
|
+
SkSpan<const SkPoint> fPts; // Verb points.
|
70
|
+
};
|
71
|
+
|
72
|
+
private:
|
73
|
+
struct Segment;
|
74
|
+
|
75
|
+
public:
|
76
|
+
/** Utility for iterating over the current contour verbs:
|
77
|
+
*
|
78
|
+
* for (const auto verb_measure : contour_measure) {
|
79
|
+
* ...
|
80
|
+
* }
|
81
|
+
*/
|
82
|
+
class ForwardVerbIterator final {
|
83
|
+
public:
|
84
|
+
VerbMeasure operator*() const;
|
85
|
+
|
86
|
+
ForwardVerbIterator& operator++() {
|
87
|
+
SkASSERT(!fSegments.empty());
|
88
|
+
|
89
|
+
fSegments = LastSegForCurrentVerb(fSegments.subspan(1));
|
90
|
+
|
91
|
+
return *this;
|
92
|
+
}
|
93
|
+
|
94
|
+
bool operator==(const ForwardVerbIterator& other) {
|
95
|
+
SkASSERT(fSegments.data() != other.fSegments.data() ||
|
96
|
+
fSegments.size() == other.fSegments.size());
|
97
|
+
return fSegments.data() == other.fSegments.data();
|
98
|
+
}
|
99
|
+
|
100
|
+
bool operator!=(const ForwardVerbIterator& other) {
|
101
|
+
return !((*this) == other);
|
102
|
+
}
|
103
|
+
|
104
|
+
private:
|
105
|
+
friend class SkContourMeasure;
|
106
|
+
|
107
|
+
ForwardVerbIterator(SkSpan<const Segment> segs, SkSpan<const SkPoint> pts)
|
108
|
+
: fSegments(LastSegForCurrentVerb(segs))
|
109
|
+
, fPts(pts) {}
|
110
|
+
|
111
|
+
static SkSpan<const Segment> LastSegForCurrentVerb(const SkSpan<const Segment>& segs) {
|
112
|
+
size_t i = 1;
|
113
|
+
while (i < segs.size() && segs[0].fPtIndex == segs[i].fPtIndex) {
|
114
|
+
++i;
|
115
|
+
}
|
116
|
+
|
117
|
+
return segs.subspan(i - 1);
|
118
|
+
}
|
119
|
+
|
120
|
+
// Remaining segments for forward iteration. The first segment in the span is
|
121
|
+
// adjusted to always point to the last segment of the current verb, such that its distance
|
122
|
+
// corresponds to the verb distance.
|
123
|
+
SkSpan<const Segment> fSegments;
|
124
|
+
|
125
|
+
// All path points (indexed in segments).
|
126
|
+
SkSpan<const SkPoint> fPts;
|
127
|
+
};
|
128
|
+
|
129
|
+
ForwardVerbIterator begin() const {
|
130
|
+
return ForwardVerbIterator(fSegments, fPts);
|
131
|
+
}
|
132
|
+
ForwardVerbIterator end() const {
|
133
|
+
return ForwardVerbIterator(SkSpan(fSegments.end(), 0), fPts);
|
134
|
+
}
|
135
|
+
|
60
136
|
private:
|
61
137
|
struct Segment {
|
62
138
|
SkScalar fDistance; // total distance up to this point
|
@@ -0,0 +1,48 @@
|
|
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_H_
|
9
|
+
#define SKFONTSCANNER_H_
|
10
|
+
|
11
|
+
#include "include/core/SkFontArguments.h"
|
12
|
+
#include "include/core/SkRefCnt.h"
|
13
|
+
#include "include/core/SkTypes.h"
|
14
|
+
#include "include/private/base/SkFixed.h"
|
15
|
+
#include "include/private/base/SkNoncopyable.h"
|
16
|
+
#include "include/private/base/SkTArray.h"
|
17
|
+
class SkFontStyle;
|
18
|
+
class SkStreamAsset;
|
19
|
+
class SkString;
|
20
|
+
class SkTypeface;
|
21
|
+
|
22
|
+
class SkFontScanner : public SkNoncopyable {
|
23
|
+
public:
|
24
|
+
virtual ~SkFontScanner() = default;
|
25
|
+
struct AxisDefinition {
|
26
|
+
SkFourByteTag fTag;
|
27
|
+
SkScalar fMinimum;
|
28
|
+
SkScalar fDefault;
|
29
|
+
SkScalar fMaximum;
|
30
|
+
};
|
31
|
+
typedef skia_private::STArray<4, AxisDefinition, true> AxisDefinitions;
|
32
|
+
|
33
|
+
virtual bool scanFile(SkStreamAsset* stream, int* numFaces) const = 0;
|
34
|
+
virtual bool scanFace(SkStreamAsset* stream, int faceIndex, int* numInstances) const = 0;
|
35
|
+
/* instanceIndex 0 is the default instance, 1 to numInstances are the named instances. */
|
36
|
+
virtual bool scanInstance(SkStreamAsset* stream,
|
37
|
+
int faceIndex,
|
38
|
+
int instanceIndex,
|
39
|
+
SkString* name,
|
40
|
+
SkFontStyle* style,
|
41
|
+
bool* isFixedPitch,
|
42
|
+
AxisDefinitions* axes) const = 0;
|
43
|
+
virtual sk_sp<SkTypeface> MakeFromStream(std::unique_ptr<SkStreamAsset> stream,
|
44
|
+
const SkFontArguments& args) const = 0;
|
45
|
+
virtual SkFourByteTag getFactoryId() const = 0;
|
46
|
+
};
|
47
|
+
|
48
|
+
#endif // SKFONTSCANNER_H_
|
@@ -26,6 +26,7 @@
|
|
26
26
|
#include <tuple>
|
27
27
|
#include <type_traits>
|
28
28
|
|
29
|
+
struct SkArc;
|
29
30
|
class SkData;
|
30
31
|
class SkPathRef;
|
31
32
|
class SkRRect;
|
@@ -280,6 +281,16 @@ public:
|
|
280
281
|
*/
|
281
282
|
bool isRRect(SkRRect* rrect) const;
|
282
283
|
|
284
|
+
/** Returns true if path is representable as an oval arc. In other words, could this
|
285
|
+
path be drawn using SkCanvas::drawArc.
|
286
|
+
|
287
|
+
arc receives parameters of arc
|
288
|
+
|
289
|
+
@param arc storage for arc; may be nullptr
|
290
|
+
@return true if SkPath contains only a single arc from an oval
|
291
|
+
*/
|
292
|
+
bool isArc(SkArc* arc) const;
|
293
|
+
|
283
294
|
/** Sets SkPath to its initial state.
|
284
295
|
Removes verb array, SkPoint array, and weights, and sets FillType to kWinding.
|
285
296
|
Internal storage associated with SkPath is released.
|
@@ -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,
|
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,
|
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
|
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 ::
|
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;
|
@@ -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
|
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(
|
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
|
175
|
+
Coverage,
|
176
|
+
const RenderPassDesc&)> ProcessCombination;
|
175
177
|
|
176
178
|
void buildCombinations(const KeyContext&,
|
177
179
|
PipelineDataGatherer*,
|
178
|
-
DrawTypeFlags
|
180
|
+
DrawTypeFlags,
|
179
181
|
bool addPrimitiveBlender,
|
180
|
-
Coverage
|
181
|
-
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;
|
@@ -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_
|