mirror of
https://gitee.com/openharmony/arkui_ace_engine
synced 2024-11-23 07:01:24 +00:00
fixDrawablePixelMap
Signed-off-by: hw_wyx <wuyinxiao@huawei.com> Change-Id: I904ceb5e7c5f7ca2782cb812eee05ed38d858856
This commit is contained in:
parent
f05cbcae32
commit
bd570756e3
@ -16,6 +16,7 @@
|
||||
#include "image_converter.h"
|
||||
|
||||
#include "drawable_descriptor_log.h"
|
||||
#include "securec.h"
|
||||
#ifndef PREVIEW
|
||||
#include "image_utils.h"
|
||||
#include "platform/image_native/image_type.h"
|
||||
@ -139,12 +140,17 @@ std::shared_ptr<Media::PixelMap> ImageConverter::BitmapToPixelMap(
|
||||
auto data = bitMap->GetPixels();
|
||||
opts.size.width = static_cast<int32_t>(bitMap->GetWidth());
|
||||
opts.size.height = static_cast<int32_t>(bitMap->GetHeight());
|
||||
auto pixelMap = Media::PixelMap::Create(reinterpret_cast<uint32_t*>(data),
|
||||
opts.size.width * opts.size.height, opts);
|
||||
opts.editable = false;
|
||||
auto pixelMap = Media::PixelMap::Create(opts);
|
||||
if (!pixelMap) {
|
||||
HILOGE("PixelMap is null, bitMap's Size = (%{public}d, %{public}d)", bitMap->GetWidth(), bitMap->GetHeight());
|
||||
return pixelMap;
|
||||
}
|
||||
auto dstAddr = pixelMap->GetWritablePixels();
|
||||
if (memcpy_s(dstAddr, pixelMap->GetByteCount(), data, pixelMap->GetByteCount()) != 0) {
|
||||
HILOGE("PixelMap write fail");
|
||||
return nullptr;
|
||||
}
|
||||
return pixelMap;
|
||||
}
|
||||
#endif
|
||||
|
@ -113,6 +113,21 @@ public:
|
||||
return 0;
|
||||
}
|
||||
|
||||
void* GetWritablePixels()
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int32_t GetByteCount()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static std::unique_ptr<PixelMap> Create(const InitializationOptions& opts)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static std::unique_ptr<PixelMap> Create(
|
||||
const uint32_t* colors, uint32_t colorLength, const InitializationOptions& opts)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user