Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Graphic Ui
提交
b4cac638
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,发现更多精彩内容 >>
提交
b4cac638
编写于
3月 22, 2022
作者:
X
xucheng57@huawei.com
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修复gfx_engine_manager
Signed-off-by:
N
xucheng57
<
xucheng57@huawei.com
>
上级
9f168851
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
43 addition
and
82 deletion
+43
-82
frameworks/engines/gfx/gfx_engine_manager.cpp
frameworks/engines/gfx/gfx_engine_manager.cpp
+21
-19
interfaces/innerkits/engines/gfx/gfx_engine_manager.h
interfaces/innerkits/engines/gfx/gfx_engine_manager.h
+22
-63
未找到文件。
frameworks/engines/gfx/gfx_engine_manager.cpp
浏览文件 @
b4cac638
/*
* Copyright (c) 2020-2022
Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
* Copyright (c) 2020-2021
Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "engines/gfx/gfx_engine_manager.h"
#include <cstdlib>
#include "draw/clip_utils.h"
#include "draw/draw_arc.h"
#include "draw/draw_curve.h"
...
...
@@ -85,7 +88,7 @@ void BaseGfxEngine::DrawTransform(BufferInfo& dst,
const
TransformDataInfo
&
dataInfo
)
{
DrawUtils
::
GetInstance
()
->
DrawTransform
(
dst
,
mask
,
position
,
color
,
opacity
,
transMap
,
dataInfo
);
opacity
,
transMap
,
dataInfo
);
}
void
BaseGfxEngine
::
ClipCircle
(
const
ImageInfo
*
info
,
float
x
,
float
y
,
float
radius
)
...
...
@@ -103,9 +106,8 @@ void BaseGfxEngine::Blit(BufferInfo& dst,
const
BlendOption
&
blendOption
)
{
DrawUtils
::
GetInstance
()
->
BlendWithSoftWare
(
static_cast
<
uint8_t
*>
(
src
.
virAddr
),
src
.
rect
,
src
.
stride
,
src
.
rect
.
GetHeight
(),
src
.
mode
,
src
.
color
,
blendOption
.
opacity
,
static_cast
<
uint8_t
*>
(
dst
.
virAddr
),
dst
.
stride
,
dst
.
mode
,
subRect
.
GetX
(),
subRect
.
GetY
());
src
.
rect
.
GetHeight
(),
src
.
mode
,
src
.
color
,
blendOption
.
opacity
,
static_cast
<
uint8_t
*>
(
dst
.
virAddr
),
dst
.
stride
,
dst
.
mode
,
subRect
.
GetX
(),
subRect
.
GetY
());
}
void
BaseGfxEngine
::
Fill
(
BufferInfo
&
dst
,
const
Rect
&
fillArea
,
const
ColorType
color
,
const
OpacityType
opacity
)
...
...
@@ -115,11 +117,11 @@ void BaseGfxEngine::Fill(BufferInfo& dst, const Rect& fillArea, const ColorType
uint8_t
*
BaseGfxEngine
::
AllocBuffer
(
uint32_t
size
,
uint32_t
usage
)
{
return
static_cast
<
uint8_t
*>
(
malloc
(
size
));
return
static_cast
<
uint8_t
*>
(
malloc
(
size
));
}
void
BaseGfxEngine
::
FreeBuffer
(
uint8_t
*
buffer
)
{
free
(
buffer
);
}
}
// namespace OHOS
}
interfaces/innerkits/engines/gfx/gfx_engine_manager.h
浏览文件 @
b4cac638
/*
* Copyright (c) 2020-202
2
Huawei Device Co., Ltd.
* Copyright (c) 2020-202
1
Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
...
...
@@ -23,60 +23,23 @@
#include "gfx_utils/heap_base.h"
#include "gfx_utils/style.h"
#include "gfx_utils/transform.h"
namespace
OHOS
{
class
GfxEngineManager
;
namespace
OHOS
{
class
BaseGfxEngine
;
enum
BlendMode
{
/** No mixing */
BLEND_MODE
=
-
1
,
/** S */
BLEND_SRC
,
/** D */
BLEND_DST
,
/** Default. Displays the source image on the target image. */
/** S + (1 - Sa) * D */
BLEND_SRC_OVER
,
/** Displays the target image on the source image. */
/** (1 - Da) * S + D */
BLEND_DST_OVER
,
/** Displays the source image in the target image. Only the source image part within the target image
* will be displayed, and the target image is transparent. */
/** Da * S */
BLEND_SRC_IN
,
/** Displays the target image in the source image. Only the target image part within the source image
* will be displayed, and the source image is transparent. */
/** Sa * D */
BLEND_DST_IN
,
/** Displays the source image outside the target image. Only the source image part other than the target
* image will be displayed, and the target image is transparent. */
/** S * (1 - Da) */
BLEND_SRC_OUT
,
/** Displays the target image outside the source image. Only the part of the target image other than the
* source image will be displayed, and the source image is transparent. */
/** D * (1 - Sa) */
BLEND_DST_OUT
,
/** Displays the source image at the top of the target image. The part of the source image outside the
* target image is invisible. */
BLEND_SRC_ATOP
,
/** Displays the target image at the top of the source image. The part of the target image outside the
* source image is invisible. */
BLEND_DST_ATOP
,
/** Use the XOR operation to combine the source image with the target image. */
BLEND_XOR
,
/** Display source image + target image. */
BLEND_LIGHTEN
,
/** Blend transparency */
BLEND_ALPHA
,
/** S + D - S * D */
BLEND_SCREEN
,
/** S * (1 - Da) + D * (1 - Sa) + S * D */
BLEND_MULTIPLY
,
/** S + D */
BLEND_ADDITIVE
,
/** D * (1 - S) */
BLEND_SUBTRACT
,
/** Displays the source image. Ignore the target image. */
BLEND_COPY
=
1000
BLEND_MODE
,
/* no blending */
BLEND_SRC
,
/* S */
BLEND_DST
,
/* D */
BLEND_SRC_OVER
,
/* S + (1 - Sa) * D */
BLEND_DST_OVER
,
/* (1 - Da) * S + D */
BLEND_SRC_IN
,
/* Da * S */
BLEND_DST_IN
,
/* Sa * D */
BLEND_SRC_OUT
,
/* S * (1 - Da) */
BLEND_DST_OUT
,
/* D * (1 - Sa) */
BLEND_SCREEN
,
/* S + D - S * D */
BLEND_MULTIPLY
,
/* S * (1 - Da) + D * (1 - Sa) + S * D */
BLEND_ADDITIVE
,
/* S + D */
BLEND_SUBTRACT
,
/* D * (1 - S) */
};
#ifndef TRANSFORMOPTION
...
...
@@ -117,7 +80,7 @@ enum BufferInfoUsage {
BUFFER_SNAPSHOT_SURFACE
};
class
GfxEngineManager
:
public
HeapBase
{
class
BaseGfxEngine
:
public
HeapBase
{
public:
virtual
void
DrawArc
(
BufferInfo
&
dst
,
ArcInfo
&
arcInfo
,
const
Rect
&
mask
,
const
Style
&
style
,
OpacityType
opacity
,
uint8_t
cap
);
...
...
@@ -169,8 +132,6 @@ public:
virtual
void
FreeBuffer
(
uint8_t
*
buffer
);
virtual
void
FlushRegion
(
const
Rect
&
rect
,
const
uint8_t
*
buffer
,
ColorMode
mode
)
{}
virtual
BufferInfo
*
GetFBBufferInfo
()
{
return
nullptr
;
...
...
@@ -198,28 +159,26 @@ public:
return
screenShape_
;
}
static
GfxEngineManager
*
GetInstance
()
static
BaseGfxEngine
*
GetInstance
()
{
return
baseEngine_
;
}
static
void
InitGfxEngine
(
GfxEngineManager
*
gfxEngine
=
nullptr
)
static
void
InitGfxEngine
(
BaseGfxEngine
*
gfxEngine
=
nullptr
)
{
if
(
gfxEngine
==
nullptr
)
{
static
GfxEngineManager
localGfxEngine
;
static
BaseGfxEngine
localGfxEngine
;
baseEngine_
=
&
localGfxEngine
;
return
;
}
baseEngine_
=
gfxEngine
;
}
protected:
static
GfxEngineManager
*
baseEngine_
;
static
BaseGfxEngine
*
baseEngine_
;
uint16_t
width_
=
HORIZONTAL_RESOLUTION
;
uint16_t
height_
=
VERTICAL_RESOLUTION
;
ScreenShape
screenShape_
=
RECTANGLE
;
};
using
BaseGfxEngine
=
GfxEngineManager
;
}
// namespace OHOS
}
#endif // GRAPHIC_LITE_GFX_ENGINE_MANAGER_H
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录