Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Graphic Ui
提交
e1e9b286
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,发现更多精彩内容 >>
未验证
提交
e1e9b286
编写于
2月 09, 2023
作者:
O
openharmony_ci
提交者:
Gitee
2月 09, 2023
浏览文件
操作
浏览文件
下载
差异文件
!884 二维码图片像素对齐
Merge pull request !884 from 郝烁/cherry-pick-1675856249
上级
ba329711
52399c29
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
12 addition
and
4 deletion
+12
-4
frameworks/components/ui_qrcode.cpp
frameworks/components/ui_qrcode.cpp
+12
-4
未找到文件。
frameworks/components/ui_qrcode.cpp
浏览文件 @
e1e9b286
...
...
@@ -125,7 +125,8 @@ void UIQrcode::SetImageInfo(qrcodegen::QrCode& qrcode)
imageInfo_
.
header
.
width
=
width
;
imageInfo_
.
header
.
height
=
height
;
imageInfo_
.
header
.
colorMode
=
ARGB8888
;
imageInfo_
.
dataSize
=
imageInfo_
.
header
.
width
*
imageInfo_
.
header
.
height
*
QRCODE_FACTOR_NUM
;
width
=
UI_ALIGN_UP
(
width
);
imageInfo_
.
dataSize
=
width
*
imageInfo_
.
header
.
height
*
QRCODE_FACTOR_NUM
;
if
(
imageInfo_
.
data
!=
nullptr
)
{
ImageCacheFree
(
imageInfo_
);
imageInfo_
.
data
=
nullptr
;
...
...
@@ -158,6 +159,7 @@ void UIQrcode::FillQrCodeColor(qrcodegen::QrCode& qrcode)
int32_t
offsetX
=
(
width
-
outFilePixelPrescaler
*
qrWidth
)
/
2
;
// 2: half
int32_t
offsetY
=
(
height
-
outFilePixelPrescaler
*
qrWidth
)
/
2
;
// 2: half
width
=
UI_ALIGN_UP
(
width
);
uint8_t
*
destData
=
nullptr
;
int64_t
oneLinePixel
=
width
*
QRCODE_FACTOR_NUM
*
outFilePixelPrescaler
;
int64_t
oneLineOffsetPixel
=
(
offsetY
*
width
*
QRCODE_FACTOR_NUM
)
+
(
offsetX
*
QRCODE_FACTOR_NUM
);
...
...
@@ -180,8 +182,11 @@ void UIQrcode::FillQrCodeBackgroundColor()
*
(
initColorData
+
2
)
=
backgroundColor_
.
red
;
// 2: R channel
*
(
initColorData
+
3
)
=
OPA_OPAQUE
;
// 3: Alpha channel
uint32_t
width
=
imageInfo_
.
header
.
width
;
width
=
UI_ALIGN_UP
(
width
);
uint8_t
*
tempColorData
=
initColorData
;
for
(
int16_t
col
=
1
;
col
<
imageInfo_
.
header
.
width
;
++
col
)
{
for
(
int16_t
col
=
1
;
col
<
width
;
++
col
)
{
initColorData
+=
QRCODE_FACTOR_NUM
;
if
(
memcpy_s
(
initColorData
,
QRCODE_FACTOR_NUM
,
tempColorData
,
QRCODE_FACTOR_NUM
)
!=
EOK
)
{
GRAPHIC_LOGE
(
"UIQrcode::FillQrCodeBackgroundColor memcpy_s failed!
\n
"
);
...
...
@@ -189,7 +194,7 @@ void UIQrcode::FillQrCodeBackgroundColor()
}
}
initColorData
=
tempColorData
;
int32_t
deltaWidth
=
QRCODE_FACTOR_NUM
*
imageInfo_
.
header
.
width
;
int32_t
deltaWidth
=
QRCODE_FACTOR_NUM
*
width
;
for
(
int16_t
row
=
1
;
row
<
imageInfo_
.
header
.
height
;
++
row
)
{
initColorData
+=
deltaWidth
;
if
(
memcpy_s
(
initColorData
,
deltaWidth
,
tempColorData
,
deltaWidth
)
!=
EOK
)
{
...
...
@@ -201,8 +206,11 @@ void UIQrcode::FillQrCodeBackgroundColor()
void
UIQrcode
::
GetDestData
(
uint8_t
*
destData
,
int32_t
outFilePixelPrescaler
)
{
uint32_t
width
=
imageInfo_
.
header
.
width
;
width
=
UI_ALIGN_UP
(
width
);
for
(
int32_t
x
=
0
;
x
<
outFilePixelPrescaler
;
++
x
)
{
uint8_t
*
tempData
=
destData
+
imageInfo_
.
header
.
width
*
QRCODE_FACTOR_NUM
*
x
;
uint8_t
*
tempData
=
destData
+
width
*
QRCODE_FACTOR_NUM
*
x
;
for
(
int32_t
y
=
0
;
y
<
outFilePixelPrescaler
;
++
y
)
{
*
(
tempData
+
0
)
=
qrColor_
.
blue
;
// 0: B channel
*
(
tempData
+
1
)
=
qrColor_
.
green
;
// 1: G channel
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录