@shopify/react-native-skia 2.0.0-next.3 → 2.0.0-next.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/cpp/skia/include/codec/SkCodec.h +39 -1
- package/cpp/skia/include/config/SkUserConfig.h +1 -10
- package/cpp/skia/include/core/SkCanvas.h +8 -4
- package/cpp/skia/include/core/SkContourMeasure.h +2 -2
- package/cpp/skia/include/core/SkMilestone.h +1 -1
- package/cpp/skia/include/core/SkPaint.h +8 -5
- package/cpp/skia/include/core/SkStream.h +8 -3
- package/cpp/skia/include/core/SkTextBlob.h +9 -9
- package/cpp/skia/include/core/SkTypeface.h +4 -6
- package/cpp/skia/include/core/SkTypes.h +5 -0
- package/cpp/skia/include/docs/SkPDFDocument.h +47 -2
- package/cpp/skia/include/docs/SkPDFJpegHelpers.h +41 -0
- package/cpp/skia/include/effects/SkRuntimeEffect.h +5 -1
- package/cpp/skia/include/effects/SkTableMaskFilter.h +4 -0
- package/cpp/skia/include/gpu/graphite/BackendTexture.h +0 -2
- package/cpp/skia/include/gpu/graphite/ContextOptions.h +17 -0
- package/cpp/skia/include/gpu/graphite/GraphiteTypes.h +21 -18
- package/cpp/skia/include/gpu/graphite/PrecompileContext.h +24 -0
- package/cpp/skia/include/gpu/graphite/TextureInfo.h +87 -42
- package/cpp/skia/include/gpu/graphite/YUVABackendTextures.h +13 -4
- package/cpp/skia/include/gpu/graphite/dawn/DawnBackendContext.h +9 -0
- package/cpp/skia/include/gpu/graphite/dawn/DawnGraphiteTypes.h +166 -0
- package/cpp/skia/include/gpu/graphite/dawn/DawnTypes.h +3 -141
- package/cpp/skia/include/gpu/graphite/dawn/DawnUtils.h +2 -21
- package/cpp/skia/include/gpu/graphite/mtl/MtlBackendContext.h +4 -0
- package/cpp/skia/include/gpu/graphite/mtl/MtlGraphiteTypes.h +30 -6
- package/cpp/skia/include/gpu/graphite/mtl/MtlGraphiteTypesUtils.h +4 -42
- package/cpp/skia/include/gpu/graphite/mtl/MtlGraphiteTypes_cpp.h +50 -0
- package/cpp/skia/include/gpu/graphite/mtl/MtlGraphiteUtils.h +2 -20
- package/cpp/skia/include/gpu/graphite/precompile/Precompile.h +14 -4
- package/cpp/skia/include/gpu/graphite/precompile/PrecompileShader.h +14 -6
- package/cpp/skia/include/gpu/graphite/vk/VulkanGraphiteContext.h +31 -0
- package/cpp/skia/include/gpu/graphite/vk/VulkanGraphiteTypes.h +36 -14
- package/cpp/skia/include/gpu/graphite/vk/VulkanGraphiteUtils.h +3 -21
- package/cpp/skia/include/ports/SkTypeface_fontations.h +3 -0
- package/cpp/skia/include/private/SkJpegMetadataDecoder.h +7 -0
- package/cpp/skia/include/private/base/SkAnySubclass.h +6 -0
- package/cpp/skia/include/private/chromium/SkPMColor.h +38 -0
- package/cpp/skia/modules/skparagraph/include/Paragraph.h +2 -2
- package/cpp/skia/modules/skunicode/include/SkUnicode.h +10 -6
- package/cpp/skia/modules/svg/include/SkSVGDOM.h +1 -3
- package/cpp/skia/src/base/SkTInternalLList.h +1 -1
- package/cpp/skia/src/core/SkLRUCache.h +6 -3
- package/lib/commonjs/external/reanimated/textures.d.ts +2 -4
- package/lib/commonjs/external/reanimated/textures.js +8 -15
- package/lib/commonjs/external/reanimated/textures.js.map +1 -1
- package/lib/commonjs/sksg/HostConfig.js +2 -1
- package/lib/commonjs/sksg/HostConfig.js.map +1 -1
- package/lib/module/external/reanimated/textures.d.ts +2 -4
- package/lib/module/external/reanimated/textures.js +7 -12
- package/lib/module/external/reanimated/textures.js.map +1 -1
- package/lib/module/sksg/HostConfig.js +2 -1
- package/lib/module/sksg/HostConfig.js.map +1 -1
- package/lib/typescript/lib/commonjs/external/reanimated/textures.d.ts +1 -3
- package/lib/typescript/lib/commonjs/sksg/HostConfig.d.ts +1 -1
- package/lib/typescript/lib/module/external/reanimated/textures.d.ts +1 -3
- package/lib/typescript/lib/module/sksg/HostConfig.d.ts +1 -1
- package/lib/typescript/src/external/reanimated/textures.d.ts +2 -4
- package/libs/android/arm64-v8a/libskia.a +0 -0
- package/libs/android/arm64-v8a/libskottie.a +0 -0
- package/libs/android/arm64-v8a/libskparagraph.a +0 -0
- package/libs/android/arm64-v8a/libsksg.a +0 -0
- package/libs/android/arm64-v8a/libskshaper.a +0 -0
- package/libs/android/arm64-v8a/libskunicode_icu.a +0 -0
- package/libs/android/arm64-v8a/libsvg.a +0 -0
- package/libs/android/armeabi-v7a/libskia.a +0 -0
- package/libs/android/armeabi-v7a/libskottie.a +0 -0
- package/libs/android/armeabi-v7a/libskparagraph.a +0 -0
- package/libs/android/armeabi-v7a/libsksg.a +0 -0
- package/libs/android/armeabi-v7a/libskshaper.a +0 -0
- package/libs/android/armeabi-v7a/libskunicode_icu.a +0 -0
- package/libs/android/armeabi-v7a/libsvg.a +0 -0
- package/libs/android/x86/libskia.a +0 -0
- package/libs/android/x86/libskottie.a +0 -0
- package/libs/android/x86/libskparagraph.a +0 -0
- package/libs/android/x86/libsksg.a +0 -0
- package/libs/android/x86/libskshaper.a +0 -0
- package/libs/android/x86/libskunicode_icu.a +0 -0
- package/libs/android/x86/libsvg.a +0 -0
- package/libs/android/x86_64/libskia.a +0 -0
- package/libs/android/x86_64/libskottie.a +0 -0
- package/libs/android/x86_64/libskparagraph.a +0 -0
- package/libs/android/x86_64/libsksg.a +0 -0
- package/libs/android/x86_64/libskshaper.a +0 -0
- package/libs/android/x86_64/libskunicode_icu.a +0 -0
- package/libs/android/x86_64/libsvg.a +0 -0
- package/libs/apple/libskia.xcframework/Info.plist +15 -15
- package/libs/apple/libskia.xcframework/ios-arm64_arm64e/libskia.a +0 -0
- package/libs/apple/libskia.xcframework/ios-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
- package/libs/apple/libskia.xcframework/macos-arm64_x86_64/libskia.a +0 -0
- package/libs/apple/libskia.xcframework/tvos-arm64_arm64e/libskia.a +0 -0
- package/libs/apple/libskia.xcframework/tvos-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
- package/libs/apple/libskottie.xcframework/Info.plist +7 -7
- package/libs/apple/libskottie.xcframework/ios-arm64_arm64e/libskottie.a +0 -0
- package/libs/apple/libskottie.xcframework/ios-arm64_arm64e_x86_64-simulator/libskottie.a +0 -0
- package/libs/apple/libskottie.xcframework/macos-arm64_x86_64/libskottie.a +0 -0
- package/libs/apple/libskottie.xcframework/tvos-arm64_arm64e/libskottie.a +0 -0
- package/libs/apple/libskottie.xcframework/tvos-arm64_arm64e_x86_64-simulator/libskottie.a +0 -0
- package/libs/apple/libskparagraph.xcframework/Info.plist +13 -13
- package/libs/apple/libskparagraph.xcframework/ios-arm64_arm64e/libskparagraph.a +0 -0
- package/libs/apple/libskparagraph.xcframework/ios-arm64_arm64e_x86_64-simulator/libskparagraph.a +0 -0
- package/libs/apple/libskparagraph.xcframework/macos-arm64_x86_64/libskparagraph.a +0 -0
- package/libs/apple/libskparagraph.xcframework/tvos-arm64_arm64e/libskparagraph.a +0 -0
- package/libs/apple/libskparagraph.xcframework/tvos-arm64_arm64e_x86_64-simulator/libskparagraph.a +0 -0
- package/libs/apple/libsksg.xcframework/Info.plist +13 -13
- package/libs/apple/libsksg.xcframework/ios-arm64_arm64e/libsksg.a +0 -0
- package/libs/apple/libsksg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsksg.a +0 -0
- package/libs/apple/libsksg.xcframework/macos-arm64_x86_64/libsksg.a +0 -0
- package/libs/apple/libsksg.xcframework/tvos-arm64_arm64e/libsksg.a +0 -0
- package/libs/apple/libsksg.xcframework/tvos-arm64_arm64e_x86_64-simulator/libsksg.a +0 -0
- package/libs/apple/libskshaper.xcframework/Info.plist +14 -14
- package/libs/apple/libskshaper.xcframework/ios-arm64_arm64e/libskshaper.a +0 -0
- package/libs/apple/libskshaper.xcframework/ios-arm64_arm64e_x86_64-simulator/libskshaper.a +0 -0
- package/libs/apple/libskshaper.xcframework/macos-arm64_x86_64/libskshaper.a +0 -0
- package/libs/apple/libskshaper.xcframework/tvos-arm64_arm64e/libskshaper.a +0 -0
- package/libs/apple/libskshaper.xcframework/tvos-arm64_arm64e_x86_64-simulator/libskshaper.a +0 -0
- package/libs/apple/libskunicode_core.xcframework/Info.plist +12 -12
- package/libs/apple/libskunicode_core.xcframework/ios-arm64_arm64e/libskunicode_core.a +0 -0
- package/libs/apple/libskunicode_core.xcframework/ios-arm64_arm64e_x86_64-simulator/libskunicode_core.a +0 -0
- package/libs/apple/libskunicode_core.xcframework/macos-arm64_x86_64/libskunicode_core.a +0 -0
- package/libs/apple/libskunicode_core.xcframework/tvos-arm64_arm64e/libskunicode_core.a +0 -0
- package/libs/apple/libskunicode_core.xcframework/tvos-arm64_arm64e_x86_64-simulator/libskunicode_core.a +0 -0
- package/libs/apple/libskunicode_libgrapheme.xcframework/Info.plist +15 -15
- package/libs/apple/libskunicode_libgrapheme.xcframework/ios-arm64_arm64e/libskunicode_libgrapheme.a +0 -0
- package/libs/apple/libskunicode_libgrapheme.xcframework/ios-arm64_arm64e_x86_64-simulator/libskunicode_libgrapheme.a +0 -0
- package/libs/apple/libskunicode_libgrapheme.xcframework/macos-arm64_x86_64/libskunicode_libgrapheme.a +0 -0
- package/libs/apple/libskunicode_libgrapheme.xcframework/tvos-arm64_arm64e/libskunicode_libgrapheme.a +0 -0
- package/libs/apple/libskunicode_libgrapheme.xcframework/tvos-arm64_arm64e_x86_64-simulator/libskunicode_libgrapheme.a +0 -0
- package/libs/apple/libsvg.xcframework/Info.plist +8 -8
- package/libs/apple/libsvg.xcframework/ios-arm64_arm64e/libsvg.a +0 -0
- package/libs/apple/libsvg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsvg.a +0 -0
- package/libs/apple/libsvg.xcframework/macos-arm64_x86_64/libsvg.a +0 -0
- package/libs/apple/libsvg.xcframework/tvos-arm64_arm64e/libsvg.a +0 -0
- package/libs/apple/libsvg.xcframework/tvos-arm64_arm64e_x86_64-simulator/libsvg.a +0 -0
- package/package.json +1 -1
- package/src/external/reanimated/textures.tsx +12 -20
- package/src/sksg/HostConfig.ts +2 -1
- package/cpp/skia/include/core/SkColorPriv.h +0 -165
- package/cpp/skia/include/private/SkColorData.h +0 -385
@@ -784,12 +784,46 @@ public:
|
|
784
784
|
*
|
785
785
|
* As such, future decoding calls may require a rewind.
|
786
786
|
*
|
787
|
-
*
|
787
|
+
* `getRepetitionCount` will return `0` in two cases:
|
788
|
+
* 1. Still (non-animated) images.
|
789
|
+
* 2. Animated images that only play the animation once (i.e. that don't
|
790
|
+
* repeat the animation)
|
791
|
+
* `isAnimated` can be used to disambiguate between these two cases.
|
788
792
|
*/
|
789
793
|
int getRepetitionCount() {
|
790
794
|
return this->onGetRepetitionCount();
|
791
795
|
}
|
792
796
|
|
797
|
+
/**
|
798
|
+
* `isAnimated` returns whether the full input is expected to contain an
|
799
|
+
* animated image (i.e. more than 1 image frame). This can be used to
|
800
|
+
* disambiguate the meaning of `getRepetitionCount` returning `0` (see
|
801
|
+
* `getRepetitionCount`'s doc comment for more details).
|
802
|
+
*
|
803
|
+
* Note that in some codecs `getFrameCount()` only returns the number of
|
804
|
+
* frames for which all the metadata has been already successfully decoded.
|
805
|
+
* Therefore for a partial input `isAnimated()` may return "yes", even
|
806
|
+
* though `getFrameCount()` may temporarily return `1` until more of the
|
807
|
+
* input is available.
|
808
|
+
*
|
809
|
+
* When handling partial input, some codecs may not know until later (e.g.
|
810
|
+
* until encountering additional image frames) whether the given image has
|
811
|
+
* more than one frame. Such codecs may initially return
|
812
|
+
* `IsAnimated::kUnknown` and only later give a definitive "yes" or "no"
|
813
|
+
* answer. GIF format is one example where this may happen.
|
814
|
+
*
|
815
|
+
* Other codecs may be able to decode the information from the metadata
|
816
|
+
* present before the first image frame. Such codecs should be able to give
|
817
|
+
* a definitive "yes" or "no" answer as soon as they are constructed. PNG
|
818
|
+
* format is one example where this happens.
|
819
|
+
*/
|
820
|
+
enum class IsAnimated {
|
821
|
+
kYes,
|
822
|
+
kNo,
|
823
|
+
kUnknown,
|
824
|
+
};
|
825
|
+
IsAnimated isAnimated() { return this->onIsAnimated(); }
|
826
|
+
|
793
827
|
// Register a decoder at runtime by passing two function pointers:
|
794
828
|
// - peek() to return true if the span of bytes appears to be your encoded format;
|
795
829
|
// - make() to attempt to create an SkCodec from the given stream.
|
@@ -937,6 +971,10 @@ protected:
|
|
937
971
|
return 0;
|
938
972
|
}
|
939
973
|
|
974
|
+
virtual IsAnimated onIsAnimated() {
|
975
|
+
return IsAnimated::kNo;
|
976
|
+
}
|
977
|
+
|
940
978
|
private:
|
941
979
|
const SkEncodedInfo fEncodedInfo;
|
942
980
|
XformFormat fSrcXformFormat;
|
@@ -80,16 +80,6 @@
|
|
80
80
|
*/
|
81
81
|
//#define SK_CANVAS_SAVE_RESTORE_PREALLOC_COUNT 32
|
82
82
|
|
83
|
-
/* Determines whether to build code that supports the Ganesh GPU backend. Some classes
|
84
|
-
that are not GPU-specific, such as SkShader subclasses, have optional code
|
85
|
-
that is used allows them to interact with this GPU backend. If you'd like to
|
86
|
-
include this code, include -DSK_GANESH in your cflags or uncomment below.
|
87
|
-
Defaults to not set (No Ganesh GPU backend).
|
88
|
-
This define affects the ABI of Skia, so make sure it matches the client which uses
|
89
|
-
the compiled version of Skia.
|
90
|
-
*/
|
91
|
-
//#define SK_GANESH
|
92
|
-
|
93
83
|
/* Skia makes use of histogram logging macros to trace the frequency of
|
94
84
|
events. By default, Skia provides no-op versions of these macros.
|
95
85
|
Skia consumers can provide their own definitions of these macros to
|
@@ -99,6 +89,7 @@
|
|
99
89
|
//#define SK_HISTOGRAM_ENUMERATION(name, sampleEnum, enumSize)
|
100
90
|
//#define SK_HISTOGRAM_EXACT_LINEAR(name, sample, valueMax)
|
101
91
|
//#define SK_HISTOGRAM_MEMORY_KB(name, sample)
|
92
|
+
//#define SK_HISTOGRAM_CUSTOM_COUNTS(name, sample, countMin, countMax, bucketCount)
|
102
93
|
//#define SK_HISTOGRAM_CUSTOM_MICROSECONDS_TIMES(name, sampleUSec, minUSec, maxUSec, bucketCount)
|
103
94
|
|
104
95
|
/*
|
@@ -54,6 +54,7 @@ class GrRecordingContext;
|
|
54
54
|
|
55
55
|
class SkBitmap;
|
56
56
|
class SkBlender;
|
57
|
+
class SkBlurMaskFilterImpl;
|
57
58
|
class SkColorSpace;
|
58
59
|
class SkData;
|
59
60
|
class SkDevice;
|
@@ -2679,11 +2680,14 @@ private:
|
|
2679
2680
|
// into the canvas' global space.
|
2680
2681
|
SkRect computeDeviceClipBounds(bool outsetForAA=true) const;
|
2681
2682
|
|
2682
|
-
//
|
2683
|
-
//
|
2684
|
-
|
2685
|
-
|
2683
|
+
// Returns the paint's mask filter if it can be used to draw an rrect with an analytic blur, and
|
2684
|
+
// returns null otherwise.
|
2685
|
+
const SkBlurMaskFilterImpl* canAttemptBlurredRRectDraw(const SkPaint&) const;
|
2686
|
+
|
2687
|
+
// Attempt to draw a rrect with an analytic blur. If the draw succeeds or predrawNotify fails,
|
2688
|
+
// nullopt is returned indicating that nothing further should be drawn.
|
2686
2689
|
std::optional<AutoLayerForImageFilter> attemptBlurredRRectDraw(const SkRRect&,
|
2690
|
+
const SkBlurMaskFilterImpl*,
|
2687
2691
|
const SkPaint&,
|
2688
2692
|
SkEnumBitMask<PredrawFlags>);
|
2689
2693
|
|
@@ -91,13 +91,13 @@ public:
|
|
91
91
|
return *this;
|
92
92
|
}
|
93
93
|
|
94
|
-
bool operator==(const ForwardVerbIterator& other) {
|
94
|
+
bool operator==(const ForwardVerbIterator& other) const {
|
95
95
|
SkASSERT(fSegments.data() != other.fSegments.data() ||
|
96
96
|
fSegments.size() == other.fSegments.size());
|
97
97
|
return fSegments.data() == other.fSegments.data();
|
98
98
|
}
|
99
99
|
|
100
|
-
bool operator!=(const ForwardVerbIterator& other) {
|
100
|
+
bool operator!=(const ForwardVerbIterator& other) const {
|
101
101
|
return !((*this) == other);
|
102
102
|
}
|
103
103
|
|
@@ -317,15 +317,18 @@ public:
|
|
317
317
|
*/
|
318
318
|
SkScalar getStrokeMiter() const { return fMiterLimit; }
|
319
319
|
|
320
|
-
/**
|
321
|
-
|
322
|
-
|
320
|
+
/** When stroking a small joinAngle with miter, the miterLength may be very long.
|
321
|
+
When miterLength > maxMiterLength (or joinAngle < minJoinAngle) the join will become bevel.
|
322
|
+
miterLimit = maxMiterLength / strokeWidth or miterLimit = 1 / sin(minJoinAngle / 2).
|
323
323
|
|
324
|
-
|
324
|
+
This call has no effect if the miterLimit passed is less than zero.
|
325
|
+
Values less than one will be treated as bevel.
|
326
|
+
|
327
|
+
@param miterLimit zero and greater miter limit
|
325
328
|
|
326
329
|
example: https://fiddle.skia.org/c/@Paint_setStrokeMiter
|
327
330
|
*/
|
328
|
-
void setStrokeMiter(SkScalar
|
331
|
+
void setStrokeMiter(SkScalar miterLimit);
|
329
332
|
|
330
333
|
/** \enum SkPaint::Cap
|
331
334
|
Cap draws at the beginning and end of an open path contour.
|
@@ -79,10 +79,12 @@ public:
|
|
79
79
|
[[nodiscard]] bool readS8(int8_t*);
|
80
80
|
[[nodiscard]] bool readS16(int16_t*);
|
81
81
|
[[nodiscard]] bool readS32(int32_t*);
|
82
|
+
[[nodiscard]] bool readS64(int64_t*);
|
82
83
|
|
83
|
-
[[nodiscard]] bool readU8(uint8_t* i)
|
84
|
+
[[nodiscard]] bool readU8(uint8_t* i) { return this->readS8((int8_t*)i); }
|
84
85
|
[[nodiscard]] bool readU16(uint16_t* i) { return this->readS16((int16_t*)i); }
|
85
86
|
[[nodiscard]] bool readU32(uint32_t* i) { return this->readS32((int32_t*)i); }
|
87
|
+
[[nodiscard]] bool readU64(uint64_t* i) { return this->readS64((int64_t*)i); }
|
86
88
|
|
87
89
|
[[nodiscard]] bool readBool(bool* b) {
|
88
90
|
uint8_t i;
|
@@ -240,8 +242,11 @@ public:
|
|
240
242
|
uint16_t v = SkToU16(value);
|
241
243
|
return this->write(&v, 2);
|
242
244
|
}
|
243
|
-
bool write32(uint32_t
|
244
|
-
return this->write(&
|
245
|
+
bool write32(uint32_t value) {
|
246
|
+
return this->write(&value, 4);
|
247
|
+
}
|
248
|
+
bool write64(uint64_t value) {
|
249
|
+
return this->write(&value, 8);
|
245
250
|
}
|
246
251
|
|
247
252
|
bool writeText(const char text[]) {
|
@@ -209,13 +209,13 @@ public:
|
|
209
209
|
class SK_API Iter {
|
210
210
|
public:
|
211
211
|
struct Run {
|
212
|
-
SkTypeface*
|
213
|
-
int
|
214
|
-
const
|
212
|
+
SkTypeface* fTypeface;
|
213
|
+
int fGlyphCount;
|
214
|
+
const SkGlyphID* fGlyphIndices;
|
215
215
|
#ifdef SK_UNTIL_CRBUG_1187654_IS_FIXED
|
216
216
|
const uint32_t* fClusterIndex_forTest;
|
217
|
-
int
|
218
|
-
const char*
|
217
|
+
int fUtf8Size_forTest;
|
218
|
+
const char* fUtf8_forTest;
|
219
219
|
#endif
|
220
220
|
};
|
221
221
|
|
@@ -229,10 +229,10 @@ public:
|
|
229
229
|
|
230
230
|
// Experimental, DO NO USE, will change/go-away
|
231
231
|
struct ExperimentalRun {
|
232
|
-
SkFont
|
233
|
-
int
|
234
|
-
const
|
235
|
-
const SkPoint*
|
232
|
+
SkFont font;
|
233
|
+
int count;
|
234
|
+
const SkGlyphID* glyphs;
|
235
|
+
const SkPoint* positions;
|
236
236
|
};
|
237
237
|
bool experimentalNext(ExperimentalRun*);
|
238
238
|
|
@@ -366,12 +366,10 @@ protected:
|
|
366
366
|
virtual bool onGetFixedPitch() const; // TODO: = 0;
|
367
367
|
|
368
368
|
// Must return a valid scaler context. It can not return nullptr.
|
369
|
-
virtual std::unique_ptr<SkScalerContext> onCreateScalerContext(
|
370
|
-
|
369
|
+
virtual std::unique_ptr<SkScalerContext> onCreateScalerContext(
|
370
|
+
const SkScalerContextEffects&, const SkDescriptor*) const = 0;
|
371
371
|
virtual std::unique_ptr<SkScalerContext> onCreateScalerContextAsProxyTypeface
|
372
|
-
|
373
|
-
const SkDescriptor*,
|
374
|
-
sk_sp<SkTypeface>) const;
|
372
|
+
(const SkScalerContextEffects&, const SkDescriptor*, SkTypeface* proxyTypeface) const;
|
375
373
|
virtual void onFilterRec(SkScalerContextRec*) const = 0;
|
376
374
|
friend class SkScalerContext; // onFilterRec
|
377
375
|
|
@@ -442,8 +440,8 @@ private:
|
|
442
440
|
friend class SkRandomTypeface; // getAdvancedMetrics
|
443
441
|
friend class SkPDFFont; // getAdvancedMetrics
|
444
442
|
friend class SkTypeface_proxy;
|
445
|
-
|
446
443
|
friend class SkFontPriv; // getGlyphToUnicodeMap
|
444
|
+
friend void TestSkTypefaceGlyphToUnicodeMap(SkTypeface&, SkUnichar*);
|
447
445
|
|
448
446
|
private:
|
449
447
|
SkTypefaceID fUniqueID;
|
@@ -97,6 +97,7 @@
|
|
97
97
|
defined(SK_HISTOGRAM_BOOLEAN) || \
|
98
98
|
defined(SK_HISTOGRAM_EXACT_LINEAR) || \
|
99
99
|
defined(SK_HISTOGRAM_MEMORY_KB) || \
|
100
|
+
defined(SK_HISTOGRAM_CUSTOM_COUNTS)|| \
|
100
101
|
defined(SK_HISTOGRAM_CUSTOM_MICROSECONDS_TIMES)
|
101
102
|
# define SK_HISTOGRAMS_ENABLED 1
|
102
103
|
#else
|
@@ -119,6 +120,10 @@
|
|
119
120
|
# define SK_HISTOGRAM_MEMORY_KB(name, sample)
|
120
121
|
#endif
|
121
122
|
|
123
|
+
#ifndef SK_HISTOGRAM_CUSTOM_COUNTS
|
124
|
+
# define SK_HISTOGRAM_CUSTOM_COUNTS(name, sample, countMin, countMax, bucketCount)
|
125
|
+
#endif
|
126
|
+
|
122
127
|
#ifndef SK_HISTOGRAM_CUSTOM_MICROSECONDS_TIMES
|
123
128
|
# define SK_HISTOGRAM_CUSTOM_MICROSECONDS_TIMES(name, sampleUSec, minUSec, maxUSec, bucketCount)
|
124
129
|
#endif
|
@@ -16,9 +16,12 @@
|
|
16
16
|
#include <vector>
|
17
17
|
|
18
18
|
class SkCanvas;
|
19
|
+
class SkCodec;
|
20
|
+
class SkData;
|
19
21
|
class SkExecutor;
|
20
22
|
class SkPDFArray;
|
21
23
|
class SkPDFStructTree;
|
24
|
+
class SkPixmap;
|
22
25
|
class SkWStream;
|
23
26
|
|
24
27
|
#define SKPDF_STRING(X) SKPDF_STRING_IMPL(X)
|
@@ -80,6 +83,9 @@ struct DateTime {
|
|
80
83
|
void toISO8601(SkString* dst) const;
|
81
84
|
};
|
82
85
|
|
86
|
+
using DecodeJpegCallback = std::unique_ptr<SkCodec> (*)(sk_sp<SkData>);
|
87
|
+
using EncodeJpegCallback = bool (*)(SkWStream* dst, const SkPixmap& src, int quality);
|
88
|
+
|
83
89
|
/** Optional metadata to be passed into the PDF factory function.
|
84
90
|
*/
|
85
91
|
struct Metadata {
|
@@ -157,6 +163,7 @@ struct Metadata {
|
|
157
163
|
enum class Outline : int {
|
158
164
|
None = 0,
|
159
165
|
StructureElementHeaders = 1,
|
166
|
+
StructureElements = 2,
|
160
167
|
} fOutline = Outline::None;
|
161
168
|
|
162
169
|
/** Executor to handle threaded work within PDF Backend. If this is nullptr,
|
@@ -186,14 +193,50 @@ struct Metadata {
|
|
186
193
|
enum Subsetter {
|
187
194
|
kHarfbuzz_Subsetter,
|
188
195
|
} fSubsetter = kHarfbuzz_Subsetter;
|
196
|
+
|
197
|
+
/** Clients can provide a way to decode jpeg. To use Skia's JPEG decoder, pass in
|
198
|
+
SkJpegDecoder::Decode. If not supplied, all images will need to be re-encoded
|
199
|
+
as jpegs or deflated images before embedding. If supplied, Skia may be able to
|
200
|
+
skip the re-encoding step.
|
201
|
+
Skia's JPEG decoder can be used here.
|
202
|
+
*/
|
203
|
+
SkPDF::DecodeJpegCallback jpegDecoder = nullptr;
|
204
|
+
|
205
|
+
/** Clients can provide a way to encode jpeg. If not supplied, images will be embedded
|
206
|
+
as a deflated image, potentially making them much larger. If clients provide
|
207
|
+
their own implementation, JPEGs should be encoded to RGB (not YUV) otherwise they
|
208
|
+
will have the wrong surrounding metadata provided by Skia.
|
209
|
+
Skia's JPEG encoder can be used here.
|
210
|
+
*/
|
211
|
+
SkPDF::EncodeJpegCallback jpegEncoder = nullptr;
|
212
|
+
|
213
|
+
// Skia's PDF support depends on having both a jpeg encoder and decoder for writing
|
214
|
+
// compact PDFs. It will technically work, but produce larger than optimal PDFs
|
215
|
+
// if either the decoder or encoder are left as nullptr. If clients will be creating
|
216
|
+
// PDFs that don't use images or otherwise want to incur this cost (with the upside
|
217
|
+
// of not having a jpeg library), they should set this to true to avoid an internal
|
218
|
+
// assert from firing.
|
219
|
+
bool allowNoJpegs = false;
|
189
220
|
};
|
190
221
|
|
222
|
+
namespace NodeID {
|
223
|
+
static const constexpr int Nothing = 0;
|
224
|
+
static const constexpr int OtherArtifact = -1;
|
225
|
+
static const constexpr int PaginationArtifact = -2;
|
226
|
+
static const constexpr int PaginationHeaderArtifact = -3;
|
227
|
+
static const constexpr int PaginationFooterArtifact = -4;
|
228
|
+
static const constexpr int PaginationWatermarkArtifact = -5;
|
229
|
+
static const constexpr int LayoutArtifact = -6;
|
230
|
+
static const constexpr int PageArtifact = -7;
|
231
|
+
static const constexpr int BackgroundArtifact = -8;
|
232
|
+
} // namespace NodeID
|
233
|
+
|
191
234
|
/** Associate a node ID with subsequent drawing commands in an
|
192
235
|
SkCanvas. The same node ID can appear in a StructureElementNode
|
193
236
|
in order to associate a document's structure element tree with
|
194
237
|
its content.
|
195
238
|
|
196
|
-
A node ID of zero indicates no node ID.
|
239
|
+
A node ID of zero indicates no node ID. Negative node IDs are reserved.
|
197
240
|
|
198
241
|
@param canvas The canvas used to draw to the PDF.
|
199
242
|
@param nodeId The node ID for subsequent drawing commands.
|
@@ -207,15 +250,17 @@ SK_API void SetNodeId(SkCanvas* dst, int nodeID);
|
|
207
250
|
@param stream A PDF document will be written to this stream. The document may write
|
208
251
|
to the stream at anytime during its lifetime, until either close() is
|
209
252
|
called or the document is deleted.
|
210
|
-
@param metadata a PDFmetadata object.
|
253
|
+
@param metadata a PDFmetadata object. Some fields may be left empty.
|
211
254
|
|
212
255
|
@returns NULL if there is an error, otherwise a newly created PDF-backed SkDocument.
|
213
256
|
*/
|
214
257
|
SK_API sk_sp<SkDocument> MakeDocument(SkWStream* stream, const Metadata& metadata);
|
215
258
|
|
259
|
+
#if !defined(SK_DISABLE_LEGACY_PDF_JPEG)
|
216
260
|
static inline sk_sp<SkDocument> MakeDocument(SkWStream* stream) {
|
217
261
|
return MakeDocument(stream, Metadata());
|
218
262
|
}
|
263
|
+
#endif
|
219
264
|
|
220
265
|
} // namespace SkPDF
|
221
266
|
|
@@ -0,0 +1,41 @@
|
|
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
|
+
#ifndef SkPDFJPEGHelpers_DEFINED
|
8
|
+
#define SkPDFJPEGHelpers_DEFINED
|
9
|
+
|
10
|
+
#include "include/codec/SkJpegDecoder.h"
|
11
|
+
#include "include/core/SkData.h"
|
12
|
+
#include "include/core/SkRefCnt.h"
|
13
|
+
#include "include/docs/SkPDFDocument.h"
|
14
|
+
#include "include/encode/SkJpegEncoder.h"
|
15
|
+
|
16
|
+
class SkPixmap;
|
17
|
+
class SkWStream;
|
18
|
+
|
19
|
+
#include <memory>
|
20
|
+
|
21
|
+
namespace SkPDF::JPEG {
|
22
|
+
inline std::unique_ptr<SkCodec> Decode(sk_sp<SkData> data) {
|
23
|
+
return SkJpegDecoder::Decode(data, nullptr, nullptr);
|
24
|
+
}
|
25
|
+
|
26
|
+
inline bool Encode(SkWStream* dst, const SkPixmap& src, int quality) {
|
27
|
+
SkJpegEncoder::Options jOpts;
|
28
|
+
jOpts.fQuality = quality;
|
29
|
+
return SkJpegEncoder::Encode(dst, src, jOpts);
|
30
|
+
}
|
31
|
+
|
32
|
+
inline SkPDF::Metadata MetadataWithCallbacks() {
|
33
|
+
SkPDF::Metadata m;
|
34
|
+
m.jpegDecoder = SkPDF::JPEG::Decode;
|
35
|
+
m.jpegEncoder = SkPDF::JPEG::Encode;
|
36
|
+
return m;
|
37
|
+
}
|
38
|
+
|
39
|
+
} // namespace SkPDF::JPEG
|
40
|
+
|
41
|
+
#endif
|
@@ -126,6 +126,8 @@ public:
|
|
126
126
|
// don't run the inliner directly, but they still get an inlining pass once they are
|
127
127
|
// painted.)
|
128
128
|
bool forceUnoptimized = false;
|
129
|
+
// When possible this name will be used to identify the created runtime effect.
|
130
|
+
std::string_view fName;
|
129
131
|
|
130
132
|
private:
|
131
133
|
friend class SkRuntimeEffect;
|
@@ -317,7 +319,9 @@ private:
|
|
317
319
|
friend class SkRuntimeEffectPriv;
|
318
320
|
|
319
321
|
uint32_t fHash;
|
320
|
-
|
322
|
+
// When not 0, this field holds a StableKey value or a user-defined stable key
|
323
|
+
uint32_t fStableKey = 0;
|
324
|
+
SkString fName;
|
321
325
|
|
322
326
|
std::unique_ptr<SkSL::Program> fBaseProgram;
|
323
327
|
std::unique_ptr<SkSL::RP::Program> fRPProgram;
|
@@ -17,7 +17,6 @@
|
|
17
17
|
namespace skgpu::graphite {
|
18
18
|
|
19
19
|
class BackendTextureData;
|
20
|
-
struct VulkanTextureInfo;
|
21
20
|
|
22
21
|
class SK_API BackendTexture {
|
23
22
|
public:
|
@@ -61,4 +60,3 @@ private:
|
|
61
60
|
} // namespace skgpu::graphite
|
62
61
|
|
63
62
|
#endif // skgpu_graphite_BackendTexture_DEFINED
|
64
|
-
|
@@ -9,12 +9,14 @@
|
|
9
9
|
#define skgpu_graphite_ContextOptions_DEFINED
|
10
10
|
|
11
11
|
#include "include/core/SkRefCnt.h"
|
12
|
+
#include "include/core/SkSpan.h"
|
12
13
|
#include "include/private/base/SkAPI.h"
|
13
14
|
#include "include/private/base/SkMath.h"
|
14
15
|
|
15
16
|
#include <optional>
|
16
17
|
|
17
18
|
class SkData;
|
19
|
+
class SkRuntimeEffect;
|
18
20
|
namespace skgpu { class ShaderErrorHandler; }
|
19
21
|
|
20
22
|
namespace skgpu::graphite {
|
@@ -136,6 +138,21 @@ struct SK_API ContextOptions {
|
|
136
138
|
PipelineCallbackContext fPipelineCallbackContext = nullptr;
|
137
139
|
PipelineCallback fPipelineCallback = nullptr;
|
138
140
|
|
141
|
+
/**
|
142
|
+
* The runtime effects provided here will be registered as user-defined *known* runtime
|
143
|
+
* effects and will be given a stable key. Such runtime effects can then be used in
|
144
|
+
* serialized pipeline keys (c.f. PrecompileContext::precompile).
|
145
|
+
*
|
146
|
+
* Graphite will take a ref on the provided runtime effects and they will persist for as long
|
147
|
+
* as the Context exists. Rather than recreating new SkRuntimeEffects using the same SkSL,
|
148
|
+
* clients should use the existing SkRuntimeEffects provided here.
|
149
|
+
*
|
150
|
+
* Warning: Registering runtime effects here does obligate users to clear out their caches
|
151
|
+
* of serialized pipeline keys if the provided runtime effects ever change in a meaningful way.
|
152
|
+
* This includes adding, removing or reordering the effects provided here.
|
153
|
+
*/
|
154
|
+
SkSpan<sk_sp<SkRuntimeEffect>> fUserDefinedKnownRuntimeEffects;
|
155
|
+
|
139
156
|
/**
|
140
157
|
* Private options that are only meant for testing within Skia's tools.
|
141
158
|
*/
|
@@ -140,44 +140,47 @@ enum class DepthStencilFlags : int {
|
|
140
140
|
*/
|
141
141
|
enum DrawTypeFlags : uint16_t {
|
142
142
|
|
143
|
-
kNone =
|
143
|
+
kNone = 0,
|
144
144
|
|
145
145
|
// kBitmapText_Mask should be used for the BitmapTextRenderStep[mask] RenderStep
|
146
|
-
kBitmapText_Mask =
|
146
|
+
kBitmapText_Mask = 1 << 0,
|
147
147
|
// kBitmapText_LCD should be used for the BitmapTextRenderStep[LCD] RenderStep
|
148
|
-
kBitmapText_LCD =
|
148
|
+
kBitmapText_LCD = 1 << 1,
|
149
149
|
// kBitmapText_Color should be used for the BitmapTextRenderStep[color] RenderStep
|
150
|
-
kBitmapText_Color =
|
150
|
+
kBitmapText_Color = 1 << 2,
|
151
151
|
// kSDFText should be used for the SDFTextRenderStep RenderStep
|
152
|
-
kSDFText =
|
152
|
+
kSDFText = 1 << 3,
|
153
153
|
// kSDFText_LCD should be used for the SDFTextLCDRenderStep RenderStep
|
154
|
-
kSDFText_LCD =
|
154
|
+
kSDFText_LCD = 1 << 4,
|
155
155
|
|
156
156
|
// kDrawVertices should be used to generate Pipelines that use the following RenderSteps:
|
157
157
|
// VerticesRenderStep[*] for:
|
158
|
-
// [
|
159
|
-
// [
|
160
|
-
kDrawVertices =
|
158
|
+
// [Tris], [TrisTexCoords], [TrisColor], [TrisColorTexCoords],
|
159
|
+
// [Tristrips], [TristripsTexCoords], [TristripsColor], [TristripsColorTexCoords]
|
160
|
+
kDrawVertices = 1 << 5,
|
161
|
+
|
162
|
+
// kCircularArc renders filled circular arcs, with or without the center included, and
|
163
|
+
// stroked circular arcs with butt or round caps that don't include the center point.
|
164
|
+
// It corresponds to the CircularArcRenderStep.
|
165
|
+
kCircularArc = 1 << 6,
|
161
166
|
|
162
167
|
// kSimpleShape should be used to generate Pipelines that use the following RenderSteps:
|
163
|
-
// AnalyticBlurRenderStep
|
164
168
|
// AnalyticRRectRenderStep
|
165
169
|
// PerEdgeAAQuadRenderStep
|
166
|
-
// CoverBoundsRenderStep[
|
167
|
-
kSimpleShape =
|
170
|
+
// CoverBoundsRenderStep[NonAAFill]
|
171
|
+
kSimpleShape = 1 << 7,
|
168
172
|
|
169
173
|
// kNonSimpleShape should be used to generate Pipelines that use the following RenderSteps:
|
170
174
|
// CoverageMaskRenderStep
|
171
|
-
// CoverBoundsRenderStep[*] for [
|
175
|
+
// CoverBoundsRenderStep[*] for [InverseCover], [RegularCover]
|
172
176
|
// TessellateStrokeRenderStep
|
173
|
-
// TessellateWedgesRenderStep[*] for [
|
174
|
-
// TessellateCurvesRenderStep[*] for [
|
175
|
-
// MiddleOutFanRenderStep[*] for [
|
176
|
-
kNonSimpleShape =
|
177
|
+
// TessellateWedgesRenderStep[*] for [Convex], [EvenOdd], [Winding]
|
178
|
+
// TessellateCurvesRenderStep[*] for [EvenOdd], [Winding]
|
179
|
+
// MiddleOutFanRenderStep[*] for [EvenOdd], [Winding]
|
180
|
+
kNonSimpleShape = 1 << 8,
|
177
181
|
|
178
182
|
kLast = kNonSimpleShape,
|
179
183
|
};
|
180
|
-
static constexpr int kDrawTypeFlagsCnt = static_cast<int>(DrawTypeFlags::kLast) + 1;
|
181
184
|
|
182
185
|
} // namespace skgpu::graphite
|
183
186
|
|
@@ -14,6 +14,8 @@
|
|
14
14
|
#include <chrono>
|
15
15
|
#include <memory>
|
16
16
|
|
17
|
+
class SkData;
|
18
|
+
|
17
19
|
namespace skgpu::graphite {
|
18
20
|
|
19
21
|
class SharedContext;
|
@@ -32,6 +34,28 @@ public:
|
|
32
34
|
*/
|
33
35
|
void purgePipelinesNotUsedInMs(std::chrono::milliseconds msNotUsed);
|
34
36
|
|
37
|
+
/**
|
38
|
+
* Emit histograms (using the SK_HISTOGRAM* macros) for Skia's Pipeline usage.
|
39
|
+
*/
|
40
|
+
void reportPipelineStats();
|
41
|
+
|
42
|
+
/**
|
43
|
+
* Precompile one specific Pipeline that has been previously serialized. Serialized pipeline
|
44
|
+
* keys can be acquired via the ContextOptions::PipelineCallback.
|
45
|
+
*
|
46
|
+
* @param serializedPipelineKey serialized Pipeline key.
|
47
|
+
* @return true if a Pipeline was created from the key; false otherwise
|
48
|
+
*/
|
49
|
+
bool precompile(sk_sp<SkData> serializedPipelineKey);
|
50
|
+
|
51
|
+
/**
|
52
|
+
* Get a human-readable version of a serialized pipeline key.
|
53
|
+
*
|
54
|
+
* @param serializedPipelineKey serialized Pipeline key.
|
55
|
+
* @return A human-readable version of the provided key; "" on failure.
|
56
|
+
*/
|
57
|
+
std::string getPipelineLabel(sk_sp<SkData> serializedPipelineKey);
|
58
|
+
|
35
59
|
// Provides access to functions that aren't part of the public API.
|
36
60
|
PrecompileContextPriv priv();
|
37
61
|
const PrecompileContextPriv priv() const; // NOLINT(readability-const-return-type)
|