@shopify/react-native-skia 2.6.0 → 2.6.1
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 +0 -1
- package/android/cpp/jni/JniWebGPUView.cpp +3 -3
- package/android/cpp/rnskia-android/OpenGLContext.h +4 -5
- package/android/cpp/rnskia-android/RNSkAndroidPlatformContext.h +1 -1
- package/apple/MetalContext.h +5 -6
- package/apple/MetalWindowContext.mm +3 -4
- package/apple/RNSkApplePlatformContext.h +1 -1
- package/apple/RNSkApplePlatformContext.mm +4 -3
- package/apple/SkiaCVPixelBufferUtils.h +1 -1
- package/apple/SkiaCVPixelBufferUtils.mm +31 -30
- package/apple/SkiaPlatformContext.mm +2 -2
- package/apple/SkiaUIView.mm +1 -1
- package/apple/SkiaWebGPUView.mm +8 -4
- package/apple/WebGPUMetalView.h +1 -1
- package/apple/WebGPUMetalView.mm +1 -1
- package/cpp/api/JsiSkColor.h +8 -4
- package/cpp/api/JsiSkContourMeasure.h +4 -3
- package/cpp/api/JsiSkImage.h +17 -9
- package/cpp/api/JsiSkParagraphBuilder.h +14 -1
- package/cpp/api/JsiSkPath.h +71 -81
- package/cpp/api/JsiSkPathEffectFactory.h +2 -1
- package/cpp/api/JsiSkPathFactory.h +48 -52
- package/cpp/api/JsiSkShader.h +1 -1
- package/cpp/api/JsiSkShaderFactory.h +50 -26
- package/cpp/api/JsiSkSurfaceFactory.h +2 -1
- package/cpp/api/recorder/Drawings.h +5 -7
- package/cpp/api/recorder/Shaders.h +77 -22
- package/cpp/jsi2/JSIConverter.h +1 -1
- package/cpp/rnskia/RNDawnContext.h +14 -15
- package/cpp/rnskia/RNDawnUtils.h +14 -17
- package/cpp/rnskia/RNDawnWindowContext.h +1 -1
- package/cpp/rnskia/RNSkManager.cpp +5 -4
- package/cpp/rnskia/RNSkPlatformContext.h +2 -2
- package/cpp/rnwgpu/api/GPU.cpp +21 -0
- package/cpp/rnwgpu/api/GPUCanvasContext.cpp +1 -1
- package/cpp/rnwgpu/api/GPUCanvasContext.h +2 -2
- package/cpp/rnwgpu/api/GPUFeatures.h +0 -9
- package/cpp/rnwgpu/api/GPUTexture.h +14 -2
- package/cpp/rnwgpu/api/GPUUncapturedErrorEvent.h +3 -4
- package/cpp/rnwgpu/api/RNWebGPU.h +1 -1
- package/cpp/rnwgpu/api/descriptors/Unions.h +0 -15
- package/cpp/skia/include/android/SkImageAndroid.h +7 -2
- package/cpp/skia/include/android/vk/AndroidVulkanMemoryAllocator.h +31 -0
- package/cpp/skia/include/codec/SkCodec.h +42 -15
- package/cpp/skia/include/config/SkUserConfig.h +8 -0
- package/cpp/skia/include/core/SkBitmap.h +0 -5
- package/cpp/skia/include/core/SkCanvas.h +2 -39
- package/cpp/skia/include/core/SkColor.h +12 -0
- package/cpp/skia/include/core/SkColorSpace.h +9 -0
- package/cpp/skia/include/core/SkContourMeasure.h +1 -5
- package/cpp/skia/include/core/SkData.h +8 -0
- package/cpp/skia/include/core/SkFont.h +1 -55
- package/cpp/skia/include/core/SkFontArguments.h +15 -0
- package/cpp/skia/include/core/SkGraphics.h +0 -5
- package/cpp/skia/include/core/SkImage.h +0 -4
- package/cpp/skia/include/core/SkImageGenerator.h +1 -4
- package/cpp/skia/include/core/SkMatrix.h +0 -37
- package/cpp/skia/include/core/SkMilestone.h +1 -1
- package/cpp/skia/include/core/SkPath.h +11 -911
- package/cpp/skia/include/core/SkPathBuilder.h +42 -32
- package/cpp/skia/include/core/SkPathEffect.h +0 -9
- package/cpp/skia/include/core/SkPathMeasure.h +1 -4
- package/cpp/skia/include/core/SkPathUtils.h +0 -10
- package/cpp/skia/include/core/SkRect.h +0 -12
- package/cpp/skia/include/core/SkRegion.h +1 -6
- package/cpp/skia/include/core/SkSerialProcs.h +4 -5
- package/cpp/skia/include/core/SkSurfaceProps.h +6 -0
- package/cpp/skia/include/core/SkTextBlob.h +0 -22
- package/cpp/skia/include/core/SkTypeface.h +14 -32
- package/cpp/skia/include/core/SkTypes.h +0 -8
- package/cpp/skia/include/docs/SkPDFDocument.h +19 -17
- package/cpp/skia/include/effects/SkDashPathEffect.h +0 -6
- package/cpp/skia/include/effects/SkGradient.h +206 -0
- package/cpp/skia/include/effects/SkHighContrastFilter.h +2 -2
- package/cpp/skia/include/gpu/GpuTypes.h +2 -0
- package/cpp/skia/include/gpu/ganesh/GrBackendSemaphore.h +5 -35
- package/cpp/skia/include/gpu/ganesh/GrBackendSurface.h +7 -106
- package/cpp/skia/include/gpu/ganesh/GrContextOptions.h +0 -11
- package/cpp/skia/include/gpu/ganesh/GrDirectContext.h +0 -9
- package/cpp/skia/include/gpu/ganesh/d3d/GrD3DBackendSemaphore.h +20 -0
- package/cpp/skia/include/gpu/ganesh/d3d/GrD3DBackendSurface.h +59 -0
- package/cpp/skia/include/gpu/ganesh/d3d/GrD3DDirectContext.h +28 -0
- package/cpp/skia/include/gpu/ganesh/gl/GrGLFunctions.h +4 -1
- package/cpp/skia/include/gpu/graphite/ContextOptions.h +4 -20
- package/cpp/skia/include/gpu/graphite/GraphiteTypes.h +32 -46
- package/cpp/skia/include/gpu/graphite/Recorder.h +1 -1
- package/cpp/skia/include/gpu/graphite/Surface.h +31 -0
- package/cpp/skia/include/gpu/graphite/TextureInfo.h +3 -10
- package/cpp/skia/include/gpu/graphite/dawn/DawnGraphiteTypes.h +3 -3
- package/cpp/skia/include/gpu/graphite/mtl/MtlGraphiteTypes.h +1 -1
- package/cpp/skia/include/gpu/graphite/precompile/PrecompileShader.h +6 -6
- package/cpp/skia/include/gpu/graphite/vk/VulkanGraphiteTypes.h +5 -3
- package/cpp/skia/include/gpu/graphite/vk/precompile/VulkanPrecompileShader.h +1 -1
- package/cpp/skia/include/gpu/vk/VulkanBackendContext.h +1 -1
- package/cpp/skia/include/gpu/vk/VulkanPreferredFeatures.h +8 -0
- package/cpp/skia/include/private/SkEncodedInfo.h +43 -105
- package/cpp/skia/include/private/SkHdrMetadata.h +165 -2
- package/cpp/skia/include/private/SkPathRef.h +0 -457
- package/cpp/skia/include/private/base/SkFeatures.h +4 -0
- package/cpp/skia/include/private/base/SkFloatingPoint.h +1 -2
- package/cpp/skia/include/private/base/SkLoadUserConfig.h +2 -1
- package/cpp/skia/include/private/base/SkLog.h +68 -0
- package/cpp/skia/include/private/base/SkLogPriority.h +35 -0
- package/cpp/skia/include/private/base/SkMacros.h +9 -0
- package/cpp/skia/include/private/base/SkTArray.h +1 -1
- package/cpp/skia/include/private/gpu/ganesh/GrD3DTypesMinimal.h +10 -24
- package/cpp/skia/include/utils/SkEventTracer.h +5 -7
- package/cpp/skia/modules/skottie/include/TextShaper.h +0 -7
- package/cpp/skia/modules/skparagraph/include/FontCollection.h +6 -20
- package/cpp/skia/modules/skparagraph/include/ParagraphBuilder.h +0 -6
- package/cpp/skia/modules/skparagraph/include/ParagraphCache.h +4 -19
- package/cpp/skia/modules/skparagraph/include/TypefaceFontProvider.h +2 -3
- package/cpp/skia/modules/skunicode/include/SkUnicode_icu.h +18 -0
- package/cpp/skia/modules/skunicode/include/SkUnicode_libgrapheme.h +19 -0
- package/cpp/skia/src/base/SkMathPriv.h +27 -132
- package/package.json +5 -5
- package/cpp/skia/include/effects/SkGradientShader.h +0 -359
- package/cpp/skia/include/gpu/graphite/LogPriority.h +0 -36
|
@@ -30,7 +30,15 @@ class SkRRect;
|
|
|
30
30
|
struct SkPathRaw;
|
|
31
31
|
class SkString;
|
|
32
32
|
|
|
33
|
+
// todo: add this flag to clients
|
|
34
|
+
#ifndef SK_SUPPORT_LEGACY_PATHBUILDER_SETLASTPT
|
|
35
|
+
#define SK_SUPPORT_LEGACY_PATHBUILDER_SETLASTPT
|
|
36
|
+
#endif
|
|
37
|
+
|
|
33
38
|
class SK_API SkPathBuilder {
|
|
39
|
+
using PointsArray = skia_private::STArray<4, SkPoint>;
|
|
40
|
+
using VerbsArray = skia_private::STArray<4, SkPathVerb>;
|
|
41
|
+
using ConicWeightsArray = skia_private::STArray<2, float>;
|
|
34
42
|
public:
|
|
35
43
|
/** Constructs an empty SkPathBuilder. By default, SkPathBuilder has no verbs, no SkPoint, and
|
|
36
44
|
no weights. FillType is set to kWinding.
|
|
@@ -39,6 +47,12 @@ public:
|
|
|
39
47
|
*/
|
|
40
48
|
SkPathBuilder();
|
|
41
49
|
|
|
50
|
+
SkPathBuilder(const SkPathBuilder&);
|
|
51
|
+
SkPathBuilder& operator=(const SkPathBuilder&);
|
|
52
|
+
SkPathBuilder(SkPathBuilder&&);
|
|
53
|
+
SkPathBuilder& operator=(SkPathBuilder&&);
|
|
54
|
+
~SkPathBuilder();
|
|
55
|
+
|
|
42
56
|
/** Constructs an empty SkPathBuilder with the given FillType. By default, SkPathBuilder has no
|
|
43
57
|
verbs, no SkPoint, and no weights.
|
|
44
58
|
|
|
@@ -55,9 +69,6 @@ public:
|
|
|
55
69
|
*/
|
|
56
70
|
explicit SkPathBuilder(const SkPath& path);
|
|
57
71
|
|
|
58
|
-
SkPathBuilder(const SkPathBuilder&) = default;
|
|
59
|
-
~SkPathBuilder();
|
|
60
|
-
|
|
61
72
|
/** Sets an SkPathBuilder to be a copy of an existing SkPath.
|
|
62
73
|
Copies the FillType and replays all of the verbs from the SkPath into the SkPathBuilder.
|
|
63
74
|
|
|
@@ -65,7 +76,6 @@ public:
|
|
|
65
76
|
@return SkPathBuilder
|
|
66
77
|
*/
|
|
67
78
|
SkPathBuilder& operator=(const SkPath&);
|
|
68
|
-
SkPathBuilder& operator=(const SkPathBuilder&) = default;
|
|
69
79
|
|
|
70
80
|
bool operator==(const SkPathBuilder&) const;
|
|
71
81
|
bool operator!=(const SkPathBuilder& o) const { return !(*this == o); }
|
|
@@ -86,9 +96,7 @@ public:
|
|
|
86
96
|
|
|
87
97
|
@return bounds of all SkPoint in SkPoint array, or {}.
|
|
88
98
|
*/
|
|
89
|
-
std::optional<SkRect> computeFiniteBounds() const
|
|
90
|
-
return SkRect::Bounds(fPts);
|
|
91
|
-
}
|
|
99
|
+
std::optional<SkRect> computeFiniteBounds() const;
|
|
92
100
|
|
|
93
101
|
/** Like computeFiniteBounds() but returns a 'tight' bounds, meaning when there are curve
|
|
94
102
|
* segments, this computes the X/Y limits of the curve itself, not the curve's control
|
|
@@ -789,20 +797,22 @@ public:
|
|
|
789
797
|
return this->addOval(oval, dir, 1);
|
|
790
798
|
}
|
|
791
799
|
|
|
792
|
-
/** Adds circle
|
|
793
|
-
four kConic_Verb, and kClose_Verb. Circle begins at: (
|
|
794
|
-
clockwise if dir is kCW_Direction, and counterclockwise if dir is kCCW_Direction.
|
|
800
|
+
/** Adds circle with center and radius to SkPathBuilder, appending kMove_Verb,
|
|
801
|
+
four kConic_Verb, and kClose_Verb. Circle begins at: (center.fX + radius, center.fY).
|
|
795
802
|
|
|
796
803
|
Has no effect if radius is zero or negative.
|
|
797
804
|
|
|
798
|
-
@param
|
|
799
|
-
@param y center of circle
|
|
805
|
+
@param center center of circle
|
|
800
806
|
@param radius distance from center to edge
|
|
801
807
|
@param dir SkPath::Direction to wind circle
|
|
802
808
|
@return reference to SkPathBuilder
|
|
803
809
|
*/
|
|
804
|
-
SkPathBuilder& addCircle(
|
|
810
|
+
SkPathBuilder& addCircle(SkPoint center, float radius,
|
|
805
811
|
SkPathDirection dir = SkPathDirection::kDefault);
|
|
812
|
+
SkPathBuilder& addCircle(float x, float y, float radius,
|
|
813
|
+
SkPathDirection dir = SkPathDirection::kDefault) {
|
|
814
|
+
return this->addCircle({x, y}, radius, dir);
|
|
815
|
+
}
|
|
806
816
|
|
|
807
817
|
/** Adds contour created from line array, adding (pts.size() - 1) line segments.
|
|
808
818
|
Contour added starts at pts[0], then adds a line for every additional SkPoint
|
|
@@ -934,13 +944,24 @@ public:
|
|
|
934
944
|
*/
|
|
935
945
|
void setPoint(size_t index, SkPoint p);
|
|
936
946
|
|
|
937
|
-
/**
|
|
938
|
-
|
|
947
|
+
/** Change the last point in the builder.
|
|
948
|
+
* If the builder is empty, the call does nothing.
|
|
949
|
+
*
|
|
950
|
+
* @param p the new point value
|
|
951
|
+
*/
|
|
952
|
+
void setLastPoint(SkPoint p) {
|
|
953
|
+
this->setPoint(this->points().size() - 1, p);
|
|
954
|
+
}
|
|
955
|
+
|
|
956
|
+
#ifdef SK_SUPPORT_LEGACY_PATHBUILDER_SETLASTPT
|
|
957
|
+
/** DEPRECATED: use setLastPoint() or setPoint()
|
|
958
|
+
Sets the last point on the path. If SkPoint array is empty, this behaves like moveTo().
|
|
939
959
|
|
|
940
|
-
@param
|
|
941
|
-
@param y y-value of last point
|
|
960
|
+
@param pt the new value for the last point in the path
|
|
942
961
|
*/
|
|
943
|
-
void setLastPt(
|
|
962
|
+
void setLastPt(SkPoint pt);
|
|
963
|
+
void setLastPt(float x, float y) { this->setLastPt({x, y}); }
|
|
964
|
+
#endif
|
|
944
965
|
|
|
945
966
|
/** Returns the number of points in SkPathBuilder.
|
|
946
967
|
SkPoint count is initially zero.
|
|
@@ -956,15 +977,6 @@ public:
|
|
|
956
977
|
*/
|
|
957
978
|
bool isInverseFillType() const { return SkPathFillType_IsInverse(fFillType); }
|
|
958
979
|
|
|
959
|
-
#ifdef SK_SUPPORT_UNSPANNED_APIS
|
|
960
|
-
SkPathBuilder& addPolygon(const SkPoint pts[], int count, bool close) {
|
|
961
|
-
return this->addPolygon({pts, count}, close);
|
|
962
|
-
}
|
|
963
|
-
SkPathBuilder& polylineTo(const SkPoint pts[], int count) {
|
|
964
|
-
return this->polylineTo({pts, count});
|
|
965
|
-
}
|
|
966
|
-
#endif
|
|
967
|
-
|
|
968
980
|
SkSpan<const SkPoint> points() const {
|
|
969
981
|
return fPts;
|
|
970
982
|
}
|
|
@@ -992,9 +1004,9 @@ public:
|
|
|
992
1004
|
bool contains(SkPoint) const;
|
|
993
1005
|
|
|
994
1006
|
private:
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
1007
|
+
PointsArray fPts;
|
|
1008
|
+
VerbsArray fVerbs;
|
|
1009
|
+
ConicWeightsArray fConicWeights;
|
|
998
1010
|
|
|
999
1011
|
SkPathFillType fFillType;
|
|
1000
1012
|
bool fIsVolatile;
|
|
@@ -1016,8 +1028,6 @@ private:
|
|
|
1016
1028
|
}
|
|
1017
1029
|
}
|
|
1018
1030
|
|
|
1019
|
-
SkPath make(sk_sp<SkPathRef>) const;
|
|
1020
|
-
|
|
1021
1031
|
bool isZeroLengthSincePoint(int startPtIndex) const;
|
|
1022
1032
|
|
|
1023
1033
|
SkPathBuilder& privateReverseAddPath(const SkPath&);
|
|
@@ -78,15 +78,6 @@ public:
|
|
|
78
78
|
|
|
79
79
|
static sk_sp<SkPathEffect> Deserialize(const void* data, size_t size,
|
|
80
80
|
const SkDeserialProcs* procs = nullptr);
|
|
81
|
-
|
|
82
|
-
#ifdef SK_SUPPORT_MUTABLE_PATHEFFECT
|
|
83
|
-
bool filterPath(SkPath* dst, const SkPath& src, SkStrokeRec*, const SkRect* cullR) const;
|
|
84
|
-
|
|
85
|
-
/** Version of filterPath that can be called when the CTM is known. */
|
|
86
|
-
bool filterPath(SkPath* dst, const SkPath& src, SkStrokeRec*, const SkRect* cullR,
|
|
87
|
-
const SkMatrix& ctm) const;
|
|
88
|
-
#endif
|
|
89
|
-
|
|
90
81
|
private:
|
|
91
82
|
SkPathEffect() = default;
|
|
92
83
|
friend class SkPathEffectBase;
|
|
@@ -65,16 +65,13 @@ public:
|
|
|
65
65
|
[[nodiscard]] bool getMatrix(SkScalar distance, SkMatrix* matrix,
|
|
66
66
|
MatrixFlags flags = kGetPosAndTan_MatrixFlag);
|
|
67
67
|
|
|
68
|
-
/** Given a start and stop distance,
|
|
68
|
+
/** Given a start and stop distance, append to dst the intervening segment(s).
|
|
69
69
|
If the segment is zero-length, return false, else return true.
|
|
70
70
|
startD and stopD are pinned to legal values (0..getLength()). If startD > stopD
|
|
71
71
|
then return false (and leave dst untouched).
|
|
72
72
|
Begin the segment with a moveTo if startWithMoveTo is true
|
|
73
73
|
*/
|
|
74
74
|
bool getSegment(SkScalar startD, SkScalar stopD, SkPathBuilder* dst, bool startWithMoveTo);
|
|
75
|
-
#ifdef SK_SUPPORT_MUTABLE_PATHEFFECT
|
|
76
|
-
bool getSegment(SkScalar startD, SkScalar stopD, SkPath* dst, bool startWithMoveTo);
|
|
77
|
-
#endif
|
|
78
75
|
|
|
79
76
|
/** Return true if the current contour is closed()
|
|
80
77
|
*/
|
|
@@ -34,16 +34,6 @@ SK_API bool FillPathWithPaint(const SkPath& src, const SkPaint& paint, SkPathBui
|
|
|
34
34
|
|
|
35
35
|
SK_API SkPath FillPathWithPaint(const SkPath& src, const SkPaint& paint, bool* isFill = nullptr);
|
|
36
36
|
|
|
37
|
-
#ifdef SK_SUPPORT_MUTABLE_PATHEFFECT
|
|
38
|
-
SK_API bool FillPathWithPaint(const SkPath &src, const SkPaint &paint, SkPath *dst,
|
|
39
|
-
const SkRect *cullRect, SkScalar resScale = 1);
|
|
40
|
-
|
|
41
|
-
SK_API bool FillPathWithPaint(const SkPath &src, const SkPaint &paint, SkPath *dst,
|
|
42
|
-
const SkRect *cullRect, const SkMatrix &ctm);
|
|
43
|
-
|
|
44
|
-
SK_API bool FillPathWithPaint(const SkPath &src, const SkPaint &paint, SkPath *dst);
|
|
45
|
-
#endif
|
|
46
|
-
|
|
47
37
|
}
|
|
48
38
|
|
|
49
39
|
#endif
|
|
@@ -951,18 +951,6 @@ struct SK_API SkRect {
|
|
|
951
951
|
*/
|
|
952
952
|
void setBoundsNoCheck(SkSpan<const SkPoint> pts);
|
|
953
953
|
|
|
954
|
-
#ifdef SK_SUPPORT_UNSPANNED_APIS
|
|
955
|
-
void setBounds(const SkPoint pts[], int count) {
|
|
956
|
-
this->setBounds({pts, count});
|
|
957
|
-
}
|
|
958
|
-
void setBoundsNoCheck(const SkPoint pts[], int count) {
|
|
959
|
-
this->setBoundsNoCheck({pts, count});
|
|
960
|
-
}
|
|
961
|
-
bool setBoundsCheck(const SkPoint pts[], int count) {
|
|
962
|
-
return this->setBoundsCheck({pts, count});
|
|
963
|
-
}
|
|
964
|
-
#endif
|
|
965
|
-
|
|
966
954
|
/** Sets bounds to the smallest SkRect enclosing SkPoint p0 and p1. The result is
|
|
967
955
|
sorted and may be empty. Does not check to see if values are finite.
|
|
968
956
|
|
|
@@ -8,14 +8,13 @@
|
|
|
8
8
|
#ifndef SkRegion_DEFINED
|
|
9
9
|
#define SkRegion_DEFINED
|
|
10
10
|
|
|
11
|
+
#include "include/core/SkPath.h"
|
|
11
12
|
#include "include/core/SkRect.h"
|
|
12
13
|
#include "include/private/base/SkAPI.h"
|
|
13
14
|
#include "include/private/base/SkAssert.h"
|
|
14
15
|
#include "include/private/base/SkDebug.h"
|
|
15
16
|
#include "include/private/base/SkTypeTraits.h"
|
|
16
17
|
|
|
17
|
-
#include "include/core/SkPath.h" // IWYU -- for SK_HIDE_PATH_EDIT_METHODS
|
|
18
|
-
|
|
19
18
|
#include <cstddef>
|
|
20
19
|
#include <cstdint>
|
|
21
20
|
#include <type_traits>
|
|
@@ -195,10 +194,6 @@ public:
|
|
|
195
194
|
*/
|
|
196
195
|
SkPath getBoundaryPath() const;
|
|
197
196
|
|
|
198
|
-
#ifndef SK_HIDE_PATH_EDIT_METHODS
|
|
199
|
-
bool getBoundaryPath(SkPath* path) const;
|
|
200
|
-
#endif
|
|
201
|
-
|
|
202
197
|
/** Constructs an empty SkRegion. SkRegion is set to empty bounds
|
|
203
198
|
at (0, 0) with zero width and height. Always returns false.
|
|
204
199
|
|
|
@@ -19,16 +19,13 @@ class SkImage;
|
|
|
19
19
|
class SkPicture;
|
|
20
20
|
class SkTypeface;
|
|
21
21
|
class SkReadBuffer;
|
|
22
|
+
class SkStream;
|
|
22
23
|
enum SkAlphaType : int;
|
|
23
24
|
namespace sktext::gpu {
|
|
24
25
|
class Slug;
|
|
25
26
|
}
|
|
26
27
|
|
|
27
|
-
#if defined(SK_DISABLE_LEGACY_NONCONST_SERIAL_PROCS)
|
|
28
28
|
using SkSerialReturnType = sk_sp<const SkData>;
|
|
29
|
-
#else
|
|
30
|
-
using SkSerialReturnType = sk_sp<SkData>;
|
|
31
|
-
#endif
|
|
32
29
|
/**
|
|
33
30
|
* A serial-proc is asked to serialize the specified object (e.g. picture or image).
|
|
34
31
|
* If a data object is returned, it will be used (even if it is zero-length).
|
|
@@ -84,7 +81,9 @@ using SkSlugProc = sk_sp<sktext::gpu::Slug> (*)(SkReadBuffer&, void* ctx);
|
|
|
84
81
|
/**
|
|
85
82
|
* Called with the encoded form of a typeface (previously written with a custom
|
|
86
83
|
* SkSerialTypefaceProc proc). Return a typeface object, or nullptr indicating failure.
|
|
84
|
+
* TODO: Users must not attempt to fork or duplicate the passed stream and hold on to the result.
|
|
87
85
|
*/
|
|
86
|
+
using SkDeserialTypefaceStreamProc = sk_sp<SkTypeface> (*)(SkStream&, void* ctx);
|
|
88
87
|
using SkDeserialTypefaceProc = sk_sp<SkTypeface> (*)(const void* data, size_t length, void* ctx);
|
|
89
88
|
|
|
90
89
|
struct SK_API SkSerialProcs {
|
|
@@ -109,7 +108,7 @@ struct SK_API SkDeserialProcs {
|
|
|
109
108
|
SkSlugProc fSlugProc = nullptr;
|
|
110
109
|
void* fSlugCtx = nullptr;
|
|
111
110
|
|
|
112
|
-
|
|
111
|
+
SkDeserialTypefaceStreamProc fTypefaceStreamProc = nullptr;
|
|
113
112
|
void* fTypefaceCtx = nullptr;
|
|
114
113
|
|
|
115
114
|
// This looks like a flag, but it could be considered a proc as well (one that takes no
|
|
@@ -60,6 +60,8 @@ public:
|
|
|
60
60
|
// If set, all rendering will have dithering enabled
|
|
61
61
|
// Currently this only impacts GPU backends
|
|
62
62
|
kAlwaysDither_Flag = 1 << 2,
|
|
63
|
+
// The surface will preserve transparent draws (instead of skipping them).
|
|
64
|
+
kPreservesTransparentDraws_Flag = 1 << 3,
|
|
63
65
|
};
|
|
64
66
|
|
|
65
67
|
/** No flags, unknown pixel geometry, platform-default contrast/gamma. */
|
|
@@ -94,6 +96,10 @@ public:
|
|
|
94
96
|
return SkToBool(fFlags & kAlwaysDither_Flag);
|
|
95
97
|
}
|
|
96
98
|
|
|
99
|
+
bool preservesTransparentDraws() const {
|
|
100
|
+
return SkToBool(fFlags & kPreservesTransparentDraws_Flag);
|
|
101
|
+
}
|
|
102
|
+
|
|
97
103
|
bool operator==(const SkSurfaceProps& that) const {
|
|
98
104
|
return fFlags == that.fFlags && fPixelGeometry == that.fPixelGeometry &&
|
|
99
105
|
fTextContrast == that.fTextContrast && fTextGamma == that.fTextGamma;
|
|
@@ -262,28 +262,6 @@ public:
|
|
|
262
262
|
const RunRecord* fRunRecord;
|
|
263
263
|
};
|
|
264
264
|
|
|
265
|
-
#ifdef SK_SUPPORT_UNSPANNED_APIS
|
|
266
|
-
static sk_sp<SkTextBlob> MakeFromPosTextH(const void* text, size_t byteLength,
|
|
267
|
-
const SkScalar xpos[], SkScalar constY,
|
|
268
|
-
const SkFont& font,
|
|
269
|
-
SkTextEncoding encoding = SkTextEncoding::kUTF8) {
|
|
270
|
-
const size_t worstCaseCount = byteLength;
|
|
271
|
-
return MakeFromPosTextH(text, byteLength, {xpos, worstCaseCount}, constY, font, encoding);
|
|
272
|
-
}
|
|
273
|
-
static sk_sp<SkTextBlob> MakeFromPosText(const void* text, size_t byteLength,
|
|
274
|
-
const SkPoint pos[], const SkFont& font,
|
|
275
|
-
SkTextEncoding encoding = SkTextEncoding::kUTF8) {
|
|
276
|
-
const size_t worstCaseCount = byteLength;
|
|
277
|
-
return MakeFromPosText(text, byteLength, {pos, worstCaseCount}, font, encoding);
|
|
278
|
-
}
|
|
279
|
-
static sk_sp<SkTextBlob> MakeFromRSXform(const void* text, size_t byteLength,
|
|
280
|
-
const SkRSXform xform[], const SkFont& font,
|
|
281
|
-
SkTextEncoding encoding = SkTextEncoding::kUTF8) {
|
|
282
|
-
const size_t worstCaseCount = byteLength;
|
|
283
|
-
return MakeFromRSXform(text, byteLength, {xform, worstCaseCount}, font, encoding);
|
|
284
|
-
}
|
|
285
|
-
#endif
|
|
286
|
-
|
|
287
265
|
private:
|
|
288
266
|
friend class SkNVRefCnt<SkTextBlob>;
|
|
289
267
|
|
|
@@ -56,10 +56,10 @@ public:
|
|
|
56
56
|
/** Returns the typeface's intrinsic style attributes. */
|
|
57
57
|
SkFontStyle fontStyle() const;
|
|
58
58
|
|
|
59
|
-
/** Returns true if
|
|
59
|
+
/** Returns true if fontStyle() weight is at least semi bold */
|
|
60
60
|
bool isBold() const;
|
|
61
61
|
|
|
62
|
-
/** Returns true if
|
|
62
|
+
/** Returns true if fontStyle() is not upright. */
|
|
63
63
|
bool isItalic() const;
|
|
64
64
|
|
|
65
65
|
/** Returns true if the typeface claims to be fixed-pitch.
|
|
@@ -92,6 +92,12 @@ public:
|
|
|
92
92
|
*/
|
|
93
93
|
int getVariationDesignParameters(SkSpan<SkFontParameters::Variation::Axis> parameters) const;
|
|
94
94
|
|
|
95
|
+
/** Returns true if the typeface is internally being fake bolded. */
|
|
96
|
+
bool isSyntheticBold() const;
|
|
97
|
+
|
|
98
|
+
/** Returns true if the typeface is internally being fake obliqued. */
|
|
99
|
+
bool isSyntheticOblique() const;
|
|
100
|
+
|
|
95
101
|
/** Return a 32bit value for this typeface, unique for the underlying font
|
|
96
102
|
data. Will never return 0.
|
|
97
103
|
*/
|
|
@@ -127,7 +133,7 @@ public:
|
|
|
127
133
|
/** Write a unique signature to a stream, sufficient to reconstruct a
|
|
128
134
|
typeface referencing the same font when Deserialize is called.
|
|
129
135
|
*/
|
|
130
|
-
|
|
136
|
+
bool serialize(SkWStream*, SerializeBehavior = SerializeBehavior::kIncludeDataIfLocal) const;
|
|
131
137
|
|
|
132
138
|
/**
|
|
133
139
|
* Same as serialize(SkWStream*, ...) but returns the serialized data in SkData, instead of
|
|
@@ -176,7 +182,7 @@ public:
|
|
|
176
182
|
|
|
177
183
|
/** Copy into tags[] (allocated by the caller) the list of table tags in
|
|
178
184
|
* the font, and return the number. This will be the same as CountTables()
|
|
179
|
-
* or 0 if an error
|
|
185
|
+
* or 0 if an error occurred. If tags is empty, this only returns the count
|
|
180
186
|
* (the same as calling countTables()).
|
|
181
187
|
*/
|
|
182
188
|
int readTableTags(SkSpan<SkFontTableTag> tags) const;
|
|
@@ -190,7 +196,7 @@ public:
|
|
|
190
196
|
* (which for most truetype tables is big endian). If the table tag is
|
|
191
197
|
* not found, or there is an error copying the data, then 0 is returned.
|
|
192
198
|
* If this happens, it is possible that some or all of the memory pointed
|
|
193
|
-
* to by data may have been written to, even though an error has
|
|
199
|
+
* to by data may have been written to, even though an error has occurred.
|
|
194
200
|
*
|
|
195
201
|
* @param tag The table tag whose contents are to be copied
|
|
196
202
|
* @param offset The offset in bytes into the table's contents where the
|
|
@@ -347,33 +353,6 @@ public:
|
|
|
347
353
|
FactoryId id,
|
|
348
354
|
sk_sp<SkTypeface> (*make)(std::unique_ptr<SkStreamAsset>, const SkFontArguments&));
|
|
349
355
|
|
|
350
|
-
#ifdef SK_SUPPORT_UNSPANNED_APIS
|
|
351
|
-
public:
|
|
352
|
-
int getVariationDesignPosition(SkFontArguments::VariationPosition::Coordinate coordinates[],
|
|
353
|
-
int count) const {
|
|
354
|
-
return this->getVariationDesignPosition({coordinates, count});
|
|
355
|
-
}
|
|
356
|
-
int getVariationDesignParameters(SkFontParameters::Variation::Axis parameters[],
|
|
357
|
-
int count) const {
|
|
358
|
-
return this->getVariationDesignParameters({parameters, count});
|
|
359
|
-
}
|
|
360
|
-
void unicharsToGlyphs(const SkUnichar unis[], int count, SkGlyphID glyphs[]) const {
|
|
361
|
-
this->unicharsToGlyphs({unis, count}, {glyphs, count});
|
|
362
|
-
}
|
|
363
|
-
int textToGlyphs(const void* text, size_t byteLength, SkTextEncoding encoding,
|
|
364
|
-
SkGlyphID glyphs[], int maxGlyphCount) const {
|
|
365
|
-
return (int)this->textToGlyphs(text, byteLength, encoding, {glyphs, maxGlyphCount});
|
|
366
|
-
}
|
|
367
|
-
int getTableTags(SkFontTableTag tags[]) const {
|
|
368
|
-
const size_t count = tags ? MAX_REASONABLE_TABLE_COUNT : 0;
|
|
369
|
-
return this->readTableTags({tags, count});
|
|
370
|
-
}
|
|
371
|
-
bool getKerningPairAdjustments(const SkGlyphID glyphs[], int count,
|
|
372
|
-
int32_t adjustments[]) const {
|
|
373
|
-
return this->getKerningPairAdjustments({glyphs, count}, {adjustments, count});
|
|
374
|
-
}
|
|
375
|
-
#endif
|
|
376
|
-
|
|
377
356
|
protected:
|
|
378
357
|
// needed until onGetTableTags() is updated to take a span
|
|
379
358
|
enum { MAX_REASONABLE_TABLE_COUNT = (1 << 16) - 1 };
|
|
@@ -423,6 +402,9 @@ protected:
|
|
|
423
402
|
|
|
424
403
|
virtual int onGetVariationDesignParameters(SkSpan<SkFontParameters::Variation::Axis>) const = 0;
|
|
425
404
|
|
|
405
|
+
virtual bool onIsSyntheticBold() const;
|
|
406
|
+
virtual bool onIsSyntheticOblique() const;
|
|
407
|
+
|
|
426
408
|
virtual void onGetFontDescriptor(SkFontDescriptor*, bool* isLocal) const = 0;
|
|
427
409
|
|
|
428
410
|
virtual void onCharsToGlyphs(SkSpan<const SkUnichar>, SkSpan<SkGlyphID>) const = 0;
|
|
@@ -145,14 +145,6 @@
|
|
|
145
145
|
#define SK_DISABLE_SDF_TEXT
|
|
146
146
|
#endif
|
|
147
147
|
|
|
148
|
-
#ifndef SK_DISABLE_LEGACY_SHADERCONTEXT
|
|
149
|
-
# define SK_ENABLE_LEGACY_SHADERCONTEXT
|
|
150
|
-
#endif
|
|
151
|
-
|
|
152
|
-
#ifndef SK_SUPPORT_MUTABLE_PATHEFFECT
|
|
153
|
-
# define SK_SUPPORT_MUTABLE_PATHEFFECT
|
|
154
|
-
#endif
|
|
155
|
-
|
|
156
148
|
#if defined(SK_BUILD_FOR_LIBFUZZER) || defined(SK_BUILD_FOR_AFL_FUZZ)
|
|
157
149
|
#if !defined(SK_BUILD_FOR_FUZZER)
|
|
158
150
|
#define SK_BUILD_FOR_FUZZER
|
|
@@ -7,8 +7,10 @@
|
|
|
7
7
|
#include "include/core/SkMilestone.h"
|
|
8
8
|
#include "include/core/SkRefCnt.h"
|
|
9
9
|
#include "include/core/SkScalar.h"
|
|
10
|
+
#include "include/core/SkSpan.h"
|
|
10
11
|
#include "include/core/SkString.h"
|
|
11
12
|
#include "include/private/base/SkAPI.h"
|
|
13
|
+
#include "include/private/base/SkMacros.h"
|
|
12
14
|
#include "include/private/base/SkNoncopyable.h"
|
|
13
15
|
|
|
14
16
|
#include <cstdint>
|
|
@@ -24,29 +26,31 @@ class SkPDFStructTree;
|
|
|
24
26
|
class SkPixmap;
|
|
25
27
|
class SkWStream;
|
|
26
28
|
|
|
27
|
-
#define SKPDF_STRING(X) SKPDF_STRING_IMPL(X)
|
|
28
|
-
#define SKPDF_STRING_IMPL(X) #X
|
|
29
|
-
|
|
30
29
|
namespace SkPDF {
|
|
31
30
|
|
|
32
|
-
/** Attributes for nodes in the PDF tree.
|
|
31
|
+
/** Attributes for nodes in the PDF tree.
|
|
32
|
+
*
|
|
33
|
+
* Each attribute must have an owner (e.g. "Layout", "List", "Table", etc)
|
|
34
|
+
* and an attribute name (e.g. "BBox", "RowSpan", etc.) from PDF32000_2008 14.8.5,
|
|
35
|
+
* and then a value of the proper type according to the spec.
|
|
36
|
+
*
|
|
37
|
+
* Parameters of type `const char*` will not be copied and the pointers must remain valid until
|
|
38
|
+
* `SkDocument::close` or `SkDocument::abort` is called.
|
|
39
|
+
* Names are expected to be constants and are taken as `const char*`.
|
|
40
|
+
* Parameters not taken as `const char*` will be copied.
|
|
41
|
+
*/
|
|
33
42
|
class SK_API AttributeList : SkNoncopyable {
|
|
34
43
|
public:
|
|
35
44
|
AttributeList();
|
|
36
45
|
~AttributeList();
|
|
37
46
|
|
|
38
|
-
// Each attribute must have an owner (e.g. "Layout", "List", "Table", etc)
|
|
39
|
-
// and an attribute name (e.g. "BBox", "RowSpan", etc.) from PDF32000_2008 14.8.5,
|
|
40
|
-
// and then a value of the proper type according to the spec.
|
|
41
47
|
void appendInt(const char* owner, const char* name, int value);
|
|
42
48
|
void appendFloat(const char* owner, const char* name, float value);
|
|
43
|
-
void appendName(const char* owner, const char*
|
|
44
|
-
void
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
void appendNodeIdArray(const char* owner,
|
|
48
|
-
const char* attrName,
|
|
49
|
-
const std::vector<int>& nodeIds);
|
|
49
|
+
void appendName(const char* owner, const char* name, const char* value);
|
|
50
|
+
void appendTextString(const char* owner, const char* name, const char* value);
|
|
51
|
+
void appendTextString(const char* owner, const char* name, SkString value);
|
|
52
|
+
void appendFloatArray(const char* owner, const char* name, SkSpan<const float> value);
|
|
53
|
+
void appendNodeIdArray(const char* owner, const char* name, SkSpan<const int> nodeIds);
|
|
50
54
|
|
|
51
55
|
private:
|
|
52
56
|
friend class ::SkPDFStructTree;
|
|
@@ -114,7 +118,7 @@ struct Metadata {
|
|
|
114
118
|
|
|
115
119
|
/** The product that is converting this document to PDF.
|
|
116
120
|
*/
|
|
117
|
-
SkString fProducer = SkString("Skia/PDF m"
|
|
121
|
+
SkString fProducer = SkString("Skia/PDF m" SK_MACRO_STRINGIFY(SK_MILESTONE));
|
|
118
122
|
|
|
119
123
|
/** The date and time the document was created.
|
|
120
124
|
The zero default value represents an unknown/unset time.
|
|
@@ -264,6 +268,4 @@ static inline sk_sp<SkDocument> MakeDocument(SkWStream* stream) {
|
|
|
264
268
|
|
|
265
269
|
} // namespace SkPDF
|
|
266
270
|
|
|
267
|
-
#undef SKPDF_STRING
|
|
268
|
-
#undef SKPDF_STRING_IMPL
|
|
269
271
|
#endif // SkPDFDocument_DEFINED
|
|
@@ -38,12 +38,6 @@ public:
|
|
|
38
38
|
Note: only affects stroked paths.
|
|
39
39
|
*/
|
|
40
40
|
static sk_sp<SkPathEffect> Make(SkSpan<const SkScalar> intervals, SkScalar phase);
|
|
41
|
-
|
|
42
|
-
#ifdef SK_SUPPORT_UNSPANNED_APIS
|
|
43
|
-
static sk_sp<SkPathEffect> Make(const SkScalar intervals[], int count, SkScalar phase) {
|
|
44
|
-
return intervals ? Make({intervals, count}, phase) : nullptr;
|
|
45
|
-
}
|
|
46
|
-
#endif
|
|
47
41
|
};
|
|
48
42
|
|
|
49
43
|
#endif
|