1a3e0fd82Sopenharmony_ci/*
2a3e0fd82Sopenharmony_ci * Copyright (c) 2020-2021 Huawei Device Co., Ltd.
3a3e0fd82Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
4a3e0fd82Sopenharmony_ci * you may not use this file except in compliance with the License.
5a3e0fd82Sopenharmony_ci * You may obtain a copy of the License at
6a3e0fd82Sopenharmony_ci *
7a3e0fd82Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
8a3e0fd82Sopenharmony_ci *
9a3e0fd82Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
10a3e0fd82Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
11a3e0fd82Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12a3e0fd82Sopenharmony_ci * See the License for the specific language governing permissions and
13a3e0fd82Sopenharmony_ci * limitations under the License.
14a3e0fd82Sopenharmony_ci */
15a3e0fd82Sopenharmony_ci
16a3e0fd82Sopenharmony_ci#include "draw/draw_rect.h"
17a3e0fd82Sopenharmony_ci#include "draw/draw_utils.h"
18a3e0fd82Sopenharmony_ci#include "engines/gfx/gfx_engine_manager.h"
19a3e0fd82Sopenharmony_ci#include "gfx_utils/graphic_log.h"
20a3e0fd82Sopenharmony_ci#include "gfx_utils/graphic_math.h"
21a3e0fd82Sopenharmony_ci#include "gfx_utils/style.h"
22a3e0fd82Sopenharmony_ci
23a3e0fd82Sopenharmony_cinamespace OHOS {
24a3e0fd82Sopenharmony_civoid DrawRect::Draw(BufferInfo& gfxDstBuffer, const Rect& rect, const Rect& dirtyRect,
25a3e0fd82Sopenharmony_ci                    const Style& style, OpacityType opaScale)
26a3e0fd82Sopenharmony_ci{
27a3e0fd82Sopenharmony_ci    if ((rect.GetWidth() <= 0) || (rect.GetHeight() <= 0)) {
28a3e0fd82Sopenharmony_ci        GRAPHIC_LOGD("DrawRect::Draw width or height is zero\n");
29a3e0fd82Sopenharmony_ci        return;
30a3e0fd82Sopenharmony_ci    }
31a3e0fd82Sopenharmony_ci
32a3e0fd82Sopenharmony_ci    /**
33a3e0fd82Sopenharmony_ci     * no border
34a3e0fd82Sopenharmony_ci     *      radius = 0 (1/4)
35a3e0fd82Sopenharmony_ci     *      radius > 0 (2/4)
36a3e0fd82Sopenharmony_ci     *          rect width > rect height
37a3e0fd82Sopenharmony_ci     *              radius >= rect height / 2
38a3e0fd82Sopenharmony_ci     *              radius < rect height / 2
39a3e0fd82Sopenharmony_ci     *          rect width <= rect height
40a3e0fd82Sopenharmony_ci     *              radius >= rect width / 2
41a3e0fd82Sopenharmony_ci     *              radius < rect width / 2
42a3e0fd82Sopenharmony_ci     * have border
43a3e0fd82Sopenharmony_ci     *      radius = 0 (3/4)
44a3e0fd82Sopenharmony_ci     *      radius > 0 (4/4)
45a3e0fd82Sopenharmony_ci     *          radius < border width (4.1/4)
46a3e0fd82Sopenharmony_ci     *          radius = border width (4.2/4)
47a3e0fd82Sopenharmony_ci     *          radius > border width (4.3/4)
48a3e0fd82Sopenharmony_ci     *             rect width <= rect height
49a3e0fd82Sopenharmony_ci     *                  radius >= border width + rect height / 2
50a3e0fd82Sopenharmony_ci     *                  radius < border width + rect height / 2
51a3e0fd82Sopenharmony_ci     *             rect width > rect height
52a3e0fd82Sopenharmony_ci     *                  radius >= border width + rect height / 2
53a3e0fd82Sopenharmony_ci     *                  radius < border width + rect height / 2
54a3e0fd82Sopenharmony_ci     */
55a3e0fd82Sopenharmony_ci    if (style.borderWidth_ == 0) {
56a3e0fd82Sopenharmony_ci        if (style.borderRadius_ == 0) {
57a3e0fd82Sopenharmony_ci            /* no border no radius (1/4) */
58a3e0fd82Sopenharmony_ci            OpacityType opa = DrawUtils::GetMixOpacity(opaScale, style.bgOpa_);
59a3e0fd82Sopenharmony_ci            DrawUtils::GetInstance()->DrawColorArea(gfxDstBuffer, rect, dirtyRect, style.bgColor_, opa);
60a3e0fd82Sopenharmony_ci            return;
61a3e0fd82Sopenharmony_ci        } else {
62a3e0fd82Sopenharmony_ci            /* [2/4] no border with radius (2/4) */
63a3e0fd82Sopenharmony_ci            DrawRectRadiusWithoutBorder(gfxDstBuffer, rect, dirtyRect, style, opaScale);
64a3e0fd82Sopenharmony_ci        }
65a3e0fd82Sopenharmony_ci    } else {
66a3e0fd82Sopenharmony_ci        if (style.borderRadius_ == 0) {
67a3e0fd82Sopenharmony_ci            /* [3/4] border without radius (3/4) */
68a3e0fd82Sopenharmony_ci            DrawRectBorderWithoutRadius(gfxDstBuffer, rect, dirtyRect, style, opaScale);
69a3e0fd82Sopenharmony_ci        } else if (style.borderRadius_ < style.borderWidth_) {
70a3e0fd82Sopenharmony_ci            /* [4.1/4] radius < border width */
71a3e0fd82Sopenharmony_ci            DrawRectRadiusSmallThanBorder(gfxDstBuffer, rect, dirtyRect, style, opaScale);
72a3e0fd82Sopenharmony_ci        } else if (style.borderRadius_ == style.borderWidth_) {
73a3e0fd82Sopenharmony_ci            /* [4.2/4] radius = border width */
74a3e0fd82Sopenharmony_ci            DrawRectRadiusEqualBorder(gfxDstBuffer, rect, dirtyRect, style, opaScale);
75a3e0fd82Sopenharmony_ci        } else {
76a3e0fd82Sopenharmony_ci            /* [4.3/4] radius >= border width + rect height_or_width / 2 */
77a3e0fd82Sopenharmony_ci            DrawRectRadiusBiggerThanBorder(gfxDstBuffer, rect, dirtyRect, style, opaScale);
78a3e0fd82Sopenharmony_ci        }
79a3e0fd82Sopenharmony_ci    }
80a3e0fd82Sopenharmony_ci}
81a3e0fd82Sopenharmony_ci
82a3e0fd82Sopenharmony_civoid DrawRect::DrawRectRadiusWithoutBorder(BufferInfo& gfxDstBuffer, const Rect& rect, const Rect& dirtyRect,
83a3e0fd82Sopenharmony_ci                                           const Style& style, OpacityType opaScale)
84a3e0fd82Sopenharmony_ci{
85a3e0fd82Sopenharmony_ci    // 2 : half
86a3e0fd82Sopenharmony_ci    if ((rect.GetWidth() > rect.GetHeight()) && (style.borderRadius_ >= rect.GetHeight() / 2)) {
87a3e0fd82Sopenharmony_ci        DrawRectRadiusWithoutBorderCon1(gfxDstBuffer, rect, dirtyRect, style, opaScale);
88a3e0fd82Sopenharmony_ci    } else if ((rect.GetWidth() < rect.GetHeight()) && (style.borderRadius_ >= rect.GetWidth() / 2)) {
89a3e0fd82Sopenharmony_ci        DrawRectRadiusWithoutBorderCon2(gfxDstBuffer, rect, dirtyRect, style, opaScale);
90a3e0fd82Sopenharmony_ci    } else if ((rect.GetWidth() == rect.GetHeight()) && (style.borderRadius_ >= rect.GetWidth() / 2)) {
91a3e0fd82Sopenharmony_ci        DrawRectRadiusWithoutBorderCon3(gfxDstBuffer, rect, dirtyRect, style, opaScale);
92a3e0fd82Sopenharmony_ci    } else {
93a3e0fd82Sopenharmony_ci        DrawRectRadiusWithoutBorderCon4(gfxDstBuffer, rect, dirtyRect, style, opaScale);
94a3e0fd82Sopenharmony_ci    }
95a3e0fd82Sopenharmony_ci}
96a3e0fd82Sopenharmony_ci
97a3e0fd82Sopenharmony_civoid DrawRect::DrawRectRadiusWithoutBorderCon1(BufferInfo& gfxDstBuffer, const Rect& rect, const Rect& dirtyRect,
98a3e0fd82Sopenharmony_ci                                               const Style& style, OpacityType opaScale)
99a3e0fd82Sopenharmony_ci{
100a3e0fd82Sopenharmony_ci    int16_t radius = rect.GetHeight() / 2;
101a3e0fd82Sopenharmony_ci    int16_t col2X = rect.GetLeft() + radius - 1;
102a3e0fd82Sopenharmony_ci    int16_t col3X = rect.GetRight() - radius + 1;
103a3e0fd82Sopenharmony_ci
104a3e0fd82Sopenharmony_ci    int16_t row1Y = rect.GetTop();
105a3e0fd82Sopenharmony_ci    int16_t row2Y = rect.GetTop() + radius - 1;
106a3e0fd82Sopenharmony_ci    int16_t row3Y = rect.GetBottom();
107a3e0fd82Sopenharmony_ci
108a3e0fd82Sopenharmony_ci    Style arcStyle = style;
109a3e0fd82Sopenharmony_ci    arcStyle.lineWidth_ = radius;
110a3e0fd82Sopenharmony_ci    arcStyle.lineColor_ = style.bgColor_;
111a3e0fd82Sopenharmony_ci    arcStyle.lineOpa_ = style.bgOpa_;
112a3e0fd82Sopenharmony_ci    // draw left sector
113a3e0fd82Sopenharmony_ci    ArcInfo arcInfo;
114a3e0fd82Sopenharmony_ci    arcInfo.center = {col2X, row2Y};
115a3e0fd82Sopenharmony_ci    arcInfo.radius = radius;
116a3e0fd82Sopenharmony_ci    arcInfo.startAngle = SEMICIRCLE_IN_DEGREE;
117a3e0fd82Sopenharmony_ci    arcInfo.endAngle = CIRCLE_IN_DEGREE;
118a3e0fd82Sopenharmony_ci    arcInfo.imgPos = {0, 0};
119a3e0fd82Sopenharmony_ci    arcInfo.imgSrc = nullptr;
120a3e0fd82Sopenharmony_ci    BaseGfxEngine* baseGfxEngine = BaseGfxEngine::GetInstance();
121a3e0fd82Sopenharmony_ci    baseGfxEngine->DrawArc(gfxDstBuffer, arcInfo, dirtyRect, arcStyle, opaScale, CapType::CAP_NONE);
122a3e0fd82Sopenharmony_ci
123a3e0fd82Sopenharmony_ci    // draw right sector
124a3e0fd82Sopenharmony_ci    arcInfo.center = {col3X, row2Y};
125a3e0fd82Sopenharmony_ci    arcInfo.startAngle = 0;
126a3e0fd82Sopenharmony_ci    arcInfo.endAngle = SEMICIRCLE_IN_DEGREE;
127a3e0fd82Sopenharmony_ci    baseGfxEngine->DrawArc(gfxDstBuffer, arcInfo, dirtyRect, arcStyle, opaScale, CapType::CAP_NONE);
128a3e0fd82Sopenharmony_ci
129a3e0fd82Sopenharmony_ci    // draw top rectangle
130a3e0fd82Sopenharmony_ci    DrawUtils* drawUtils = DrawUtils::GetInstance();
131a3e0fd82Sopenharmony_ci    Rect topRect(col2X, row1Y, col3X - 1, row2Y - 1);
132a3e0fd82Sopenharmony_ci    OpacityType opa = DrawUtils::GetMixOpacity(opaScale, style.bgOpa_);
133a3e0fd82Sopenharmony_ci    drawUtils->DrawColorArea(gfxDstBuffer, topRect, dirtyRect, style.bgColor_, opa);
134a3e0fd82Sopenharmony_ci
135a3e0fd82Sopenharmony_ci    // draw bottom rectangle
136a3e0fd82Sopenharmony_ci    Rect bottomRect(col2X + 1, row2Y, col3X - 1, row3Y);
137a3e0fd82Sopenharmony_ci    drawUtils->DrawColorArea(gfxDstBuffer, bottomRect, dirtyRect, style.bgColor_, opa);
138a3e0fd82Sopenharmony_ci}
139a3e0fd82Sopenharmony_ci
140a3e0fd82Sopenharmony_civoid DrawRect::DrawRectRadiusWithoutBorderCon2(BufferInfo& gfxDstBuffer, const Rect& rect, const Rect& dirtyRect,
141a3e0fd82Sopenharmony_ci                                               const Style& style, OpacityType opaScale)
142a3e0fd82Sopenharmony_ci{
143a3e0fd82Sopenharmony_ci    int16_t radius = rect.GetWidth() / 2;
144a3e0fd82Sopenharmony_ci    int16_t col1X = rect.GetLeft();
145a3e0fd82Sopenharmony_ci    int16_t col2X = rect.GetLeft() + radius - 1;
146a3e0fd82Sopenharmony_ci    int16_t col3X = rect.GetRight();
147a3e0fd82Sopenharmony_ci
148a3e0fd82Sopenharmony_ci    int16_t row2Y = rect.GetTop() + radius - 1;
149a3e0fd82Sopenharmony_ci    int16_t row3Y = rect.GetBottom() - radius + 1;
150a3e0fd82Sopenharmony_ci
151a3e0fd82Sopenharmony_ci    Style arcStyle = style;
152a3e0fd82Sopenharmony_ci    arcStyle.lineWidth_ = radius;
153a3e0fd82Sopenharmony_ci    arcStyle.lineColor_ = style.bgColor_;
154a3e0fd82Sopenharmony_ci    arcStyle.lineOpa_ = style.bgOpa_;
155a3e0fd82Sopenharmony_ci    // draw top sector
156a3e0fd82Sopenharmony_ci    ArcInfo arcInfo;
157a3e0fd82Sopenharmony_ci    arcInfo.center = {col2X, row2Y};
158a3e0fd82Sopenharmony_ci    arcInfo.startAngle = THREE_QUARTER_IN_DEGREE;
159a3e0fd82Sopenharmony_ci    arcInfo.endAngle = QUARTER_IN_DEGREE;
160a3e0fd82Sopenharmony_ci    arcInfo.radius = radius;
161a3e0fd82Sopenharmony_ci    arcInfo.imgPos = {0, 0};
162a3e0fd82Sopenharmony_ci    arcInfo.imgSrc = nullptr;
163a3e0fd82Sopenharmony_ci    BaseGfxEngine* baseGfxEngine = BaseGfxEngine::GetInstance();
164a3e0fd82Sopenharmony_ci    baseGfxEngine->DrawArc(gfxDstBuffer, arcInfo, dirtyRect, arcStyle, opaScale, CapType::CAP_NONE);
165a3e0fd82Sopenharmony_ci
166a3e0fd82Sopenharmony_ci    // draw bottom sector
167a3e0fd82Sopenharmony_ci    arcInfo.center = {col2X, row3Y};
168a3e0fd82Sopenharmony_ci    arcInfo.startAngle = QUARTER_IN_DEGREE;
169a3e0fd82Sopenharmony_ci    arcInfo.endAngle = THREE_QUARTER_IN_DEGREE;
170a3e0fd82Sopenharmony_ci    baseGfxEngine->DrawArc(gfxDstBuffer, arcInfo, dirtyRect, arcStyle, opaScale, CapType::CAP_NONE);
171a3e0fd82Sopenharmony_ci
172a3e0fd82Sopenharmony_ci    // draw middle rectangle
173a3e0fd82Sopenharmony_ci    Rect middleRect(col1X, row2Y + 1, col3X, row3Y - 1);
174a3e0fd82Sopenharmony_ci    OpacityType opa = DrawUtils::GetMixOpacity(opaScale, style.bgOpa_);
175a3e0fd82Sopenharmony_ci    DrawUtils::GetInstance()->DrawColorArea(gfxDstBuffer, middleRect, dirtyRect, style.bgColor_, opa);
176a3e0fd82Sopenharmony_ci}
177a3e0fd82Sopenharmony_ci
178a3e0fd82Sopenharmony_civoid DrawRect::DrawRectRadiusWithoutBorderCon3(BufferInfo& gfxDstBuffer, const Rect& rect, const Rect& dirtyRect,
179a3e0fd82Sopenharmony_ci                                               const Style& style, OpacityType opaScale)
180a3e0fd82Sopenharmony_ci{
181a3e0fd82Sopenharmony_ci    int16_t radius = rect.GetWidth() / 2;
182a3e0fd82Sopenharmony_ci    int16_t col1X = rect.GetLeft() + radius - 1;
183a3e0fd82Sopenharmony_ci    int16_t row1Y = rect.GetTop() + radius - 1;
184a3e0fd82Sopenharmony_ci
185a3e0fd82Sopenharmony_ci    Style arcStyle = style;
186a3e0fd82Sopenharmony_ci    arcStyle.lineWidth_ = radius;
187a3e0fd82Sopenharmony_ci    arcStyle.lineColor_ = style.bgColor_;
188a3e0fd82Sopenharmony_ci    arcStyle.lineOpa_ = style.bgOpa_;
189a3e0fd82Sopenharmony_ci    // draw circle
190a3e0fd82Sopenharmony_ci    ArcInfo arcInfo;
191a3e0fd82Sopenharmony_ci    arcInfo.center = {col1X, row1Y};
192a3e0fd82Sopenharmony_ci    arcInfo.startAngle = 0;
193a3e0fd82Sopenharmony_ci    arcInfo.endAngle = CIRCLE_IN_DEGREE;
194a3e0fd82Sopenharmony_ci    arcInfo.radius = radius;
195a3e0fd82Sopenharmony_ci    arcInfo.imgPos = {0, 0};
196a3e0fd82Sopenharmony_ci    arcInfo.imgSrc = nullptr;
197a3e0fd82Sopenharmony_ci    BaseGfxEngine::GetInstance()->DrawArc(gfxDstBuffer, arcInfo, dirtyRect, arcStyle, opaScale, CapType::CAP_NONE);
198a3e0fd82Sopenharmony_ci}
199a3e0fd82Sopenharmony_ci
200a3e0fd82Sopenharmony_civoid DrawRect::DrawRectRadiusWithoutBorderCon4(BufferInfo& gfxDstBuffer, const Rect& rect, const Rect& dirtyRect,
201a3e0fd82Sopenharmony_ci                                               const Style& style, OpacityType opaScale)
202a3e0fd82Sopenharmony_ci{
203a3e0fd82Sopenharmony_ci    int16_t radius = style.borderRadius_;
204a3e0fd82Sopenharmony_ci    int16_t col1X = rect.GetLeft();
205a3e0fd82Sopenharmony_ci    int16_t col2X = rect.GetLeft() + radius - 1;
206a3e0fd82Sopenharmony_ci    int16_t col3X = rect.GetRight() - radius + 1;
207a3e0fd82Sopenharmony_ci    int16_t col4X = rect.GetRight();
208a3e0fd82Sopenharmony_ci
209a3e0fd82Sopenharmony_ci    int16_t row1Y = rect.GetTop();
210a3e0fd82Sopenharmony_ci    int16_t row2Y = rect.GetTop() + radius - 1;
211a3e0fd82Sopenharmony_ci    int16_t row3Y = rect.GetBottom() - radius + 1;
212a3e0fd82Sopenharmony_ci    int16_t row4Y = rect.GetBottom();
213a3e0fd82Sopenharmony_ci
214a3e0fd82Sopenharmony_ci    OpacityType opa = DrawUtils::GetMixOpacity(opaScale, style.bgOpa_);
215a3e0fd82Sopenharmony_ci    // draw top rectangle
216a3e0fd82Sopenharmony_ci    Rect topRect(col2X, row1Y, col3X - 1, row2Y);
217a3e0fd82Sopenharmony_ci    DrawUtils* drawUtils = DrawUtils::GetInstance();
218a3e0fd82Sopenharmony_ci    drawUtils->DrawColorArea(gfxDstBuffer, topRect, dirtyRect, style.bgColor_, opa);
219a3e0fd82Sopenharmony_ci
220a3e0fd82Sopenharmony_ci    // draw middle rectangle
221a3e0fd82Sopenharmony_ci    Rect middleRect(col1X, row2Y + 1, col4X, row3Y - 1);
222a3e0fd82Sopenharmony_ci    drawUtils->DrawColorArea(gfxDstBuffer, middleRect, dirtyRect, style.bgColor_, opa);
223a3e0fd82Sopenharmony_ci
224a3e0fd82Sopenharmony_ci    // draw bottom rectangle
225a3e0fd82Sopenharmony_ci    Rect bottomRect(col2X + 1, row3Y, col3X - 1, row4Y);
226a3e0fd82Sopenharmony_ci    drawUtils->DrawColorArea(gfxDstBuffer, bottomRect, dirtyRect, style.bgColor_, opa);
227a3e0fd82Sopenharmony_ci
228a3e0fd82Sopenharmony_ci    Style arcStyle = style;
229a3e0fd82Sopenharmony_ci    arcStyle.lineWidth_ = radius;
230a3e0fd82Sopenharmony_ci    arcStyle.lineColor_ = style.bgColor_;
231a3e0fd82Sopenharmony_ci    arcStyle.lineOpa_ = style.bgOpa_;
232a3e0fd82Sopenharmony_ci    // top left sector
233a3e0fd82Sopenharmony_ci    ArcInfo arcInfo;
234a3e0fd82Sopenharmony_ci    arcInfo.center = {col2X, row2Y};
235a3e0fd82Sopenharmony_ci    arcInfo.startAngle = THREE_QUARTER_IN_DEGREE;
236a3e0fd82Sopenharmony_ci    arcInfo.endAngle = CIRCLE_IN_DEGREE;
237a3e0fd82Sopenharmony_ci    arcInfo.radius = radius;
238a3e0fd82Sopenharmony_ci    arcInfo.imgPos = {0, 0};
239a3e0fd82Sopenharmony_ci    arcInfo.imgSrc = nullptr;
240a3e0fd82Sopenharmony_ci    BaseGfxEngine* baseGfxEngine = BaseGfxEngine::GetInstance();
241a3e0fd82Sopenharmony_ci    baseGfxEngine->DrawArc(gfxDstBuffer, arcInfo, dirtyRect, arcStyle, opaScale, CapType::CAP_NONE);
242a3e0fd82Sopenharmony_ci
243a3e0fd82Sopenharmony_ci    // top right sector
244a3e0fd82Sopenharmony_ci    arcInfo.center = {col3X, row2Y};
245a3e0fd82Sopenharmony_ci    arcInfo.startAngle = 0;
246a3e0fd82Sopenharmony_ci    arcInfo.endAngle = QUARTER_IN_DEGREE;
247a3e0fd82Sopenharmony_ci    baseGfxEngine->DrawArc(gfxDstBuffer, arcInfo, dirtyRect, arcStyle, opaScale, CapType::CAP_NONE);
248a3e0fd82Sopenharmony_ci
249a3e0fd82Sopenharmony_ci    // bottom left sector
250a3e0fd82Sopenharmony_ci    arcInfo.center = {col2X, row3Y};
251a3e0fd82Sopenharmony_ci    arcInfo.startAngle = SEMICIRCLE_IN_DEGREE;
252a3e0fd82Sopenharmony_ci    arcInfo.endAngle = THREE_QUARTER_IN_DEGREE;
253a3e0fd82Sopenharmony_ci    baseGfxEngine->DrawArc(gfxDstBuffer, arcInfo, dirtyRect, arcStyle, opaScale, CapType::CAP_NONE);
254a3e0fd82Sopenharmony_ci
255a3e0fd82Sopenharmony_ci    // bottom right sector
256a3e0fd82Sopenharmony_ci    arcInfo.center = {col3X, row3Y};
257a3e0fd82Sopenharmony_ci    arcInfo.startAngle = QUARTER_IN_DEGREE;
258a3e0fd82Sopenharmony_ci    arcInfo.endAngle = SEMICIRCLE_IN_DEGREE;
259a3e0fd82Sopenharmony_ci    baseGfxEngine->DrawArc(gfxDstBuffer, arcInfo, dirtyRect, arcStyle, opaScale, CapType::CAP_NONE);
260a3e0fd82Sopenharmony_ci}
261a3e0fd82Sopenharmony_ci
262a3e0fd82Sopenharmony_civoid DrawRect::DrawRectBorderWithoutRadius(BufferInfo& gfxDstBuffer, const Rect& rect, const Rect& dirtyRect,
263a3e0fd82Sopenharmony_ci                                           const Style& style, OpacityType opaScale)
264a3e0fd82Sopenharmony_ci{
265a3e0fd82Sopenharmony_ci    int16_t col1X = rect.GetLeft();
266a3e0fd82Sopenharmony_ci    int16_t col2X = rect.GetLeft() + style.borderWidth_ - 1;
267a3e0fd82Sopenharmony_ci    int16_t col3X = rect.GetRight() - style.borderWidth_ + 1;
268a3e0fd82Sopenharmony_ci    int16_t col4X = rect.GetRight();
269a3e0fd82Sopenharmony_ci
270a3e0fd82Sopenharmony_ci    int16_t row1Y = rect.GetTop();
271a3e0fd82Sopenharmony_ci    int16_t row2Y = rect.GetTop() + style.borderWidth_ - 1;
272a3e0fd82Sopenharmony_ci    int16_t row3Y = rect.GetBottom() - style.borderWidth_ + 1;
273a3e0fd82Sopenharmony_ci    int16_t row4Y = rect.GetBottom();
274a3e0fd82Sopenharmony_ci
275a3e0fd82Sopenharmony_ci    OpacityType opa = DrawUtils::GetMixOpacity(opaScale, style.borderOpa_);
276a3e0fd82Sopenharmony_ci    // draw top border
277a3e0fd82Sopenharmony_ci    Rect topRect(col1X, row1Y, col4X, row2Y);
278a3e0fd82Sopenharmony_ci    DrawUtils* drawUtils = DrawUtils::GetInstance();
279a3e0fd82Sopenharmony_ci    drawUtils->DrawColorArea(gfxDstBuffer, topRect, dirtyRect, style.borderColor_, opa);
280a3e0fd82Sopenharmony_ci
281a3e0fd82Sopenharmony_ci    // draw left border
282a3e0fd82Sopenharmony_ci    Rect leftRect(col1X, row2Y + 1, col2X, row3Y - 1);
283a3e0fd82Sopenharmony_ci    drawUtils->DrawColorArea(gfxDstBuffer, leftRect, dirtyRect, style.borderColor_, opa);
284a3e0fd82Sopenharmony_ci
285a3e0fd82Sopenharmony_ci    OpacityType opaBg = DrawUtils::GetMixOpacity(opaScale, style.bgOpa_);
286a3e0fd82Sopenharmony_ci    // draw middle rectangle
287a3e0fd82Sopenharmony_ci    Rect middleRect(col2X + 1, row2Y + 1, col3X - 1, row3Y - 1);
288a3e0fd82Sopenharmony_ci    drawUtils->DrawColorArea(gfxDstBuffer, middleRect, dirtyRect, style.bgColor_, opaBg);
289a3e0fd82Sopenharmony_ci
290a3e0fd82Sopenharmony_ci    // draw right border
291a3e0fd82Sopenharmony_ci    Rect rightRect(col3X, row2Y + 1, col4X, row3Y - 1);
292a3e0fd82Sopenharmony_ci    drawUtils->DrawColorArea(gfxDstBuffer, rightRect, dirtyRect, style.borderColor_, opa);
293a3e0fd82Sopenharmony_ci
294a3e0fd82Sopenharmony_ci    // draw bottom border
295a3e0fd82Sopenharmony_ci    Rect bottomRect(col1X, row3Y, col4X, row4Y);
296a3e0fd82Sopenharmony_ci    drawUtils->DrawColorArea(gfxDstBuffer, bottomRect, dirtyRect, style.borderColor_, opa);
297a3e0fd82Sopenharmony_ci}
298a3e0fd82Sopenharmony_ci
299a3e0fd82Sopenharmony_civoid DrawRect::DrawRectRadiusEqualBorder(BufferInfo& gfxDstBuffer, const Rect& rect, const Rect& dirtyRect,
300a3e0fd82Sopenharmony_ci                                         const Style& style, OpacityType opaScale)
301a3e0fd82Sopenharmony_ci{
302a3e0fd82Sopenharmony_ci    int16_t col1X = rect.GetLeft();
303a3e0fd82Sopenharmony_ci    int16_t col2X = rect.GetLeft() + style.borderRadius_ - 1;
304a3e0fd82Sopenharmony_ci    int16_t col3X = rect.GetRight() - style.borderRadius_ + 1;
305a3e0fd82Sopenharmony_ci    int16_t col4X = rect.GetRight();
306a3e0fd82Sopenharmony_ci
307a3e0fd82Sopenharmony_ci    int16_t row1Y = rect.GetTop();
308a3e0fd82Sopenharmony_ci    int16_t row2Y = rect.GetTop() + style.borderRadius_ - 1;
309a3e0fd82Sopenharmony_ci    int16_t row3Y = rect.GetBottom() - style.borderRadius_ + 1;
310a3e0fd82Sopenharmony_ci    int16_t row4Y = rect.GetBottom();
311a3e0fd82Sopenharmony_ci
312a3e0fd82Sopenharmony_ci    Style arcStyle = style;
313a3e0fd82Sopenharmony_ci    arcStyle.lineWidth_ = style.borderWidth_;
314a3e0fd82Sopenharmony_ci    arcStyle.lineColor_ = style.borderColor_;
315a3e0fd82Sopenharmony_ci    arcStyle.lineOpa_ = style.borderOpa_;
316a3e0fd82Sopenharmony_ci    // draw top left sector in border
317a3e0fd82Sopenharmony_ci    ArcInfo arcInfo;
318a3e0fd82Sopenharmony_ci    arcInfo.center = {col2X, row2Y};
319a3e0fd82Sopenharmony_ci    arcInfo.startAngle = THREE_QUARTER_IN_DEGREE;
320a3e0fd82Sopenharmony_ci    arcInfo.endAngle = CIRCLE_IN_DEGREE;
321a3e0fd82Sopenharmony_ci    arcInfo.radius = style.borderRadius_;
322a3e0fd82Sopenharmony_ci    arcInfo.imgPos = {0, 0};
323a3e0fd82Sopenharmony_ci    arcInfo.imgSrc = nullptr;
324a3e0fd82Sopenharmony_ci    BaseGfxEngine* baseGfxEngine = BaseGfxEngine::GetInstance();
325a3e0fd82Sopenharmony_ci    baseGfxEngine->DrawArc(gfxDstBuffer, arcInfo, dirtyRect, arcStyle, opaScale, CapType::CAP_NONE);
326a3e0fd82Sopenharmony_ci
327a3e0fd82Sopenharmony_ci    // draw top right sector in border
328a3e0fd82Sopenharmony_ci    arcInfo.center = {col3X, row2Y};
329a3e0fd82Sopenharmony_ci    arcInfo.startAngle = 0;
330a3e0fd82Sopenharmony_ci    arcInfo.endAngle = QUARTER_IN_DEGREE;
331a3e0fd82Sopenharmony_ci    baseGfxEngine->DrawArc(gfxDstBuffer, arcInfo, dirtyRect, arcStyle, opaScale, CapType::CAP_NONE);
332a3e0fd82Sopenharmony_ci
333a3e0fd82Sopenharmony_ci    // draw bottom left sector in border
334a3e0fd82Sopenharmony_ci    arcInfo.center = {col2X, row3Y};
335a3e0fd82Sopenharmony_ci    arcInfo.startAngle = SEMICIRCLE_IN_DEGREE;
336a3e0fd82Sopenharmony_ci    arcInfo.endAngle = THREE_QUARTER_IN_DEGREE;
337a3e0fd82Sopenharmony_ci    baseGfxEngine->DrawArc(gfxDstBuffer, arcInfo, dirtyRect, arcStyle, opaScale, CapType::CAP_NONE);
338a3e0fd82Sopenharmony_ci
339a3e0fd82Sopenharmony_ci    // draw bottom right sector in border
340a3e0fd82Sopenharmony_ci    arcInfo.center = {col3X, row3Y};
341a3e0fd82Sopenharmony_ci    arcInfo.startAngle = QUARTER_IN_DEGREE;
342a3e0fd82Sopenharmony_ci    arcInfo.endAngle = SEMICIRCLE_IN_DEGREE;
343a3e0fd82Sopenharmony_ci    baseGfxEngine->DrawArc(gfxDstBuffer, arcInfo, dirtyRect, arcStyle, opaScale, CapType::CAP_NONE);
344a3e0fd82Sopenharmony_ci
345a3e0fd82Sopenharmony_ci    OpacityType opa = DrawUtils::GetMixOpacity(opaScale, style.borderOpa_);
346a3e0fd82Sopenharmony_ci    // draw top rectangle in border
347a3e0fd82Sopenharmony_ci    Rect topRect(col2X, row1Y, col3X - 1, row2Y);
348a3e0fd82Sopenharmony_ci    DrawUtils::GetInstance()->DrawColorArea(gfxDstBuffer, topRect, dirtyRect, style.borderColor_, opa);
349a3e0fd82Sopenharmony_ci
350a3e0fd82Sopenharmony_ci    // draw left rectangle in border
351a3e0fd82Sopenharmony_ci    Rect leftRect(col1X, row2Y + 1, col2X, row3Y - 1);
352a3e0fd82Sopenharmony_ci    DrawUtils* drawUtils = DrawUtils::GetInstance();
353a3e0fd82Sopenharmony_ci    drawUtils->DrawColorArea(gfxDstBuffer, leftRect, dirtyRect, style.borderColor_, opa);
354a3e0fd82Sopenharmony_ci
355a3e0fd82Sopenharmony_ci    OpacityType opaBg = DrawUtils::GetMixOpacity(opaScale, style.bgOpa_);
356a3e0fd82Sopenharmony_ci    // draw middle rectangle
357a3e0fd82Sopenharmony_ci    Rect middleRect(col2X + 1, row2Y + 1, col3X - 1, row3Y - 1);
358a3e0fd82Sopenharmony_ci    drawUtils->DrawColorArea(gfxDstBuffer, middleRect, dirtyRect, style.bgColor_, opaBg);
359a3e0fd82Sopenharmony_ci
360a3e0fd82Sopenharmony_ci    // draw right rectangle in border
361a3e0fd82Sopenharmony_ci    Rect rightRect(col3X, row2Y + 1, col4X, row3Y - 1);
362a3e0fd82Sopenharmony_ci    drawUtils->DrawColorArea(gfxDstBuffer, rightRect, dirtyRect, style.borderColor_, opa);
363a3e0fd82Sopenharmony_ci
364a3e0fd82Sopenharmony_ci    // draw bottom rectangle in border
365a3e0fd82Sopenharmony_ci    Rect bottomRect(col2X + 1, row3Y, col3X - 1, row4Y);
366a3e0fd82Sopenharmony_ci    drawUtils->DrawColorArea(gfxDstBuffer, bottomRect, dirtyRect, style.borderColor_, opa);
367a3e0fd82Sopenharmony_ci}
368a3e0fd82Sopenharmony_ci
369a3e0fd82Sopenharmony_civoid DrawRect::DrawRectRadiusSmallThanBorder(BufferInfo& gfxDstBuffer, const Rect& rect, const Rect& dirtyRect,
370a3e0fd82Sopenharmony_ci                                             const Style& style, OpacityType opaScale)
371a3e0fd82Sopenharmony_ci{
372a3e0fd82Sopenharmony_ci    int16_t radiusCol1X = rect.GetLeft();
373a3e0fd82Sopenharmony_ci    int16_t radiusCol2X = rect.GetLeft() + style.borderRadius_ - 1;
374a3e0fd82Sopenharmony_ci    int16_t radiusCol3X = rect.GetRight() - style.borderRadius_ + 1;
375a3e0fd82Sopenharmony_ci    int16_t radiusCol4X = rect.GetRight();
376a3e0fd82Sopenharmony_ci
377a3e0fd82Sopenharmony_ci    int16_t radiusRow1Y = rect.GetTop();
378a3e0fd82Sopenharmony_ci    int16_t radiusRow2Y = rect.GetTop() + style.borderRadius_ - 1;
379a3e0fd82Sopenharmony_ci    int16_t radiusRow3Y = rect.GetBottom() - style.borderRadius_ + 1;
380a3e0fd82Sopenharmony_ci    int16_t radiusRow4Y = rect.GetBottom();
381a3e0fd82Sopenharmony_ci
382a3e0fd82Sopenharmony_ci    int16_t rectCol1X = radiusCol1X;
383a3e0fd82Sopenharmony_ci    int16_t rectCol2X = rect.GetLeft() + style.borderWidth_ - 1;
384a3e0fd82Sopenharmony_ci    int16_t rectCol3X = rect.GetRight() - style.borderWidth_ + 1;
385a3e0fd82Sopenharmony_ci    int16_t rectCol4X = radiusCol4X;
386a3e0fd82Sopenharmony_ci
387a3e0fd82Sopenharmony_ci    int16_t rectRow1Y = radiusRow2Y;
388a3e0fd82Sopenharmony_ci    int16_t rectRow2Y = rect.GetTop() + style.borderWidth_ - 1;
389a3e0fd82Sopenharmony_ci    int16_t rectRow3Y = rect.GetBottom() - style.borderWidth_ + 1;
390a3e0fd82Sopenharmony_ci
391a3e0fd82Sopenharmony_ci    Style arcStyle = style;
392a3e0fd82Sopenharmony_ci    arcStyle.lineWidth_ = style.borderWidth_;
393a3e0fd82Sopenharmony_ci    arcStyle.lineColor_ = style.borderColor_;
394a3e0fd82Sopenharmony_ci    arcStyle.lineOpa_ = style.borderOpa_;
395a3e0fd82Sopenharmony_ci    // draw top left sector in border
396a3e0fd82Sopenharmony_ci    ArcInfo arcInfo;
397a3e0fd82Sopenharmony_ci    arcInfo.center = {radiusCol2X, radiusRow2Y};
398a3e0fd82Sopenharmony_ci    arcInfo.startAngle = THREE_QUARTER_IN_DEGREE;
399a3e0fd82Sopenharmony_ci    arcInfo.endAngle = CIRCLE_IN_DEGREE;
400a3e0fd82Sopenharmony_ci    arcInfo.radius = style.borderRadius_;
401a3e0fd82Sopenharmony_ci    arcInfo.imgPos = {0, 0};
402a3e0fd82Sopenharmony_ci    arcInfo.imgSrc = nullptr;
403a3e0fd82Sopenharmony_ci    BaseGfxEngine* baseGfxEngine = BaseGfxEngine::GetInstance();
404a3e0fd82Sopenharmony_ci    baseGfxEngine->DrawArc(gfxDstBuffer, arcInfo, dirtyRect, arcStyle, opaScale, CapType::CAP_NONE);
405a3e0fd82Sopenharmony_ci
406a3e0fd82Sopenharmony_ci    // draw top right sector in border
407a3e0fd82Sopenharmony_ci    arcInfo.center = {radiusCol3X, radiusRow2Y};
408a3e0fd82Sopenharmony_ci    arcInfo.startAngle = 0;
409a3e0fd82Sopenharmony_ci    arcInfo.endAngle = QUARTER_IN_DEGREE;
410a3e0fd82Sopenharmony_ci    baseGfxEngine->DrawArc(gfxDstBuffer, arcInfo, dirtyRect, arcStyle, opaScale, CapType::CAP_NONE);
411a3e0fd82Sopenharmony_ci
412a3e0fd82Sopenharmony_ci    // draw bottom left sector in border
413a3e0fd82Sopenharmony_ci    arcInfo.center = {radiusCol2X, radiusRow3Y};
414a3e0fd82Sopenharmony_ci    arcInfo.startAngle = SEMICIRCLE_IN_DEGREE;
415a3e0fd82Sopenharmony_ci    arcInfo.endAngle = THREE_QUARTER_IN_DEGREE;
416a3e0fd82Sopenharmony_ci    baseGfxEngine->DrawArc(gfxDstBuffer, arcInfo, dirtyRect, arcStyle, opaScale, CapType::CAP_NONE);
417a3e0fd82Sopenharmony_ci
418a3e0fd82Sopenharmony_ci    // draw bottom right sector in border
419a3e0fd82Sopenharmony_ci    arcInfo.center = {radiusCol3X, radiusRow3Y};
420a3e0fd82Sopenharmony_ci    arcInfo.startAngle = QUARTER_IN_DEGREE;
421a3e0fd82Sopenharmony_ci    arcInfo.endAngle = SEMICIRCLE_IN_DEGREE;
422a3e0fd82Sopenharmony_ci    baseGfxEngine->DrawArc(gfxDstBuffer, arcInfo, dirtyRect, arcStyle, opaScale, CapType::CAP_NONE);
423a3e0fd82Sopenharmony_ci
424a3e0fd82Sopenharmony_ci    OpacityType opa = DrawUtils::GetMixOpacity(opaScale, style.borderOpa_);
425a3e0fd82Sopenharmony_ci    // draw top rectangle in border
426a3e0fd82Sopenharmony_ci    Rect topRect(radiusCol2X, radiusRow1Y, radiusCol3X - 1, radiusRow2Y);
427a3e0fd82Sopenharmony_ci    DrawUtils* drawUtils = DrawUtils::GetInstance();
428a3e0fd82Sopenharmony_ci    drawUtils->DrawColorArea(gfxDstBuffer, topRect, dirtyRect, style.borderColor_, opa);
429a3e0fd82Sopenharmony_ci    Rect topRect2(rectCol1X, rectRow1Y + 1, rectCol4X, rectRow2Y);
430a3e0fd82Sopenharmony_ci    drawUtils->DrawColorArea(gfxDstBuffer, topRect2, dirtyRect, style.borderColor_, opa);
431a3e0fd82Sopenharmony_ci
432a3e0fd82Sopenharmony_ci    // draw left rectangle in border
433a3e0fd82Sopenharmony_ci    Rect leftRect(rectCol1X, rectRow2Y + 1, rectCol2X, rectRow3Y - 1);
434a3e0fd82Sopenharmony_ci    drawUtils->DrawColorArea(gfxDstBuffer, leftRect, dirtyRect, style.borderColor_, opa);
435a3e0fd82Sopenharmony_ci
436a3e0fd82Sopenharmony_ci    OpacityType opaBg = DrawUtils::GetMixOpacity(opaScale, style.bgOpa_);
437a3e0fd82Sopenharmony_ci    // draw middle rectangle
438a3e0fd82Sopenharmony_ci    Rect middleRect(rectCol2X + 1, rectRow2Y + 1, rectCol3X - 1, rectRow3Y - 1);
439a3e0fd82Sopenharmony_ci    drawUtils->DrawColorArea(gfxDstBuffer, middleRect, dirtyRect, style.bgColor_, opaBg);
440a3e0fd82Sopenharmony_ci
441a3e0fd82Sopenharmony_ci    // draw right rectangle in border
442a3e0fd82Sopenharmony_ci    Rect rightRect(rectCol3X, rectRow2Y + 1, rectCol4X, rectRow3Y - 1);
443a3e0fd82Sopenharmony_ci    drawUtils->DrawColorArea(gfxDstBuffer, rightRect, dirtyRect, style.borderColor_, opa);
444a3e0fd82Sopenharmony_ci
445a3e0fd82Sopenharmony_ci    // draw bottom rectangle in border
446a3e0fd82Sopenharmony_ci    Rect bottomRect(radiusCol2X + 1, radiusRow3Y, radiusCol3X - 1, radiusRow4Y);
447a3e0fd82Sopenharmony_ci    drawUtils->DrawColorArea(gfxDstBuffer, bottomRect, dirtyRect, style.borderColor_, opa);
448a3e0fd82Sopenharmony_ci    Rect bottomRect2(rectCol1X, rectRow3Y, rectCol4X, radiusRow3Y - 1);
449a3e0fd82Sopenharmony_ci    drawUtils->DrawColorArea(gfxDstBuffer, bottomRect2, dirtyRect, style.borderColor_, opa);
450a3e0fd82Sopenharmony_ci}
451a3e0fd82Sopenharmony_ci
452a3e0fd82Sopenharmony_civoid DrawRect::DrawRectRadiusBiggerThanBorder(BufferInfo& gfxDstBuffer, const Rect& rect, const Rect& dirtyRect,
453a3e0fd82Sopenharmony_ci                                              const Style& style, OpacityType opaScale)
454a3e0fd82Sopenharmony_ci{
455a3e0fd82Sopenharmony_ci    // 2 : half
456a3e0fd82Sopenharmony_ci    if ((rect.GetWidth() > rect.GetHeight()) && (style.borderRadius_ >= rect.GetHeight() / 2)) {
457a3e0fd82Sopenharmony_ci        DrawRectRadiusBiggerThanBorderCon1(gfxDstBuffer, rect, dirtyRect, style, opaScale);
458a3e0fd82Sopenharmony_ci    } else if ((rect.GetWidth() < rect.GetHeight()) && (style.borderRadius_ >= rect.GetWidth() / 2)) {
459a3e0fd82Sopenharmony_ci        DrawRectRadiusBiggerThanBorderCon2(gfxDstBuffer, rect, dirtyRect, style, opaScale);
460a3e0fd82Sopenharmony_ci    } else if ((rect.GetWidth() == rect.GetHeight()) && (style.borderRadius_ >= rect.GetWidth() / 2)) {
461a3e0fd82Sopenharmony_ci        DrawRectRadiusBiggerThanBorderCon3(gfxDstBuffer, rect, dirtyRect, style, opaScale);
462a3e0fd82Sopenharmony_ci    } else {
463a3e0fd82Sopenharmony_ci        DrawRectRadiusBiggerThanBorderCon4(gfxDstBuffer, rect, dirtyRect, style, opaScale);
464a3e0fd82Sopenharmony_ci    }
465a3e0fd82Sopenharmony_ci}
466a3e0fd82Sopenharmony_ci
467a3e0fd82Sopenharmony_civoid DrawRect::DrawRectRadiusBiggerThanBorderCon1(BufferInfo& gfxDstBuffer, const Rect& rect, const Rect& dirtyRect,
468a3e0fd82Sopenharmony_ci                                                  const Style& style, OpacityType opaScale)
469a3e0fd82Sopenharmony_ci{
470a3e0fd82Sopenharmony_ci    int16_t radius = rect.GetHeight() / 2;
471a3e0fd82Sopenharmony_ci    int16_t borderWidth = style.borderWidth_;
472a3e0fd82Sopenharmony_ci    int16_t col2X = rect.GetLeft() + radius - 1;
473a3e0fd82Sopenharmony_ci    int16_t col3X = rect.GetRight() - radius + 1;
474a3e0fd82Sopenharmony_ci
475a3e0fd82Sopenharmony_ci    int16_t row1Y = rect.GetTop();
476a3e0fd82Sopenharmony_ci    int16_t row2Y = rect.GetTop() + borderWidth - 1;
477a3e0fd82Sopenharmony_ci    int16_t row3Y = rect.GetTop() + radius - 1;
478a3e0fd82Sopenharmony_ci    int16_t row4Y = rect.GetBottom() - borderWidth + 1;
479a3e0fd82Sopenharmony_ci    int16_t row5Y = rect.GetBottom();
480a3e0fd82Sopenharmony_ci
481a3e0fd82Sopenharmony_ci    Style arcStyle = style;
482a3e0fd82Sopenharmony_ci    arcStyle.lineWidth_ = borderWidth;
483a3e0fd82Sopenharmony_ci    arcStyle.lineColor_ = style.borderColor_;
484a3e0fd82Sopenharmony_ci    arcStyle.lineOpa_ = style.borderOpa_;
485a3e0fd82Sopenharmony_ci    // draw left arc in border
486a3e0fd82Sopenharmony_ci    ArcInfo arcInfo;
487a3e0fd82Sopenharmony_ci    arcInfo.center = {col2X, row3Y};
488a3e0fd82Sopenharmony_ci    arcInfo.startAngle = SEMICIRCLE_IN_DEGREE;
489a3e0fd82Sopenharmony_ci    arcInfo.endAngle = CIRCLE_IN_DEGREE;
490a3e0fd82Sopenharmony_ci    arcInfo.radius = radius;
491a3e0fd82Sopenharmony_ci    arcInfo.imgPos = {0, 0};
492a3e0fd82Sopenharmony_ci    arcInfo.imgSrc = nullptr;
493a3e0fd82Sopenharmony_ci
494a3e0fd82Sopenharmony_ci    BaseGfxEngine* baseGfxEngine = BaseGfxEngine::GetInstance();
495a3e0fd82Sopenharmony_ci    baseGfxEngine->DrawArc(gfxDstBuffer, arcInfo, dirtyRect, arcStyle, opaScale, CapType::CAP_NONE);
496a3e0fd82Sopenharmony_ci    // draw right arc in border
497a3e0fd82Sopenharmony_ci    arcInfo.center = {col3X, row3Y};
498a3e0fd82Sopenharmony_ci    arcInfo.startAngle = 0;
499a3e0fd82Sopenharmony_ci    arcInfo.endAngle = SEMICIRCLE_IN_DEGREE;
500a3e0fd82Sopenharmony_ci    baseGfxEngine->DrawArc(gfxDstBuffer, arcInfo, dirtyRect, arcStyle, opaScale, CapType::CAP_NONE);
501a3e0fd82Sopenharmony_ci
502a3e0fd82Sopenharmony_ci    radius = radius - borderWidth;
503a3e0fd82Sopenharmony_ci    arcStyle.lineWidth_ = radius;
504a3e0fd82Sopenharmony_ci    arcStyle.lineColor_ = style.bgColor_;
505a3e0fd82Sopenharmony_ci    arcStyle.lineOpa_ = style.bgOpa_;
506a3e0fd82Sopenharmony_ci
507a3e0fd82Sopenharmony_ci    // draw left sector in rectangle
508a3e0fd82Sopenharmony_ci    arcInfo.center = {col2X, row3Y};
509a3e0fd82Sopenharmony_ci    arcInfo.startAngle = SEMICIRCLE_IN_DEGREE;
510a3e0fd82Sopenharmony_ci    arcInfo.endAngle = CIRCLE_IN_DEGREE;
511a3e0fd82Sopenharmony_ci    arcInfo.radius = radius;
512a3e0fd82Sopenharmony_ci    baseGfxEngine->DrawArc(gfxDstBuffer, arcInfo, dirtyRect, arcStyle, opaScale, CapType::CAP_NONE);
513a3e0fd82Sopenharmony_ci    // draw right sector in rectangle
514a3e0fd82Sopenharmony_ci    arcInfo.center = {col3X, row3Y};
515a3e0fd82Sopenharmony_ci    arcInfo.startAngle = 0;
516a3e0fd82Sopenharmony_ci    arcInfo.endAngle = SEMICIRCLE_IN_DEGREE;
517a3e0fd82Sopenharmony_ci    baseGfxEngine->DrawArc(gfxDstBuffer, arcInfo, dirtyRect, arcStyle, opaScale, CapType::CAP_NONE);
518a3e0fd82Sopenharmony_ci
519a3e0fd82Sopenharmony_ci    OpacityType opa = DrawUtils::GetMixOpacity(opaScale, style.borderOpa_);
520a3e0fd82Sopenharmony_ci    // top rectangle in border
521a3e0fd82Sopenharmony_ci    Rect topBorderRect(col2X, row1Y, col3X - 1, row2Y);
522a3e0fd82Sopenharmony_ci    DrawUtils* drawUtils = DrawUtils::GetInstance();
523a3e0fd82Sopenharmony_ci    drawUtils->DrawColorArea(gfxDstBuffer, topBorderRect, dirtyRect, style.borderColor_, opa);
524a3e0fd82Sopenharmony_ci    OpacityType opaBg = DrawUtils::GetMixOpacity(opaScale, style.bgOpa_);
525a3e0fd82Sopenharmony_ci    // middle rectangle inner
526a3e0fd82Sopenharmony_ci    Rect middleInnerRect(col2X, row2Y + 1, col3X - 1, row3Y);
527a3e0fd82Sopenharmony_ci    drawUtils->DrawColorArea(gfxDstBuffer, middleInnerRect, dirtyRect, style.bgColor_, opaBg);
528a3e0fd82Sopenharmony_ci    Rect middleInnerRect2(col2X + 1, row3Y + 1, col3X - 1, row4Y - 1);
529a3e0fd82Sopenharmony_ci    drawUtils->DrawColorArea(gfxDstBuffer, middleInnerRect2, dirtyRect, style.bgColor_, opaBg);
530a3e0fd82Sopenharmony_ci
531a3e0fd82Sopenharmony_ci    // bottom rectangle in border
532a3e0fd82Sopenharmony_ci    Rect bottomBorderRect(col2X + 1, row4Y, col3X - 1, row5Y);
533a3e0fd82Sopenharmony_ci    drawUtils->DrawColorArea(gfxDstBuffer, bottomBorderRect, dirtyRect, style.borderColor_, opa);
534a3e0fd82Sopenharmony_ci}
535a3e0fd82Sopenharmony_ci
536a3e0fd82Sopenharmony_civoid DrawRect::DrawRectRadiusBiggerThanBorderCon2(BufferInfo& gfxDstBuffer, const Rect& rect, const Rect& dirtyRect,
537a3e0fd82Sopenharmony_ci                                                  const Style& style, OpacityType opaScale)
538a3e0fd82Sopenharmony_ci{
539a3e0fd82Sopenharmony_ci    int16_t radius = rect.GetWidth() / 2;
540a3e0fd82Sopenharmony_ci    int16_t borderWidth = style.borderWidth_;
541a3e0fd82Sopenharmony_ci    int16_t col1X = rect.GetLeft();
542a3e0fd82Sopenharmony_ci    int16_t col2X = rect.GetLeft() + borderWidth - 1;
543a3e0fd82Sopenharmony_ci    int16_t col3X = rect.GetLeft() + radius - 1;
544a3e0fd82Sopenharmony_ci    int16_t col4X = rect.GetRight() - borderWidth + 1;
545a3e0fd82Sopenharmony_ci    int16_t col5X = rect.GetRight();
546a3e0fd82Sopenharmony_ci
547a3e0fd82Sopenharmony_ci    int16_t row2Y = rect.GetTop() + radius - 1;
548a3e0fd82Sopenharmony_ci    int16_t row3Y = rect.GetBottom() - radius + 1;
549a3e0fd82Sopenharmony_ci
550a3e0fd82Sopenharmony_ci    Style arcStyle = style;
551a3e0fd82Sopenharmony_ci    arcStyle.lineWidth_ = borderWidth;
552a3e0fd82Sopenharmony_ci    arcStyle.lineColor_ = style.borderColor_;
553a3e0fd82Sopenharmony_ci    arcStyle.lineOpa_ = style.borderOpa_;
554a3e0fd82Sopenharmony_ci    // draw top arc in border
555a3e0fd82Sopenharmony_ci    ArcInfo arcInfo;
556a3e0fd82Sopenharmony_ci    arcInfo.center = {col3X, row2Y};
557a3e0fd82Sopenharmony_ci    arcInfo.startAngle = THREE_QUARTER_IN_DEGREE;
558a3e0fd82Sopenharmony_ci    arcInfo.endAngle = QUARTER_IN_DEGREE;
559a3e0fd82Sopenharmony_ci    arcInfo.radius = radius;
560a3e0fd82Sopenharmony_ci    arcInfo.imgPos = {0, 0};
561a3e0fd82Sopenharmony_ci    arcInfo.imgSrc = nullptr;
562a3e0fd82Sopenharmony_ci    BaseGfxEngine* baseGfxEngine = BaseGfxEngine::GetInstance();
563a3e0fd82Sopenharmony_ci    baseGfxEngine->DrawArc(gfxDstBuffer, arcInfo, dirtyRect, arcStyle, opaScale, CapType::CAP_NONE);
564a3e0fd82Sopenharmony_ci    // draw bottom arc in border
565a3e0fd82Sopenharmony_ci    arcInfo.center = {col3X, row3Y};
566a3e0fd82Sopenharmony_ci    arcInfo.startAngle = QUARTER_IN_DEGREE;
567a3e0fd82Sopenharmony_ci    arcInfo.endAngle = THREE_QUARTER_IN_DEGREE;
568a3e0fd82Sopenharmony_ci    baseGfxEngine->DrawArc(gfxDstBuffer, arcInfo, dirtyRect, arcStyle, opaScale, CapType::CAP_NONE);
569a3e0fd82Sopenharmony_ci
570a3e0fd82Sopenharmony_ci    radius = radius - borderWidth;
571a3e0fd82Sopenharmony_ci    arcStyle.lineWidth_ = radius;
572a3e0fd82Sopenharmony_ci    arcStyle.lineColor_ = style.bgColor_;
573a3e0fd82Sopenharmony_ci    arcStyle.lineOpa_ = style.bgOpa_;
574a3e0fd82Sopenharmony_ci
575a3e0fd82Sopenharmony_ci    // draw top sector in rectangle
576a3e0fd82Sopenharmony_ci    arcInfo.center = {col3X, row2Y};
577a3e0fd82Sopenharmony_ci    arcInfo.startAngle = THREE_QUARTER_IN_DEGREE;
578a3e0fd82Sopenharmony_ci    arcInfo.endAngle = QUARTER_IN_DEGREE;
579a3e0fd82Sopenharmony_ci    arcInfo.radius = radius;
580a3e0fd82Sopenharmony_ci    baseGfxEngine->DrawArc(gfxDstBuffer, arcInfo, dirtyRect, arcStyle, opaScale, CapType::CAP_NONE);
581a3e0fd82Sopenharmony_ci    // draw bottom sector in rectangle
582a3e0fd82Sopenharmony_ci    arcInfo.center = {col3X, row3Y};
583a3e0fd82Sopenharmony_ci    arcInfo.startAngle = QUARTER_IN_DEGREE;
584a3e0fd82Sopenharmony_ci    arcInfo.endAngle = THREE_QUARTER_IN_DEGREE;
585a3e0fd82Sopenharmony_ci    baseGfxEngine->DrawArc(gfxDstBuffer, arcInfo, dirtyRect, arcStyle, opaScale, CapType::CAP_NONE);
586a3e0fd82Sopenharmony_ci
587a3e0fd82Sopenharmony_ci    OpacityType opa = DrawUtils::GetMixOpacity(opaScale, style.borderOpa_);
588a3e0fd82Sopenharmony_ci    // left rectangle in border
589a3e0fd82Sopenharmony_ci    Rect topBorderRect(col1X, row2Y + 1, col2X, row3Y - 1);
590a3e0fd82Sopenharmony_ci    DrawUtils* drawUtils = DrawUtils::GetInstance();
591a3e0fd82Sopenharmony_ci    drawUtils->DrawColorArea(gfxDstBuffer, topBorderRect, dirtyRect, style.borderColor_, opa);
592a3e0fd82Sopenharmony_ci
593a3e0fd82Sopenharmony_ci    OpacityType opaBg = DrawUtils::GetMixOpacity(opaScale, style.bgOpa_);
594a3e0fd82Sopenharmony_ci    // middle rectangle inner
595a3e0fd82Sopenharmony_ci    Rect middleInnerRect(col2X + 1, row2Y + 1, col4X - 1, row3Y - 1);
596a3e0fd82Sopenharmony_ci    drawUtils->DrawColorArea(gfxDstBuffer, middleInnerRect, dirtyRect, style.bgColor_, opaBg);
597a3e0fd82Sopenharmony_ci
598a3e0fd82Sopenharmony_ci    // right rectangle in border
599a3e0fd82Sopenharmony_ci    Rect bottomBorderRect(col4X, row2Y + 1, col5X, row3Y - 1);
600a3e0fd82Sopenharmony_ci    drawUtils->DrawColorArea(gfxDstBuffer, bottomBorderRect, dirtyRect, style.borderColor_, opa);
601a3e0fd82Sopenharmony_ci}
602a3e0fd82Sopenharmony_ci
603a3e0fd82Sopenharmony_civoid DrawRect::DrawRectRadiusBiggerThanBorderCon3(BufferInfo& gfxDstBuffer, const Rect& rect, const Rect& dirtyRect,
604a3e0fd82Sopenharmony_ci                                                  const Style& style, OpacityType opaScale)
605a3e0fd82Sopenharmony_ci{
606a3e0fd82Sopenharmony_ci    int16_t radius = rect.GetWidth() / 2;
607a3e0fd82Sopenharmony_ci    int16_t borderWidth = style.borderWidth_;
608a3e0fd82Sopenharmony_ci    int16_t col2X = rect.GetLeft() + radius - 1;
609a3e0fd82Sopenharmony_ci    int16_t row2Y = rect.GetTop() + radius - 1;
610a3e0fd82Sopenharmony_ci
611a3e0fd82Sopenharmony_ci    Style arcStyle = style;
612a3e0fd82Sopenharmony_ci    arcStyle.lineWidth_ = borderWidth;
613a3e0fd82Sopenharmony_ci    arcStyle.lineColor_ = style.borderColor_;
614a3e0fd82Sopenharmony_ci    arcStyle.lineOpa_ = style.borderOpa_;
615a3e0fd82Sopenharmony_ci    // draw circle in border
616a3e0fd82Sopenharmony_ci    ArcInfo arcInfo;
617a3e0fd82Sopenharmony_ci    arcInfo.center = {col2X, row2Y};
618a3e0fd82Sopenharmony_ci    arcInfo.startAngle = 0;
619a3e0fd82Sopenharmony_ci    arcInfo.endAngle = CIRCLE_IN_DEGREE;
620a3e0fd82Sopenharmony_ci    arcInfo.radius = radius;
621a3e0fd82Sopenharmony_ci    arcInfo.imgPos = {0, 0};
622a3e0fd82Sopenharmony_ci    arcInfo.imgSrc = nullptr;
623a3e0fd82Sopenharmony_ci    BaseGfxEngine* baseGfxEngine = BaseGfxEngine::GetInstance();
624a3e0fd82Sopenharmony_ci    baseGfxEngine->DrawArc(gfxDstBuffer, arcInfo, dirtyRect, arcStyle, opaScale, CapType::CAP_NONE);
625a3e0fd82Sopenharmony_ci
626a3e0fd82Sopenharmony_ci    radius = radius - borderWidth;
627a3e0fd82Sopenharmony_ci    arcStyle.lineWidth_ = radius;
628a3e0fd82Sopenharmony_ci    arcStyle.lineColor_ = style.bgColor_;
629a3e0fd82Sopenharmony_ci    arcStyle.lineOpa_ = style.bgOpa_;
630a3e0fd82Sopenharmony_ci
631a3e0fd82Sopenharmony_ci    // draw circle in rectangle
632a3e0fd82Sopenharmony_ci    arcInfo.center = {col2X, row2Y};
633a3e0fd82Sopenharmony_ci    arcInfo.startAngle = 0;
634a3e0fd82Sopenharmony_ci    arcInfo.endAngle = CIRCLE_IN_DEGREE;
635a3e0fd82Sopenharmony_ci    arcInfo.radius = radius;
636a3e0fd82Sopenharmony_ci    baseGfxEngine->DrawArc(gfxDstBuffer, arcInfo, dirtyRect, arcStyle, opaScale, CapType::CAP_NONE);
637a3e0fd82Sopenharmony_ci}
638a3e0fd82Sopenharmony_ci
639a3e0fd82Sopenharmony_civoid DrawRect::DrawRectRadiusBiggerThanBorderCon4(BufferInfo& gfxDstBuffer, const Rect& rect, const Rect& dirtyRect,
640a3e0fd82Sopenharmony_ci                                                  const Style& style, OpacityType opaScale)
641a3e0fd82Sopenharmony_ci{
642a3e0fd82Sopenharmony_ci    int16_t radius = style.borderRadius_;
643a3e0fd82Sopenharmony_ci    int16_t borderWidth = style.borderWidth_;
644a3e0fd82Sopenharmony_ci    int16_t col1X = rect.GetLeft();
645a3e0fd82Sopenharmony_ci    int16_t col2X = rect.GetLeft() + borderWidth - 1;
646a3e0fd82Sopenharmony_ci    int16_t col3X = rect.GetLeft() + radius - 1;
647a3e0fd82Sopenharmony_ci    int16_t col4X = rect.GetRight() - radius + 1;
648a3e0fd82Sopenharmony_ci    int16_t col5X = rect.GetRight() - borderWidth + 1;
649a3e0fd82Sopenharmony_ci    int16_t col6X = rect.GetRight();
650a3e0fd82Sopenharmony_ci
651a3e0fd82Sopenharmony_ci    int16_t row1Y = rect.GetTop();
652a3e0fd82Sopenharmony_ci    int16_t row2Y = rect.GetTop() + borderWidth - 1;
653a3e0fd82Sopenharmony_ci    int16_t row3Y = rect.GetTop() + radius - 1;
654a3e0fd82Sopenharmony_ci    int16_t row4Y = rect.GetBottom() - radius + 1;
655a3e0fd82Sopenharmony_ci    int16_t row5Y = rect.GetBottom() - borderWidth + 1;
656a3e0fd82Sopenharmony_ci    int16_t row6Y = rect.GetBottom();
657a3e0fd82Sopenharmony_ci
658a3e0fd82Sopenharmony_ci    Style arcStyle = style;
659a3e0fd82Sopenharmony_ci    arcStyle.lineWidth_ = borderWidth;
660a3e0fd82Sopenharmony_ci    arcStyle.lineColor_ = style.borderColor_;
661a3e0fd82Sopenharmony_ci    arcStyle.lineOpa_ = style.borderOpa_;
662a3e0fd82Sopenharmony_ci
663a3e0fd82Sopenharmony_ci    // draw top left arc in border
664a3e0fd82Sopenharmony_ci    ArcInfo arcInfo;
665a3e0fd82Sopenharmony_ci    arcInfo.center = {col3X, row3Y};
666a3e0fd82Sopenharmony_ci    arcInfo.startAngle = THREE_QUARTER_IN_DEGREE;
667a3e0fd82Sopenharmony_ci    arcInfo.endAngle = CIRCLE_IN_DEGREE;
668a3e0fd82Sopenharmony_ci    arcInfo.radius = radius;
669a3e0fd82Sopenharmony_ci    arcInfo.imgPos = {0, 0};
670a3e0fd82Sopenharmony_ci    arcInfo.imgSrc = nullptr;
671a3e0fd82Sopenharmony_ci    BaseGfxEngine* baseGfxEngine = BaseGfxEngine::GetInstance();
672a3e0fd82Sopenharmony_ci    baseGfxEngine->DrawArc(gfxDstBuffer, arcInfo, dirtyRect, arcStyle, opaScale, CapType::CAP_NONE);
673a3e0fd82Sopenharmony_ci    // draw top right arc in border
674a3e0fd82Sopenharmony_ci    arcInfo.center = {col4X, row3Y};
675a3e0fd82Sopenharmony_ci    arcInfo.startAngle = 0;
676a3e0fd82Sopenharmony_ci    arcInfo.endAngle = QUARTER_IN_DEGREE;
677a3e0fd82Sopenharmony_ci    baseGfxEngine->DrawArc(gfxDstBuffer, arcInfo, dirtyRect, arcStyle, opaScale, CapType::CAP_NONE);
678a3e0fd82Sopenharmony_ci    // draw bottom left arc in border
679a3e0fd82Sopenharmony_ci    arcInfo.center = {col3X, row4Y};
680a3e0fd82Sopenharmony_ci    arcInfo.startAngle = SEMICIRCLE_IN_DEGREE;
681a3e0fd82Sopenharmony_ci    arcInfo.endAngle = THREE_QUARTER_IN_DEGREE;
682a3e0fd82Sopenharmony_ci    baseGfxEngine->DrawArc(gfxDstBuffer, arcInfo, dirtyRect, arcStyle, opaScale, CapType::CAP_NONE);
683a3e0fd82Sopenharmony_ci    // draw bottom right arc in border
684a3e0fd82Sopenharmony_ci    arcInfo.center = {col4X, row4Y};
685a3e0fd82Sopenharmony_ci    arcInfo.startAngle = QUARTER_IN_DEGREE;
686a3e0fd82Sopenharmony_ci    arcInfo.endAngle = SEMICIRCLE_IN_DEGREE;
687a3e0fd82Sopenharmony_ci    baseGfxEngine->DrawArc(gfxDstBuffer, arcInfo, dirtyRect, arcStyle, opaScale, CapType::CAP_NONE);
688a3e0fd82Sopenharmony_ci
689a3e0fd82Sopenharmony_ci    radius = radius - borderWidth;
690a3e0fd82Sopenharmony_ci    arcStyle.lineWidth_ = radius;
691a3e0fd82Sopenharmony_ci    arcStyle.lineColor_ = style.bgColor_;
692a3e0fd82Sopenharmony_ci    arcStyle.lineOpa_ = style.bgOpa_;
693a3e0fd82Sopenharmony_ci
694a3e0fd82Sopenharmony_ci    // draw top left sector in rectangle
695a3e0fd82Sopenharmony_ci    arcInfo.center = {col3X, row3Y};
696a3e0fd82Sopenharmony_ci    arcInfo.startAngle = THREE_QUARTER_IN_DEGREE;
697a3e0fd82Sopenharmony_ci    arcInfo.endAngle = CIRCLE_IN_DEGREE;
698a3e0fd82Sopenharmony_ci    arcInfo.radius = radius;
699a3e0fd82Sopenharmony_ci    baseGfxEngine->DrawArc(gfxDstBuffer, arcInfo, dirtyRect, arcStyle, opaScale, CapType::CAP_NONE);
700a3e0fd82Sopenharmony_ci    // draw top right sector in rectangle
701a3e0fd82Sopenharmony_ci    arcInfo.center = {col4X, row3Y};
702a3e0fd82Sopenharmony_ci    arcInfo.startAngle = 0;
703a3e0fd82Sopenharmony_ci    arcInfo.endAngle = QUARTER_IN_DEGREE;
704a3e0fd82Sopenharmony_ci    baseGfxEngine->DrawArc(gfxDstBuffer, arcInfo, dirtyRect, arcStyle, opaScale, CapType::CAP_NONE);
705a3e0fd82Sopenharmony_ci    // draw bottom left sector in rectangle
706a3e0fd82Sopenharmony_ci    arcInfo.center = {col3X, row4Y};
707a3e0fd82Sopenharmony_ci    arcInfo.startAngle = SEMICIRCLE_IN_DEGREE;
708a3e0fd82Sopenharmony_ci    arcInfo.endAngle = THREE_QUARTER_IN_DEGREE;
709a3e0fd82Sopenharmony_ci    baseGfxEngine->DrawArc(gfxDstBuffer, arcInfo, dirtyRect, arcStyle, opaScale, CapType::CAP_NONE);
710a3e0fd82Sopenharmony_ci    // draw bottom right sector in rectangle
711a3e0fd82Sopenharmony_ci    arcInfo.center = {col4X, row4Y};
712a3e0fd82Sopenharmony_ci    arcInfo.startAngle = QUARTER_IN_DEGREE;
713a3e0fd82Sopenharmony_ci    arcInfo.endAngle = SEMICIRCLE_IN_DEGREE;
714a3e0fd82Sopenharmony_ci    baseGfxEngine->DrawArc(gfxDstBuffer, arcInfo, dirtyRect, arcStyle, opaScale, CapType::CAP_NONE);
715a3e0fd82Sopenharmony_ci
716a3e0fd82Sopenharmony_ci    OpacityType opa = DrawUtils::GetMixOpacity(opaScale, style.borderOpa_);
717a3e0fd82Sopenharmony_ci    // top rectangle in border
718a3e0fd82Sopenharmony_ci    Rect topBorderRect(col3X, row1Y, col4X - 1, row2Y);
719a3e0fd82Sopenharmony_ci    DrawUtils::GetInstance()->DrawColorArea(gfxDstBuffer, topBorderRect, dirtyRect, style.borderColor_, opa);
720a3e0fd82Sopenharmony_ci
721a3e0fd82Sopenharmony_ci    OpacityType opaBg = DrawUtils::GetMixOpacity(opaScale, style.bgOpa_);
722a3e0fd82Sopenharmony_ci    // top rectangle inner
723a3e0fd82Sopenharmony_ci    Rect topInnerRect(col3X, row2Y + 1, col4X - 1, row3Y);
724a3e0fd82Sopenharmony_ci    DrawUtils* drawUtils = DrawUtils::GetInstance();
725a3e0fd82Sopenharmony_ci    drawUtils->DrawColorArea(gfxDstBuffer, topInnerRect, dirtyRect, style.bgColor_, opaBg);
726a3e0fd82Sopenharmony_ci
727a3e0fd82Sopenharmony_ci    // left rectangle in border
728a3e0fd82Sopenharmony_ci    Rect leftBorderRect(col1X, row3Y + 1, col2X, row4Y - 1);
729a3e0fd82Sopenharmony_ci    drawUtils->DrawColorArea(gfxDstBuffer, leftBorderRect, dirtyRect, style.borderColor_, opa);
730a3e0fd82Sopenharmony_ci
731a3e0fd82Sopenharmony_ci    // middle rectangle inner
732a3e0fd82Sopenharmony_ci    Rect middleInnerRect(col2X + 1, row3Y + 1, col5X - 1, row4Y - 1);
733a3e0fd82Sopenharmony_ci    drawUtils->DrawColorArea(gfxDstBuffer, middleInnerRect, dirtyRect, style.bgColor_, opaBg);
734a3e0fd82Sopenharmony_ci
735a3e0fd82Sopenharmony_ci    // right rectangle in border
736a3e0fd82Sopenharmony_ci    Rect rightBorderRect(col5X, row3Y + 1, col6X, row4Y - 1);
737a3e0fd82Sopenharmony_ci    drawUtils->DrawColorArea(gfxDstBuffer, rightBorderRect, dirtyRect, style.borderColor_, opa);
738a3e0fd82Sopenharmony_ci
739a3e0fd82Sopenharmony_ci    // bottom rectangle inner
740a3e0fd82Sopenharmony_ci    Rect bottomInnerRect(col3X + 1, row4Y, col4X - 1, row5Y - 1);
741a3e0fd82Sopenharmony_ci    drawUtils->DrawColorArea(gfxDstBuffer, bottomInnerRect, dirtyRect, style.bgColor_, opaBg);
742a3e0fd82Sopenharmony_ci
743a3e0fd82Sopenharmony_ci    // bottom rectangle in border
744a3e0fd82Sopenharmony_ci    Rect bottomBorderRect(col3X + 1, row5Y, col4X - 1, row6Y);
745a3e0fd82Sopenharmony_ci    drawUtils->DrawColorArea(gfxDstBuffer, bottomBorderRect, dirtyRect, style.borderColor_, opa);
746a3e0fd82Sopenharmony_ci}
747a3e0fd82Sopenharmony_ci} // namespace OHOS
748