Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Graphic Ui
提交
073d9d7c
G
Graphic Ui
项目概览
OpenHarmony
/
Graphic Ui
大约 1 年 前同步成功
通知
13
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
Graphic Ui
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
073d9d7c
编写于
2月 07, 2023
作者:
O
openharmony_ci
提交者:
Gitee
2月 07, 2023
浏览文件
操作
浏览文件
下载
差异文件
!869 隔离canvas扩展功能
Merge pull request !869 from 郝烁/master
上级
b61a5b91
95e3eb23
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
401 addition
and
12 deletion
+401
-12
BUILD.gn
BUILD.gn
+1
-0
frameworks/components/ui_canvas.cpp
frameworks/components/ui_canvas.cpp
+315
-5
frameworks/draw/draw_canvas.cpp
frameworks/draw/draw_canvas.cpp
+4
-0
frameworks/draw/draw_canvas.h
frameworks/draw/draw_canvas.h
+6
-2
frameworks/engines/gfx/soft_engine.cpp
frameworks/engines/gfx/soft_engine.cpp
+4
-0
interfaces/kits/components/ui_canvas.h
interfaces/kits/components/ui_canvas.h
+42
-1
test/uitest/test_canvas/ui_test_canvas.cpp
test/uitest/test_canvas/ui_test_canvas.cpp
+14
-0
test/unittest/components/ui_canvas_unit_test.cpp
test/unittest/components/ui_canvas_unit_test.cpp
+14
-4
tools/qt/simulator/libui/libui.pro
tools/qt/simulator/libui/libui.pro
+1
-0
未找到文件。
BUILD.gn
浏览文件 @
073d9d7c
...
@@ -73,6 +73,7 @@ config("graphic_define_config") {
...
@@ -73,6 +73,7 @@ config("graphic_define_config") {
} else if (ohos_kernel_type == "liteos_m") {
} else if (ohos_kernel_type == "liteos_m") {
include_dirs += [ "//third_party/freetype/include" ]
include_dirs += [ "//third_party/freetype/include" ]
defines += [
defines += [
"ENABLE_CANVAS_EXTEND=0",
"GRAPHIC_ENABLE_DASH_GENERATE_FLAG=1",
"GRAPHIC_ENABLE_DASH_GENERATE_FLAG=1",
"GRAPHIC_ENABLE_BLUR_EFFECT_FLAG=1",
"GRAPHIC_ENABLE_BLUR_EFFECT_FLAG=1",
"GRAPHIC_ENABLE_PATTERN_FILL_FLAG=1",
"GRAPHIC_ENABLE_PATTERN_FILL_FLAG=1",
...
...
frameworks/components/ui_canvas.cpp
浏览文件 @
073d9d7c
...
@@ -17,7 +17,6 @@
...
@@ -17,7 +17,6 @@
#include "draw/clip_utils.h"
#include "draw/clip_utils.h"
#include "draw/draw_arc.h"
#include "draw/draw_arc.h"
#include "draw/draw_canvas.h"
#include "draw/draw_image.h"
#include "draw/draw_image.h"
#include "gfx_utils/graphic_log.h"
#include "gfx_utils/graphic_log.h"
#include "render/render_buffer.h"
#include "render/render_buffer.h"
...
@@ -25,6 +24,12 @@
...
@@ -25,6 +24,12 @@
#include "render/render_scanline.h"
#include "render/render_scanline.h"
namespace
OHOS
{
namespace
OHOS
{
UICanvas
::
UICanvasPath
::~
UICanvasPath
()
{
points_
.
Clear
();
cmd_
.
Clear
();
arcParam_
.
Clear
();
}
BufferInfo
*
UICanvas
::
gfxMapBuffer_
=
nullptr
;
BufferInfo
*
UICanvas
::
gfxMapBuffer_
=
nullptr
;
...
@@ -35,6 +40,7 @@ void RenderSolid(const Paint& paint,
...
@@ -35,6 +40,7 @@ void RenderSolid(const Paint& paint,
void
UICanvas
::
BeginPath
()
void
UICanvas
::
BeginPath
()
{
{
#if defined(ENABLE_CANVAS_EXTEND) && ENABLE_CANVAS_EXTEND
/* If the previous path is not added to the drawing linked list, it should be destroyed directly. */
/* If the previous path is not added to the drawing linked list, it should be destroyed directly. */
if
(
vertices_
!=
nullptr
&&
vertices_
->
GetTotalVertices
()
==
0
)
{
if
(
vertices_
!=
nullptr
&&
vertices_
->
GetTotalVertices
()
==
0
)
{
delete
vertices_
;
delete
vertices_
;
...
@@ -46,26 +52,68 @@ void UICanvas::BeginPath()
...
@@ -46,26 +52,68 @@ void UICanvas::BeginPath()
GRAPHIC_LOGE
(
"new UICanvasVertices fail"
);
GRAPHIC_LOGE
(
"new UICanvasVertices fail"
);
return
;
return
;
}
}
#else
if
(
path_
!=
nullptr
&&
path_
->
strokeCount_
==
0
)
{
delete
path_
;
path_
=
nullptr
;
}
path_
=
new
UICanvasPath
();
if
(
path_
==
nullptr
)
{
GRAPHIC_LOGE
(
"new UICanvasPath fail"
);
return
;
}
#endif
}
}
void
UICanvas
::
MoveTo
(
const
Point
&
point
)
void
UICanvas
::
MoveTo
(
const
Point
&
point
)
{
{
#if defined(ENABLE_CANVAS_EXTEND) && ENABLE_CANVAS_EXTEND
if
(
vertices_
==
nullptr
)
{
if
(
vertices_
==
nullptr
)
{
return
;
return
;
}
}
vertices_
->
MoveTo
(
point
.
x
,
point
.
y
);
vertices_
->
MoveTo
(
point
.
x
,
point
.
y
);
#else
if
(
path_
==
nullptr
)
{
return
;
}
path_
->
startPos_
=
point
;
/* If the previous command is also CMD_MOVE_TO, the previous command is overwritten. */
if
((
path_
->
cmd_
.
Size
()
!=
0
)
&&
(
path_
->
cmd_
.
Tail
()
->
data_
==
CMD_MOVE_TO
))
{
path_
->
points_
.
Tail
()
->
data_
=
point
;
return
;
}
path_
->
points_
.
PushBack
(
point
);
path_
->
cmd_
.
PushBack
(
CMD_MOVE_TO
);
#endif
}
}
void
UICanvas
::
LineTo
(
const
Point
&
point
)
void
UICanvas
::
LineTo
(
const
Point
&
point
)
{
{
#if defined(ENABLE_CANVAS_EXTEND) && ENABLE_CANVAS_EXTEND
if
(
vertices_
==
nullptr
)
{
if
(
vertices_
==
nullptr
)
{
return
;
return
;
}
}
vertices_
->
LineTo
(
point
.
x
,
point
.
y
);
vertices_
->
LineTo
(
point
.
x
,
point
.
y
);
#else
if
(
path_
==
nullptr
)
{
return
;
}
path_
->
points_
.
PushBack
(
point
);
if
(
path_
->
cmd_
.
Size
()
==
0
)
{
path_
->
startPos_
=
point
;
path_
->
cmd_
.
PushBack
(
CMD_MOVE_TO
);
}
else
{
path_
->
cmd_
.
PushBack
(
CMD_LINE_TO
);
}
#endif
}
}
void
UICanvas
::
ArcTo
(
const
Point
&
center
,
uint16_t
radius
,
int16_t
startAngle
,
int16_t
endAngle
)
void
UICanvas
::
ArcTo
(
const
Point
&
center
,
uint16_t
radius
,
int16_t
startAngle
,
int16_t
endAngle
)
{
{
#if defined(ENABLE_CANVAS_EXTEND) && ENABLE_CANVAS_EXTEND
if
(
vertices_
==
nullptr
||
startAngle
==
endAngle
)
{
if
(
vertices_
==
nullptr
||
startAngle
==
endAngle
)
{
return
;
return
;
}
}
...
@@ -86,10 +134,55 @@ void UICanvas::ArcTo(const Point& center, uint16_t radius, int16_t startAngle, i
...
@@ -86,10 +134,55 @@ void UICanvas::ArcTo(const Point& center, uint16_t radius, int16_t startAngle, i
largeArcFlag
=
true
;
largeArcFlag
=
true
;
}
}
vertices_
->
ArcTo
(
radius
,
radius
,
angle
,
largeArcFlag
,
1
,
float
(
center
.
x
+
sinma
),
float
(
center
.
y
-
cosma
));
vertices_
->
ArcTo
(
radius
,
radius
,
angle
,
largeArcFlag
,
1
,
float
(
center
.
x
+
sinma
),
float
(
center
.
y
-
cosma
));
#else
if
(
path_
==
nullptr
)
{
return
;
}
/*
* If there is no command before CMD_ARC, only the arc is drawn. If there is a command in front of
* CMD_ARC, the start point of arc must be connected to the end point of the path.
*/
float
sinma
=
radius
*
Sin
(
startAngle
);
float
cosma
=
radius
*
Sin
(
QUARTER_IN_DEGREE
-
startAngle
);
if
(
path_
->
cmd_
.
Size
()
!=
0
)
{
path_
->
points_
.
PushBack
({
MATH_ROUND
(
center
.
x
+
sinma
),
MATH_ROUND
(
center
.
y
-
cosma
)});
path_
->
cmd_
.
PushBack
(
CMD_LINE_TO
);
}
else
{
path_
->
startPos_
=
{
MATH_ROUND
(
center
.
x
+
sinma
),
MATH_ROUND
(
center
.
y
-
cosma
)};
}
/* If the ARC scan range exceeds 360 degrees, the end point of the path is the position of the start angle. */
if
(
MATH_ABS
(
startAngle
-
endAngle
)
<
CIRCLE_IN_DEGREE
)
{
sinma
=
radius
*
Sin
(
endAngle
);
cosma
=
radius
*
Sin
(
QUARTER_IN_DEGREE
-
endAngle
);
}
path_
->
points_
.
PushBack
({
MATH_ROUND
(
center
.
x
+
sinma
),
MATH_ROUND
(
center
.
y
-
cosma
)});
path_
->
cmd_
.
PushBack
(
CMD_ARC
);
int16_t
start
;
int16_t
end
;
if
(
startAngle
>
endAngle
)
{
start
=
endAngle
;
end
=
startAngle
;
}
else
{
start
=
startAngle
;
end
=
endAngle
;
}
DrawArc
::
GetInstance
()
->
GetDrawRange
(
start
,
end
);
ArcParam
param
;
param
.
center
=
center
;
param
.
radius
=
radius
;
param
.
startAngle
=
start
;
param
.
endAngle
=
end
;
path_
->
arcParam_
.
PushBack
(
param
);
#endif
}
}
void
UICanvas
::
AddRect
(
const
Point
&
point
,
int16_t
height
,
int16_t
width
)
void
UICanvas
::
AddRect
(
const
Point
&
point
,
int16_t
height
,
int16_t
width
)
{
{
#if defined(ENABLE_CANVAS_EXTEND) && ENABLE_CANVAS_EXTEND
if
(
vertices_
==
nullptr
)
{
if
(
vertices_
==
nullptr
)
{
return
;
return
;
}
}
...
@@ -106,23 +199,48 @@ void UICanvas::AddRect(const Point& point, int16_t height, int16_t width)
...
@@ -106,23 +199,48 @@ void UICanvas::AddRect(const Point& point, int16_t height, int16_t width)
if
(
fBottom
>
INT16_MAX
)
{
if
(
fBottom
>
INT16_MAX
)
{
bottom
+=
setup
;
bottom
+=
setup
;
}
}
MoveTo
(
point
);
MoveTo
(
point
);
LineTo
({
right
,
point
.
y
});
LineTo
({
right
,
point
.
y
});
LineTo
({
right
,
bottom
});
LineTo
({
right
,
bottom
});
LineTo
({
point
.
x
,
bottom
});
LineTo
({
point
.
x
,
bottom
});
#else
if
(
path_
==
nullptr
)
{
return
;
}
MoveTo
(
point
);
LineTo
({
static_cast
<
int16_t
>
(
point
.
x
+
width
),
point
.
y
});
LineTo
({
static_cast
<
int16_t
>
(
point
.
x
+
width
),
static_cast
<
int16_t
>
(
point
.
y
+
height
)});
LineTo
({
point
.
x
,
static_cast
<
int16_t
>
(
point
.
y
+
height
)});
#endif
ClosePath
();
ClosePath
();
}
}
void
UICanvas
::
ClosePath
()
void
UICanvas
::
ClosePath
()
{
{
#if defined(ENABLE_CANVAS_EXTEND) && ENABLE_CANVAS_EXTEND
if
(
vertices_
==
nullptr
)
{
if
(
vertices_
==
nullptr
)
{
return
;
return
;
}
}
vertices_
->
ClosePolygon
();
vertices_
->
ClosePolygon
();
#else
if
((
path_
==
nullptr
)
||
(
path_
->
cmd_
.
Size
()
==
0
))
{
return
;
}
path_
->
points_
.
PushBack
(
path_
->
startPos_
);
path_
->
cmd_
.
PushBack
(
CMD_CLOSE
);
#endif
}
}
UICanvas
::~
UICanvas
()
UICanvas
::~
UICanvas
()
{
{
if
((
path_
!=
nullptr
)
&&
(
path_
->
strokeCount_
==
0
))
{
delete
path_
;
path_
=
nullptr
;
}
void
*
param
=
nullptr
;
void
*
param
=
nullptr
;
ListNode
<
DrawCmd
>*
curDraw
=
drawCmdList_
.
Begin
();
ListNode
<
DrawCmd
>*
curDraw
=
drawCmdList_
.
Begin
();
for
(;
curDraw
!=
drawCmdList_
.
End
();
curDraw
=
curDraw
->
next_
)
{
for
(;
curDraw
!=
drawCmdList_
.
End
();
curDraw
=
curDraw
->
next_
)
{
...
@@ -140,6 +258,10 @@ UICanvas::~UICanvas()
...
@@ -140,6 +258,10 @@ UICanvas::~UICanvas()
void
UICanvas
::
Clear
()
void
UICanvas
::
Clear
()
{
{
if
((
path_
!=
nullptr
)
&&
(
path_
->
strokeCount_
==
0
))
{
delete
path_
;
path_
=
nullptr
;
}
void
*
param
=
nullptr
;
void
*
param
=
nullptr
;
ListNode
<
DrawCmd
>*
curDraw
=
drawCmdList_
.
Begin
();
ListNode
<
DrawCmd
>*
curDraw
=
drawCmdList_
.
Begin
();
for
(;
curDraw
!=
drawCmdList_
.
End
();
curDraw
=
curDraw
->
next_
)
{
for
(;
curDraw
!=
drawCmdList_
.
End
();
curDraw
=
curDraw
->
next_
)
{
...
@@ -155,7 +277,7 @@ void UICanvas::Clear()
...
@@ -155,7 +277,7 @@ void UICanvas::Clear()
Invalidate
();
Invalidate
();
}
}
void
DeleteImageParam
(
void
*
param
)
void
UICanvas
::
DeleteImageParam
(
void
*
param
)
{
{
ImageParam
*
imageParam
=
static_cast
<
ImageParam
*>
(
param
);
ImageParam
*
imageParam
=
static_cast
<
ImageParam
*>
(
param
);
if
(
imageParam
->
image
!=
nullptr
)
{
if
(
imageParam
->
image
!=
nullptr
)
{
...
@@ -166,9 +288,10 @@ void DeleteImageParam(void* param)
...
@@ -166,9 +288,10 @@ void DeleteImageParam(void* param)
imageParam
=
nullptr
;
imageParam
=
nullptr
;
}
}
void
DeletePathParam
(
void
*
param
)
void
UICanvas
::
DeletePathParam
(
void
*
param
)
{
{
PathParam
*
pathParam
=
static_cast
<
PathParam
*>
(
param
);
PathParam
*
pathParam
=
static_cast
<
PathParam
*>
(
param
);
#if defined(ENABLE_CANVAS_EXTEND) && ENABLE_CANVAS_EXTEND
if
(
pathParam
->
vertices
!=
nullptr
)
{
if
(
pathParam
->
vertices
!=
nullptr
)
{
pathParam
->
vertices
->
FreeAll
();
pathParam
->
vertices
->
FreeAll
();
pathParam
->
vertices
=
nullptr
;
pathParam
->
vertices
=
nullptr
;
...
@@ -176,6 +299,12 @@ void DeletePathParam(void* param)
...
@@ -176,6 +299,12 @@ void DeletePathParam(void* param)
if
(
pathParam
->
imageParam
!=
nullptr
)
{
if
(
pathParam
->
imageParam
!=
nullptr
)
{
DeleteImageParam
(
pathParam
->
imageParam
);
DeleteImageParam
(
pathParam
->
imageParam
);
}
}
#else
pathParam
->
path
->
strokeCount_
--
;
if
(
pathParam
->
path
->
strokeCount_
==
0
)
{
delete
pathParam
->
path
;
}
#endif
delete
pathParam
;
delete
pathParam
;
pathParam
=
nullptr
;
pathParam
=
nullptr
;
}
}
...
@@ -243,6 +372,7 @@ void UICanvas::DrawCurve(const Point& startPoint,
...
@@ -243,6 +372,7 @@ void UICanvas::DrawCurve(const Point& startPoint,
void
UICanvas
::
DrawRect
(
const
Point
&
startPoint
,
int16_t
height
,
int16_t
width
,
const
Paint
&
paint
)
void
UICanvas
::
DrawRect
(
const
Point
&
startPoint
,
int16_t
height
,
int16_t
width
,
const
Paint
&
paint
)
{
{
#if defined(ENABLE_CANVAS_EXTEND) && ENABLE_CANVAS_EXTEND
if
(
!
paint
.
GetChangeFlag
())
{
if
(
!
paint
.
GetChangeFlag
())
{
if
(
static_cast
<
uint8_t
>
(
paint
.
GetStyle
())
&
Paint
::
PaintStyle
::
STROKE_STYLE
)
{
if
(
static_cast
<
uint8_t
>
(
paint
.
GetStyle
())
&
Paint
::
PaintStyle
::
STROKE_STYLE
)
{
DrawRectSetCmd
(
startPoint
,
height
,
width
,
paint
,
Paint
::
PaintStyle
::
STROKE_STYLE
);
DrawRectSetCmd
(
startPoint
,
height
,
width
,
paint
,
Paint
::
PaintStyle
::
STROKE_STYLE
);
...
@@ -261,6 +391,43 @@ void UICanvas::DrawRect(const Point& startPoint, int16_t height, int16_t width,
...
@@ -261,6 +391,43 @@ void UICanvas::DrawRect(const Point& startPoint, int16_t height, int16_t width,
FillPath
(
paint
);
FillPath
(
paint
);
DrawPath
(
paint
);
DrawPath
(
paint
);
}
}
#else
if
(
static_cast
<
uint8_t
>
(
paint
.
GetStyle
())
&
Paint
::
PaintStyle
::
STROKE_STYLE
)
{
RectParam
*
rectParam
=
new
RectParam
;
if
(
rectParam
==
nullptr
)
{
GRAPHIC_LOGE
(
"new RectParam fail"
);
return
;
}
rectParam
->
start
=
startPoint
;
rectParam
->
height
=
height
;
rectParam
->
width
=
width
;
DrawCmd
cmd
;
cmd
.
paint
=
paint
;
cmd
.
param
=
rectParam
;
cmd
.
DeleteParam
=
DeleteRectParam
;
cmd
.
DrawGraphics
=
DoDrawRect
;
drawCmdList_
.
PushBack
(
cmd
);
}
if
(
static_cast
<
uint8_t
>
(
paint
.
GetStyle
())
&
Paint
::
PaintStyle
::
FILL_STYLE
)
{
RectParam
*
rectParam
=
new
RectParam
;
if
(
rectParam
==
nullptr
)
{
GRAPHIC_LOGE
(
"new RectParam fail"
);
return
;
}
rectParam
->
start
=
startPoint
;
rectParam
->
height
=
height
;
rectParam
->
width
=
width
;
DrawCmd
cmd
;
cmd
.
paint
=
paint
;
cmd
.
param
=
rectParam
;
cmd
.
DeleteParam
=
DeleteRectParam
;
cmd
.
DrawGraphics
=
DoFillRect
;
drawCmdList_
.
PushBack
(
cmd
);
}
#endif
Invalidate
();
Invalidate
();
}
}
...
@@ -288,6 +455,7 @@ void UICanvas::DrawRectSetCmd(const Point& startPoint, int16_t height, int16_t w
...
@@ -288,6 +455,7 @@ void UICanvas::DrawRectSetCmd(const Point& startPoint, int16_t height, int16_t w
drawCmdList_
.
PushBack
(
cmd
);
drawCmdList_
.
PushBack
(
cmd
);
}
}
#if defined(ENABLE_CANVAS_EXTEND) && ENABLE_CANVAS_EXTEND
void
UICanvas
::
StrokeRect
(
const
Point
&
startPoint
,
int16_t
height
,
int16_t
width
,
const
Paint
&
paint
)
void
UICanvas
::
StrokeRect
(
const
Point
&
startPoint
,
int16_t
height
,
int16_t
width
,
const
Paint
&
paint
)
{
{
if
(
!
paint
.
GetChangeFlag
())
{
if
(
!
paint
.
GetChangeFlag
())
{
...
@@ -331,9 +499,11 @@ void UICanvas::ClearRect(const Point& startPoint, int16_t height, int16_t width)
...
@@ -331,9 +499,11 @@ void UICanvas::ClearRect(const Point& startPoint, int16_t height, int16_t width)
ClosePath
();
ClosePath
();
FillPath
(
paint
);
FillPath
(
paint
);
}
}
#endif
void
UICanvas
::
DrawCircle
(
const
Point
&
center
,
uint16_t
radius
,
const
Paint
&
paint
)
void
UICanvas
::
DrawCircle
(
const
Point
&
center
,
uint16_t
radius
,
const
Paint
&
paint
)
{
{
#if defined(ENABLE_CANVAS_EXTEND) && ENABLE_CANVAS_EXTEND
if
(
paint
.
GetChangeFlag
())
{
if
(
paint
.
GetChangeFlag
())
{
#if defined(GRAPHIC_ENABLE_BEZIER_ARC_FLAG) && GRAPHIC_ENABLE_BEZIER_ARC_FLAG
#if defined(GRAPHIC_ENABLE_BEZIER_ARC_FLAG) && GRAPHIC_ENABLE_BEZIER_ARC_FLAG
if
(
vertices_
==
nullptr
)
{
if
(
vertices_
==
nullptr
)
{
...
@@ -366,7 +536,22 @@ void UICanvas::DrawCircle(const Point& center, uint16_t radius, const Paint& pai
...
@@ -366,7 +536,22 @@ void UICanvas::DrawCircle(const Point& center, uint16_t radius, const Paint& pai
cmd
.
DrawGraphics
=
DoDrawCircle
;
cmd
.
DrawGraphics
=
DoDrawCircle
;
drawCmdList_
.
PushBack
(
cmd
);
drawCmdList_
.
PushBack
(
cmd
);
}
}
#else
CircleParam
*
circleParam
=
new
CircleParam
;
if
(
circleParam
==
nullptr
)
{
GRAPHIC_LOGE
(
"new CircleParam fail"
);
return
;
}
circleParam
->
center
=
center
;
circleParam
->
radius
=
radius
;
DrawCmd
cmd
;
cmd
.
paint
=
paint
;
cmd
.
param
=
circleParam
;
cmd
.
DeleteParam
=
DeleteCircleParam
;
cmd
.
DrawGraphics
=
DoDrawCircle
;
drawCmdList_
.
PushBack
(
cmd
);
#endif
Invalidate
();
Invalidate
();
}
}
...
@@ -376,6 +561,7 @@ void UICanvas::DrawSector(const Point& center,
...
@@ -376,6 +561,7 @@ void UICanvas::DrawSector(const Point& center,
int16_t
endAngle
,
int16_t
endAngle
,
const
Paint
&
paint
)
const
Paint
&
paint
)
{
{
#if defined(ENABLE_CANVAS_EXTEND) && ENABLE_CANVAS_EXTEND
BeginPath
();
BeginPath
();
MoveTo
(
center
);
MoveTo
(
center
);
ArcTo
(
center
,
radius
,
startAngle
,
endAngle
);
ArcTo
(
center
,
radius
,
startAngle
,
endAngle
);
...
@@ -386,16 +572,29 @@ void UICanvas::DrawSector(const Point& center,
...
@@ -386,16 +572,29 @@ void UICanvas::DrawSector(const Point& center,
if
(
static_cast
<
uint8_t
>
(
paint
.
GetStyle
())
&
Paint
::
PaintStyle
::
FILL_STYLE
)
{
if
(
static_cast
<
uint8_t
>
(
paint
.
GetStyle
())
&
Paint
::
PaintStyle
::
FILL_STYLE
)
{
FillPath
(
paint
);
FillPath
(
paint
);
}
}
#else
if
(
static_cast
<
uint8_t
>
(
paint
.
GetStyle
())
&
Paint
::
PaintStyle
::
FILL_STYLE
)
{
Paint
innerPaint
=
paint
;
innerPaint
.
SetStyle
(
Paint
::
PaintStyle
::
STROKE_STYLE
);
innerPaint
.
SetStrokeWidth
(
radius
);
innerPaint
.
SetStrokeColor
(
paint
.
GetFillColor
());
radius
>>=
1
;
DrawArc
(
center
,
radius
,
startAngle
,
endAngle
,
innerPaint
);
}
#endif
}
}
void
UICanvas
::
DrawArc
(
const
Point
&
center
,
uint16_t
radius
,
int16_t
startAngle
,
void
UICanvas
::
DrawArc
(
const
Point
&
center
,
uint16_t
radius
,
int16_t
startAngle
,
int16_t
endAngle
,
const
Paint
&
paint
)
int16_t
endAngle
,
const
Paint
&
paint
)
{
{
if
(
static_cast
<
uint8_t
>
(
paint
.
GetStyle
())
&
Paint
::
PaintStyle
::
STROKE_STYLE
)
{
if
(
static_cast
<
uint8_t
>
(
paint
.
GetStyle
())
&
Paint
::
PaintStyle
::
STROKE_STYLE
)
{
#if defined(ENABLE_CANVAS_EXTEND) && ENABLE_CANVAS_EXTEND
if
(
paint
.
GetChangeFlag
())
{
if
(
paint
.
GetChangeFlag
())
{
ArcTo
(
center
,
radius
,
startAngle
,
endAngle
);
ArcTo
(
center
,
radius
,
startAngle
,
endAngle
);
DrawPath
(
paint
);
DrawPath
(
paint
);
}
else
{
}
else
#endif
{
ArcParam
*
arcParam
=
new
ArcParam
;
ArcParam
*
arcParam
=
new
ArcParam
;
if
(
arcParam
==
nullptr
)
{
if
(
arcParam
==
nullptr
)
{
GRAPHIC_LOGE
(
"new ArcParam fail"
);
GRAPHIC_LOGE
(
"new ArcParam fail"
);
...
@@ -535,6 +734,7 @@ void UICanvas::DrawImage(const Point& startPoint, const char* image,
...
@@ -535,6 +734,7 @@ void UICanvas::DrawImage(const Point& startPoint, const char* image,
void
UICanvas
::
DrawPath
(
const
Paint
&
paint
)
void
UICanvas
::
DrawPath
(
const
Paint
&
paint
)
{
{
#if defined(ENABLE_CANVAS_EXTEND) && ENABLE_CANVAS_EXTEND
if
(
vertices_
==
nullptr
)
{
if
(
vertices_
==
nullptr
)
{
return
;
return
;
}
}
...
@@ -571,6 +771,20 @@ void UICanvas::DrawPath(const Paint& paint)
...
@@ -571,6 +771,20 @@ void UICanvas::DrawPath(const Paint& paint)
pathParam
->
imageParam
=
imageParam
;
pathParam
->
imageParam
=
imageParam
;
}
}
#endif
#else
if
((
path_
==
nullptr
)
||
(
path_
->
cmd_
.
Size
()
==
0
))
{
return
;
}
path_
->
strokeCount_
++
;
PathParam
*
pathParam
=
new
PathParam
;
if
(
pathParam
==
nullptr
)
{
GRAPHIC_LOGE
(
"new PathParam fail"
);
return
;
}
pathParam
->
path
=
path_
;
pathParam
->
count
=
path_
->
cmd_
.
Size
();
#endif
#endif
DrawCmd
cmd
;
DrawCmd
cmd
;
cmd
.
paint
=
paint
;
cmd
.
paint
=
paint
;
...
@@ -581,6 +795,7 @@ void UICanvas::DrawPath(const Paint& paint)
...
@@ -581,6 +795,7 @@ void UICanvas::DrawPath(const Paint& paint)
Invalidate
();
Invalidate
();
}
}
#if defined(ENABLE_CANVAS_EXTEND) && ENABLE_CANVAS_EXTEND
void
UICanvas
::
FillPath
(
const
Paint
&
paint
)
void
UICanvas
::
FillPath
(
const
Paint
&
paint
)
{
{
if
(
vertices_
==
nullptr
)
{
if
(
vertices_
==
nullptr
)
{
...
@@ -627,6 +842,7 @@ void UICanvas::FillPath(const Paint& paint)
...
@@ -627,6 +842,7 @@ void UICanvas::FillPath(const Paint& paint)
drawCmdList_
.
PushBack
(
cmd
);
drawCmdList_
.
PushBack
(
cmd
);
Invalidate
();
Invalidate
();
}
}
#endif
void
UICanvas
::
OnDraw
(
BufferInfo
&
gfxDstBuffer
,
const
Rect
&
invalidatedArea
)
void
UICanvas
::
OnDraw
(
BufferInfo
&
gfxDstBuffer
,
const
Rect
&
invalidatedArea
)
{
{
...
@@ -640,6 +856,7 @@ void UICanvas::OnDraw(BufferInfo& gfxDstBuffer, const Rect& invalidatedArea)
...
@@ -640,6 +856,7 @@ void UICanvas::OnDraw(BufferInfo& gfxDstBuffer, const Rect& invalidatedArea)
if
(
!
trunc
.
Intersect
(
trunc
,
coords
))
{
if
(
!
trunc
.
Intersect
(
trunc
,
coords
))
{
return
;
return
;
}
}
#if defined(ENABLE_CANVAS_EXTEND) && ENABLE_CANVAS_EXTEND
bool
haveComposite
=
false
;
bool
haveComposite
=
false
;
for
(;
curDraw
!=
drawCmdList_
.
End
();
curDraw
=
curDraw
->
next_
)
{
for
(;
curDraw
!=
drawCmdList_
.
End
();
curDraw
=
curDraw
->
next_
)
{
if
(
curDraw
->
data_
.
paint
.
HaveComposite
())
{
if
(
curDraw
->
data_
.
paint
.
HaveComposite
())
{
...
@@ -650,7 +867,9 @@ void UICanvas::OnDraw(BufferInfo& gfxDstBuffer, const Rect& invalidatedArea)
...
@@ -650,7 +867,9 @@ void UICanvas::OnDraw(BufferInfo& gfxDstBuffer, const Rect& invalidatedArea)
if
(
haveComposite
)
{
if
(
haveComposite
)
{
OnBlendDraw
(
gfxDstBuffer
,
trunc
);
OnBlendDraw
(
gfxDstBuffer
,
trunc
);
}
else
{
}
else
#endif
{
curDraw
=
drawCmdList_
.
Begin
();
curDraw
=
drawCmdList_
.
Begin
();
for
(;
curDraw
!=
drawCmdList_
.
End
();
curDraw
=
curDraw
->
next_
)
{
for
(;
curDraw
!=
drawCmdList_
.
End
();
curDraw
=
curDraw
->
next_
)
{
param
=
curDraw
->
data_
.
param
;
param
=
curDraw
->
data_
.
param
;
...
@@ -659,6 +878,7 @@ void UICanvas::OnDraw(BufferInfo& gfxDstBuffer, const Rect& invalidatedArea)
...
@@ -659,6 +878,7 @@ void UICanvas::OnDraw(BufferInfo& gfxDstBuffer, const Rect& invalidatedArea)
}
}
}
}
#if defined(ENABLE_CANVAS_EXTEND) && ENABLE_CANVAS_EXTEND
void
OnBlendDrawPattern
(
ListNode
<
UICanvas
::
DrawCmd
>*
curDraw
,
void
OnBlendDrawPattern
(
ListNode
<
UICanvas
::
DrawCmd
>*
curDraw
,
UICanvas
::
DrawCmd
&
drawCmd
,
UICanvas
::
DrawCmd
&
drawCmd
,
Rect
&
rect
,
Rect
&
rect
,
...
@@ -791,6 +1011,7 @@ void UICanvas::OnBlendDraw(BufferInfo& gfxDstBuffer, const Rect& trunc)
...
@@ -791,6 +1011,7 @@ void UICanvas::OnBlendDraw(BufferInfo& gfxDstBuffer, const Rect& trunc)
rasterizer
,
renBase
,
transform
,
pathParamBlend
);
rasterizer
,
renBase
,
transform
,
pathParamBlend
);
}
}
}
}
#endif
void
UICanvas
::
GetAbsolutePosition
(
const
Point
&
prePoint
,
const
Rect
&
rect
,
const
Style
&
style
,
Point
&
point
)
void
UICanvas
::
GetAbsolutePosition
(
const
Point
&
prePoint
,
const
Rect
&
rect
,
const
Style
&
style
,
Point
&
point
)
{
{
...
@@ -1071,7 +1292,94 @@ void UICanvas::DoDrawPath(BufferInfo& gfxDstBuffer,
...
@@ -1071,7 +1292,94 @@ void UICanvas::DoDrawPath(BufferInfo& gfxDstBuffer,
const
Rect
&
invalidatedArea
,
const
Rect
&
invalidatedArea
,
const
Style
&
style
)
const
Style
&
style
)
{
{
#if defined(ENABLE_CANVAS_EXTEND) && ENABLE_CANVAS_EXTEND
BaseGfxEngine
::
GetInstance
()
->
DrawPath
(
gfxDstBuffer
,
param
,
paint
,
rect
,
invalidatedArea
,
style
);
BaseGfxEngine
::
GetInstance
()
->
DrawPath
(
gfxDstBuffer
,
param
,
paint
,
rect
,
invalidatedArea
,
style
);
#else
if
(
param
==
nullptr
)
{
return
;
}
PathParam
*
pathParam
=
static_cast
<
PathParam
*>
(
param
);
const
UICanvasPath
*
path
=
pathParam
->
path
;
if
(
path
==
nullptr
)
{
return
;
}
Point
pathEnd
=
{
COORD_MIN
,
COORD_MIN
};
ListNode
<
Point
>*
pointIter
=
path
->
points_
.
Begin
();
ListNode
<
ArcParam
>*
arcIter
=
path
->
arcParam_
.
Begin
();
ListNode
<
PathCmd
>*
iter
=
path
->
cmd_
.
Begin
();
for
(
uint16_t
i
=
0
;
(
i
<
pathParam
->
count
)
&&
(
iter
!=
path
->
cmd_
.
End
());
i
++
,
iter
=
iter
->
next_
)
{
switch
(
iter
->
data_
)
{
case
CMD_MOVE_TO
:
{
pointIter
=
pointIter
->
next_
;
break
;
}
case
CMD_LINE_TO
:
{
Point
start
=
pointIter
->
prev_
->
data_
;
Point
end
=
pointIter
->
data_
;
pointIter
=
pointIter
->
next_
;
if
((
start
.
x
==
end
.
x
)
&&
(
start
.
y
==
end
.
y
))
{
break
;
}
GetAbsolutePosition
(
start
,
rect
,
style
,
start
);
GetAbsolutePosition
(
end
,
rect
,
style
,
end
);
BaseGfxEngine
::
GetInstance
()
->
DrawLine
(
gfxDstBuffer
,
start
,
end
,
invalidatedArea
,
paint
.
GetStrokeWidth
(),
paint
.
GetStrokeColor
(),
OPA_OPAQUE
);
if
((
pathEnd
.
x
==
start
.
x
)
&&
(
pathEnd
.
y
==
start
.
y
))
{
DoDrawLineJoin
(
gfxDstBuffer
,
start
,
invalidatedArea
,
paint
);
}
pathEnd
=
end
;
break
;
}
case
CMD_ARC
:
{
ArcInfo
arcInfo
=
{{
0
}};
arcInfo
.
imgPos
=
Point
{
0
,
0
};
arcInfo
.
startAngle
=
arcIter
->
data_
.
startAngle
;
arcInfo
.
endAngle
=
arcIter
->
data_
.
endAngle
;
Style
drawStyle
=
StyleDefault
::
GetDefaultStyle
();
drawStyle
.
lineWidth_
=
static_cast
<
int16_t
>
(
paint
.
GetStrokeWidth
());
drawStyle
.
lineColor_
=
paint
.
GetStrokeColor
();
drawStyle
.
lineOpa_
=
OPA_OPAQUE
;
arcInfo
.
radius
=
arcIter
->
data_
.
radius
+
((
paint
.
GetStrokeWidth
()
+
1
)
>>
1
);
GetAbsolutePosition
(
arcIter
->
data_
.
center
,
rect
,
style
,
arcInfo
.
center
);
BaseGfxEngine
::
GetInstance
()
->
DrawArc
(
gfxDstBuffer
,
arcInfo
,
invalidatedArea
,
drawStyle
,
OPA_OPAQUE
,
CapType
::
CAP_NONE
);
if
(
pointIter
!=
path
->
points_
.
Begin
())
{
DoDrawLineJoin
(
gfxDstBuffer
,
pathEnd
,
invalidatedArea
,
paint
);
}
GetAbsolutePosition
(
pointIter
->
data_
,
rect
,
style
,
pathEnd
);
pointIter
=
pointIter
->
next_
;
arcIter
=
arcIter
->
next_
;
break
;
}
case
CMD_CLOSE
:
{
Point
start
=
pointIter
->
prev_
->
data_
;
Point
end
=
pointIter
->
data_
;
GetAbsolutePosition
(
start
,
rect
,
style
,
start
);
GetAbsolutePosition
(
end
,
rect
,
style
,
end
);
if
((
start
.
x
!=
end
.
x
)
||
(
start
.
y
!=
end
.
y
))
{
BaseGfxEngine
::
GetInstance
()
->
DrawLine
(
gfxDstBuffer
,
start
,
end
,
invalidatedArea
,
paint
.
GetStrokeWidth
(),
paint
.
GetStrokeColor
(),
OPA_OPAQUE
);
if
((
pathEnd
.
x
==
start
.
x
)
&&
(
pathEnd
.
y
==
start
.
y
))
{
DoDrawLineJoin
(
gfxDstBuffer
,
start
,
invalidatedArea
,
paint
);
}
pathEnd
=
end
;
}
if
((
pathEnd
.
x
==
end
.
x
)
&&
(
pathEnd
.
y
==
end
.
y
))
{
DoDrawLineJoin
(
gfxDstBuffer
,
end
,
invalidatedArea
,
paint
);
}
pointIter
=
pointIter
->
next_
;
break
;
}
default:
break
;
}
}
#endif
}
}
void
UICanvas
::
DoFillPath
(
BufferInfo
&
gfxDstBuffer
,
void
UICanvas
::
DoFillPath
(
BufferInfo
&
gfxDstBuffer
,
...
@@ -1264,6 +1572,7 @@ void UICanvas::DestroyMapBufferInfo()
...
@@ -1264,6 +1572,7 @@ void UICanvas::DestroyMapBufferInfo()
}
}
}
}
#if defined(ENABLE_CANVAS_EXTEND) && ENABLE_CANVAS_EXTEND
void
UICanvas
::
BlendRaster
(
const
Paint
&
paint
,
void
UICanvas
::
BlendRaster
(
const
Paint
&
paint
,
void
*
param
,
void
*
param
,
RasterizerScanlineAntialias
&
blendRasterizer
,
RasterizerScanlineAntialias
&
blendRasterizer
,
...
@@ -1333,4 +1642,5 @@ void UICanvas::BlendRaster(const Paint& paint,
...
@@ -1333,4 +1642,5 @@ void UICanvas::BlendRaster(const Paint& paint,
}
}
#endif
#endif
}
}
#endif // ENABLE_CANVAS_EXTEND
}
// namespace OHOS
}
// namespace OHOS
frameworks/draw/draw_canvas.cpp
浏览文件 @
073d9d7c
...
@@ -32,6 +32,7 @@ void RenderSolid(const Paint& paint, RasterizerScanlineAntialias& rasterizer, Re
...
@@ -32,6 +32,7 @@ void RenderSolid(const Paint& paint, RasterizerScanlineAntialias& rasterizer, Re
RenderScanlinesAntiAliasSolid
(
rasterizer
,
scanline
,
renBase
,
color
);
RenderScanlinesAntiAliasSolid
(
rasterizer
,
scanline
,
renBase
,
color
);
}
}
#if defined(ENABLE_CANVAS_EXTEND) && ENABLE_CANVAS_EXTEND
void
DrawCanvas
::
DoRender
(
BufferInfo
&
gfxDstBuffer
,
void
DrawCanvas
::
DoRender
(
BufferInfo
&
gfxDstBuffer
,
void
*
param
,
void
*
param
,
const
Paint
&
paint
,
const
Paint
&
paint
,
...
@@ -140,6 +141,7 @@ void DrawCanvas::DoDrawShadow(BufferInfo& gfxDstBuffer,
...
@@ -140,6 +141,7 @@ void DrawCanvas::DoDrawShadow(BufferInfo& gfxDstBuffer,
#endif // GRAPHIC_ENABLE_BLUR_EFFECT_FLAG
#endif // GRAPHIC_ENABLE_BLUR_EFFECT_FLAG
}
}
#endif // GRAPHIC_ENABLE_SHADOW_EFFECT_FLAG
#endif // GRAPHIC_ENABLE_SHADOW_EFFECT_FLAG
#endif // ENABLE_CANVAS_EXTEND
void
DrawCanvas
::
InitRenderAndTransform
(
BufferInfo
&
gfxDstBuffer
,
void
DrawCanvas
::
InitRenderAndTransform
(
BufferInfo
&
gfxDstBuffer
,
RenderBuffer
&
renderBuffer
,
RenderBuffer
&
renderBuffer
,
...
@@ -267,6 +269,7 @@ void DrawCanvas::BuildRadialGradientMatrix(const Paint& paint,
...
@@ -267,6 +269,7 @@ void DrawCanvas::BuildRadialGradientMatrix(const Paint& paint,
#endif // GRAPHIC_ENABLE_GRADIENT_FILL_FLAG
#endif // GRAPHIC_ENABLE_GRADIENT_FILL_FLAG
#if defined(GRAPHIC_ENABLE_PATTERN_FILL_FLAG) && GRAPHIC_ENABLE_PATTERN_FILL_FLAG
#if defined(GRAPHIC_ENABLE_PATTERN_FILL_FLAG) && GRAPHIC_ENABLE_PATTERN_FILL_FLAG
#if defined(ENABLE_CANVAS_EXTEND) && ENABLE_CANVAS_EXTEND
void
DrawCanvas
::
RenderPattern
(
const
Paint
&
paint
,
void
DrawCanvas
::
RenderPattern
(
const
Paint
&
paint
,
void
*
param
,
void
*
param
,
RasterizerScanlineAntialias
&
rasterizer
,
RasterizerScanlineAntialias
&
rasterizer
,
...
@@ -286,6 +289,7 @@ void DrawCanvas::RenderPattern(const Paint& paint,
...
@@ -286,6 +289,7 @@ void DrawCanvas::RenderPattern(const Paint& paint,
rect
.
GetTop
());
rect
.
GetTop
());
RenderScanlinesAntiAlias
(
rasterizer
,
scanline
,
renBase
,
allocator
,
spanPattern
);
RenderScanlinesAntiAlias
(
rasterizer
,
scanline
,
renBase
,
allocator
,
spanPattern
);
}
}
#endif
#endif // GRAPHIC_ENABLE_PATTERN_FILL_FLAG
#endif // GRAPHIC_ENABLE_PATTERN_FILL_FLAG
}
// namespace OHOS
}
// namespace OHOS
frameworks/draw/draw_canvas.h
浏览文件 @
073d9d7c
...
@@ -23,9 +23,9 @@
...
@@ -23,9 +23,9 @@
#include "gfx_utils/diagram/rasterizer/rasterizer_scanline_antialias.h"
#include "gfx_utils/diagram/rasterizer/rasterizer_scanline_antialias.h"
#include "gfx_utils/diagram/spancolorfill/fill_gradient_lut.h"
#include "gfx_utils/diagram/spancolorfill/fill_gradient_lut.h"
namespace
OHOS
{
namespace
OHOS
{
#if defined(ENABLE_CANVAS_EXTEND) && ENABLE_CANVAS_EXTEND
struct
ImageParam
:
public
HeapBase
{
struct
ImageParam
:
public
HeapBase
{
Point
start
;
Point
start
;
uint16_t
height
;
uint16_t
height
;
...
@@ -40,11 +40,13 @@ struct PathParam : public HeapBase {
...
@@ -40,11 +40,13 @@ struct PathParam : public HeapBase {
ImageParam
*
imageParam
=
nullptr
;
ImageParam
*
imageParam
=
nullptr
;
bool
isStroke
;
bool
isStroke
;
};
};
#endif
class
RenderBuffer
;
class
RenderBuffer
;
class
RenderBase
;
class
RenderBase
;
class
DrawCanvas
:
public
HeapBase
{
class
DrawCanvas
:
public
HeapBase
{
public:
public:
#if defined(ENABLE_CANVAS_EXTEND) && ENABLE_CANVAS_EXTEND
static
void
DoRender
(
BufferInfo
&
gfxDstBuffer
,
static
void
DoRender
(
BufferInfo
&
gfxDstBuffer
,
void
*
param
,
void
*
param
,
const
Paint
&
paint
,
const
Paint
&
paint
,
...
@@ -62,7 +64,7 @@ public:
...
@@ -62,7 +64,7 @@ public:
const
Style
&
style
,
const
Style
&
style
,
const
bool
&
isStroke
);
const
bool
&
isStroke
);
#endif
#endif
#endif
static
void
InitRenderAndTransform
(
BufferInfo
&
gfxDstBuffer
,
static
void
InitRenderAndTransform
(
BufferInfo
&
gfxDstBuffer
,
RenderBuffer
&
renderBuffer
,
RenderBuffer
&
renderBuffer
,
const
Rect
&
rect
,
const
Rect
&
rect
,
...
@@ -114,6 +116,7 @@ public:
...
@@ -114,6 +116,7 @@ public:
#endif // GRAPHIC_ENABLE_GRADIENT_FILL_FLAG
#endif // GRAPHIC_ENABLE_GRADIENT_FILL_FLAG
#if defined(GRAPHIC_ENABLE_PATTERN_FILL_FLAG) && GRAPHIC_ENABLE_PATTERN_FILL_FLAG
#if defined(GRAPHIC_ENABLE_PATTERN_FILL_FLAG) && GRAPHIC_ENABLE_PATTERN_FILL_FLAG
#if defined(ENABLE_CANVAS_EXTEND) && ENABLE_CANVAS_EXTEND
/**
/**
* Render pattern mode
* Render pattern mode
*/
*/
...
@@ -123,6 +126,7 @@ public:
...
@@ -123,6 +126,7 @@ public:
RenderBase
&
renBase
,
RenderBase
&
renBase
,
FillBase
&
allocator
,
FillBase
&
allocator
,
const
Rect
&
rect
);
const
Rect
&
rect
);
#endif
#endif // GRAPHIC_ENABLE_PATTERN_FILL_FLAG
#endif // GRAPHIC_ENABLE_PATTERN_FILL_FLAG
static
void
ChangeColor
(
Rgba8T
&
color
,
ColorType
colorType
,
uint8_t
alpha
)
static
void
ChangeColor
(
Rgba8T
&
color
,
ColorType
colorType
,
uint8_t
alpha
)
...
...
frameworks/engines/gfx/soft_engine.cpp
浏览文件 @
073d9d7c
...
@@ -121,7 +121,9 @@ void SoftEngine::DrawPath(BufferInfo& dst,
...
@@ -121,7 +121,9 @@ void SoftEngine::DrawPath(BufferInfo& dst,
const
Rect
&
invalidatedArea
,
const
Rect
&
invalidatedArea
,
const
Style
&
style
)
const
Style
&
style
)
{
{
#if defined(ENABLE_CANVAS_EXTEND) && ENABLE_CANVAS_EXTEND
DrawCanvas
::
DoRender
(
dst
,
param
,
paint
,
rect
,
invalidatedArea
,
style
,
true
);
DrawCanvas
::
DoRender
(
dst
,
param
,
paint
,
rect
,
invalidatedArea
,
style
,
true
);
#endif
}
}
void
SoftEngine
::
FillPath
(
BufferInfo
&
dst
,
void
SoftEngine
::
FillPath
(
BufferInfo
&
dst
,
...
@@ -131,7 +133,9 @@ void SoftEngine::FillPath(BufferInfo& dst,
...
@@ -131,7 +133,9 @@ void SoftEngine::FillPath(BufferInfo& dst,
const
Rect
&
invalidatedArea
,
const
Rect
&
invalidatedArea
,
const
Style
&
style
)
const
Style
&
style
)
{
{
#if defined(ENABLE_CANVAS_EXTEND) && ENABLE_CANVAS_EXTEND
DrawCanvas
::
DoRender
(
dst
,
param
,
paint
,
rect
,
invalidatedArea
,
style
,
false
);
DrawCanvas
::
DoRender
(
dst
,
param
,
paint
,
rect
,
invalidatedArea
,
style
,
false
);
#endif
}
}
uint8_t
*
SoftEngine
::
AllocBuffer
(
uint32_t
size
,
uint32_t
usage
)
uint8_t
*
SoftEngine
::
AllocBuffer
(
uint32_t
size
,
uint32_t
usage
)
...
...
interfaces/kits/components/ui_canvas.h
浏览文件 @
073d9d7c
...
@@ -72,7 +72,7 @@ public:
...
@@ -72,7 +72,7 @@ public:
* @since 1.0
* @since 1.0
* @version 1.0
* @version 1.0
*/
*/
UICanvas
()
:
startPoint_
({
0
,
0
}),
vertices_
(
nullptr
)
{}
UICanvas
()
:
startPoint_
({
0
,
0
}),
vertices_
(
nullptr
)
,
path_
(
nullptr
)
{}
/**
/**
* @brief A destructor used to delete the <b>UICanvas</b> instance.
* @brief A destructor used to delete the <b>UICanvas</b> instance.
...
@@ -197,6 +197,7 @@ public:
...
@@ -197,6 +197,7 @@ public:
*/
*/
void
DrawRect
(
const
Point
&
startPoint
,
int16_t
height
,
int16_t
width
,
const
Paint
&
paint
);
void
DrawRect
(
const
Point
&
startPoint
,
int16_t
height
,
int16_t
width
,
const
Paint
&
paint
);
#if defined(ENABLE_CANVAS_EXTEND) && ENABLE_CANVAS_EXTEND
/**
/**
* @brief Draws a rectangular path with no fill.
* @brief Draws a rectangular path with no fill.
* @param startPoint starting point
* @param startPoint starting point
...
@@ -213,6 +214,7 @@ public:
...
@@ -213,6 +214,7 @@ public:
* @param width
* @param width
*/
*/
void
ClearRect
(
const
Point
&
startPoint
,
int16_t
height
,
int16_t
width
);
void
ClearRect
(
const
Point
&
startPoint
,
int16_t
height
,
int16_t
width
);
#endif
/**
/**
* @brief Draws a circle.
* @brief Draws a circle.
...
@@ -390,6 +392,7 @@ public:
...
@@ -390,6 +392,7 @@ public:
*/
*/
void
DrawPath
(
const
Paint
&
paint
);
void
DrawPath
(
const
Paint
&
paint
);
#if defined(ENABLE_CANVAS_EXTEND) && ENABLE_CANVAS_EXTEND
/**
/**
* @brief Fill polygon path
* @brief Fill polygon path
* @param paint fill paint
* @param paint fill paint
...
@@ -397,6 +400,7 @@ public:
...
@@ -397,6 +400,7 @@ public:
* @version 5.0
* @version 5.0
*/
*/
void
FillPath
(
const
Paint
&
paint
);
void
FillPath
(
const
Paint
&
paint
);
#endif
#if defined(GRAPHIC_ENABLE_DRAW_TEXT_FLAG) && GRAPHIC_ENABLE_DRAW_TEXT_FLAG
#if defined(GRAPHIC_ENABLE_DRAW_TEXT_FLAG) && GRAPHIC_ENABLE_DRAW_TEXT_FLAG
/* Draw text on canvas */
/* Draw text on canvas */
...
@@ -429,7 +433,9 @@ public:
...
@@ -429,7 +433,9 @@ public:
return
paint
;
return
paint
;
}
}
#if defined(ENABLE_CANVAS_EXTEND) && ENABLE_CANVAS_EXTEND
void
OnBlendDraw
(
BufferInfo
&
gfxDstBuffer
,
const
Rect
&
trunc
);
void
OnBlendDraw
(
BufferInfo
&
gfxDstBuffer
,
const
Rect
&
trunc
);
#endif
void
OnDraw
(
BufferInfo
&
gfxDstBuffer
,
const
Rect
&
invalidatedArea
)
override
;
void
OnDraw
(
BufferInfo
&
gfxDstBuffer
,
const
Rect
&
invalidatedArea
)
override
;
...
@@ -442,6 +448,8 @@ public:
...
@@ -442,6 +448,8 @@ public:
SpanBase
&
spanGen
,
SpanBase
&
spanGen
,
const
Rect
&
rect
,
const
Rect
&
rect
,
bool
isStroke
);
bool
isStroke
);
static
void
DeleteImageParam
(
void
*
param
);
static
void
DeletePathParam
(
void
*
param
);
protected:
protected:
constexpr
static
uint8_t
MAX_CURVE_WIDTH
=
3
;
constexpr
static
uint8_t
MAX_CURVE_WIDTH
=
3
;
...
@@ -475,6 +483,38 @@ protected:
...
@@ -475,6 +483,38 @@ protected:
int16_t
endAngle
;
int16_t
endAngle
;
};
};
enum
PathCmd
{
CMD_MOVE_TO
,
CMD_LINE_TO
,
CMD_ARC
,
CMD_CLOSE
,
};
class
UICanvasPath
:
public
HeapBase
{
public:
UICanvasPath
()
:
startPos_
({
0
,
0
}),
strokeCount_
(
0
)
{};
~
UICanvasPath
();
List
<
Point
>
points_
;
List
<
PathCmd
>
cmd_
;
List
<
ArcParam
>
arcParam_
;
Point
startPos_
;
uint16_t
strokeCount_
;
};
#if (!(defined(ENABLE_CANVAS_EXTEND) && ENABLE_CANVAS_EXTEND))
struct
PathParam
:
public
HeapBase
{
UICanvasPath
*
path
;
uint16_t
count
;
};
struct
ImageParam
:
public
HeapBase
{
Point
start
;
uint16_t
height
;
uint16_t
width
;
Image
*
image
;
};
#endif
struct
TextParam
:
public
HeapBase
{
struct
TextParam
:
public
HeapBase
{
const
char
*
text
;
const
char
*
text
;
Point
position
;
Point
position
;
...
@@ -504,6 +544,7 @@ protected:
...
@@ -504,6 +544,7 @@ protected:
Point
startPoint_
;
Point
startPoint_
;
UICanvasVertices
*
vertices_
;
UICanvasVertices
*
vertices_
;
UICanvasPath
*
path_
;
List
<
DrawCmd
>
drawCmdList_
;
List
<
DrawCmd
>
drawCmdList_
;
// Save historical modification information of paint
// Save historical modification information of paint
List
<
Paint
>
paintStack_
;
List
<
Paint
>
paintStack_
;
...
...
test/uitest/test_canvas/ui_test_canvas.cpp
浏览文件 @
073d9d7c
...
@@ -40,21 +40,28 @@ void UITestCanvas::TearDown()
...
@@ -40,21 +40,28 @@ void UITestCanvas::TearDown()
const
UIView
*
UITestCanvas
::
GetTestView
()
const
UIView
*
UITestCanvas
::
GetTestView
()
{
{
UIKitCanvasTestDrawImage002
();
UIKitCanvasTestDrawImage002
();
#if defined(ENABLE_CANVAS_EXTEND) && ENABLE_CANVAS_EXTEND
RM008UIKitCanvasTest001
();
RM008UIKitCanvasTest001
();
RM008UIKitCanvasTest002
();
RM008UIKitCanvasTest002
();
#endif
RM008UIKitCanvasTest003
();
RM008UIKitCanvasTest003
();
#if defined(ENABLE_CANVAS_EXTEND) && ENABLE_CANVAS_EXTEND
RM008UIKitCanvasTest004
();
RM008UIKitCanvasTest004
();
RM008UIKitCanvasTest005
();
RM008UIKitCanvasTest005
();
RM008UIKitCanvasTest006
();
RM008UIKitCanvasTest006
();
RM008UIKitCanvasTest007
();
RM008UIKitCanvasTest007
();
RM008UIKitCanvasShadowTest008
();
RM008UIKitCanvasShadowTest008
();
#endif
RM009LineCapDrawPath
();
RM009LineCapDrawPath
();
RM009LineJoinDrawPath
();
RM009LineJoinDrawPath
();
RM009LineDashDrawPath
();
RM009LineDashDrawPath
();
#if defined(ENABLE_CANVAS_EXTEND) && ENABLE_CANVAS_EXTEND
RM009StrokeAndClearRectDrawPath
();
RM009StrokeAndClearRectDrawPath
();
#endif
RM011StrokeText001
();
RM011StrokeText001
();
RM011CanvasScale001
();
RM011CanvasScale001
();
RM011CanvasRotate001
();
RM011CanvasRotate001
();
#if defined(ENABLE_CANVAS_EXTEND) && ENABLE_CANVAS_EXTEND
RM012globalAlpha001
();
RM012globalAlpha001
();
RM012SaveOrRestore002
();
RM012SaveOrRestore002
();
RM012GlobalCompositeOperationSourceOver
();
RM012GlobalCompositeOperationSourceOver
();
...
@@ -68,6 +75,7 @@ const UIView* UITestCanvas::GetTestView()
...
@@ -68,6 +75,7 @@ const UIView* UITestCanvas::GetTestView()
RM012GlobalCompositeOperationLIGHTER
();
RM012GlobalCompositeOperationLIGHTER
();
RM012GlobalCompositeOperationCopy
();
RM012GlobalCompositeOperationCopy
();
RM012GlobalCompositeOperationXOR
();
RM012GlobalCompositeOperationXOR
();
#endif
UIKitCanvasTestDrawLine001
();
UIKitCanvasTestDrawLine001
();
UIKitCanvasTestDrawLine002
();
UIKitCanvasTestDrawLine002
();
UIKitCanvasTestDrawCurve001
();
UIKitCanvasTestDrawCurve001
();
...
@@ -1144,6 +1152,7 @@ void UITestCanvas::RM009LineDashDrawPath()
...
@@ -1144,6 +1152,7 @@ void UITestCanvas::RM009LineDashDrawPath()
#endif
#endif
}
}
#if defined(ENABLE_CANVAS_EXTEND) && ENABLE_CANVAS_EXTEND
void
UITestCanvas
::
RM009StrokeAndClearRectDrawPath
()
void
UITestCanvas
::
RM009StrokeAndClearRectDrawPath
()
{
{
if
(
container_
==
nullptr
)
{
if
(
container_
==
nullptr
)
{
...
@@ -1242,6 +1251,7 @@ void UITestCanvas::RM008UIKitCanvasTest002()
...
@@ -1242,6 +1251,7 @@ void UITestCanvas::RM008UIKitCanvasTest002()
canvas
->
ClosePath
();
canvas
->
ClosePath
();
canvas
->
FillPath
(
paint
);
canvas
->
FillPath
(
paint
);
}
}
#endif
void
UITestCanvas
::
RM008UIKitCanvasTest003
()
void
UITestCanvas
::
RM008UIKitCanvasTest003
()
{
{
...
@@ -1290,6 +1300,7 @@ void UITestCanvas::RM008UIKitCanvasTest003()
...
@@ -1290,6 +1300,7 @@ void UITestCanvas::RM008UIKitCanvasTest003()
canvas
->
DrawPath
(
paint
);
canvas
->
DrawPath
(
paint
);
}
}
#if defined(ENABLE_CANVAS_EXTEND) && ENABLE_CANVAS_EXTEND
void
UITestCanvas
::
RM008UIKitCanvasTest004
()
void
UITestCanvas
::
RM008UIKitCanvasTest004
()
{
{
if
(
container_
==
nullptr
)
{
if
(
container_
==
nullptr
)
{
...
@@ -1498,6 +1509,7 @@ void UITestCanvas::RM008UIKitCanvasShadowTest008()
...
@@ -1498,6 +1509,7 @@ void UITestCanvas::RM008UIKitCanvasShadowTest008()
#endif
#endif
}
}
#endif
void
UITestCanvas
::
RM011StrokeText001
()
void
UITestCanvas
::
RM011StrokeText001
()
{
{
CreateTitleLabel
(
"RM011_StrokeText_多国文字加旋转放大"
);
CreateTitleLabel
(
"RM011_StrokeText_多国文字加旋转放大"
);
...
@@ -1622,6 +1634,7 @@ void UITestCanvas::RM011CanvasRotate001()
...
@@ -1622,6 +1634,7 @@ void UITestCanvas::RM011CanvasRotate001()
canvas
->
DrawPath
(
paint
);
canvas
->
DrawPath
(
paint
);
}
}
#if defined(ENABLE_CANVAS_EXTEND) && ENABLE_CANVAS_EXTEND
void
UITestCanvas
::
RM012globalAlpha001
()
void
UITestCanvas
::
RM012globalAlpha001
()
{
{
if
(
container_
==
nullptr
)
{
if
(
container_
==
nullptr
)
{
...
@@ -1991,4 +2004,5 @@ void UITestCanvas::RM012SaveOrRestore002()
...
@@ -1991,4 +2004,5 @@ void UITestCanvas::RM012SaveOrRestore002()
paint
=
canvas
->
Restore
();
paint
=
canvas
->
Restore
();
canvas
->
FillPath
(
paint
);
canvas
->
FillPath
(
paint
);
}
}
#endif
}
// namespace OHOS
}
// namespace OHOS
test/unittest/components/ui_canvas_unit_test.cpp
浏览文件 @
073d9d7c
...
@@ -306,6 +306,7 @@ HWTEST_F(UICanvasTest, UICanvasDrawCurve_001, TestSize.Level0)
...
@@ -306,6 +306,7 @@ HWTEST_F(UICanvasTest, UICanvasDrawCurve_001, TestSize.Level0)
viewGroup
->
Remove
(
canvas_
);
viewGroup
->
Remove
(
canvas_
);
}
}
#if defined(ENABLE_CANVAS_EXTEND) && ENABLE_CANVAS_EXTEND
/**
/**
* @tc.name: UICanvasBeginPath_001
* @tc.name: UICanvasBeginPath_001
* @tc.desc: Verify BeginPath function, equal.
* @tc.desc: Verify BeginPath function, equal.
...
@@ -369,7 +370,7 @@ HWTEST_F(UICanvasTest, UICanvasLineTo_001, TestSize.Level0)
...
@@ -369,7 +370,7 @@ HWTEST_F(UICanvasTest, UICanvasLineTo_001, TestSize.Level0)
EXPECT_EQ
(
end
.
x
,
LINE1_X
);
EXPECT_EQ
(
end
.
x
,
LINE1_X
);
EXPECT_EQ
(
end
.
y
,
LINE1_Y
);
EXPECT_EQ
(
end
.
y
,
LINE1_Y
);
}
}
#endif
/**
/**
* @tc.name: UICanvasLineTo_002
* @tc.name: UICanvasLineTo_002
* @tc.desc: Verify LineTo function, equal.
* @tc.desc: Verify LineTo function, equal.
...
@@ -400,6 +401,7 @@ HWTEST_F(UICanvasTest, UICanvasLineTo_002, TestSize.Level1)
...
@@ -400,6 +401,7 @@ HWTEST_F(UICanvasTest, UICanvasLineTo_002, TestSize.Level1)
}
}
#if defined(GRAPHIC_ENABLE_ARC_FLAG) && GRAPHIC_ENABLE_ARC_FLAG
#if defined(GRAPHIC_ENABLE_ARC_FLAG) && GRAPHIC_ENABLE_ARC_FLAG
#if defined(ENABLE_CANVAS_EXTEND) && ENABLE_CANVAS_EXTEND
/**
/**
* @tc.name: UICanvasArcTo_001
* @tc.name: UICanvasArcTo_001
* @tc.desc: Verify ArcTo function, equal.
* @tc.desc: Verify ArcTo function, equal.
...
@@ -427,6 +429,7 @@ HWTEST_F(UICanvasTest, UICanvasArcTo_001, TestSize.Level0)
...
@@ -427,6 +429,7 @@ HWTEST_F(UICanvasTest, UICanvasArcTo_001, TestSize.Level0)
EXPECT_EQ
(
end
.
x
,
int16_t
(
CENTER_X
+
sinma
));
EXPECT_EQ
(
end
.
x
,
int16_t
(
CENTER_X
+
sinma
));
EXPECT_EQ
(
end
.
y
,
int16_t
(
CENTER_Y
-
cosma
));
EXPECT_EQ
(
end
.
y
,
int16_t
(
CENTER_Y
-
cosma
));
}
}
#endif
/**
/**
* @tc.name: UICanvasArcTo_002
* @tc.name: UICanvasArcTo_002
...
@@ -485,6 +488,7 @@ HWTEST_F(UICanvasTest, UICanvasArcTo_003, TestSize.Level1)
...
@@ -485,6 +488,7 @@ HWTEST_F(UICanvasTest, UICanvasArcTo_003, TestSize.Level1)
}
}
#endif
#endif
#if defined(ENABLE_CANVAS_EXTEND) && ENABLE_CANVAS_EXTEND
/**
/**
* @tc.name: UICanvasAddRect_001
* @tc.name: UICanvasAddRect_001
* @tc.desc: Verify AddRect function, equal.
* @tc.desc: Verify AddRect function, equal.
...
@@ -508,7 +512,7 @@ HWTEST_F(UICanvasTest, UICanvasAddRect_001, TestSize.Level0)
...
@@ -508,7 +512,7 @@ HWTEST_F(UICanvasTest, UICanvasAddRect_001, TestSize.Level0)
EXPECT_EQ
(
end
.
x
,
0
);
EXPECT_EQ
(
end
.
x
,
0
);
EXPECT_EQ
(
end
.
y
,
0
);
EXPECT_EQ
(
end
.
y
,
0
);
}
}
#endif
/**
/**
* @tc.name: UICanvasAddRect_002
* @tc.name: UICanvasAddRect_002
* @tc.desc: Verify AddRect function, equal.
* @tc.desc: Verify AddRect function, equal.
...
@@ -535,6 +539,7 @@ HWTEST_F(UICanvasTest, UICanvasAddRect_002, TestSize.Level1)
...
@@ -535,6 +539,7 @@ HWTEST_F(UICanvasTest, UICanvasAddRect_002, TestSize.Level1)
EXPECT_EQ
(
end
.
y
,
0
);
EXPECT_EQ
(
end
.
y
,
0
);
}
}
#if defined(ENABLE_CANVAS_EXTEND) && ENABLE_CANVAS_EXTEND
/**
/**
* @tc.name: UICanvasClosePath_001
* @tc.name: UICanvasClosePath_001
* @tc.desc: Verify ClosePath function, equal.
* @tc.desc: Verify ClosePath function, equal.
...
@@ -560,7 +565,7 @@ HWTEST_F(UICanvasTest, UICanvasClosePath_001, TestSize.Level0)
...
@@ -560,7 +565,7 @@ HWTEST_F(UICanvasTest, UICanvasClosePath_001, TestSize.Level0)
EXPECT_EQ
(
end
.
x
,
0
);
EXPECT_EQ
(
end
.
x
,
0
);
EXPECT_EQ
(
end
.
y
,
0
);
EXPECT_EQ
(
end
.
y
,
0
);
}
}
#endif
/**
/**
* @tc.name: UICanvasClosePath_002
* @tc.name: UICanvasClosePath_002
* @tc.desc: Verify ClosePath function, equal.
* @tc.desc: Verify ClosePath function, equal.
...
@@ -844,6 +849,7 @@ HWTEST_F(UICanvasTest, UICanvasSetLineDash_001, TestSize.Level0)
...
@@ -844,6 +849,7 @@ HWTEST_F(UICanvasTest, UICanvasSetLineDash_001, TestSize.Level0)
EXPECT_EQ
(
paint_
->
IsLineDash
(),
0
);
EXPECT_EQ
(
paint_
->
IsLineDash
(),
0
);
}
}
#endif
#endif
#if defined(ENABLE_CANVAS_EXTEND) && ENABLE_CANVAS_EXTEND
/**
/**
* @tc.name: UICanvasStrokeRect_001
* @tc.name: UICanvasStrokeRect_001
* @tc.desc: Verify StrokeRect function, equal.
* @tc.desc: Verify StrokeRect function, equal.
...
@@ -987,7 +993,6 @@ HWTEST_F(UICanvasTest, UICanvasDrawImage_001, TestSize.Level1)
...
@@ -987,7 +993,6 @@ HWTEST_F(UICanvasTest, UICanvasDrawImage_001, TestSize.Level1)
EXPECT_EQ
(
canvas_
->
GetStartPosition
().
y
,
IMAGE_Y
);
EXPECT_EQ
(
canvas_
->
GetStartPosition
().
y
,
IMAGE_Y
);
viewGroup
->
Remove
(
canvas_
);
viewGroup
->
Remove
(
canvas_
);
}
}
/**
/**
* @tc.name: UICanvasDrawImage_002
* @tc.name: UICanvasDrawImage_002
* @tc.desc: Verify DrawImage function, equal.
* @tc.desc: Verify DrawImage function, equal.
...
@@ -1091,6 +1096,7 @@ HWTEST_F(UICanvasTest, UICanvasDrawImage_003, TestSize.Level1)
...
@@ -1091,6 +1096,7 @@ HWTEST_F(UICanvasTest, UICanvasDrawImage_003, TestSize.Level1)
viewGroup
->
Remove
(
canvas_
);
viewGroup
->
Remove
(
canvas_
);
}
}
#endif
#endif
#endif // ENABLE_CANVAS_EXTEND
#if defined(GRAPHIC_ENABLE_DRAW_TEXT_FLAG) && GRAPHIC_ENABLE_DRAW_TEXT_FLAG
#if defined(GRAPHIC_ENABLE_DRAW_TEXT_FLAG) && GRAPHIC_ENABLE_DRAW_TEXT_FLAG
/**
/**
...
@@ -1640,6 +1646,7 @@ HWTEST_F(UICanvasTest, UICanvasSetGlobalCompositeOperation_001, TestSize.Level0)
...
@@ -1640,6 +1646,7 @@ HWTEST_F(UICanvasTest, UICanvasSetGlobalCompositeOperation_001, TestSize.Level0)
EXPECT_EQ
(
paint_
->
GetGlobalCompositeOperation
(),
OHOS
::
COPY
);
EXPECT_EQ
(
paint_
->
GetGlobalCompositeOperation
(),
OHOS
::
COPY
);
}
}
#if defined(ENABLE_CANVAS_EXTEND) && ENABLE_CANVAS_EXTEND
/**
/**
* @tc.name: UICanvasSetGlobalCompositeOperation_002
* @tc.name: UICanvasSetGlobalCompositeOperation_002
* @tc.desc: Verify SetGlobalCompositeOperation function, equal.
* @tc.desc: Verify SetGlobalCompositeOperation function, equal.
...
@@ -1678,6 +1685,7 @@ HWTEST_F(UICanvasTest, UICanvasSetGlobalCompositeOperation_002, TestSize.Level1)
...
@@ -1678,6 +1685,7 @@ HWTEST_F(UICanvasTest, UICanvasSetGlobalCompositeOperation_002, TestSize.Level1)
EXPECT_EQ
(
paint_
->
GetGlobalCompositeOperation
(),
OHOS
::
COPY
);
EXPECT_EQ
(
paint_
->
GetGlobalCompositeOperation
(),
OHOS
::
COPY
);
}
}
#endif
/**
/**
* @tc.name: UICanvasGetGlobalCompositeOperation_001
* @tc.name: UICanvasGetGlobalCompositeOperation_001
...
@@ -1700,6 +1708,7 @@ HWTEST_F(UICanvasTest, UICanvasGetGlobalCompositeOperation_001, TestSize.Level0)
...
@@ -1700,6 +1708,7 @@ HWTEST_F(UICanvasTest, UICanvasGetGlobalCompositeOperation_001, TestSize.Level0)
EXPECT_EQ
(
paint_
->
GetGlobalCompositeOperation
(),
OHOS
::
SOURCE_OVER
);
EXPECT_EQ
(
paint_
->
GetGlobalCompositeOperation
(),
OHOS
::
SOURCE_OVER
);
}
}
#if defined(ENABLE_CANVAS_EXTEND) && ENABLE_CANVAS_EXTEND
/**
/**
* @tc.name: UICanvasGetGlobalCompositeOperation_002
* @tc.name: UICanvasGetGlobalCompositeOperation_002
* @tc.desc: Verify GetGlobalCompositeOperation function, equal.
* @tc.desc: Verify GetGlobalCompositeOperation function, equal.
...
@@ -1738,6 +1747,7 @@ HWTEST_F(UICanvasTest, UICanvasGetGlobalCompositeOperation_002, TestSize.Level1)
...
@@ -1738,6 +1747,7 @@ HWTEST_F(UICanvasTest, UICanvasGetGlobalCompositeOperation_002, TestSize.Level1)
canvas_
->
FillPath
(
*
paint_
);
canvas_
->
FillPath
(
*
paint_
);
EXPECT_EQ
(
paint_
->
GetGlobalCompositeOperation
(),
OHOS
::
SOURCE_OVER
);
EXPECT_EQ
(
paint_
->
GetGlobalCompositeOperation
(),
OHOS
::
SOURCE_OVER
);
}
}
#endif
/**
/**
* @tc.name: UICanvasSave_001
* @tc.name: UICanvasSave_001
...
...
tools/qt/simulator/libui/libui.pro
浏览文件 @
073d9d7c
...
@@ -29,6 +29,7 @@ DEFINES += QT_DEPRECATED_WARNINGS \
...
@@ -29,6 +29,7 @@ DEFINES += QT_DEPRECATED_WARNINGS \
"GRAPHIC_ENABLE_PATTERN_FILL_FLAG=1"
\
"GRAPHIC_ENABLE_PATTERN_FILL_FLAG=1"
\
"GRAPHIC_ENABLE_DRAW_IMAGE_FLAG=1"
\
"GRAPHIC_ENABLE_DRAW_IMAGE_FLAG=1"
\
"GRAPHIC_ENABLE_DRAW_TEXT_FLAG=1"
\
"GRAPHIC_ENABLE_DRAW_TEXT_FLAG=1"
\
"ENABLE_CANVAS_EXTEND=1"
\
"DEFAULT_ANIMATION=1"
"DEFAULT_ANIMATION=1"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录