!11393 修复创建surface后未判空导致的空指针问题

Merge pull request !11393 from Liu Yongwei/dev_0523
This commit is contained in:
openharmony_ci 2024-05-23 11:03:46 +00:00 committed by Gitee
commit c52a8c510e
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -240,6 +240,10 @@ void RSFilterCacheManager::GenerateFilteredSnapshot(
// Create an offscreen canvas with the same size as the filter region.
auto offscreenRect = dstRect;
auto offscreenSurface = surface->MakeSurface(offscreenRect.GetWidth(), offscreenRect.GetHeight());
if (offscreenSurface == nullptr) {
RS_LOGD("RSFilterCacheManager::GenerateFilteredSnapshot offscreenSurface is nullptr");
return;
}
RSPaintFilterCanvas offscreenCanvas(offscreenSurface.get());
// Src rect and dst rect, with origin at (0, 0).