@shopify/react-native-skia 0.1.196 → 0.1.199
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 +32 -31
- package/android/cpp/rnskia-android/SkiaOpenGLRenderer.cpp +4 -2
- package/android/cpp/rnskia-android/SkiaOpenGLRenderer.h +3 -0
- package/cpp/api/JsiSkImage.h +1 -1
- package/cpp/api/JsiSkShaderFactory.h +4 -4
- package/cpp/api/JsiSkSurface.h +0 -1
- package/cpp/api/JsiSkSurfaceFactory.h +2 -1
- package/cpp/rnskia/RNSkView.h +20 -40
- package/cpp/rnskia/dom/nodes/JsiShaderNodes.h +2 -2
- package/cpp/rnskia/values/RNSkReadonlyValue.h +6 -7
- package/cpp/skia/include/android/SkCanvasAndroid.h +20 -0
- package/cpp/skia/include/android/SkHeifDecoder.h +43 -0
- package/cpp/skia/include/android/SkSurfaceAndroid.h +50 -0
- package/cpp/skia/include/codec/SkAvifDecoder.h +43 -0
- package/cpp/skia/include/codec/SkBmpDecoder.h +43 -0
- package/cpp/skia/include/codec/SkCodec.h +25 -1
- package/cpp/skia/include/codec/SkGifDecoder.h +43 -0
- package/cpp/skia/include/codec/SkIcoDecoder.h +43 -0
- package/cpp/skia/include/codec/SkJpegDecoder.h +43 -0
- package/cpp/skia/include/codec/SkJpegxlDecoder.h +43 -0
- package/cpp/skia/include/codec/SkPngDecoder.h +43 -0
- package/cpp/skia/include/codec/SkRawDecoder.h +49 -0
- package/cpp/skia/include/codec/SkWbmpDecoder.h +43 -0
- package/cpp/skia/include/codec/SkWebpDecoder.h +43 -0
- package/cpp/skia/include/core/SkBBHFactory.h +5 -1
- package/cpp/skia/include/core/SkBlender.h +0 -2
- package/cpp/skia/include/core/SkCanvas.h +4 -23
- package/cpp/skia/include/core/SkColorFilter.h +14 -1
- package/cpp/skia/include/core/SkColorTable.h +59 -0
- package/cpp/skia/include/core/SkContourMeasure.h +3 -0
- package/cpp/skia/include/core/SkDeferredDisplayList.h +8 -104
- package/cpp/skia/include/core/SkDeferredDisplayListRecorder.h +8 -91
- package/cpp/skia/include/core/SkDrawable.h +5 -2
- package/cpp/skia/include/core/SkGraphics.h +7 -19
- package/cpp/skia/include/core/SkImage.h +157 -249
- package/cpp/skia/include/core/SkImageGenerator.h +0 -31
- package/cpp/skia/include/core/SkMilestone.h +1 -1
- package/cpp/skia/include/core/SkPathMeasure.h +3 -3
- package/cpp/skia/include/core/SkPictureRecorder.h +1 -1
- package/cpp/skia/include/core/SkPoint.h +5 -563
- package/cpp/skia/include/core/SkPoint3.h +1 -0
- package/cpp/skia/include/core/SkPromiseImageTexture.h +4 -30
- package/cpp/skia/include/core/SkRect.h +8 -8
- package/cpp/skia/include/core/SkSamplingOptions.h +4 -2
- package/cpp/skia/include/core/SkScalar.h +1 -1
- package/cpp/skia/include/core/SkSerialProcs.h +5 -1
- package/cpp/skia/include/core/SkShader.h +14 -21
- package/cpp/skia/include/core/SkString.h +2 -0
- package/cpp/skia/include/core/SkSurface.h +169 -701
- package/cpp/skia/include/core/SkSurfaceCharacterization.h +8 -256
- package/cpp/skia/include/core/SkTiledImageUtils.h +97 -0
- package/cpp/skia/include/core/SkTypes.h +4 -2
- package/cpp/skia/include/core/SkYUVAPixmaps.h +0 -5
- package/cpp/skia/include/effects/SkGradientShader.h +10 -1
- package/cpp/skia/include/effects/SkImageFilters.h +62 -37
- package/cpp/skia/include/effects/SkPerlinNoiseShader.h +28 -29
- package/cpp/skia/include/effects/SkRuntimeEffect.h +17 -12
- package/cpp/skia/include/gpu/GrBackendSurface.h +12 -39
- package/cpp/skia/include/gpu/GrBackendSurfaceMutableState.h +6 -0
- package/cpp/skia/include/gpu/GrContextThreadSafeProxy.h +3 -3
- package/cpp/skia/include/gpu/GrDirectContext.h +103 -3
- package/cpp/skia/include/gpu/GrRecordingContext.h +10 -19
- package/cpp/skia/include/gpu/MutableTextureState.h +4 -0
- package/cpp/skia/include/gpu/ganesh/GrExternalTextureGenerator.h +54 -0
- package/cpp/skia/include/gpu/ganesh/SkImageGanesh.h +20 -76
- package/cpp/skia/include/gpu/ganesh/SkSurfaceGanesh.h +217 -0
- package/cpp/skia/include/gpu/ganesh/mtl/SkSurfaceMetal.h +73 -0
- package/cpp/skia/include/gpu/gl/GrGLTypes.h +13 -2
- package/cpp/skia/include/gpu/graphite/BackendSemaphore.h +78 -0
- package/cpp/skia/include/gpu/graphite/BackendTexture.h +1 -0
- package/cpp/skia/include/gpu/graphite/Image.h +277 -0
- package/cpp/skia/include/gpu/graphite/ImageProvider.h +1 -1
- package/cpp/skia/include/gpu/graphite/Recording.h +1 -4
- package/cpp/skia/include/gpu/graphite/Surface.h +81 -0
- package/cpp/skia/include/gpu/graphite/TextureInfo.h +5 -7
- package/cpp/skia/include/gpu/graphite/YUVABackendTextures.h +2 -2
- package/cpp/skia/include/gpu/mock/GrMockTypes.h +23 -8
- package/cpp/skia/include/ports/SkTypeface_fontations.h +21 -0
- package/cpp/skia/include/private/SkGainmapInfo.h +2 -0
- package/cpp/skia/include/private/SkGainmapShader.h +1 -0
- package/cpp/skia/include/private/SkJpegMetadataDecoder.h +19 -1
- package/cpp/skia/include/private/SkPathRef.h +13 -15
- package/cpp/skia/include/private/SkXmp.h +53 -0
- package/cpp/skia/include/private/base/SkFeatures.h +0 -4
- package/cpp/skia/include/private/base/SkFloatingPoint.h +11 -5
- package/cpp/skia/include/private/base/SkPoint_impl.h +569 -0
- package/cpp/skia/include/private/base/SkSpan_impl.h +3 -7
- package/cpp/skia/include/private/base/SkTArray.h +11 -11
- package/cpp/skia/include/private/chromium/GrDeferredDisplayList.h +120 -0
- package/cpp/skia/include/private/chromium/GrDeferredDisplayListRecorder.h +98 -0
- package/cpp/skia/include/private/chromium/GrPromiseImageTexture.h +43 -0
- package/cpp/skia/include/private/chromium/GrSurfaceCharacterization.h +215 -0
- package/cpp/skia/include/private/chromium/GrVkSecondaryCBDrawContext.h +6 -6
- package/cpp/skia/include/private/chromium/SkImageChromium.h +104 -0
- package/cpp/skia/include/private/chromium/Slug.h +7 -3
- package/cpp/skia/include/private/gpu/ganesh/GrContext_Base.h +7 -3
- package/cpp/skia/include/private/gpu/ganesh/GrGLTypesPriv.h +2 -0
- package/cpp/skia/include/private/gpu/ganesh/GrImageContext.h +3 -2
- package/cpp/skia/include/private/gpu/ganesh/GrMtlTypesPriv.h +10 -2
- package/cpp/skia/include/{gpu → private/gpu}/ganesh/GrTextureGenerator.h +2 -13
- package/cpp/skia/include/private/gpu/ganesh/GrTypesPriv.h +1 -1
- package/cpp/skia/include/private/gpu/graphite/DawnTypesPriv.h +7 -0
- package/cpp/skia/include/private/gpu/graphite/MtlGraphiteTypesPriv.h +19 -6
- package/cpp/skia/include/private/gpu/graphite/VulkanGraphiteTypesPriv.h +13 -0
- package/cpp/skia/include/third_party/vulkan/vulkan/vulkan.h +0 -1
- package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_android.h +14 -1
- package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_core.h +999 -79
- package/cpp/skia/modules/skcms/src/Transform_inl.h +36 -236
- package/cpp/skia/modules/skparagraph/include/Paragraph.h +2 -0
- package/cpp/skia/modules/skparagraph/include/ParagraphBuilder.h +16 -0
- package/cpp/skia/modules/skparagraph/include/TextStyle.h +6 -2
- package/cpp/skia/modules/skresources/include/SkResources.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGCircle.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGClipPath.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGContainer.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGDOM.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGDefs.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGEllipse.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGFe.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGFeBlend.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGFeColorMatrix.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGFeComposite.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGFeDisplacementMap.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGFeFlood.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGFeGaussianBlur.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGFeImage.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGFeLightSource.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGFeLighting.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGFeOffset.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGFeTurbulence.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGFilter.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGG.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGGradient.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGHiddenContainer.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGImage.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGLine.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGLinearGradient.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGMask.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGNode.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGPath.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGPattern.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGPoly.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGRadialGradient.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGRect.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGRenderContext.h +3 -3
- package/cpp/skia/modules/svg/include/SkSVGSVG.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGShape.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGStop.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGText.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGTransformableNode.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGTypes.h +21 -21
- package/cpp/skia/modules/svg/include/SkSVGUse.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGValue.h +2 -2
- package/cpp/skia/{include/private → src/core}/SkChecksum.h +32 -17
- package/cpp/skia/src/core/SkTHash.h +1 -1
- package/ios/RNSkia-iOS/RNSkMetalCanvasProvider.mm +3 -1
- package/ios/RNSkia-iOS/SkiaMetalRenderer.mm +3 -1
- package/lib/commonjs/renderer/Canvas.js +24 -13
- package/lib/commonjs/renderer/Canvas.js.map +1 -1
- package/lib/commonjs/skia/core/Data.d.ts +2 -2
- package/lib/commonjs/skia/core/Data.js.map +1 -1
- package/lib/commonjs/skia/core/RRect.js +5 -1
- package/lib/commonjs/skia/core/RRect.js.map +1 -1
- package/lib/commonjs/skia/core/Rect.js +32 -6
- package/lib/commonjs/skia/core/Rect.js.map +1 -1
- package/lib/commonjs/skia/types/Color.js.map +1 -1
- package/lib/commonjs/skia/types/JsiInstance.d.ts +2 -4
- package/lib/commonjs/skia/types/JsiInstance.js.map +1 -1
- package/lib/module/renderer/Canvas.js +25 -14
- package/lib/module/renderer/Canvas.js.map +1 -1
- package/lib/module/skia/core/Data.d.ts +2 -2
- package/lib/module/skia/core/Data.js.map +1 -1
- package/lib/module/skia/core/RRect.js +5 -1
- package/lib/module/skia/core/RRect.js.map +1 -1
- package/lib/module/skia/core/Rect.js +32 -6
- package/lib/module/skia/core/Rect.js.map +1 -1
- package/lib/module/skia/types/Color.js.map +1 -1
- package/lib/module/skia/types/JsiInstance.d.ts +2 -4
- package/lib/module/skia/types/JsiInstance.js.map +1 -1
- package/lib/typescript/src/skia/core/Data.d.ts +2 -2
- package/lib/typescript/src/skia/types/JsiInstance.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/libsksg.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/libsksg.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/libsksg.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/libsksg.a +0 -0
- package/libs/android/x86_64/libsvg.a +0 -0
- package/libs/ios/libskia.xcframework/ios-arm64_arm64e/libskia.a +0 -0
- package/libs/ios/libskia.xcframework/ios-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
- package/libs/ios/libskottie.xcframework/ios-arm64_arm64e/libskottie.a +0 -0
- package/libs/ios/libskottie.xcframework/ios-arm64_arm64e_x86_64-simulator/libskottie.a +0 -0
- package/libs/ios/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/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 +3 -4
- package/src/renderer/Canvas.tsx +25 -19
- package/src/skia/core/Data.ts +3 -3
- package/src/skia/core/RRect.tsx +4 -2
- package/src/skia/core/Rect.ts +29 -12
- package/src/skia/types/Color.ts +1 -1
- package/src/skia/types/JsiInstance.ts +2 -5
- package/cpp/skia/include/effects/SkTableColorFilter.h +0 -29
- package/cpp/skia/include/private/SkOpts_spi.h +0 -23
- package/cpp/skia/include/private/SkSpinlock.h +0 -57
- package/cpp/skia/include/private/chromium/GrSlug.h +0 -16
- package/scripts/install-npm.js +0 -33
|
@@ -5,259 +5,11 @@
|
|
|
5
5
|
* found in the LICENSE file.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
#
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
class SkColorSpace;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
#if defined(SK_GANESH)
|
|
21
|
-
#include "include/gpu/GrBackendSurface.h"
|
|
22
|
-
#include "include/gpu/GrContextThreadSafeProxy.h"
|
|
23
|
-
#include "include/gpu/GrTypes.h"
|
|
24
|
-
|
|
25
|
-
/** \class SkSurfaceCharacterization
|
|
26
|
-
A surface characterization contains all the information Ganesh requires to makes its internal
|
|
27
|
-
rendering decisions. When passed into a SkDeferredDisplayListRecorder it will copy the
|
|
28
|
-
data and pass it on to the SkDeferredDisplayList if/when it is created. Note that both of
|
|
29
|
-
those objects (the Recorder and the DisplayList) will take a ref on the
|
|
30
|
-
GrContextThreadSafeProxy and SkColorSpace objects.
|
|
31
|
-
*/
|
|
32
|
-
class SK_API SkSurfaceCharacterization {
|
|
33
|
-
public:
|
|
34
|
-
enum class Textureable : bool { kNo = false, kYes = true };
|
|
35
|
-
enum class MipMapped : bool { kNo = false, kYes = true };
|
|
36
|
-
enum class UsesGLFBO0 : bool { kNo = false, kYes = true };
|
|
37
|
-
// This flag indicates that the backing VkImage for this Vulkan surface will have the
|
|
38
|
-
// VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT set. This bit allows skia to handle advanced blends
|
|
39
|
-
// more optimally in a shader by being able to directly read the dst values.
|
|
40
|
-
enum class VkRTSupportsInputAttachment : bool { kNo = false, kYes = true };
|
|
41
|
-
// This flag indicates if the surface is wrapping a raw Vulkan secondary command buffer.
|
|
42
|
-
enum class VulkanSecondaryCBCompatible : bool { kNo = false, kYes = true };
|
|
43
|
-
|
|
44
|
-
SkSurfaceCharacterization()
|
|
45
|
-
: fCacheMaxResourceBytes(0)
|
|
46
|
-
, fOrigin(kBottomLeft_GrSurfaceOrigin)
|
|
47
|
-
, fSampleCnt(0)
|
|
48
|
-
, fIsTextureable(Textureable::kYes)
|
|
49
|
-
, fIsMipMapped(MipMapped::kYes)
|
|
50
|
-
, fUsesGLFBO0(UsesGLFBO0::kNo)
|
|
51
|
-
, fVulkanSecondaryCBCompatible(VulkanSecondaryCBCompatible::kNo)
|
|
52
|
-
, fIsProtected(GrProtected::kNo)
|
|
53
|
-
, fSurfaceProps(0, kUnknown_SkPixelGeometry) {
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
SkSurfaceCharacterization(SkSurfaceCharacterization&&) = default;
|
|
57
|
-
SkSurfaceCharacterization& operator=(SkSurfaceCharacterization&&) = default;
|
|
58
|
-
|
|
59
|
-
SkSurfaceCharacterization(const SkSurfaceCharacterization&) = default;
|
|
60
|
-
SkSurfaceCharacterization& operator=(const SkSurfaceCharacterization& other) = default;
|
|
61
|
-
bool operator==(const SkSurfaceCharacterization& other) const;
|
|
62
|
-
bool operator!=(const SkSurfaceCharacterization& other) const {
|
|
63
|
-
return !(*this == other);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
/*
|
|
67
|
-
* Return a new surface characterization with the only difference being a different width
|
|
68
|
-
* and height
|
|
69
|
-
*/
|
|
70
|
-
SkSurfaceCharacterization createResized(int width, int height) const;
|
|
71
|
-
|
|
72
|
-
/*
|
|
73
|
-
* Return a new surface characterization with only a replaced color space
|
|
74
|
-
*/
|
|
75
|
-
SkSurfaceCharacterization createColorSpace(sk_sp<SkColorSpace>) const;
|
|
76
|
-
|
|
77
|
-
/*
|
|
78
|
-
* Return a new surface characterization with the backend format replaced. A colorType
|
|
79
|
-
* must also be supplied to indicate the interpretation of the new format.
|
|
80
|
-
*/
|
|
81
|
-
SkSurfaceCharacterization createBackendFormat(SkColorType colorType,
|
|
82
|
-
const GrBackendFormat& backendFormat) const;
|
|
83
|
-
|
|
84
|
-
/*
|
|
85
|
-
* Return a new surface characterization with just a different use of FBO0 (in GL)
|
|
86
|
-
*/
|
|
87
|
-
SkSurfaceCharacterization createFBO0(bool usesGLFBO0) const;
|
|
88
|
-
|
|
89
|
-
GrContextThreadSafeProxy* contextInfo() const { return fContextInfo.get(); }
|
|
90
|
-
sk_sp<GrContextThreadSafeProxy> refContextInfo() const { return fContextInfo; }
|
|
91
|
-
size_t cacheMaxResourceBytes() const { return fCacheMaxResourceBytes; }
|
|
92
|
-
|
|
93
|
-
bool isValid() const { return kUnknown_SkColorType != fImageInfo.colorType(); }
|
|
94
|
-
|
|
95
|
-
const SkImageInfo& imageInfo() const { return fImageInfo; }
|
|
96
|
-
const GrBackendFormat& backendFormat() const { return fBackendFormat; }
|
|
97
|
-
GrSurfaceOrigin origin() const { return fOrigin; }
|
|
98
|
-
SkISize dimensions() const { return fImageInfo.dimensions(); }
|
|
99
|
-
int width() const { return fImageInfo.width(); }
|
|
100
|
-
int height() const { return fImageInfo.height(); }
|
|
101
|
-
SkColorType colorType() const { return fImageInfo.colorType(); }
|
|
102
|
-
int sampleCount() const { return fSampleCnt; }
|
|
103
|
-
bool isTextureable() const { return Textureable::kYes == fIsTextureable; }
|
|
104
|
-
bool isMipMapped() const { return MipMapped::kYes == fIsMipMapped; }
|
|
105
|
-
bool usesGLFBO0() const { return UsesGLFBO0::kYes == fUsesGLFBO0; }
|
|
106
|
-
bool vkRTSupportsInputAttachment() const {
|
|
107
|
-
return VkRTSupportsInputAttachment::kYes == fVkRTSupportsInputAttachment;
|
|
108
|
-
}
|
|
109
|
-
bool vulkanSecondaryCBCompatible() const {
|
|
110
|
-
return VulkanSecondaryCBCompatible::kYes == fVulkanSecondaryCBCompatible;
|
|
111
|
-
}
|
|
112
|
-
GrProtected isProtected() const { return fIsProtected; }
|
|
113
|
-
SkColorSpace* colorSpace() const { return fImageInfo.colorSpace(); }
|
|
114
|
-
sk_sp<SkColorSpace> refColorSpace() const { return fImageInfo.refColorSpace(); }
|
|
115
|
-
const SkSurfaceProps& surfaceProps()const { return fSurfaceProps; }
|
|
116
|
-
|
|
117
|
-
// Is the provided backend texture compatible with this surface characterization?
|
|
118
|
-
bool isCompatible(const GrBackendTexture&) const;
|
|
119
|
-
|
|
120
|
-
private:
|
|
121
|
-
friend class SkSurface_Ganesh; // for 'set' & 'config'
|
|
122
|
-
friend class GrVkSecondaryCBDrawContext; // for 'set' & 'config'
|
|
123
|
-
friend class GrContextThreadSafeProxy; // for private ctor
|
|
124
|
-
friend class SkDeferredDisplayListRecorder; // for 'config'
|
|
125
|
-
friend class SkSurface; // for 'config'
|
|
126
|
-
|
|
127
|
-
SkDEBUGCODE(void validate() const;)
|
|
128
|
-
|
|
129
|
-
SkSurfaceCharacterization(sk_sp<GrContextThreadSafeProxy> contextInfo,
|
|
130
|
-
size_t cacheMaxResourceBytes,
|
|
131
|
-
const SkImageInfo& ii,
|
|
132
|
-
const GrBackendFormat& backendFormat,
|
|
133
|
-
GrSurfaceOrigin origin,
|
|
134
|
-
int sampleCnt,
|
|
135
|
-
Textureable isTextureable,
|
|
136
|
-
MipMapped isMipMapped,
|
|
137
|
-
UsesGLFBO0 usesGLFBO0,
|
|
138
|
-
VkRTSupportsInputAttachment vkRTSupportsInputAttachment,
|
|
139
|
-
VulkanSecondaryCBCompatible vulkanSecondaryCBCompatible,
|
|
140
|
-
GrProtected isProtected,
|
|
141
|
-
const SkSurfaceProps& surfaceProps)
|
|
142
|
-
: fContextInfo(std::move(contextInfo))
|
|
143
|
-
, fCacheMaxResourceBytes(cacheMaxResourceBytes)
|
|
144
|
-
, fImageInfo(ii)
|
|
145
|
-
, fBackendFormat(backendFormat)
|
|
146
|
-
, fOrigin(origin)
|
|
147
|
-
, fSampleCnt(sampleCnt)
|
|
148
|
-
, fIsTextureable(isTextureable)
|
|
149
|
-
, fIsMipMapped(isMipMapped)
|
|
150
|
-
, fUsesGLFBO0(usesGLFBO0)
|
|
151
|
-
, fVkRTSupportsInputAttachment(vkRTSupportsInputAttachment)
|
|
152
|
-
, fVulkanSecondaryCBCompatible(vulkanSecondaryCBCompatible)
|
|
153
|
-
, fIsProtected(isProtected)
|
|
154
|
-
, fSurfaceProps(surfaceProps) {
|
|
155
|
-
if (fSurfaceProps.flags() & SkSurfaceProps::kDynamicMSAA_Flag) {
|
|
156
|
-
// Dynamic MSAA is not currently supported with DDL.
|
|
157
|
-
*this = {};
|
|
158
|
-
}
|
|
159
|
-
SkDEBUGCODE(this->validate());
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
void set(sk_sp<GrContextThreadSafeProxy> contextInfo,
|
|
163
|
-
size_t cacheMaxResourceBytes,
|
|
164
|
-
const SkImageInfo& ii,
|
|
165
|
-
const GrBackendFormat& backendFormat,
|
|
166
|
-
GrSurfaceOrigin origin,
|
|
167
|
-
int sampleCnt,
|
|
168
|
-
Textureable isTextureable,
|
|
169
|
-
MipMapped isMipMapped,
|
|
170
|
-
UsesGLFBO0 usesGLFBO0,
|
|
171
|
-
VkRTSupportsInputAttachment vkRTSupportsInputAttachment,
|
|
172
|
-
VulkanSecondaryCBCompatible vulkanSecondaryCBCompatible,
|
|
173
|
-
GrProtected isProtected,
|
|
174
|
-
const SkSurfaceProps& surfaceProps) {
|
|
175
|
-
if (surfaceProps.flags() & SkSurfaceProps::kDynamicMSAA_Flag) {
|
|
176
|
-
// Dynamic MSAA is not currently supported with DDL.
|
|
177
|
-
*this = {};
|
|
178
|
-
} else {
|
|
179
|
-
fContextInfo = contextInfo;
|
|
180
|
-
fCacheMaxResourceBytes = cacheMaxResourceBytes;
|
|
181
|
-
|
|
182
|
-
fImageInfo = ii;
|
|
183
|
-
fBackendFormat = backendFormat;
|
|
184
|
-
fOrigin = origin;
|
|
185
|
-
fSampleCnt = sampleCnt;
|
|
186
|
-
fIsTextureable = isTextureable;
|
|
187
|
-
fIsMipMapped = isMipMapped;
|
|
188
|
-
fUsesGLFBO0 = usesGLFBO0;
|
|
189
|
-
fVkRTSupportsInputAttachment = vkRTSupportsInputAttachment;
|
|
190
|
-
fVulkanSecondaryCBCompatible = vulkanSecondaryCBCompatible;
|
|
191
|
-
fIsProtected = isProtected;
|
|
192
|
-
fSurfaceProps = surfaceProps;
|
|
193
|
-
}
|
|
194
|
-
SkDEBUGCODE(this->validate());
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
sk_sp<GrContextThreadSafeProxy> fContextInfo;
|
|
198
|
-
size_t fCacheMaxResourceBytes;
|
|
199
|
-
|
|
200
|
-
SkImageInfo fImageInfo;
|
|
201
|
-
GrBackendFormat fBackendFormat;
|
|
202
|
-
GrSurfaceOrigin fOrigin;
|
|
203
|
-
int fSampleCnt;
|
|
204
|
-
Textureable fIsTextureable;
|
|
205
|
-
MipMapped fIsMipMapped;
|
|
206
|
-
UsesGLFBO0 fUsesGLFBO0;
|
|
207
|
-
VkRTSupportsInputAttachment fVkRTSupportsInputAttachment;
|
|
208
|
-
VulkanSecondaryCBCompatible fVulkanSecondaryCBCompatible;
|
|
209
|
-
GrProtected fIsProtected;
|
|
210
|
-
SkSurfaceProps fSurfaceProps;
|
|
211
|
-
};
|
|
212
|
-
|
|
213
|
-
#else// !defined(SK_GANESH)
|
|
214
|
-
class GrBackendFormat;
|
|
215
|
-
|
|
216
|
-
class SK_API SkSurfaceCharacterization {
|
|
217
|
-
public:
|
|
218
|
-
SkSurfaceCharacterization() : fSurfaceProps(0, kUnknown_SkPixelGeometry) { }
|
|
219
|
-
|
|
220
|
-
SkSurfaceCharacterization createResized(int width, int height) const {
|
|
221
|
-
return *this;
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
SkSurfaceCharacterization createColorSpace(sk_sp<SkColorSpace>) const {
|
|
225
|
-
return *this;
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
SkSurfaceCharacterization createBackendFormat(SkColorType, const GrBackendFormat&) const {
|
|
229
|
-
return *this;
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
SkSurfaceCharacterization createFBO0(bool usesGLFBO0) const {
|
|
233
|
-
return *this;
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
bool operator==(const SkSurfaceCharacterization& other) const { return false; }
|
|
237
|
-
bool operator!=(const SkSurfaceCharacterization& other) const {
|
|
238
|
-
return !(*this == other);
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
size_t cacheMaxResourceBytes() const { return 0; }
|
|
242
|
-
|
|
243
|
-
bool isValid() const { return false; }
|
|
244
|
-
|
|
245
|
-
int width() const { return 0; }
|
|
246
|
-
int height() const { return 0; }
|
|
247
|
-
int stencilCount() const { return 0; }
|
|
248
|
-
bool isTextureable() const { return false; }
|
|
249
|
-
bool isMipMapped() const { return false; }
|
|
250
|
-
bool usesGLFBO0() const { return false; }
|
|
251
|
-
bool vkRTSupportsAttachmentInput() const { return false; }
|
|
252
|
-
bool vulkanSecondaryCBCompatible() const { return false; }
|
|
253
|
-
SkColorSpace* colorSpace() const { return nullptr; }
|
|
254
|
-
sk_sp<SkColorSpace> refColorSpace() const { return nullptr; }
|
|
255
|
-
const SkSurfaceProps& surfaceProps()const { return fSurfaceProps; }
|
|
256
|
-
|
|
257
|
-
private:
|
|
258
|
-
SkSurfaceProps fSurfaceProps;
|
|
259
|
-
};
|
|
260
|
-
|
|
261
|
-
#endif
|
|
262
|
-
|
|
263
|
-
#endif
|
|
8
|
+
// TODO(kjlubick, robertphillips) migrate Chromium to use the new location and name
|
|
9
|
+
#include "include/private/chromium/GrSurfaceCharacterization.h" // IWYU pragma: export
|
|
10
|
+
|
|
11
|
+
class GrDeferredDisplayList;
|
|
12
|
+
class GrDeferredDisplayListRecorder;
|
|
13
|
+
using SkDeferredDisplayList = GrDeferredDisplayList;
|
|
14
|
+
using SkDeferredDisplayListRecorder = GrDeferredDisplayListRecorder;
|
|
15
|
+
using SkSurfaceCharacterization = GrSurfaceCharacterization;
|
|
@@ -0,0 +1,97 @@
|
|
|
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 SkTiledImageUtils_DEFINED
|
|
9
|
+
#define SkTiledImageUtils_DEFINED
|
|
10
|
+
|
|
11
|
+
#include "include/core/SkCanvas.h"
|
|
12
|
+
#include "include/core/SkImage.h"
|
|
13
|
+
#include "include/core/SkRect.h"
|
|
14
|
+
#include "include/core/SkRefCnt.h"
|
|
15
|
+
#include "include/core/SkSamplingOptions.h"
|
|
16
|
+
#include "include/core/SkScalar.h"
|
|
17
|
+
#include "include/private/base/SkAPI.h"
|
|
18
|
+
class SkPaint;
|
|
19
|
+
|
|
20
|
+
namespace SkTiledImageUtils {
|
|
21
|
+
|
|
22
|
+
SK_API void DrawImageRect(SkCanvas* canvas,
|
|
23
|
+
const SkImage* image,
|
|
24
|
+
const SkRect& src,
|
|
25
|
+
const SkRect& dst,
|
|
26
|
+
const SkSamplingOptions& sampling = {},
|
|
27
|
+
const SkPaint* paint = nullptr,
|
|
28
|
+
SkCanvas::SrcRectConstraint constraint =
|
|
29
|
+
SkCanvas::kFast_SrcRectConstraint);
|
|
30
|
+
|
|
31
|
+
inline void DrawImageRect(SkCanvas* canvas,
|
|
32
|
+
const sk_sp<SkImage>& image,
|
|
33
|
+
const SkRect& src,
|
|
34
|
+
const SkRect& dst,
|
|
35
|
+
const SkSamplingOptions& sampling = {},
|
|
36
|
+
const SkPaint* paint = nullptr,
|
|
37
|
+
SkCanvas::SrcRectConstraint constraint =
|
|
38
|
+
SkCanvas::kFast_SrcRectConstraint) {
|
|
39
|
+
DrawImageRect(canvas, image.get(), src, dst, sampling, paint, constraint);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
inline void DrawImageRect(SkCanvas* canvas,
|
|
43
|
+
const SkImage* image,
|
|
44
|
+
const SkRect& dst,
|
|
45
|
+
const SkSamplingOptions& sampling = {},
|
|
46
|
+
const SkPaint* paint = nullptr,
|
|
47
|
+
SkCanvas::SrcRectConstraint constraint =
|
|
48
|
+
SkCanvas::kFast_SrcRectConstraint) {
|
|
49
|
+
if (!image) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
SkRect src = SkRect::MakeIWH(image->width(), image->height());
|
|
54
|
+
|
|
55
|
+
DrawImageRect(canvas, image, src, dst, sampling, paint, constraint);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
inline void DrawImageRect(SkCanvas* canvas,
|
|
59
|
+
const sk_sp<SkImage>& image,
|
|
60
|
+
const SkRect& dst,
|
|
61
|
+
const SkSamplingOptions& sampling = {},
|
|
62
|
+
const SkPaint* paint = nullptr,
|
|
63
|
+
SkCanvas::SrcRectConstraint constraint =
|
|
64
|
+
SkCanvas::kFast_SrcRectConstraint) {
|
|
65
|
+
DrawImageRect(canvas, image.get(), dst, sampling, paint, constraint);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
inline void DrawImage(SkCanvas* canvas,
|
|
69
|
+
const SkImage* image,
|
|
70
|
+
SkScalar x, SkScalar y,
|
|
71
|
+
const SkSamplingOptions& sampling = {},
|
|
72
|
+
const SkPaint* paint = nullptr,
|
|
73
|
+
SkCanvas::SrcRectConstraint constraint =
|
|
74
|
+
SkCanvas::kFast_SrcRectConstraint) {
|
|
75
|
+
if (!image) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
SkRect src = SkRect::MakeIWH(image->width(), image->height());
|
|
80
|
+
SkRect dst = SkRect::MakeXYWH(x, y, image->width(), image->height());
|
|
81
|
+
|
|
82
|
+
DrawImageRect(canvas, image, src, dst, sampling, paint, constraint);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
inline void DrawImage(SkCanvas* canvas,
|
|
86
|
+
const sk_sp<SkImage>& image,
|
|
87
|
+
SkScalar x, SkScalar y,
|
|
88
|
+
const SkSamplingOptions& sampling = {},
|
|
89
|
+
const SkPaint* paint = nullptr,
|
|
90
|
+
SkCanvas::SrcRectConstraint constraint =
|
|
91
|
+
SkCanvas::kFast_SrcRectConstraint) {
|
|
92
|
+
DrawImage(canvas, image.get(), x, y, sampling, paint, constraint);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
} // namespace SkTiledImageUtils
|
|
96
|
+
|
|
97
|
+
#endif // SkTiledImageUtils_DEFINED
|
|
@@ -125,8 +125,10 @@
|
|
|
125
125
|
|
|
126
126
|
// The top-level define SK_ENABLE_OPTIMIZE_SIZE can be used to remove several large features at once
|
|
127
127
|
#if defined(SK_ENABLE_OPTIMIZE_SIZE)
|
|
128
|
-
#
|
|
129
|
-
#
|
|
128
|
+
#if !defined(SK_FORCE_RASTER_PIPELINE_BLITTER)
|
|
129
|
+
#define SK_FORCE_RASTER_PIPELINE_BLITTER
|
|
130
|
+
#endif
|
|
131
|
+
#define SK_DISABLE_SDF_TEXT
|
|
130
132
|
#endif
|
|
131
133
|
|
|
132
134
|
#ifndef SK_DISABLE_LEGACY_SHADERCONTEXT
|
|
@@ -23,8 +23,6 @@
|
|
|
23
23
|
#include <cstddef>
|
|
24
24
|
#include <tuple>
|
|
25
25
|
|
|
26
|
-
class GrImageContext;
|
|
27
|
-
|
|
28
26
|
/**
|
|
29
27
|
* SkYUVAInfo combined with per-plane SkColorTypes and row bytes. Fully specifies the SkPixmaps
|
|
30
28
|
* for a YUVA image without the actual pixel memory and data.
|
|
@@ -55,9 +53,6 @@ public:
|
|
|
55
53
|
/** Defaults to nothing supported. */
|
|
56
54
|
constexpr SupportedDataTypes() = default;
|
|
57
55
|
|
|
58
|
-
/** Init based on texture formats supported by the context. */
|
|
59
|
-
SupportedDataTypes(const GrImageContext&);
|
|
60
|
-
|
|
61
56
|
/** All legal combinations of PlaneConfig and DataType are supported. */
|
|
62
57
|
static constexpr SupportedDataTypes All();
|
|
63
58
|
|
|
@@ -8,10 +8,19 @@
|
|
|
8
8
|
#ifndef SkGradientShader_DEFINED
|
|
9
9
|
#define SkGradientShader_DEFINED
|
|
10
10
|
|
|
11
|
+
#include "include/core/SkColor.h"
|
|
11
12
|
#include "include/core/SkColorSpace.h"
|
|
13
|
+
#include "include/core/SkPoint.h"
|
|
12
14
|
#include "include/core/SkRefCnt.h"
|
|
13
|
-
#include "include/core/
|
|
15
|
+
#include "include/core/SkScalar.h"
|
|
16
|
+
#include "include/core/SkShader.h" // IWYU pragma: keep
|
|
14
17
|
#include "include/core/SkTileMode.h"
|
|
18
|
+
#include "include/private/base/SkAPI.h"
|
|
19
|
+
|
|
20
|
+
#include <cstdint>
|
|
21
|
+
#include <utility>
|
|
22
|
+
|
|
23
|
+
class SkMatrix;
|
|
15
24
|
|
|
16
25
|
/** \class SkGradientShader
|
|
17
26
|
|
|
@@ -56,23 +56,6 @@ public:
|
|
|
56
56
|
SkRect fCropRect;
|
|
57
57
|
};
|
|
58
58
|
|
|
59
|
-
/**
|
|
60
|
-
* Create a filter that updates the alpha of the image based on 'region'. Pixels inside the
|
|
61
|
-
* region are made more opaque and pixels outside are made more transparent.
|
|
62
|
-
*
|
|
63
|
-
* Specifically, if a pixel is inside the region, its alpha will be set to
|
|
64
|
-
* max(innerMin, pixel's alpha). If a pixel is outside the region, its alpha will be updated to
|
|
65
|
-
* min(outerMax, pixel's alpha).
|
|
66
|
-
* @param region The geometric region controlling the inner and outer alpha thresholds.
|
|
67
|
-
* @param innerMin The minimum alpha value for pixels inside 'region'.
|
|
68
|
-
* @param outerMax The maximum alpha value for pixels outside of 'region'.
|
|
69
|
-
* @param input The input filter, or uses the source bitmap if this is null.
|
|
70
|
-
* @param cropRect Optional rectangle that crops the input and output.
|
|
71
|
-
*/
|
|
72
|
-
static sk_sp<SkImageFilter> AlphaThreshold(const SkRegion& region, SkScalar innerMin,
|
|
73
|
-
SkScalar outerMax, sk_sp<SkImageFilter> input,
|
|
74
|
-
const CropRect& cropRect = {});
|
|
75
|
-
|
|
76
59
|
/**
|
|
77
60
|
* Create a filter that implements a custom blend mode. Each output pixel is the result of
|
|
78
61
|
* combining the corresponding background and foreground pixels using the 4 coefficients:
|
|
@@ -198,7 +181,9 @@ public:
|
|
|
198
181
|
|
|
199
182
|
/**
|
|
200
183
|
* Create a filter that draws the 'srcRect' portion of image into 'dstRect' using the given
|
|
201
|
-
* filter quality. Similar to SkCanvas::drawImageRect.
|
|
184
|
+
* filter quality. Similar to SkCanvas::drawImageRect. The returned image filter evaluates
|
|
185
|
+
* to transparent black if 'image' is null.
|
|
186
|
+
*
|
|
202
187
|
* @param image The image that is output by the filter, subset by 'srcRect'.
|
|
203
188
|
* @param srcRect The source pixels sampled into 'dstRect'
|
|
204
189
|
* @param dstRect The local rectangle to draw the image into.
|
|
@@ -209,7 +194,9 @@ public:
|
|
|
209
194
|
|
|
210
195
|
/**
|
|
211
196
|
* Create a filter that draws the image using the given sampling.
|
|
212
|
-
* Similar to SkCanvas::drawImage.
|
|
197
|
+
* Similar to SkCanvas::drawImage. The returned image filter evaluates to transparent black if
|
|
198
|
+
* 'image' is null.
|
|
199
|
+
*
|
|
213
200
|
* @param image The image that is output by the filter.
|
|
214
201
|
* @param sampling The sampling to use when drawing the image.
|
|
215
202
|
*/
|
|
@@ -223,21 +210,19 @@ public:
|
|
|
223
210
|
}
|
|
224
211
|
|
|
225
212
|
/**
|
|
226
|
-
* Create a filter that
|
|
227
|
-
*
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
*/
|
|
240
|
-
static sk_sp<SkImageFilter> Magnifier(const SkRect& srcRect, SkScalar inset,
|
|
213
|
+
* Create a filter that fills 'lensBounds' with a magnification of the input.
|
|
214
|
+
*
|
|
215
|
+
* @param lensBounds The outer bounds of the magnifier effect
|
|
216
|
+
* @param zoomAmount The amount of magnification applied to the input image
|
|
217
|
+
* @param inset The size or width of the fish-eye distortion around the magnified content
|
|
218
|
+
* @param sampling The SkSamplingOptions applied to the input image when magnified
|
|
219
|
+
* @param input The input filter that is magnified; if null the source bitmap is used
|
|
220
|
+
* @param cropRect Optional rectangle that crops the input and output.
|
|
221
|
+
*/
|
|
222
|
+
static sk_sp<SkImageFilter> Magnifier(const SkRect& lensBounds,
|
|
223
|
+
SkScalar zoomAmount,
|
|
224
|
+
SkScalar inset,
|
|
225
|
+
const SkSamplingOptions& sampling,
|
|
241
226
|
sk_sp<SkImageFilter> input,
|
|
242
227
|
const CropRect& cropRect = {});
|
|
243
228
|
|
|
@@ -311,9 +296,11 @@ public:
|
|
|
311
296
|
const CropRect& cropRect = {});
|
|
312
297
|
|
|
313
298
|
/**
|
|
314
|
-
* Create a filter that produces the SkPicture as its output,
|
|
315
|
-
* the
|
|
316
|
-
*
|
|
299
|
+
* Create a filter that produces the SkPicture as its output, clipped to both 'targetRect' and
|
|
300
|
+
* the picture's internal cull rect.
|
|
301
|
+
*
|
|
302
|
+
* If 'pic' is null, the returned image filter produces transparent black.
|
|
303
|
+
*
|
|
317
304
|
* @param pic The picture that is drawn for the filter output.
|
|
318
305
|
* @param targetRect The drawing region for the picture.
|
|
319
306
|
*/
|
|
@@ -330,6 +317,9 @@ public:
|
|
|
330
317
|
* by the SkRuntimeShaderBuilder. The shader is defined in the image filter's local coordinate
|
|
331
318
|
* system, so it will automatically be affected by SkCanvas' transform.
|
|
332
319
|
*
|
|
320
|
+
* This variant assumes that the runtime shader samples 'childShaderName' with the same input
|
|
321
|
+
* coordinate passed to to shader.
|
|
322
|
+
*
|
|
333
323
|
* @param builder The builder used to produce the runtime shader, that will in turn
|
|
334
324
|
* fill the result image
|
|
335
325
|
* @param childShaderName The name of the child shader defined in the builder that will be
|
|
@@ -340,6 +330,22 @@ public:
|
|
|
340
330
|
* shader. If null the implicit source image is used instead
|
|
341
331
|
*/
|
|
342
332
|
static sk_sp<SkImageFilter> RuntimeShader(const SkRuntimeShaderBuilder& builder,
|
|
333
|
+
std::string_view childShaderName,
|
|
334
|
+
sk_sp<SkImageFilter> input) {
|
|
335
|
+
return RuntimeShader(builder, /*sampleRadius=*/0.f, childShaderName, std::move(input));
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
/**
|
|
339
|
+
* As above, but 'sampleRadius' defines the sampling radius of 'childShaderName' relative to
|
|
340
|
+
* the runtime shader produced by 'builder'. If greater than 0, the coordinate passed to
|
|
341
|
+
* childShader.eval() will be up to 'sampleRadius' away (maximum absolute offset in 'x' or 'y')
|
|
342
|
+
* from the coordinate passed into the runtime shader.
|
|
343
|
+
*
|
|
344
|
+
* This allows Skia to provide sampleable values for the image filter without worrying about
|
|
345
|
+
* boundary conditions.
|
|
346
|
+
*/
|
|
347
|
+
static sk_sp<SkImageFilter> RuntimeShader(const SkRuntimeShaderBuilder& builder,
|
|
348
|
+
SkScalar sampleRadius,
|
|
343
349
|
std::string_view childShaderName,
|
|
344
350
|
sk_sp<SkImageFilter> input);
|
|
345
351
|
|
|
@@ -359,6 +365,22 @@ public:
|
|
|
359
365
|
* @param inputCount How many entries are present in 'childShaderNames' and 'inputs'.
|
|
360
366
|
*/
|
|
361
367
|
static sk_sp<SkImageFilter> RuntimeShader(const SkRuntimeShaderBuilder& builder,
|
|
368
|
+
std::string_view childShaderNames[],
|
|
369
|
+
const sk_sp<SkImageFilter> inputs[],
|
|
370
|
+
int inputCount) {
|
|
371
|
+
return RuntimeShader(builder, /*maxSampleRadius=*/0.f, childShaderNames,
|
|
372
|
+
inputs, inputCount);
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
/**
|
|
376
|
+
* As above, but 'maxSampleRadius' defines the sampling limit on coordinates provided to all
|
|
377
|
+
* child shaders. Like the single-child variant with a sample radius, this can be used to
|
|
378
|
+
* inform Skia that the runtime shader guarantees that all dynamic children (defined in
|
|
379
|
+
* childShaderNames) will be evaluated with coordinates at most 'maxSampleRadius' away from the
|
|
380
|
+
* coordinate provided to the runtime shader itself.
|
|
381
|
+
*/
|
|
382
|
+
static sk_sp<SkImageFilter> RuntimeShader(const SkRuntimeShaderBuilder& builder,
|
|
383
|
+
SkScalar maxSampleRadius,
|
|
362
384
|
std::string_view childShaderNames[],
|
|
363
385
|
const sk_sp<SkImageFilter> inputs[],
|
|
364
386
|
int inputCount);
|
|
@@ -377,6 +399,9 @@ public:
|
|
|
377
399
|
* Like Image() and Picture(), this is a leaf filter that can be used to introduce inputs to
|
|
378
400
|
* a complex filter graph, but should generally be combined with a filter that as at least
|
|
379
401
|
* one null input to use the implicit source image.
|
|
402
|
+
*
|
|
403
|
+
* Returns an image filter that evaluates to transparent black if 'shader' is null.
|
|
404
|
+
*
|
|
380
405
|
* @param shader The shader that fills the result image
|
|
381
406
|
*/
|
|
382
407
|
static sk_sp<SkImageFilter> Shader(sk_sp<SkShader> shader, const CropRect& cropRect = {}) {
|
|
@@ -8,7 +8,12 @@
|
|
|
8
8
|
#ifndef SkPerlinNoiseShader_DEFINED
|
|
9
9
|
#define SkPerlinNoiseShader_DEFINED
|
|
10
10
|
|
|
11
|
-
#include "include/core/
|
|
11
|
+
#include "include/core/SkRefCnt.h"
|
|
12
|
+
#include "include/core/SkScalar.h"
|
|
13
|
+
#include "include/core/SkShader.h" // IWYU pragma: keep
|
|
14
|
+
#include "include/private/base/SkAPI.h"
|
|
15
|
+
|
|
16
|
+
struct SkISize;
|
|
12
17
|
|
|
13
18
|
/** \class SkPerlinNoiseShader
|
|
14
19
|
|
|
@@ -22,33 +27,27 @@
|
|
|
22
27
|
The algorithm used is described here :
|
|
23
28
|
http://www.w3.org/TR/SVG/filters.html#feTurbulenceElement
|
|
24
29
|
*/
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
static void RegisterFlattenables();
|
|
49
|
-
|
|
50
|
-
private:
|
|
51
|
-
SkPerlinNoiseShader() = delete;
|
|
52
|
-
};
|
|
30
|
+
namespace SkShaders {
|
|
31
|
+
/**
|
|
32
|
+
* This will construct Perlin noise of the given type (Fractal Noise or Turbulence).
|
|
33
|
+
*
|
|
34
|
+
* Both base frequencies (X and Y) have a usual range of (0..1) and must be non-negative.
|
|
35
|
+
*
|
|
36
|
+
* The number of octaves provided should be fairly small, with a limit of 255 enforced.
|
|
37
|
+
* Each octave doubles the frequency, so 10 octaves would produce noise from
|
|
38
|
+
* baseFrequency * 1, * 2, * 4, ..., * 512, which quickly yields insignificantly small
|
|
39
|
+
* periods and resembles regular unstructured noise rather than Perlin noise.
|
|
40
|
+
*
|
|
41
|
+
* If tileSize isn't NULL or an empty size, the tileSize parameter will be used to modify
|
|
42
|
+
* the frequencies so that the noise will be tileable for the given tile size. If tileSize
|
|
43
|
+
* is NULL or an empty size, the frequencies will be used as is without modification.
|
|
44
|
+
*/
|
|
45
|
+
SK_API sk_sp<SkShader> MakeFractalNoise(SkScalar baseFrequencyX, SkScalar baseFrequencyY,
|
|
46
|
+
int numOctaves, SkScalar seed,
|
|
47
|
+
const SkISize* tileSize = nullptr);
|
|
48
|
+
SK_API sk_sp<SkShader> MakeTurbulence(SkScalar baseFrequencyX, SkScalar baseFrequencyY,
|
|
49
|
+
int numOctaves, SkScalar seed,
|
|
50
|
+
const SkISize* tileSize = nullptr);
|
|
51
|
+
} // namespace SkShaders
|
|
53
52
|
|
|
54
53
|
#endif
|