Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Graphic Ui
提交
0aaa4dcf
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,发现更多精彩内容 >>
提交
0aaa4dcf
编写于
4月 16, 2021
作者:
L
liqiang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
adjust bitmap api and its implementation
Change-Id: Iec8426e58b4d53ed40d79caa01af759eae576e68
上级
b3974e19
变更
8
显示空白变更内容
内联
并排
Showing
8 changed file
with
50 addition
and
37 deletion
+50
-37
frameworks/common/screen.cpp
frameworks/common/screen.cpp
+7
-4
frameworks/components/ui_view.cpp
frameworks/components/ui_view.cpp
+12
-6
frameworks/dock/screen_device_proxy.cpp
frameworks/dock/screen_device_proxy.cpp
+14
-11
frameworks/dock/screen_device_proxy.h
frameworks/dock/screen_device_proxy.h
+3
-12
interfaces/kits/common/screen.h
interfaces/kits/common/screen.h
+7
-0
interfaces/kits/components/ui_view.h
interfaces/kits/components/ui_view.h
+7
-0
tools/qt/simulator/drivers/display/monitor.cpp
tools/qt/simulator/drivers/display/monitor.cpp
+0
-2
tools/qt/simulator/drivers/display/monitor.h
tools/qt/simulator/drivers/display/monitor.h
+0
-2
未找到文件。
frameworks/common/screen.cpp
浏览文件 @
0aaa4dcf
...
@@ -17,6 +17,7 @@
...
@@ -17,6 +17,7 @@
#include "core/render_manager.h"
#include "core/render_manager.h"
#include "dock/screen_device_proxy.h"
#include "dock/screen_device_proxy.h"
#include "draw/draw_utils.h"
#include "draw/draw_utils.h"
#include "gfx_utils/mem_api.h"
namespace
OHOS
{
namespace
OHOS
{
uint16_t
Screen
::
GetWidth
()
uint16_t
Screen
::
GetWidth
()
...
@@ -33,16 +34,18 @@ bool Screen::GetCurrentScreenBitmap(ImageInfo& info)
...
@@ -33,16 +34,18 @@ bool Screen::GetCurrentScreenBitmap(ImageInfo& info)
{
{
uint16_t
screenWidth
=
ScreenDeviceProxy
::
GetInstance
()
->
GetScreenWidth
();
uint16_t
screenWidth
=
ScreenDeviceProxy
::
GetInstance
()
->
GetScreenWidth
();
uint16_t
screenHeight
=
ScreenDeviceProxy
::
GetInstance
()
->
GetScreenHeight
();
uint16_t
screenHeight
=
ScreenDeviceProxy
::
GetInstance
()
->
GetScreenHeight
();
info
.
data
=
ScreenDeviceProxy
::
GetInstance
()
->
GetScreenBitmapBuffer
();
if
(
info
.
data
==
nullptr
)
{
return
false
;
}
info
.
header
.
colorMode
=
ScreenDeviceProxy
::
GetInstance
()
->
GetBufferMode
();
info
.
header
.
colorMode
=
ScreenDeviceProxy
::
GetInstance
()
->
GetBufferMode
();
info
.
dataSize
=
screenWidth
*
screenHeight
*
DrawUtils
::
GetByteSizeByColorMode
(
info
.
header
.
colorMode
);
info
.
dataSize
=
screenWidth
*
screenHeight
*
DrawUtils
::
GetByteSizeByColorMode
(
info
.
header
.
colorMode
);
uint8_t
*
screenBitmapBuffer
=
reinterpret_cast
<
uint8_t
*>
(
ImageCacheMalloc
(
info
));
info
.
header
.
width
=
screenWidth
;
info
.
header
.
width
=
screenWidth
;
info
.
header
.
height
=
screenHeight
;
info
.
header
.
height
=
screenHeight
;
info
.
header
.
reserved
=
0
;
info
.
header
.
reserved
=
0
;
info
.
header
.
compressMode
=
0
;
info
.
header
.
compressMode
=
0
;
if
(
!
ScreenDeviceProxy
::
GetInstance
()
->
GetScreenBitmapBuffer
(
screenBitmapBuffer
,
info
.
dataSize
))
{
return
false
;
}
info
.
data
=
screenBitmapBuffer
;
return
true
;
return
true
;
}
}
}
// namespace OHOS
}
// namespace OHOS
frameworks/components/ui_view.cpp
浏览文件 @
0aaa4dcf
...
@@ -21,6 +21,7 @@
...
@@ -21,6 +21,7 @@
#include "draw/draw_rect.h"
#include "draw/draw_rect.h"
#include "draw/draw_utils.h"
#include "draw/draw_utils.h"
#include "gfx_utils/graphic_log.h"
#include "gfx_utils/graphic_log.h"
#include "gfx_utils/mem_api.h"
#include "themes/theme_manager.h"
#include "themes/theme_manager.h"
namespace
OHOS
{
namespace
OHOS
{
...
@@ -809,9 +810,6 @@ uint8_t UIView::GetMixOpaScale()
...
@@ -809,9 +810,6 @@ uint8_t UIView::GetMixOpaScale()
bool
UIView
::
GetBitmap
(
ImageInfo
&
bitmap
)
bool
UIView
::
GetBitmap
(
ImageInfo
&
bitmap
)
{
{
if
(
!
ScreenDeviceProxy
::
GetInstance
()
->
EnableBitmapBuffer
())
{
return
false
;
}
UIView
*
tempSibling
=
nextSibling_
;
UIView
*
tempSibling
=
nextSibling_
;
UIView
*
tempParent
=
parent_
;
UIView
*
tempParent
=
parent_
;
int16_t
tempX
=
rect_
.
GetX
();
int16_t
tempX
=
rect_
.
GetX
();
...
@@ -827,15 +825,23 @@ bool UIView::GetBitmap(ImageInfo& bitmap)
...
@@ -827,15 +825,23 @@ bool UIView::GetBitmap(ImageInfo& bitmap)
mask
.
Intersect
(
mask
,
screenRect
);
mask
.
Intersect
(
mask
,
screenRect
);
uint16_t
bufferWidth
=
mask
.
GetWidth
();
uint16_t
bufferWidth
=
mask
.
GetWidth
();
uint16_t
bufferHeight
=
mask
.
GetHeight
();
uint16_t
bufferHeight
=
mask
.
GetHeight
();
ScreenDeviceProxy
::
GetInstance
()
->
SetViewBitmapBufferWidth
(
bufferWidth
);
RootView
::
GetInstance
()
->
DrawTop
(
this
,
mask
);
bitmap
.
data
=
ScreenDeviceProxy
::
GetInstance
()
->
GetBuffer
();
bitmap
.
header
.
colorMode
=
ScreenDeviceProxy
::
GetInstance
()
->
GetBufferMode
();
bitmap
.
header
.
colorMode
=
ScreenDeviceProxy
::
GetInstance
()
->
GetBufferMode
();
bitmap
.
dataSize
=
bufferWidth
*
bufferHeight
*
DrawUtils
::
GetByteSizeByColorMode
(
bitmap
.
header
.
colorMode
);
bitmap
.
dataSize
=
bufferWidth
*
bufferHeight
*
DrawUtils
::
GetByteSizeByColorMode
(
bitmap
.
header
.
colorMode
);
bitmap
.
header
.
width
=
bufferWidth
;
bitmap
.
header
.
width
=
bufferWidth
;
bitmap
.
header
.
height
=
bufferHeight
;
bitmap
.
header
.
height
=
bufferHeight
;
bitmap
.
header
.
reserved
=
0
;
bitmap
.
header
.
reserved
=
0
;
uint8_t
*
viewBitmapBuffer
=
reinterpret_cast
<
uint8_t
*>
(
ImageCacheMalloc
(
bitmap
));
if
(
viewBitmapBuffer
==
nullptr
)
{
nextSibling_
=
tempSibling
;
parent_
=
tempParent
;
rect_
.
SetPosition
(
tempX
,
tempY
);
return
false
;
}
ScreenDeviceProxy
::
GetInstance
()
->
EnableBitmapBuffer
(
viewBitmapBuffer
);
ScreenDeviceProxy
::
GetInstance
()
->
SetViewBitmapBufferWidth
(
bufferWidth
);
RootView
::
GetInstance
()
->
DrawTop
(
this
,
mask
);
bitmap
.
data
=
viewBitmapBuffer
;
ScreenDeviceProxy
::
GetInstance
()
->
DisableBitmapBuffer
();
ScreenDeviceProxy
::
GetInstance
()
->
DisableBitmapBuffer
();
nextSibling_
=
tempSibling
;
nextSibling_
=
tempSibling
;
parent_
=
tempParent
;
parent_
=
tempParent
;
...
...
frameworks/dock/screen_device_proxy.cpp
浏览文件 @
0aaa4dcf
...
@@ -109,26 +109,29 @@ ColorMode ScreenDeviceProxy::GetBufferMode()
...
@@ -109,26 +109,29 @@ ColorMode ScreenDeviceProxy::GetBufferMode()
return
frameBufferMode_
;
return
frameBufferMode_
;
}
}
bool
ScreenDeviceProxy
::
EnableBitmapBuffer
(
)
void
ScreenDeviceProxy
::
EnableBitmapBuffer
(
uint8_t
*
viewBitmapBuffer
)
{
{
if
(
viewBitmapBuffer
_
==
nullptr
)
{
if
(
viewBitmapBuffer
==
nullptr
)
{
return
false
;
return
;
}
}
viewBitmapBuffer_
=
viewBitmapBuffer
;
enableBitmapBuffer_
=
true
;
enableBitmapBuffer_
=
true
;
return
true
;
}
}
uint8_t
*
ScreenDeviceProxy
::
GetScreenBitmapBuffer
(
)
bool
ScreenDeviceProxy
::
GetScreenBitmapBuffer
(
uint8_t
*
dest
,
uint32_t
size
)
{
{
if
(
screenBitmapBuffer_
==
nullptr
)
{
if
(
(
dest
==
nullptr
)
||
(
size
==
0
)
)
{
return
nullptr
;
return
false
;
}
}
uint8_t
*
buf
=
GetBuffer
();
uint8_t
byteSize
=
DrawUtils
::
GetByteSizeByColorMode
(
frameBufferMode_
);
uint8_t
byteSize
=
DrawUtils
::
GetByteSizeByColorMode
(
frameBufferMode_
);
uint32_t
bufSize
=
width_
*
height_
*
byteSize
;
uint32_t
bufSize
=
width_
*
height_
*
byteSize
;
if
(
memcpy_s
(
screenBitmapBuffer_
,
bufSize
,
buf
,
bufSize
)
!=
EOK
)
{
if
(
size
<
bufSize
)
{
return
nullptr
;
return
false
;
}
uint8_t
*
buf
=
GetBuffer
();
if
(
memcpy_s
(
dest
,
size
,
buf
,
bufSize
)
!=
EOK
)
{
return
false
;
}
}
return
screenBitmapBuffer_
;
return
true
;
}
}
}
// namespace OHOS
}
// namespace OHOS
frameworks/dock/screen_device_proxy.h
浏览文件 @
0aaa4dcf
...
@@ -185,28 +185,20 @@ public:
...
@@ -185,28 +185,20 @@ public:
ColorMode
GetBufferMode
();
ColorMode
GetBufferMode
();
void
SetBitmapBuffer
(
uint8_t
*
addr0
,
uint8_t
*
addr1
)
{
if
((
addr0
==
nullptr
)
||
(
addr1
==
nullptr
))
{
return
;
}
viewBitmapBuffer_
=
addr0
;
screenBitmapBuffer_
=
addr1
;
}
void
SetViewBitmapBufferWidth
(
uint16_t
width
)
void
SetViewBitmapBufferWidth
(
uint16_t
width
)
{
{
bitmapBufferWidth_
=
width
;
bitmapBufferWidth_
=
width
;
}
}
bool
EnableBitmapBuffer
(
);
void
EnableBitmapBuffer
(
uint8_t
*
viewBitmapBuffer
);
void
DisableBitmapBuffer
()
void
DisableBitmapBuffer
()
{
{
enableBitmapBuffer_
=
false
;
enableBitmapBuffer_
=
false
;
}
}
uint8_t
*
GetScreenBitmapBuffer
();
bool
GetScreenBitmapBuffer
(
uint8_t
*
dest
,
uint32_t
size
);
;
private:
private:
ScreenDeviceProxy
()
{}
ScreenDeviceProxy
()
{}
virtual
~
ScreenDeviceProxy
()
{}
virtual
~
ScreenDeviceProxy
()
{}
...
@@ -234,7 +226,6 @@ private:
...
@@ -234,7 +226,6 @@ private:
ImageInfo
animatorImageInfo_
=
{{
0
}};
ImageInfo
animatorImageInfo_
=
{{
0
}};
// snapshot related
// snapshot related
uint8_t
*
viewBitmapBuffer_
=
nullptr
;
uint8_t
*
viewBitmapBuffer_
=
nullptr
;
uint8_t
*
screenBitmapBuffer_
=
nullptr
;
uint16_t
bitmapBufferWidth_
=
0
;
uint16_t
bitmapBufferWidth_
=
0
;
bool
enableBitmapBuffer_
=
false
;
bool
enableBitmapBuffer_
=
false
;
// snapshot related
// snapshot related
...
...
interfaces/kits/common/screen.h
浏览文件 @
0aaa4dcf
...
@@ -76,6 +76,13 @@ public:
...
@@ -76,6 +76,13 @@ public:
*/
*/
uint16_t
GetHeight
();
uint16_t
GetHeight
();
/**
* @brief 获取当前屏幕的bitmap截图.请注意该接口会申请内存,请在需要释放时使用{@link ImageCacheFree()}接口.
* @param info bitmap存储对象,获取的截图将被存到该引用中.
* @return bitmap是否获取成功.
* @since 5.0
* @version 3.0
*/
bool
GetCurrentScreenBitmap
(
ImageInfo
&
info
);
bool
GetCurrentScreenBitmap
(
ImageInfo
&
info
);
private:
private:
...
...
interfaces/kits/components/ui_view.h
浏览文件 @
0aaa4dcf
...
@@ -1429,6 +1429,13 @@ public:
...
@@ -1429,6 +1429,13 @@ public:
OnFocusListener
*
GetOnFocusListener
()
const
{
return
onFocusListener_
;
}
OnFocusListener
*
GetOnFocusListener
()
const
{
return
onFocusListener_
;
}
#endif
#endif
/**
* @brief 获取当前视图的bitmap截图.请注意该接口会申请内存,请在需要释放时使用{@link ImageCacheFree()}接口.
* @param info bitmap存储对象,获取的截图将被存到该引用中.
* @return bitmap是否获取成功.
* @since 5.0
* @version 3.0
*/
bool
GetBitmap
(
ImageInfo
&
bitmap
);
bool
GetBitmap
(
ImageInfo
&
bitmap
);
protected:
protected:
...
...
tools/qt/simulator/drivers/display/monitor.cpp
浏览文件 @
0aaa4dcf
...
@@ -32,8 +32,6 @@ void Monitor::InitHal()
...
@@ -32,8 +32,6 @@ void Monitor::InitHal()
HORIZONTAL_RESOLUTION
);
HORIZONTAL_RESOLUTION
);
ScreenDeviceProxy
::
GetInstance
()
->
SetAnimatorbuffer
(
reinterpret_cast
<
uint8_t
*>
(
animaterBuffer_
),
ARGB8888
,
ScreenDeviceProxy
::
GetInstance
()
->
SetAnimatorbuffer
(
reinterpret_cast
<
uint8_t
*>
(
animaterBuffer_
),
ARGB8888
,
HORIZONTAL_RESOLUTION
);
HORIZONTAL_RESOLUTION
);
ScreenDeviceProxy
::
GetInstance
()
->
SetBitmapBuffer
(
reinterpret_cast
<
uint8_t
*>
(
viewBitmapBuffer_
),
reinterpret_cast
<
uint8_t
*>
(
screenBitmapBuffer_
));
Monitor
*
display
=
Monitor
::
GetInstance
();
Monitor
*
display
=
Monitor
::
GetInstance
();
ScreenDeviceProxy
::
GetInstance
()
->
SetDevice
(
display
);
ScreenDeviceProxy
::
GetInstance
()
->
SetDevice
(
display
);
...
...
tools/qt/simulator/drivers/display/monitor.h
浏览文件 @
0aaa4dcf
...
@@ -53,8 +53,6 @@ private:
...
@@ -53,8 +53,6 @@ private:
uint8_t
fontPsramBaseAddr_
[
MIN_FONT_PSRAM_LENGTH
];
uint8_t
fontPsramBaseAddr_
[
MIN_FONT_PSRAM_LENGTH
];
uint32_t
tftFb_
[
HORIZONTAL_RESOLUTION
*
VERTICAL_RESOLUTION
];
uint32_t
tftFb_
[
HORIZONTAL_RESOLUTION
*
VERTICAL_RESOLUTION
];
uint32_t
animaterBuffer_
[
HORIZONTAL_RESOLUTION
*
VERTICAL_RESOLUTION
];
uint32_t
animaterBuffer_
[
HORIZONTAL_RESOLUTION
*
VERTICAL_RESOLUTION
];
uint32_t
viewBitmapBuffer_
[
HORIZONTAL_RESOLUTION
*
VERTICAL_RESOLUTION
];
uint32_t
screenBitmapBuffer_
[
HORIZONTAL_RESOLUTION
*
VERTICAL_RESOLUTION
];
uint32_t
defaultColor_
;
uint32_t
defaultColor_
;
};
};
}
// namespace OHOS
}
// namespace OHOS
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录