@shopify/react-native-skia 2.6.8 → 2.6.9
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.
|
@@ -119,27 +119,34 @@ public:
|
|
|
119
119
|
AHardwareBuffer_Desc description;
|
|
120
120
|
AHardwareBuffer_describe(hardwareBuffer, &description);
|
|
121
121
|
GrBackendFormat format;
|
|
122
|
+
auto colorType = kRGBA_8888_SkColorType;
|
|
122
123
|
switch (description.format) {
|
|
123
124
|
// TODO: find out if we can detect, which graphic buffers support
|
|
124
125
|
// GR_GL_TEXTURE_2D
|
|
125
126
|
case AHARDWAREBUFFER_FORMAT_R8G8B8A8_UNORM:
|
|
126
127
|
format = GrBackendFormats::MakeGL(GR_GL_RGBA8, GR_GL_TEXTURE_EXTERNAL);
|
|
128
|
+
colorType = kRGBA_8888_SkColorType;
|
|
127
129
|
break;
|
|
128
130
|
case AHARDWAREBUFFER_FORMAT_R16G16B16A16_FLOAT:
|
|
129
131
|
format = GrBackendFormats::MakeGL(GR_GL_RGBA16F, GR_GL_TEXTURE_EXTERNAL);
|
|
132
|
+
colorType = kRGBA_F16_SkColorType;
|
|
130
133
|
break;
|
|
131
134
|
case AHARDWAREBUFFER_FORMAT_R5G6B5_UNORM:
|
|
132
|
-
GrBackendFormats::MakeGL(GR_GL_RGB565, GR_GL_TEXTURE_EXTERNAL);
|
|
135
|
+
format = GrBackendFormats::MakeGL(GR_GL_RGB565, GR_GL_TEXTURE_EXTERNAL);
|
|
136
|
+
colorType = kRGB_565_SkColorType;
|
|
133
137
|
break;
|
|
134
138
|
case AHARDWAREBUFFER_FORMAT_R10G10B10A2_UNORM:
|
|
135
139
|
format = GrBackendFormats::MakeGL(GR_GL_RGB10_A2, GR_GL_TEXTURE_EXTERNAL);
|
|
140
|
+
colorType = kRGBA_1010102_SkColorType;
|
|
136
141
|
break;
|
|
137
142
|
case AHARDWAREBUFFER_FORMAT_R8G8B8_UNORM:
|
|
138
143
|
format = GrBackendFormats::MakeGL(GR_GL_RGB8, GR_GL_TEXTURE_EXTERNAL);
|
|
144
|
+
colorType = kRGB_888x_SkColorType;
|
|
139
145
|
break;
|
|
140
146
|
#if __ANDROID_API__ >= 33
|
|
141
147
|
case AHARDWAREBUFFER_FORMAT_R8_UNORM:
|
|
142
148
|
format = GrBackendFormats::MakeGL(GR_GL_R8, GR_GL_TEXTURE_EXTERNAL);
|
|
149
|
+
colorType = kAlpha_8_SkColorType;
|
|
143
150
|
break;
|
|
144
151
|
#endif
|
|
145
152
|
default:
|
|
@@ -161,9 +168,8 @@ public:
|
|
|
161
168
|
return nullptr;
|
|
162
169
|
}
|
|
163
170
|
sk_sp<SkImage> image = SkImages::BorrowTextureFrom(
|
|
164
|
-
_directContext.get(), backendTex, kTopLeft_GrSurfaceOrigin,
|
|
165
|
-
|
|
166
|
-
deleteImageCtx);
|
|
171
|
+
_directContext.get(), backendTex, kTopLeft_GrSurfaceOrigin, colorType,
|
|
172
|
+
kOpaque_SkAlphaType, nullptr, deleteImageProc, deleteImageCtx);
|
|
167
173
|
return image;
|
|
168
174
|
#else
|
|
169
175
|
throw std::runtime_error(
|
|
@@ -105,6 +105,8 @@ SkiaCVPixelBufferUtils::getCVPixelBufferBaseFormat(
|
|
|
105
105
|
case kCVPixelFormatType_32BGRA:
|
|
106
106
|
case kCVPixelFormatType_32ABGR:
|
|
107
107
|
case kCVPixelFormatType_32RGBA:
|
|
108
|
+
// 16-bit half-float RGBA
|
|
109
|
+
case kCVPixelFormatType_64RGBAHalf:
|
|
108
110
|
return CVPixelBufferBaseFormat::rgb;
|
|
109
111
|
default:
|
|
110
112
|
[[unlikely]] throw std::runtime_error(
|
|
@@ -125,6 +127,8 @@ SkColorType SkiaCVPixelBufferUtils::RGB::getCVPixelBufferColorType(
|
|
|
125
127
|
[[likely]] return kBGRA_8888_SkColorType;
|
|
126
128
|
case kCVPixelFormatType_32RGBA:
|
|
127
129
|
return kRGBA_8888_SkColorType;
|
|
130
|
+
case kCVPixelFormatType_64RGBAHalf:
|
|
131
|
+
return kRGBA_F16_SkColorType;
|
|
128
132
|
// This can be extended with branches for specific RGB formats if Apple
|
|
129
133
|
// uses new formats.
|
|
130
134
|
default:
|
|
@@ -444,6 +448,12 @@ MTLPixelFormat SkiaCVPixelBufferUtils::getMTLPixelFormatForCVPixelBufferPlane(
|
|
|
444
448
|
return throwInvalidPlaneIndexForFormat(1);
|
|
445
449
|
}
|
|
446
450
|
return MTLPixelFormatRGBA8Unorm;
|
|
451
|
+
case kCVPixelFormatType_64RGBAHalf:
|
|
452
|
+
// 1 plane, 16-bit half-float interleaved RGBA.
|
|
453
|
+
if (planeIndex != 0) {
|
|
454
|
+
return throwInvalidPlaneIndexForFormat(1);
|
|
455
|
+
}
|
|
456
|
+
return MTLPixelFormatRGBA16Float;
|
|
447
457
|
case kCVPixelFormatType_420YpCbCr8Planar:
|
|
448
458
|
case kCVPixelFormatType_420YpCbCr8PlanarFullRange:
|
|
449
459
|
// 3 planes, 8-bit 4:2:0 planar (Y, U, V), each plane is single channel.
|
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"setup-skia-web": "scripts/setup-canvaskit.js"
|
|
9
9
|
},
|
|
10
10
|
"title": "React Native Skia",
|
|
11
|
-
"version": "2.6.
|
|
11
|
+
"version": "2.6.9",
|
|
12
12
|
"description": "High-performance React Native Graphics using Skia",
|
|
13
13
|
"main": "lib/module/index.js",
|
|
14
14
|
"react-native": "src/index.ts",
|