mirror of
https://gitee.com/openharmony/multimedia_image_framework
synced 2024-11-23 06:59:52 +00:00
!2503 同步 PixelMap 相关(YUV、HDR 除外)代码差异
Merge pull request !2503 from 陈乔异/cqy/b-y-diff
This commit is contained in:
commit
7d7e0b9add
@ -550,9 +550,11 @@ napi_value PixelMapNapi::Init(napi_env env, napi_value exports)
|
||||
DECLARE_NAPI_STATIC_FUNCTION("createPixelMapSync", CreatePixelMapSync),
|
||||
DECLARE_NAPI_STATIC_FUNCTION("unmarshalling", Unmarshalling),
|
||||
DECLARE_NAPI_STATIC_FUNCTION(CREATE_PIXEL_MAP_FROM_PARCEL.c_str(), CreatePixelMapFromParcel),
|
||||
#if !defined(IOS_PLATFORM) && !defined(ANDROID_PLATFORM)
|
||||
DECLARE_NAPI_STATIC_FUNCTION("createPixelMapFromSurface", CreatePixelMapFromSurface),
|
||||
DECLARE_NAPI_STATIC_FUNCTION("createPixelMapFromSurfaceSync", CreatePixelMapFromSurfaceSync),
|
||||
DECLARE_NAPI_STATIC_FUNCTION("convertPixelFormat", ConvertPixelMapFormat),
|
||||
#endif
|
||||
DECLARE_NAPI_PROPERTY("AntiAliasingLevel",
|
||||
CreateEnumTypeObject(env, napi_number, &AntiAliasingLevel_, AntiAliasingLevelMap)),
|
||||
DECLARE_NAPI_PROPERTY("HdrMetadataKey",
|
||||
@ -4127,6 +4129,7 @@ static napi_status BuildHdrMetadataValue(napi_env env, napi_value argv[],
|
||||
HDRVividExtendMetadata &gainmapMetadata =
|
||||
*(reinterpret_cast<HDRVividExtendMetadata*>(gainmapData.data()));
|
||||
metadataValue = BuildDynamicMetadataNapi(env, gainmapMetadata);
|
||||
return napi_ok;
|
||||
}
|
||||
IMAGE_LOGE("GetSbDynamicMetadata failed");
|
||||
}
|
||||
@ -4169,7 +4172,7 @@ static HdrMetadataType ParseHdrMetadataType(napi_env env, napi_value &hdrMetadat
|
||||
{
|
||||
uint32_t type = 0;
|
||||
napi_get_value_uint32(env, hdrMetadataType, &type);
|
||||
if (type < static_cast<int32_t>(HdrMetadataType::INVALID) && type >= HdrMetadataType::NONE) {
|
||||
if (type < HdrMetadataType::INVALID && type >= HdrMetadataType::NONE) {
|
||||
return HdrMetadataType(type);
|
||||
}
|
||||
return HdrMetadataType::INVALID;
|
||||
|
@ -38,7 +38,6 @@ ohos_shared_library("pixelmap_ndk") {
|
||||
|
||||
deps = [ "$SUBSYSTEM_DIR/interfaces/kits/js/common:image" ]
|
||||
external_deps = [
|
||||
"c_utils:utils",
|
||||
"graphic_2d:color_manager",
|
||||
"napi:ace_napi",
|
||||
]
|
||||
|
@ -24,7 +24,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
struct NativePixelMap_ {
|
||||
OHOS::Media::PixelMapNapi* napi = nullptr;
|
||||
PixelMapNapi* napi = nullptr;
|
||||
};
|
||||
|
||||
MIDK_EXPORT
|
||||
@ -271,6 +271,7 @@ int32_t OH_PixelMap_UnAccessPixels(const NativePixelMap* native)
|
||||
PixelMapNapiArgs args;
|
||||
return PixelMapNapiNativeCtxCall(CTX_FUNC_UNACCESS_PIXELS, native->napi, &args);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
@ -31,7 +31,7 @@
|
||||
#define LOG_DOMAIN LOG_TAG_DOMAIN_ID_IMAGE
|
||||
|
||||
#undef LOG_TAG
|
||||
#define LOG_TAG "SendablePixelMapNapi yzp"
|
||||
#define LOG_TAG "SendablePixelMapNapi"
|
||||
|
||||
namespace {
|
||||
constexpr uint32_t NUM_0 = 0;
|
||||
|
@ -366,7 +366,7 @@ protected:
|
||||
static bool BGRA8888ToARGB(const uint8_t *in, uint32_t inCount, uint32_t *out, uint32_t outCount);
|
||||
static bool RGB888ToARGB(const uint8_t *in, uint32_t inCount, uint32_t *out, uint32_t outCount);
|
||||
static bool CheckParams(const uint32_t *colors, uint32_t colorLength, int32_t offset, int32_t stride,
|
||||
const InitializationOptions &opts);
|
||||
const InitializationOptions &opts);
|
||||
static void UpdatePixelsAlpha(const AlphaType &alphaType, const PixelFormat &pixelFormat, uint8_t *dstPixels,
|
||||
PixelMap &dstPixelMap);
|
||||
static void InitDstImageInfo(const InitializationOptions &opts, const ImageInfo &srcImageInfo,
|
||||
@ -375,7 +375,7 @@ protected:
|
||||
static bool CopyPixelMap(PixelMap &source, PixelMap &dstPixelMap, int32_t &error);
|
||||
static bool CopyPixelMap(PixelMap &source, PixelMap &dstPixelMap);
|
||||
static bool SourceCropAndConvert(PixelMap &source, const ImageInfo &srcImageInfo, const ImageInfo &dstImageInfo,
|
||||
const Rect &srcRect, PixelMap &dstPixelMap);
|
||||
const Rect &srcRect, PixelMap &dstPixelMap);
|
||||
static bool IsSameSize(const Size &src, const Size &dst);
|
||||
static bool ScalePixelMap(const Size &targetSize, const Size &dstSize, const ScaleMode &scaleMode,
|
||||
PixelMap &dstPixelMap);
|
||||
|
@ -34,6 +34,7 @@ public:
|
||||
static std::shared_ptr<PixelMap> GetSendablePixelMap(napi_env env, napi_value pixelmap);
|
||||
void ReleasePixelNapiInner()
|
||||
{
|
||||
std::unique_lock<std::shared_mutex> lock(mutex_);
|
||||
setPixelNapiEditable(false);
|
||||
nativePixelMap_ = nullptr;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user