From e1676851d06305ace65fa88de40a1957553c78a9 Mon Sep 17 00:00:00 2001 From: swx1094762 Date: Wed, 8 Feb 2023 09:08:58 +0800 Subject: [PATCH] =?UTF-8?q?fixed=2091acf84=20from=20https://gitee.com/shi-?= =?UTF-8?q?qichang/graphic=5Fui/pulls/880=20issuesno:#I6DKYS=20Description?= =?UTF-8?q?:=E5=91=BC=E5=90=B8=E6=9C=BA=E6=AD=BB=E6=9C=BA=20Sig:SIG=5FAppl?= =?UTF-8?q?icationFramework=20Feature=20or=20Bugfix:Feature=20Binary=20Sou?= =?UTF-8?q?rce:NO?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: swx1094762 --- frameworks/draw/draw_utils.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/frameworks/draw/draw_utils.cpp b/frameworks/draw/draw_utils.cpp index 4a48733..bc3015d 100644 --- a/frameworks/draw/draw_utils.cpp +++ b/frameworks/draw/draw_utils.cpp @@ -1900,12 +1900,17 @@ void DrawUtils::AddBorderToImageData(TransformDataInfo& newDataInfo) if ((width * newDataInfo.pxSize) % FONT_WEIGHT_8 != 0) { widthInByte++; } - uint8_t* newData = static_cast(UIMalloc(widthInByte * height)); + ImageInfo imageinfo; + imageinfo.header.width = newDataInfo.header.width; + imageinfo.header.height = newDataInfo.header.height; + imageinfo.dataSize = widthInByte * height; + uint8_t* newData = static_cast(ImageCacheMalloc(imageinfo)); if (newData == nullptr) { return; } + imageinfo.data = newData; if (memset_s(newData, widthInByte * height, 0, widthInByte * height) != EOK) { - UIFree(static_cast(newData)); + ImageCacheFree(imageinfo); newData = nullptr; return; } @@ -1915,7 +1920,7 @@ void DrawUtils::AddBorderToImageData(TransformDataInfo& newDataInfo) for (int i = 0; i < newDataInfo.header.height; ++i) { // 2 : double if (memcpy_s(tmp, widthInByte - diff * 2, data, widthInByte - diff * 2) != EOK) { - UIFree(static_cast(newData)); + ImageCacheFree(imageinfo); newData = nullptr; return; } @@ -1993,9 +1998,11 @@ void DrawUtils::DrawTransform(BufferInfo& gfxDstBuffer, Rect trans = newTransMap.GetBoxRect(); trans.SetX(trans.GetX() + position.x); trans.SetY(trans.GetY() + position.y); + ImageInfo imageinfo; + imageinfo.data = newDataInfo.data; if (!trans.Intersect(trans, mask)) { if (newDataInfo.data != dataInfo.data) { - UIFree(reinterpret_cast(const_cast(newDataInfo.data))); + ImageCacheFree(imageinfo); } return; } @@ -2041,7 +2048,7 @@ void DrawUtils::DrawTransform(BufferInfo& gfxDstBuffer, DrawTriangleTransform(gfxDstBuffer, mask, position, color, opaScale, newTransMap, triangleInfo); } if (newDataInfo.data != dataInfo.data) { - UIFree(reinterpret_cast(const_cast(newDataInfo.data))); + ImageCacheFree(imageinfo); } } -- GitLab