mirror of
https://gitee.com/openharmony/arkui_ace_engine
synced 2024-11-27 09:12:41 +00:00
commit
c7a4fabb6e
@ -1650,16 +1650,16 @@ public:
|
||||
void OnSurfaceCapture(std::shared_ptr<Media::PixelMap> pixelMap) override
|
||||
{
|
||||
if (pixelMap) {
|
||||
std::unique_lock<std::mutex> lock(g_mutex);
|
||||
#ifdef PIXEL_MAP_SUPPORTED
|
||||
g_pixelMap = PixelMap::CreatePixelMap(reinterpret_cast<void*>(&pixelMap));
|
||||
#endif // PIXEL_MAP_SUPPORTED
|
||||
} else {
|
||||
g_pixelMap = nullptr;
|
||||
TAG_LOGW(AceLogTag::ACE_DRAG, "get drag thumbnail pixelMap failed!");
|
||||
TAG_LOGE(AceLogTag::ACE_DRAG, "get thumbnail pixelMap failed!");
|
||||
}
|
||||
|
||||
if (callback_ == nullptr) {
|
||||
std::unique_lock<std::mutex> lock(g_mutex);
|
||||
thumbnailGet.notify_all();
|
||||
return;
|
||||
}
|
||||
@ -1684,10 +1684,12 @@ RefPtr<PixelMap> RosenRenderContext::GetThumbnailPixelMap(bool needScale)
|
||||
auto ret =
|
||||
RSInterfaces::GetInstance().TakeSurfaceCaptureForUI(rsNode_, drawDragThumbnailCallback, scaleX, scaleY, true);
|
||||
if (!ret) {
|
||||
LOGE("TakeSurfaceCaptureForUI failed!");
|
||||
return nullptr;
|
||||
}
|
||||
std::unique_lock<std::mutex> lock(g_mutex);
|
||||
if (thumbnailGet.wait_for(lock, PIXELMAP_TIMEOUT_DURATION) == std::cv_status::timeout) {
|
||||
LOGE("get thumbnail pixelMap timeout!");
|
||||
return nullptr;
|
||||
}
|
||||
return g_pixelMap;
|
||||
|
Loading…
Reference in New Issue
Block a user