提交 af944433 编写于 作者: S swx1094762 提交者: 施其昌

fixed a0568cd6 from https://gitee.com/shi-qichang/graphic_ui/pulls/914

Description:DrawUtils:: Memory leak in DrawTransform
issuesno:I6LNFB
Sig:SIG_ApplicationFramework
Feature or Bugfix:Feature
Binary Source:NO
Signed-off-by: Nswx1094762 <shiqichang@huawei.com>
上级 29c37524
......@@ -1880,7 +1880,7 @@ BottomHalf:
DrawTriangleTransformPart(gfxDstBuffer, part);
}
void DrawUtils::AddBorderToImageData(TransformDataInfo& newDataInfo)
void DrawUtils::AddBorderToImageData(TransformDataInfo& newDataInfo, ImageInfo& imageinfo)
{
int16_t border = 1; // 1 : border width
int16_t offset = border * 2; // 2 : offset
......@@ -1900,7 +1900,6 @@ void DrawUtils::AddBorderToImageData(TransformDataInfo& newDataInfo)
if ((width * newDataInfo.pxSize) % FONT_WEIGHT_8 != 0) {
widthInByte++;
}
ImageInfo imageinfo;
imageinfo.header.width = newDataInfo.header.width;
imageinfo.header.height = newDataInfo.header.height;
imageinfo.dataSize = widthInByte * height;
......@@ -1983,6 +1982,7 @@ void DrawUtils::DrawTransform(BufferInfo& gfxDstBuffer,
if ((gfxDstBuffer.virAddr == nullptr) || (dataInfo.data == nullptr)) {
return;
}
ImageInfo imageinfo;
TransformDataInfo newDataInfo = dataInfo;
TransformMap newTransMap = transMap;
// If the width and height of the rectangle of transMap are not equal to the width and height of the ImageHeader,
......@@ -1990,7 +1990,7 @@ void DrawUtils::DrawTransform(BufferInfo& gfxDstBuffer,
if ((transMap.GetTransMapRect().GetWidth() == dataInfo.header.width) &&
(transMap.GetTransMapRect().GetHeight() == dataInfo.header.height)) {
// Add a border of transparency values to the data
AddBorderToImageData(newDataInfo);
AddBorderToImageData(newDataInfo, imageinfo);
// Update the transMap according to new rect width and height
UpdateTransMap(newDataInfo.header.width, newDataInfo.header.height, newTransMap);
}
......@@ -1998,7 +1998,6 @@ 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) {
......
......@@ -355,7 +355,7 @@ private:
static OpacityType GetPxAlphaForAlphaImg(const TransformDataInfo& dataInfo, const Point& point);
static void AddBorderToImageData(TransformDataInfo& newDataInfo);
static void AddBorderToImageData(TransformDataInfo& newDataInfo, ImageInfo& imageinfo);
static void UpdateTransMap(int16_t width, int16_t height, TransformMap& transMap);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册