@shopify/react-native-skia 0.1.212 → 0.1.214
Sign up to get free protection for your applications and to get access to all the features.
- package/android/build.gradle +5 -0
- package/android/cpp/rnskia-android/SkiaOpenGLHelper.h +3 -2
- package/android/cpp/rnskia-android/SkiaOpenGLSurfaceFactory.cpp +9 -2
- package/cpp/api/JsiSkSurface.h +4 -1
- package/cpp/skia/include/android/GrAHardwareBufferUtils.h +99 -0
- package/cpp/skia/include/android/SkHeifDecoder.h +10 -3
- package/cpp/skia/include/codec/SkAvifDecoder.h +1 -0
- package/cpp/skia/include/codec/SkBmpDecoder.h +1 -0
- package/cpp/skia/include/codec/SkCodec.h +4 -3
- package/cpp/skia/include/codec/SkEncodedImageFormat.h +0 -3
- package/cpp/skia/include/codec/SkGifDecoder.h +1 -0
- package/cpp/skia/include/codec/SkIcoDecoder.h +1 -0
- package/cpp/skia/include/codec/SkJpegDecoder.h +1 -0
- package/cpp/skia/include/codec/SkJpegxlDecoder.h +1 -0
- package/cpp/skia/include/codec/SkPngDecoder.h +1 -0
- package/cpp/skia/include/codec/SkRawDecoder.h +1 -0
- package/cpp/skia/include/codec/SkWbmpDecoder.h +1 -0
- package/cpp/skia/include/codec/SkWebpDecoder.h +1 -0
- package/cpp/skia/include/config/SkUserConfig.h +0 -2
- package/cpp/skia/include/core/SkBitmap.h +8 -8
- package/cpp/skia/include/core/SkCanvas.h +37 -50
- package/cpp/skia/include/core/SkCapabilities.h +2 -7
- package/cpp/skia/include/core/SkColor.h +1 -1
- package/cpp/skia/include/core/SkColorFilter.h +6 -0
- package/cpp/skia/include/core/SkColorTable.h +3 -0
- package/cpp/skia/include/core/SkColorType.h +2 -0
- package/cpp/skia/include/core/SkContourMeasure.h +12 -8
- package/cpp/skia/include/core/SkDocument.h +1 -0
- package/cpp/skia/include/core/SkFont.h +11 -2
- package/cpp/skia/include/core/SkFontMgr.h +2 -3
- package/cpp/skia/include/core/SkGraphics.h +3 -13
- package/cpp/skia/include/core/SkImage.h +57 -111
- package/cpp/skia/include/core/SkImageFilter.h +6 -1
- package/cpp/skia/include/core/SkImageGenerator.h +8 -0
- package/cpp/skia/include/core/SkImageInfo.h +0 -2
- package/cpp/skia/include/core/SkM44.h +7 -3
- package/cpp/skia/include/core/SkMallocPixelRef.h +4 -1
- package/cpp/skia/include/core/SkMatrix.h +17 -17
- package/cpp/skia/include/core/SkMesh.h +71 -61
- package/cpp/skia/include/core/SkMilestone.h +1 -1
- package/cpp/skia/include/core/SkOverdrawCanvas.h +25 -0
- package/cpp/skia/include/core/SkPaint.h +1 -1
- package/cpp/skia/include/core/SkPath.h +12 -4
- package/cpp/skia/include/core/SkPathMeasure.h +3 -4
- package/cpp/skia/include/core/SkPicture.h +19 -6
- package/cpp/skia/include/core/SkPictureRecorder.h +6 -6
- package/cpp/skia/include/core/SkPixmap.h +2 -3
- package/cpp/skia/include/core/SkRRect.h +1 -1
- package/cpp/skia/include/core/SkRect.h +107 -110
- package/cpp/skia/include/core/SkRefCnt.h +1 -1
- package/cpp/skia/include/core/SkRegion.h +7 -1
- package/cpp/skia/include/core/SkSerialProcs.h +14 -0
- package/cpp/skia/include/core/SkShader.h +9 -0
- package/cpp/skia/include/core/SkStream.h +9 -9
- package/cpp/skia/include/core/SkString.h +1 -1
- package/cpp/skia/include/core/SkSurface.h +14 -25
- package/cpp/skia/include/core/SkTextBlob.h +17 -4
- package/cpp/skia/include/core/SkTiledImageUtils.h +28 -0
- package/cpp/skia/include/core/SkTypeface.h +7 -2
- package/cpp/skia/include/core/SkTypes.h +4 -12
- package/cpp/skia/include/docs/SkPDFDocument.h +17 -3
- package/cpp/skia/include/effects/SkImageFilters.h +73 -24
- package/cpp/skia/include/effects/SkRuntimeEffect.h +20 -51
- package/cpp/skia/include/gpu/GpuTypes.h +13 -0
- package/cpp/skia/include/gpu/GrBackendSurface.h +95 -262
- package/cpp/skia/include/gpu/GrContextOptions.h +7 -1
- package/cpp/skia/include/gpu/GrDirectContext.h +138 -128
- package/cpp/skia/include/gpu/GrRecordingContext.h +9 -4
- package/cpp/skia/include/gpu/GrSurfaceInfo.h +0 -24
- package/cpp/skia/include/gpu/GrTypes.h +16 -1
- package/cpp/skia/include/gpu/GrYUVABackendTextures.h +4 -4
- package/cpp/skia/include/gpu/d3d/GrD3DTypes.h +2 -2
- package/cpp/skia/include/gpu/ganesh/SkImageGanesh.h +44 -12
- package/cpp/skia/include/gpu/ganesh/SkMeshGanesh.h +57 -0
- package/cpp/skia/include/gpu/ganesh/SkSurfaceGanesh.h +2 -1
- package/cpp/skia/include/gpu/ganesh/gl/GrGLBackendSurface.h +58 -0
- package/cpp/skia/include/gpu/ganesh/gl/GrGLDirectContext.h +29 -0
- package/cpp/skia/include/gpu/ganesh/mtl/SkSurfaceMetal.h +1 -1
- package/cpp/skia/include/gpu/ganesh/vk/GrVkBackendSurface.h +67 -0
- package/cpp/skia/include/gpu/gl/GrGLInterface.h +2 -2
- package/cpp/skia/include/gpu/graphite/BackendTexture.h +14 -3
- package/cpp/skia/include/gpu/graphite/Context.h +93 -13
- package/cpp/skia/include/gpu/graphite/ContextOptions.h +19 -8
- package/cpp/skia/include/gpu/graphite/GraphiteTypes.h +23 -0
- package/cpp/skia/include/gpu/graphite/Image.h +56 -0
- package/cpp/skia/include/gpu/graphite/ImageProvider.h +5 -0
- package/cpp/skia/include/gpu/graphite/Recorder.h +26 -9
- package/cpp/skia/include/gpu/graphite/Recording.h +7 -5
- package/cpp/skia/include/gpu/graphite/TextureInfo.h +8 -0
- package/cpp/skia/include/gpu/graphite/mtl/MtlGraphiteTypes.h +2 -2
- package/cpp/skia/include/gpu/mtl/GrMtlTypes.h +2 -2
- package/cpp/skia/include/gpu/vk/GrVkTypes.h +4 -3
- package/cpp/skia/include/ports/SkCFObject.h +1 -1
- package/cpp/skia/include/private/SkGainmapInfo.h +4 -13
- package/cpp/skia/include/private/SkJpegGainmapEncoder.h +1 -24
- package/cpp/skia/include/private/SkWeakRefCnt.h +1 -1
- package/cpp/skia/include/private/base/SkAnySubclass.h +73 -0
- package/cpp/skia/include/private/base/SkAssert.h +106 -12
- package/cpp/skia/include/private/base/SkAttributes.h +0 -12
- package/cpp/skia/include/private/base/SkFeatures.h +0 -3
- package/cpp/skia/include/private/base/SkFloatingPoint.h +58 -105
- package/cpp/skia/include/private/base/SkSpan_impl.h +18 -12
- package/cpp/skia/include/private/base/SkTArray.h +22 -17
- package/cpp/skia/include/private/base/SkTDArray.h +5 -6
- package/cpp/skia/include/private/base/SkTemplates.h +50 -30
- package/cpp/skia/include/private/chromium/GrDeferredDisplayListRecorder.h +5 -2
- package/cpp/skia/include/private/chromium/GrSurfaceCharacterization.h +2 -2
- package/cpp/skia/include/private/chromium/SkChromeRemoteGlyphCache.h +13 -8
- package/cpp/skia/include/private/chromium/SkDiscardableMemory.h +1 -1
- package/cpp/skia/include/private/chromium/SkImageChromium.h +16 -3
- package/cpp/skia/include/private/chromium/Slug.h +11 -4
- package/cpp/skia/include/private/gpu/ganesh/GrD3DTypesMinimal.h +1 -1
- package/cpp/skia/include/private/gpu/ganesh/GrGLTypesPriv.h +6 -9
- package/cpp/skia/include/private/gpu/ganesh/GrTypesPriv.h +29 -13
- package/cpp/skia/include/private/gpu/ganesh/GrVkTypesPriv.h +2 -28
- package/cpp/skia/include/private/gpu/graphite/ContextOptionsPriv.h +34 -0
- package/cpp/skia/include/private/gpu/graphite/DawnTypesPriv.h +6 -0
- package/cpp/skia/include/private/gpu/graphite/MtlGraphiteTypesPriv.h +8 -0
- package/cpp/skia/include/private/gpu/graphite/VulkanGraphiteTypesPriv.h +10 -0
- package/cpp/skia/include/utils/SkBase64.h +2 -2
- package/cpp/skia/include/utils/SkNWayCanvas.h +1 -11
- package/cpp/skia/include/utils/SkNoDrawCanvas.h +0 -2
- package/cpp/skia/include/utils/SkPaintFilterCanvas.h +1 -2
- package/cpp/skia/include/utils/SkShadowUtils.h +15 -1
- package/cpp/skia/include/utils/SkTextUtils.h +1 -1
- package/cpp/skia/modules/skparagraph/include/Paragraph.h +107 -1
- package/cpp/skia/modules/skparagraph/include/ParagraphBuilder.h +3 -2
- package/cpp/skia/modules/skparagraph/include/ParagraphStyle.h +4 -0
- package/cpp/skia/modules/skparagraph/include/TypefaceFontProvider.h +5 -3
- package/cpp/skia/modules/svg/include/SkSVGAttributeParser.h +4 -0
- package/cpp/skia/src/core/SkChecksum.h +2 -1
- package/cpp/skia/src/core/SkPathPriv.h +1 -1
- package/cpp/skia/src/core/SkTHash.h +19 -9
- package/ios/RNSkia-iOS/RNSkMetalCanvasProvider.mm +3 -1
- package/ios/RNSkia-iOS/SkiaMetalSurfaceFactory.mm +1 -1
- package/lib/commonjs/dom/nodes/datatypes/Rect.js +5 -1
- package/lib/commonjs/dom/nodes/datatypes/Rect.js.map +1 -1
- package/lib/commonjs/external/reanimated/index.d.ts +1 -0
- package/lib/commonjs/external/reanimated/index.js +13 -0
- package/lib/commonjs/external/reanimated/index.js.map +1 -1
- package/lib/commonjs/external/reanimated/moduleWrapper.js +3 -8
- package/lib/commonjs/external/reanimated/moduleWrapper.js.map +1 -1
- package/lib/commonjs/external/reanimated/renderHelpers.js +46 -1
- package/lib/commonjs/external/reanimated/renderHelpers.js.map +1 -1
- package/lib/commonjs/external/reanimated/useDerivedValueOnJS.d.ts +2 -0
- package/lib/commonjs/external/reanimated/useDerivedValueOnJS.js +26 -0
- package/lib/commonjs/external/reanimated/useDerivedValueOnJS.js.map +1 -0
- package/lib/commonjs/external/reanimated/useSharedValueEffect.js +2 -5
- package/lib/commonjs/external/reanimated/useSharedValueEffect.js.map +1 -1
- package/lib/commonjs/index.d.ts +1 -0
- package/lib/commonjs/index.js +21 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/skia/types/MaskFilter.js +4 -0
- package/lib/commonjs/skia/types/MaskFilter.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPicture.js +2 -1
- package/lib/commonjs/skia/web/JsiSkPicture.js.map +1 -1
- package/lib/commonjs/views/SkiaBaseWebView.js +1 -1
- package/lib/commonjs/views/SkiaBaseWebView.js.map +1 -1
- package/lib/commonjs/views/types.js +3 -0
- package/lib/commonjs/views/types.js.map +1 -1
- package/lib/module/dom/nodes/datatypes/Rect.js +5 -1
- package/lib/module/dom/nodes/datatypes/Rect.js.map +1 -1
- package/lib/module/external/reanimated/index.d.ts +1 -0
- package/lib/module/external/reanimated/index.js +1 -0
- package/lib/module/external/reanimated/index.js.map +1 -1
- package/lib/module/external/reanimated/moduleWrapper.js +1 -9
- package/lib/module/external/reanimated/moduleWrapper.js.map +1 -1
- package/lib/module/external/reanimated/renderHelpers.js +48 -2
- package/lib/module/external/reanimated/renderHelpers.js.map +1 -1
- package/lib/module/external/reanimated/useDerivedValueOnJS.d.ts +2 -0
- package/lib/module/external/reanimated/useDerivedValueOnJS.js +15 -0
- package/lib/module/external/reanimated/useDerivedValueOnJS.js.map +1 -0
- package/lib/module/external/reanimated/useSharedValueEffect.js +3 -6
- package/lib/module/external/reanimated/useSharedValueEffect.js.map +1 -1
- package/lib/module/index.d.ts +1 -0
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/skia/types/MaskFilter.js +3 -0
- package/lib/module/skia/types/MaskFilter.js.map +1 -1
- package/lib/module/views/types.js +3 -0
- package/lib/module/views/types.js.map +1 -1
- package/lib/typescript/src/external/reanimated/index.d.ts +1 -0
- package/lib/typescript/src/external/reanimated/useDerivedValueOnJS.d.ts +2 -0
- package/lib/typescript/src/index.d.ts +1 -0
- 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.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.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.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.a +0 -0
- package/libs/android/x86_64/libsvg.a +0 -0
- package/libs/ios/libskia.xcframework/Info.plist +5 -5
- 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/Info.plist +5 -5
- 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/Info.plist +5 -5
- 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/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.xcframework/Info.plist +5 -5
- package/libs/ios/libskunicode.xcframework/ios-arm64_arm64e/libskunicode.a +0 -0
- package/libs/ios/libskunicode.xcframework/ios-arm64_arm64e_x86_64-simulator/libskunicode.a +0 -0
- package/libs/ios/libsvg.xcframework/Info.plist +5 -5
- 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 +1 -1
- package/src/dom/nodes/datatypes/Rect.ts +6 -2
- package/src/external/reanimated/index.ts +1 -0
- package/src/external/reanimated/moduleWrapper.ts +6 -10
- package/src/external/reanimated/renderHelpers.ts +41 -1
- package/src/external/reanimated/useDerivedValueOnJS.ts +24 -0
- package/src/external/reanimated/useSharedValueEffect.ts +4 -7
- package/src/index.ts +1 -0
- package/cpp/skia/include/core/SkDeferredDisplayList.h +0 -15
- package/cpp/skia/include/core/SkDeferredDisplayListRecorder.h +0 -15
- package/cpp/skia/include/core/SkPromiseImageTexture.h +0 -20
- package/cpp/skia/include/core/SkSurfaceCharacterization.h +0 -15
- package/cpp/skia/include/core/SkTime.h +0 -63
- package/cpp/skia/include/effects/SkOpPathEffect.h +0 -43
- package/cpp/skia/include/effects/SkStrokeAndFillPathEffect.h +0 -28
- package/cpp/skia/include/gpu/GrBackendSurfaceMutableState.h +0 -32
- package/cpp/skia/include/gpu/dawn/GrDawnTypes.h +0 -95
- package/cpp/skia/include/private/SkBitmaskEnum.h +0 -59
- package/cpp/skia/include/private/SkSLDefines.h +0 -64
- package/cpp/skia/include/private/SkShadowFlags.h +0 -27
- package/cpp/skia/include/private/gpu/ganesh/GrDawnTypesPriv.h +0 -26
- /package/cpp/skia/{include/private/base → src/core}/SkPathEnums.h +0 -0
@@ -9,17 +9,21 @@
|
|
9
9
|
#define SkImageChromium_DEFINED
|
10
10
|
|
11
11
|
#include "include/core/SkRefCnt.h"
|
12
|
-
#include "include/gpu/GrTypes.h"
|
13
12
|
#include "include/private/base/SkAPI.h"
|
14
13
|
|
15
14
|
class GrBackendFormat;
|
16
15
|
class GrContextThreadSafeProxy;
|
17
16
|
class GrPromiseImageTexture;
|
17
|
+
class GrDirectContext;
|
18
18
|
class GrYUVABackendTextureInfo;
|
19
19
|
class SkColorSpace;
|
20
20
|
class SkImage;
|
21
21
|
enum SkAlphaType : int;
|
22
22
|
enum SkColorType : int;
|
23
|
+
enum GrSurfaceOrigin : int;
|
24
|
+
namespace skgpu {
|
25
|
+
enum class Mipmapped : bool;
|
26
|
+
}
|
23
27
|
struct SkISize;
|
24
28
|
|
25
29
|
/**
|
@@ -37,7 +41,7 @@ using PromiseImageTextureReleaseProc = void (*)(PromiseImageTextureContext);
|
|
37
41
|
image pixel data. Moreover, the SkImage may be created on a thread as the creation of the
|
38
42
|
image does not require access to the backend API or GrDirectContext. Instead of passing a
|
39
43
|
GrBackendTexture the client supplies a description of the texture consisting of
|
40
|
-
GrBackendFormat, width, height, and
|
44
|
+
GrBackendFormat, width, height, and skgpu::Mipmapped state. The resulting SkImage can be drawn
|
41
45
|
to a GrDeferredDisplayListRecorder or directly to a GPU-backed SkSurface.
|
42
46
|
When the actual texture is required to perform a backend API draw, textureFulfillProc will
|
43
47
|
be called to receive a GrBackendTexture. The properties of the GrBackendTexture must match
|
@@ -63,7 +67,7 @@ using PromiseImageTextureReleaseProc = void (*)(PromiseImageTextureContext);
|
|
63
67
|
SK_API sk_sp<SkImage> PromiseTextureFrom(sk_sp<GrContextThreadSafeProxy> gpuContextProxy,
|
64
68
|
const GrBackendFormat& backendFormat,
|
65
69
|
SkISize dimensions,
|
66
|
-
|
70
|
+
skgpu::Mipmapped mipmapped,
|
67
71
|
GrSurfaceOrigin origin,
|
68
72
|
SkColorType colorType,
|
69
73
|
SkAlphaType alphaType,
|
@@ -99,6 +103,15 @@ SK_API sk_sp<SkImage> PromiseTextureFromYUVA(sk_sp<GrContextThreadSafeProxy> gpu
|
|
99
103
|
PromiseImageTextureReleaseProc textureReleaseProc,
|
100
104
|
PromiseImageTextureContext textureContexts[]);
|
101
105
|
|
106
|
+
/** Returns the GPU context associated with this image or nullptr if the image is not Ganesh-backed.
|
107
|
+
We expose this only to help transition certain API calls and do not intend for this to stick
|
108
|
+
around forever.
|
109
|
+
*/
|
110
|
+
SK_API GrDirectContext* GetContext(const SkImage* src);
|
111
|
+
inline GrDirectContext* GetContext(sk_sp<const SkImage> src) {
|
112
|
+
return GetContext(src.get());
|
113
|
+
}
|
114
|
+
|
102
115
|
} // namespace SkImages
|
103
116
|
|
104
117
|
#endif
|
@@ -10,6 +10,7 @@
|
|
10
10
|
|
11
11
|
#include "include/core/SkRect.h"
|
12
12
|
#include "include/core/SkRefCnt.h"
|
13
|
+
#include "include/core/SkSerialProcs.h" // IWYU pragma: keep
|
13
14
|
#include "include/private/base/SkAPI.h"
|
14
15
|
|
15
16
|
#include <cstddef>
|
@@ -37,15 +38,19 @@ public:
|
|
37
38
|
SkCanvas* canvas, const SkTextBlob& blob, SkPoint origin, const SkPaint& paint);
|
38
39
|
|
39
40
|
// Serialize the slug.
|
40
|
-
sk_sp<SkData> serialize() const;
|
41
|
-
size_t serialize(void* buffer, size_t size) const;
|
41
|
+
sk_sp<SkData> serialize(const SkSerialProcs& procs = {}) const;
|
42
|
+
size_t serialize(void* buffer, size_t size, const SkSerialProcs& procs = {}) const;
|
42
43
|
|
43
44
|
// Set the client parameter to the appropriate SkStrikeClient when typeface ID translation
|
44
45
|
// is needed.
|
45
|
-
static sk_sp<Slug> Deserialize(
|
46
|
-
|
46
|
+
static sk_sp<Slug> Deserialize(const void* data,
|
47
|
+
size_t size,
|
48
|
+
const SkStrikeClient* client = nullptr,
|
49
|
+
const SkDeserialProcs& procs = {});
|
47
50
|
static sk_sp<Slug> MakeFromBuffer(SkReadBuffer& buffer);
|
48
51
|
|
52
|
+
// Allows clients to deserialize SkPictures that contain slug data
|
53
|
+
static void AddDeserialProcs(SkDeserialProcs* procs, const SkStrikeClient* client = nullptr);
|
49
54
|
|
50
55
|
// Draw the Slug obeying the canvas's mapping and clipping.
|
51
56
|
void draw(SkCanvas* canvas) const;
|
@@ -66,6 +71,8 @@ private:
|
|
66
71
|
static uint32_t NextUniqueID();
|
67
72
|
const uint32_t fUniqueID{NextUniqueID()};
|
68
73
|
};
|
74
|
+
|
75
|
+
|
69
76
|
} // namespace sktext::gpu
|
70
77
|
|
71
78
|
#endif // sktext_gpu_Slug_DEFINED
|
@@ -11,6 +11,8 @@
|
|
11
11
|
#ifndef GrGLTypesPriv_DEFINED
|
12
12
|
#define GrGLTypesPriv_DEFINED
|
13
13
|
|
14
|
+
// TODO(b/293490566) Move this to src/ after GrSurfaceInfo.h has been decoupled from GL
|
15
|
+
|
14
16
|
static constexpr int kGrGLColorFormatCount = static_cast<int>(GrGLFormat::kLastColorFormat) + 1;
|
15
17
|
|
16
18
|
class GrGLTextureParameters : public SkNVRefCnt<GrGLTextureParameters> {
|
@@ -76,22 +78,17 @@ private:
|
|
76
78
|
|
77
79
|
class GrGLBackendTextureInfo {
|
78
80
|
public:
|
79
|
-
GrGLBackendTextureInfo(const GrGLTextureInfo& info, GrGLTextureParameters
|
81
|
+
GrGLBackendTextureInfo(const GrGLTextureInfo& info, sk_sp<GrGLTextureParameters> params)
|
80
82
|
: fInfo(info), fParams(params) {}
|
81
|
-
GrGLBackendTextureInfo(const GrGLBackendTextureInfo&) = delete;
|
82
|
-
GrGLBackendTextureInfo& operator=(const GrGLBackendTextureInfo&) = delete;
|
83
83
|
const GrGLTextureInfo& info() const { return fInfo; }
|
84
|
-
GrGLTextureParameters* parameters() const { return fParams; }
|
85
|
-
sk_sp<GrGLTextureParameters> refParameters() const { return
|
86
|
-
|
87
|
-
void cleanup();
|
88
|
-
void assign(const GrGLBackendTextureInfo&, bool thisIsValid);
|
84
|
+
GrGLTextureParameters* parameters() const { return fParams.get(); }
|
85
|
+
sk_sp<GrGLTextureParameters> refParameters() const { return fParams; }
|
89
86
|
|
90
87
|
bool isProtected() const { return fInfo.isProtected(); }
|
91
88
|
|
92
89
|
private:
|
93
90
|
GrGLTextureInfo fInfo;
|
94
|
-
GrGLTextureParameters
|
91
|
+
sk_sp<GrGLTextureParameters> fParams; // not const because we might call invalidate() on it.
|
95
92
|
};
|
96
93
|
|
97
94
|
struct GrGLTextureSpec {
|
@@ -9,20 +9,28 @@
|
|
9
9
|
#define GrTypesPriv_DEFINED
|
10
10
|
|
11
11
|
#include "include/core/SkColor.h"
|
12
|
-
#include "include/core/
|
12
|
+
#include "include/core/SkColorType.h"
|
13
|
+
#include "include/core/SkData.h"
|
13
14
|
#include "include/core/SkPath.h"
|
15
|
+
#include "include/core/SkPathTypes.h"
|
14
16
|
#include "include/core/SkRefCnt.h"
|
15
17
|
#include "include/core/SkTextureCompressionType.h"
|
16
18
|
#include "include/gpu/GrTypes.h"
|
19
|
+
#include "include/private/base/SkAssert.h"
|
17
20
|
#include "include/private/base/SkMacros.h"
|
18
21
|
#include "include/private/base/SkTypeTraits.h"
|
19
22
|
|
23
|
+
#include <cstddef>
|
24
|
+
#include <cstdint>
|
20
25
|
#include <functional>
|
26
|
+
#include <type_traits>
|
21
27
|
|
22
|
-
class GrBackendFormat;
|
23
|
-
class GrCaps;
|
24
28
|
class GrSurfaceProxy;
|
25
29
|
|
30
|
+
namespace skgpu {
|
31
|
+
enum class Mipmapped : bool;
|
32
|
+
}
|
33
|
+
|
26
34
|
/**
|
27
35
|
* divide, rounding up
|
28
36
|
*/
|
@@ -269,9 +277,9 @@ enum GrShaderType {
|
|
269
277
|
kVertex_GrShaderType,
|
270
278
|
kFragment_GrShaderType,
|
271
279
|
|
272
|
-
|
280
|
+
kLast_GrShaderType = kFragment_GrShaderType
|
273
281
|
};
|
274
|
-
static const int kGrShaderTypeCount =
|
282
|
+
static const int kGrShaderTypeCount = kLast_GrShaderType + 1;
|
275
283
|
|
276
284
|
enum GrShaderFlags {
|
277
285
|
kNone_GrShaderFlags = 0,
|
@@ -546,6 +554,7 @@ enum class GrColorType {
|
|
546
554
|
kBGRA_8888,
|
547
555
|
kRGBA_1010102,
|
548
556
|
kBGRA_1010102,
|
557
|
+
kRGBA_10x6,
|
549
558
|
kGray_8,
|
550
559
|
kGrayAlpha_88,
|
551
560
|
kAlpha_F16,
|
@@ -594,6 +603,7 @@ static constexpr SkColorType GrColorTypeToSkColorType(GrColorType ct) {
|
|
594
603
|
case GrColorType::kBGRA_8888: return kBGRA_8888_SkColorType;
|
595
604
|
case GrColorType::kRGBA_1010102: return kRGBA_1010102_SkColorType;
|
596
605
|
case GrColorType::kBGRA_1010102: return kBGRA_1010102_SkColorType;
|
606
|
+
case GrColorType::kRGBA_10x6: return kRGBA_10x6_SkColorType;
|
597
607
|
case GrColorType::kGray_8: return kGray_8_SkColorType;
|
598
608
|
case GrColorType::kGrayAlpha_88: return kUnknown_SkColorType;
|
599
609
|
case GrColorType::kAlpha_F16: return kA16_float_SkColorType;
|
@@ -637,6 +647,7 @@ static constexpr GrColorType SkColorTypeToGrColorType(SkColorType ct) {
|
|
637
647
|
case kBGRA_1010102_SkColorType: return GrColorType::kBGRA_1010102;
|
638
648
|
case kBGR_101010x_SkColorType: return GrColorType::kUnknown;
|
639
649
|
case kBGR_101010x_XR_SkColorType: return GrColorType::kUnknown;
|
650
|
+
case kRGBA_10x6_SkColorType: return GrColorType::kRGBA_10x6;
|
640
651
|
case kRGBA_F32_SkColorType: return GrColorType::kRGBA_F32;
|
641
652
|
case kR8G8_unorm_SkColorType: return GrColorType::kRG_88;
|
642
653
|
case kA16_unorm_SkColorType: return GrColorType::kAlpha_16;
|
@@ -662,6 +673,7 @@ static constexpr uint32_t GrColorTypeChannelFlags(GrColorType ct) {
|
|
662
673
|
case GrColorType::kBGRA_8888: return kRGBA_SkColorChannelFlags;
|
663
674
|
case GrColorType::kRGBA_1010102: return kRGBA_SkColorChannelFlags;
|
664
675
|
case GrColorType::kBGRA_1010102: return kRGBA_SkColorChannelFlags;
|
676
|
+
case GrColorType::kRGBA_10x6: return kRGBA_SkColorChannelFlags;
|
665
677
|
case GrColorType::kGray_8: return kGray_SkColorChannelFlag;
|
666
678
|
case GrColorType::kGrayAlpha_88: return kGrayAlpha_SkColorChannelFlags;
|
667
679
|
case GrColorType::kAlpha_F16: return kAlpha_SkColorChannelFlag;
|
@@ -804,6 +816,8 @@ static constexpr GrColorFormatDesc GrGetColorTypeDesc(GrColorType ct) {
|
|
804
816
|
return GrColorFormatDesc::MakeRGBA(10, 2, GrColorTypeEncoding::kUnorm);
|
805
817
|
case GrColorType::kBGRA_1010102:
|
806
818
|
return GrColorFormatDesc::MakeRGBA(10, 2, GrColorTypeEncoding::kUnorm);
|
819
|
+
case GrColorType::kRGBA_10x6:
|
820
|
+
return GrColorFormatDesc::MakeRGBA(10, GrColorTypeEncoding::kUnorm);
|
807
821
|
case GrColorType::kGray_8:
|
808
822
|
return GrColorFormatDesc::MakeGray(8, GrColorTypeEncoding::kUnorm);
|
809
823
|
case GrColorType::kGrayAlpha_88:
|
@@ -891,6 +905,7 @@ static constexpr size_t GrColorTypeBytesPerPixel(GrColorType ct) {
|
|
891
905
|
case GrColorType::kBGRA_8888: return 4;
|
892
906
|
case GrColorType::kRGBA_1010102: return 4;
|
893
907
|
case GrColorType::kBGRA_1010102: return 4;
|
908
|
+
case GrColorType::kRGBA_10x6: return 8;
|
894
909
|
case GrColorType::kGray_8: return 1;
|
895
910
|
case GrColorType::kGrayAlpha_88: return 2;
|
896
911
|
case GrColorType::kAlpha_F16: return 2;
|
@@ -936,17 +951,17 @@ enum class GrDstSampleFlags {
|
|
936
951
|
};
|
937
952
|
GR_MAKE_BITFIELD_CLASS_OPS(GrDstSampleFlags)
|
938
953
|
|
939
|
-
using GrVisitProxyFunc = std::function<void(GrSurfaceProxy*,
|
954
|
+
using GrVisitProxyFunc = std::function<void(GrSurfaceProxy*, skgpu::Mipmapped)>;
|
940
955
|
|
941
|
-
#if defined(SK_DEBUG) || GR_TEST_UTILS || defined(SK_ENABLE_DUMP_GPU)
|
956
|
+
#if defined(SK_DEBUG) || defined(GR_TEST_UTILS) || defined(SK_ENABLE_DUMP_GPU)
|
942
957
|
static constexpr const char* GrBackendApiToStr(GrBackendApi api) {
|
943
958
|
switch (api) {
|
944
|
-
case GrBackendApi::kOpenGL:
|
945
|
-
case GrBackendApi::kVulkan:
|
946
|
-
case GrBackendApi::kMetal:
|
947
|
-
case GrBackendApi::kDirect3D:
|
948
|
-
case GrBackendApi::
|
949
|
-
case GrBackendApi::
|
959
|
+
case GrBackendApi::kOpenGL: return "OpenGL";
|
960
|
+
case GrBackendApi::kVulkan: return "Vulkan";
|
961
|
+
case GrBackendApi::kMetal: return "Metal";
|
962
|
+
case GrBackendApi::kDirect3D: return "Direct3D";
|
963
|
+
case GrBackendApi::kMock: return "Mock";
|
964
|
+
case GrBackendApi::kUnsupported: return "Unsupported";
|
950
965
|
}
|
951
966
|
SkUNREACHABLE;
|
952
967
|
}
|
@@ -964,6 +979,7 @@ static constexpr const char* GrColorTypeToStr(GrColorType ct) {
|
|
964
979
|
case GrColorType::kBGRA_8888: return "kBGRA_8888";
|
965
980
|
case GrColorType::kRGBA_1010102: return "kRGBA_1010102";
|
966
981
|
case GrColorType::kBGRA_1010102: return "kBGRA_1010102";
|
982
|
+
case GrColorType::kRGBA_10x6: return "kBGRA_10x6";
|
967
983
|
case GrColorType::kGray_8: return "kGray_8";
|
968
984
|
case GrColorType::kGrayAlpha_88: return "kGrayAlpha_88";
|
969
985
|
case GrColorType::kAlpha_F16: return "kAlpha_F16";
|
@@ -15,34 +15,8 @@ namespace skgpu {
|
|
15
15
|
class MutableTextureStateRef;
|
16
16
|
}
|
17
17
|
|
18
|
-
|
19
|
-
|
20
|
-
// GrBackendTexture and GrBackendRenderTarget. When a client calls getVkImageInfo on a
|
21
|
-
// GrBackendTexture/RenderTarget, we use the GrVkBackendSurfaceInfo to create a snapshot
|
22
|
-
// GrVkImgeInfo object. Internally, this uses a ref count GrVkImageLayout object to track the
|
23
|
-
// current VkImageLayout which can be shared with an internal GrVkImage so that layout updates can
|
24
|
-
// be seen by all users of the image.
|
25
|
-
struct GrVkBackendSurfaceInfo {
|
26
|
-
GrVkBackendSurfaceInfo(GrVkImageInfo info) : fImageInfo(info) {}
|
27
|
-
|
28
|
-
void cleanup();
|
29
|
-
|
30
|
-
GrVkBackendSurfaceInfo& operator=(const GrVkBackendSurfaceInfo&) = delete;
|
31
|
-
|
32
|
-
// Assigns the passed in GrVkBackendSurfaceInfo to this object. if isValid is true we will also
|
33
|
-
// attempt to unref the old fLayout on this object.
|
34
|
-
void assign(const GrVkBackendSurfaceInfo&, bool isValid);
|
35
|
-
|
36
|
-
GrVkImageInfo snapImageInfo(const skgpu::MutableTextureStateRef*) const;
|
37
|
-
|
38
|
-
bool isProtected() const { return fImageInfo.fProtected == skgpu::Protected::kYes; }
|
39
|
-
#if GR_TEST_UTILS
|
40
|
-
bool operator==(const GrVkBackendSurfaceInfo& that) const;
|
41
|
-
#endif
|
42
|
-
|
43
|
-
private:
|
44
|
-
GrVkImageInfo fImageInfo;
|
45
|
-
};
|
18
|
+
GrVkImageInfo GrVkImageInfoWithMutableState(const GrVkImageInfo&,
|
19
|
+
const skgpu::MutableTextureStateRef*);
|
46
20
|
|
47
21
|
struct GrVkImageSpec {
|
48
22
|
GrVkImageSpec()
|
@@ -0,0 +1,34 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright 2023 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 skgpu_graphite_ContextOptionsPriv_DEFINED
|
9
|
+
#define skgpu_graphite_ContextOptionsPriv_DEFINED
|
10
|
+
|
11
|
+
namespace skgpu::graphite {
|
12
|
+
|
13
|
+
/**
|
14
|
+
* Private options that are only meant for testing within Skia's tools.
|
15
|
+
*/
|
16
|
+
struct ContextOptionsPriv {
|
17
|
+
|
18
|
+
int fMaxTextureSizeOverride = SK_MaxS32;
|
19
|
+
|
20
|
+
/**
|
21
|
+
* Maximum width and height of internal texture atlases.
|
22
|
+
*/
|
23
|
+
int fMaxTextureAtlasSize = 2048;
|
24
|
+
|
25
|
+
/**
|
26
|
+
* If true, will store a pointer in Recorder that points back to the Context
|
27
|
+
* that created it. Used by readPixels() and other methods that normally require a Context.
|
28
|
+
*/
|
29
|
+
bool fStoreContextRefInRecorder = false;
|
30
|
+
};
|
31
|
+
|
32
|
+
} // namespace skgpu::graphite
|
33
|
+
|
34
|
+
#endif // skgpu_graphite_ContextOptionsPriv_DEFINED
|
@@ -26,6 +26,12 @@ struct DawnTextureSpec {
|
|
26
26
|
fFormat == that.fFormat;
|
27
27
|
}
|
28
28
|
|
29
|
+
bool isCompatible(const DawnTextureSpec& that) const {
|
30
|
+
// The usages may match or the usage passed in may be a superset of the usage stored within.
|
31
|
+
return fFormat == that.fFormat &&
|
32
|
+
(fUsage & that.fUsage) == fUsage;
|
33
|
+
}
|
34
|
+
|
29
35
|
SkString toString() const {
|
30
36
|
return SkStringPrintf("format=0x%08X,usage=0x%08X",
|
31
37
|
static_cast<unsigned int>(fFormat),
|
@@ -64,6 +64,14 @@ struct MtlTextureSpec {
|
|
64
64
|
fFramebufferOnly == that.fFramebufferOnly;
|
65
65
|
}
|
66
66
|
|
67
|
+
bool isCompatible(const MtlTextureSpec& that) const {
|
68
|
+
// The usages may match or the usage passed in may be a superset of the usage stored within.
|
69
|
+
return fFormat == that.fFormat &&
|
70
|
+
fStorageMode == that.fStorageMode &&
|
71
|
+
fFramebufferOnly == that.fFramebufferOnly &&
|
72
|
+
(fUsage & that.fUsage) == fUsage;
|
73
|
+
}
|
74
|
+
|
67
75
|
SkString toString() const {
|
68
76
|
return SkStringPrintf("format=%u,usage=0x%04X,storageMode=%d,framebufferOnly=%d",
|
69
77
|
fFormat,
|
@@ -38,6 +38,16 @@ struct VulkanTextureSpec {
|
|
38
38
|
fAspectMask == that.fAspectMask;
|
39
39
|
}
|
40
40
|
|
41
|
+
bool isCompatible(const VulkanTextureSpec& that) const {
|
42
|
+
// The usages may match or the usage passed in may be a superset of the usage stored within.
|
43
|
+
return fFlags == that.fFlags &&
|
44
|
+
fFormat == that.fFormat &&
|
45
|
+
fImageTiling == that.fImageTiling &&
|
46
|
+
fSharingMode == that.fSharingMode &&
|
47
|
+
fAspectMask == that.fAspectMask &&
|
48
|
+
(fImageUsageFlags & that.fImageUsageFlags) == fImageUsageFlags;
|
49
|
+
}
|
50
|
+
|
41
51
|
SkString toString() const {
|
42
52
|
return SkStringPrintf(
|
43
53
|
"flags=0x%08X,format=%d,imageTiling=%d,imageUsageFlags=0x%08X,sharingMode=%d,"
|
@@ -46,8 +46,8 @@ public:
|
|
46
46
|
|
47
47
|
@param dstLength assigned the length dst is required to be. Must not be nullptr.
|
48
48
|
*/
|
49
|
-
static Error
|
50
|
-
|
49
|
+
[[nodiscard]] static Error Decode(const void* src, size_t srcLength,
|
50
|
+
void* dst, size_t* dstLength);
|
51
51
|
};
|
52
52
|
|
53
53
|
#endif // SkBase64_DEFINED
|
@@ -45,11 +45,7 @@ struct SkPoint;
|
|
45
45
|
struct SkRSXform;
|
46
46
|
struct SkRect;
|
47
47
|
|
48
|
-
|
49
|
-
namespace sktext::gpu {
|
50
|
-
class Slug;
|
51
|
-
}
|
52
|
-
#endif
|
48
|
+
namespace sktext::gpu { class Slug; }
|
53
49
|
|
54
50
|
class SK_API SkNWayCanvas : public SkCanvasVirtualEnforcer<SkNoDrawCanvas> {
|
55
51
|
public:
|
@@ -77,9 +73,7 @@ protected:
|
|
77
73
|
void onDrawGlyphRunList(const sktext::GlyphRunList&, const SkPaint&) override;
|
78
74
|
void onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
|
79
75
|
const SkPaint& paint) override;
|
80
|
-
#if defined(SK_GANESH)
|
81
76
|
void onDrawSlug(const sktext::gpu::Slug* slug) override;
|
82
|
-
#endif
|
83
77
|
void onDrawPatch(const SkPoint cubics[12], const SkColor colors[4],
|
84
78
|
const SkPoint texCoords[4], SkBlendMode, const SkPaint& paint) override;
|
85
79
|
|
@@ -120,11 +114,7 @@ protected:
|
|
120
114
|
SkBlendMode) override;
|
121
115
|
void onDrawEdgeAAImageSet2(const ImageSetEntry[], int count, const SkPoint[], const SkMatrix[],
|
122
116
|
const SkSamplingOptions&,const SkPaint*, SrcRectConstraint) override;
|
123
|
-
|
124
|
-
void onFlush() override;
|
125
|
-
|
126
117
|
class Iter;
|
127
|
-
|
128
118
|
private:
|
129
119
|
using INHERITED = SkCanvasVirtualEnforcer<SkNoDrawCanvas>;
|
130
120
|
};
|
@@ -26,8 +26,6 @@ public:
|
|
26
26
|
SkNoDrawCanvas(int width, int height);
|
27
27
|
SkNoDrawCanvas(const SkIRect&);
|
28
28
|
|
29
|
-
explicit SkNoDrawCanvas(sk_sp<SkBaseDevice> device);
|
30
|
-
|
31
29
|
// Optimization to reset state to be the same as after construction.
|
32
30
|
void resetCanvas(int w, int h) { this->resetForNextPicture(SkIRect::MakeWH(w, h)); }
|
33
31
|
void resetCanvas(const SkIRect& rect) { this->resetForNextPicture(rect); }
|
@@ -65,8 +65,7 @@ public:
|
|
65
65
|
|
66
66
|
// Forwarded to the wrapped canvas.
|
67
67
|
SkISize getBaseLayerSize() const override { return proxy()->getBaseLayerSize(); }
|
68
|
-
GrRecordingContext* recordingContext() override { return proxy()->recordingContext(); }
|
69
|
-
|
68
|
+
GrRecordingContext* recordingContext() const override { return proxy()->recordingContext(); }
|
70
69
|
protected:
|
71
70
|
/**
|
72
71
|
* Called with the paint that will be used to draw the specified type.
|
@@ -11,7 +11,6 @@
|
|
11
11
|
#include "include/core/SkColor.h"
|
12
12
|
#include "include/core/SkScalar.h"
|
13
13
|
#include "include/core/SkTypes.h"
|
14
|
-
#include "include/private/SkShadowFlags.h"
|
15
14
|
|
16
15
|
#include <cstdint>
|
17
16
|
|
@@ -21,6 +20,21 @@ class SkPath;
|
|
21
20
|
struct SkPoint3;
|
22
21
|
struct SkRect;
|
23
22
|
|
23
|
+
enum SkShadowFlags {
|
24
|
+
kNone_ShadowFlag = 0x00,
|
25
|
+
/** The occluding object is not opaque. Knowing that the occluder is opaque allows
|
26
|
+
* us to cull shadow geometry behind it and improve performance. */
|
27
|
+
kTransparentOccluder_ShadowFlag = 0x01,
|
28
|
+
/** Don't try to use analytic shadows. */
|
29
|
+
kGeometricOnly_ShadowFlag = 0x02,
|
30
|
+
/** Light position represents a direction, light radius is blur radius at elevation 1 */
|
31
|
+
kDirectionalLight_ShadowFlag = 0x04,
|
32
|
+
/** Concave paths will only use blur to generate the shadow */
|
33
|
+
kConcaveBlurOnly_ShadowFlag = 0x08,
|
34
|
+
/** mask for all shadow flags */
|
35
|
+
kAll_ShadowFlag = 0x0F
|
36
|
+
};
|
37
|
+
|
24
38
|
class SK_API SkShadowUtils {
|
25
39
|
public:
|
26
40
|
/**
|
@@ -2,6 +2,7 @@
|
|
2
2
|
#ifndef Paragraph_DEFINED
|
3
3
|
#define Paragraph_DEFINED
|
4
4
|
|
5
|
+
#include "include/core/SkPath.h"
|
5
6
|
#include "modules/skparagraph/include/FontCollection.h"
|
6
7
|
#include "modules/skparagraph/include/Metrics.h"
|
7
8
|
#include "modules/skparagraph/include/ParagraphStyle.h"
|
@@ -97,9 +98,72 @@ public:
|
|
97
98
|
using Visitor = std::function<void(int lineNumber, const VisitorInfo*)>;
|
98
99
|
virtual void visit(const Visitor&) = 0;
|
99
100
|
|
101
|
+
struct ExtendedVisitorInfo {
|
102
|
+
const SkFont& font;
|
103
|
+
SkPoint origin;
|
104
|
+
SkSize advance;
|
105
|
+
int count;
|
106
|
+
const uint16_t* glyphs; // count values
|
107
|
+
SkPoint* positions; // count values
|
108
|
+
const SkRect* bounds; // count values
|
109
|
+
const uint32_t* utf8Starts; // count+1 values
|
110
|
+
unsigned flags;
|
111
|
+
};
|
112
|
+
using ExtendedVisitor = std::function<void(int lineNumber, const ExtendedVisitorInfo*)>;
|
113
|
+
virtual void extendedVisit(const ExtendedVisitor&) = 0;
|
114
|
+
|
115
|
+
/* Returns path for a given line
|
116
|
+
*
|
117
|
+
* @param lineNumber a line number
|
118
|
+
* @param dest a resulting path
|
119
|
+
* @return a number glyphs that could not be converted to path
|
120
|
+
*/
|
121
|
+
virtual int getPath(int lineNumber, SkPath* dest) = 0;
|
122
|
+
|
123
|
+
/* Returns path for a text blob
|
124
|
+
*
|
125
|
+
* @param textBlob a text blob
|
126
|
+
* @return a path
|
127
|
+
*/
|
128
|
+
static SkPath GetPath(SkTextBlob* textBlob);
|
129
|
+
|
130
|
+
/* Checks if a given text blob contains
|
131
|
+
* glyph with emoji
|
132
|
+
*
|
133
|
+
* @param textBlob a text blob
|
134
|
+
* @return true if there is such a glyph
|
135
|
+
*/
|
136
|
+
virtual bool containsEmoji(SkTextBlob* textBlob) = 0;
|
137
|
+
|
138
|
+
/* Checks if a given text blob contains colored font or bitmap
|
139
|
+
*
|
140
|
+
* @param textBlob a text blob
|
141
|
+
* @return true if there is such a glyph
|
142
|
+
*/
|
143
|
+
virtual bool containsColorFontOrBitmap(SkTextBlob* textBlob) = 0;
|
144
|
+
|
100
145
|
// Editing API
|
146
|
+
|
147
|
+
/* Finds the line number of the line that contains the given UTF-8 index.
|
148
|
+
*
|
149
|
+
* @param index a UTF-8 TextIndex into the paragraph
|
150
|
+
* @return the line number the glyph that corresponds to the
|
151
|
+
* given codeUnitIndex is in, or -1 if the codeUnitIndex
|
152
|
+
* is out of bounds, or when the glyph is truncated or
|
153
|
+
* ellipsized away.
|
154
|
+
*/
|
101
155
|
virtual int getLineNumberAt(TextIndex codeUnitIndex) const = 0;
|
102
156
|
|
157
|
+
/* Finds the line number of the line that contains the given UTF-16 index.
|
158
|
+
*
|
159
|
+
* @param index a UTF-16 offset into the paragraph
|
160
|
+
* @return the line number the glyph that corresponds to the
|
161
|
+
* given codeUnitIndex is in, or -1 if the codeUnitIndex
|
162
|
+
* is out of bounds, or when the glyph is truncated or
|
163
|
+
* ellipsized away.
|
164
|
+
*/
|
165
|
+
virtual int getLineNumberAtUTF16Offset(size_t codeUnitIndex) = 0;
|
166
|
+
|
103
167
|
/* Returns line metrics info for the line
|
104
168
|
*
|
105
169
|
* @param lineNumber a line number
|
@@ -135,12 +199,47 @@ public:
|
|
135
199
|
* @param dx x coordinate
|
136
200
|
* @param dy y coordinate
|
137
201
|
* @param glyphInfo a glyph cluster info filled if not null
|
138
|
-
* @return
|
202
|
+
* @return true if glyph cluster was found; false if not
|
203
|
+
* (which usually means the paragraph is empty)
|
139
204
|
*/
|
140
205
|
virtual bool getClosestGlyphClusterAt(SkScalar dx,
|
141
206
|
SkScalar dy,
|
142
207
|
GlyphClusterInfo* glyphInfo) = 0;
|
143
208
|
|
209
|
+
// The glyph and grapheme cluster information assoicated with a unicode
|
210
|
+
// codepoint in the paragraph.
|
211
|
+
struct GlyphInfo {
|
212
|
+
SkRect fGraphemeLayoutBounds;
|
213
|
+
TextRange fGraphemeClusterTextRange;
|
214
|
+
TextDirection fDirection;
|
215
|
+
bool fIsEllipsis;
|
216
|
+
};
|
217
|
+
|
218
|
+
/** Retrives the information associated with the glyph located at the given
|
219
|
+
* codeUnitIndex.
|
220
|
+
*
|
221
|
+
* @param codeUnitIndex a UTF-16 offset into the paragraph
|
222
|
+
* @param glyphInfo an optional GlyphInfo struct to hold the
|
223
|
+
* information associated with the glyph found at the
|
224
|
+
* given index
|
225
|
+
* @return false only if the offset is out of bounds
|
226
|
+
*/
|
227
|
+
virtual bool getGlyphInfoAtUTF16Offset(size_t codeUnitIndex, GlyphInfo* glyphInfo) = 0;
|
228
|
+
|
229
|
+
/** Finds the information associated with the closest glyph to the given
|
230
|
+
* paragraph coordinates.
|
231
|
+
*
|
232
|
+
* @param dx x coordinate
|
233
|
+
* @param dy y coordinate
|
234
|
+
* @param glyphInfo an optional GlyphInfo struct to hold the
|
235
|
+
* information associated with the glyph found. The
|
236
|
+
* text indices and text ranges are described using
|
237
|
+
* UTF-16 offsets
|
238
|
+
* @return true if a graphme cluster was found; false if not
|
239
|
+
* (which usually means the paragraph is empty)
|
240
|
+
*/
|
241
|
+
virtual bool getClosestUTF16GlyphInfoAt(SkScalar dx, SkScalar dy, GlyphInfo* glyphInfo) = 0;
|
242
|
+
|
144
243
|
struct FontInfo {
|
145
244
|
FontInfo(const SkFont font, const TextRange textRange)
|
146
245
|
: fFont(font), fTextRange(textRange) { }
|
@@ -157,6 +256,13 @@ public:
|
|
157
256
|
*/
|
158
257
|
virtual SkFont getFontAt(TextIndex codeUnitIndex) const = 0;
|
159
258
|
|
259
|
+
/** Returns the font used to shape the text at the given UTF-16 offset.
|
260
|
+
*
|
261
|
+
* @param codeUnitIndex a UTF-16 offset in the paragraph
|
262
|
+
* @return font info or an empty font info if the text is not found
|
263
|
+
*/
|
264
|
+
virtual SkFont getFontAtUTF16Offset(size_t codeUnitIndex) = 0;
|
265
|
+
|
160
266
|
/** Returns the information about all the fonts used to shape the paragraph text
|
161
267
|
*
|
162
268
|
* @return a list of fonts and text ranges
|
@@ -16,9 +16,10 @@ namespace skia {
|
|
16
16
|
namespace textlayout {
|
17
17
|
|
18
18
|
class ParagraphBuilder {
|
19
|
-
|
20
|
-
ParagraphBuilder(
|
19
|
+
protected:
|
20
|
+
ParagraphBuilder() {}
|
21
21
|
|
22
|
+
public:
|
22
23
|
virtual ~ParagraphBuilder() = default;
|
23
24
|
|
24
25
|
// Push a style to the stack. The corresponding text added with AddText will
|