1 /*
2  * Copyright (c) 2022 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include "core/components_ng/render/ellipse_painter.h"
17 
18 #include "core/components_ng/render/shape_painter.h"
19 
20 namespace OHOS::Ace::NG {
DrawEllipse(RSCanvas & canvas,const RectF & rect,const ShapePaintProperty & shapePaintProperty)21 void EllipsePainter::DrawEllipse(RSCanvas& canvas, const RectF& rect, const ShapePaintProperty& shapePaintProperty)
22 {
23     RSPen pen;
24     RSBrush brush;
25     if (ShapePainter::SetPen(pen, shapePaintProperty)) {
26         canvas.AttachPen(pen);
27     }
28     ShapePainter::SetBrush(brush, shapePaintProperty);
29     canvas.AttachBrush(brush);
30     canvas.DrawOval(RSRect(rect.GetX(), rect.GetY(), rect.GetX() + rect.Width(), rect.GetY() + rect.Height()));
31 #ifdef USE_ROSEN_DRAWING
32     canvas.DetachBrush();
33     canvas.DetachPen();
34 #endif
35 }
36 } // namespace OHOS::Ace::NG