-
Notifications
You must be signed in to change notification settings - Fork 511
feat: add MakeTextureFromImage #2637
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
7199f12
cf5fe4b
3ea5d78
a3f96de
3d18ff7
ac1172f
b0031dc
f753b02
7a23c3b
41c051a
be6efa1
c685193
64965bf
f84e80d
84a9fc8
3eb7f24
970fe0d
e0c1f6e
6ef1296
2d2764b
fc707b2
9f00adf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -199,6 +199,14 @@ class JsiSkImage : public JsiSkWrappingSkPtrHostObject<SkImage> { | |
runtime, std::make_shared<JsiSkImage>(getContext(), rasterImage)); | ||
} | ||
|
||
JSI_HOST_FUNCTION(isTextureBacked) { | ||
return static_cast<bool>(getObject()->isTextureBacked()); | ||
} | ||
|
||
JSI_HOST_FUNCTION(textureSize) { | ||
return static_cast<double>(getObject()->textureSize()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What does this do? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Usefull to have an idea how much memory your textures use. In the future, we could allow users to configure skia memory cache size so you can then calculate also for each texture the pressure and also call purge when you need. For now added it so we can collect info on how much GPU memory we used by our textures. |
||
} | ||
|
||
EXPORT_JSI_API_TYPENAME(JsiSkImage, Image) | ||
|
||
JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiSkImage, width), | ||
|
@@ -210,6 +218,8 @@ class JsiSkImage : public JsiSkWrappingSkPtrHostObject<SkImage> { | |
JSI_EXPORT_FUNC(JsiSkImage, encodeToBase64), | ||
JSI_EXPORT_FUNC(JsiSkImage, readPixels), | ||
JSI_EXPORT_FUNC(JsiSkImage, makeNonTextureImage), | ||
JSI_EXPORT_FUNC(JsiSkImage, isTextureBacked), | ||
JSI_EXPORT_FUNC(JsiSkImage, textureSize), | ||
JSI_EXPORT_FUNC(JsiSkImage, dispose)) | ||
|
||
JsiSkImage(std::shared_ptr<RNSkPlatformContext> context, | ||
|
Uh oh!
There was an error while loading. Please reload this page.