mirror of
https://gitee.com/openharmony/arkui_ace_engine
synced 2024-11-23 15:10:30 +00:00
[DrawableDescriptor]Fix use ptr befor which can be nullptr.
Signed-off-by: Zhang Jinyu <zhangjinyu101@huawei.com> Change-Id: I1b3e6160cd07a224f81e717a7cbf4166bf149233 Signed-off-by: Zhang Jinyu <zhangjinyu101@huawei.com>
This commit is contained in:
parent
294ceb8b7d
commit
833811327b
@ -468,6 +468,10 @@ Rosen::Drawing::ImageInfo LayeredDrawableDescriptor::CreateRSImageInfo(
|
||||
void LayeredDrawableDescriptor::CompositeIconAdaptive(std::shared_ptr<Rosen::Drawing::Bitmap>& foreground,
|
||||
std::shared_ptr<Rosen::Drawing::Bitmap>& background, std::shared_ptr<Rosen::Drawing::Bitmap>& mask)
|
||||
{
|
||||
if (!background) {
|
||||
HILOGW("The background is null when adaptive composite icons are used.");
|
||||
return;
|
||||
}
|
||||
Rosen::Drawing::Brush brush;
|
||||
brush.SetAntiAlias(true);
|
||||
Rosen::Drawing::ImageInfo imageInfo =
|
||||
@ -484,11 +488,12 @@ void LayeredDrawableDescriptor::CompositeIconAdaptive(std::shared_ptr<Rosen::Dra
|
||||
bitmapCanvas.DetachBrush();
|
||||
}
|
||||
|
||||
Rosen::Drawing::Rect srcRect(0.0, 0.0, static_cast<float>(mask->GetWidth()), static_cast<float>(mask->GetHeight()));
|
||||
Rosen::Drawing::Rect dstRect(
|
||||
0.0, 0.0, static_cast<float>(background->GetWidth()), static_cast<float>(background->GetHeight()));
|
||||
Rosen::Drawing::Image image;
|
||||
if (mask) {
|
||||
Rosen::Drawing::Rect srcRect(
|
||||
0.0, 0.0, static_cast<float>(mask->GetWidth()), static_cast<float>(mask->GetHeight()));
|
||||
image.BuildFromBitmap(*mask);
|
||||
brush.SetBlendMode(Rosen::Drawing::BlendMode::DST_ATOP);
|
||||
bitmapCanvas.AttachBrush(brush);
|
||||
|
Loading…
Reference in New Issue
Block a user