mirror of
https://gitee.com/openharmony/graphic_graphic_2d
synced 2025-04-01 23:41:50 +00:00
!2 fix-subwindow-resize-func
Merge pull request !2 from passded0704/fix-subwindow-resize-func
This commit is contained in:
commit
0b58c7f017
@ -939,7 +939,7 @@ void LayerControllerClient::registry_handle_global(void* data,
|
||||
return;
|
||||
}
|
||||
|
||||
if (strcmp(interface, "wp_viewport") == 0) {
|
||||
if (strcmp(interface, "wp_viewporter") == 0) {
|
||||
auto ret = wl_registry_bind(registry, id, &wp_viewporter_interface, 1);
|
||||
wlContext->viewporter = (struct wp_viewporter*)ret;
|
||||
return;
|
||||
@ -1493,6 +1493,7 @@ InnerWindowInfo* LayerControllerClient::CreateSubWindow(int32_t subid, int32_t p
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
newSubInfo.viewport = wp_viewporter_get_viewport(wlContextStruct_.viewporter, newSubInfo.wlSurface);
|
||||
if (!CreateVideoSubWindow(newSubInfo, *wlContextStruct_.wl_shm)) {
|
||||
return nullptr;
|
||||
}
|
||||
@ -1683,9 +1684,9 @@ void LayerControllerClient::SetSubSurfaceSize(int32_t id, int32_t width, int32_t
|
||||
"LayerControllerClient::SetSubSurfaceSize", id, width, height);
|
||||
|
||||
GET_WINDOWINFO_VOID(windowInfo, id);
|
||||
if (windowInfo->subwidow == true && windowInfo->viewport) {
|
||||
windowInfo->viewport = wp_viewporter_get_viewport(wlContextStruct_.viewporter, windowInfo->wlSurface);
|
||||
if (windowInfo->subwidow == true && wlContextStruct_.viewporter) {
|
||||
if (windowInfo->viewport) {
|
||||
wp_viewport_set_destination(windowInfo->viewport, width, height);
|
||||
wp_viewport_set_source(windowInfo->viewport, windowInfo->pos_x, windowInfo->pos_y, width, height);
|
||||
}
|
||||
wl_surface_commit(windowInfo->wlSurface);
|
||||
|
@ -831,6 +831,42 @@ void Test16()
|
||||
printf("uncompress time: %lld\n", GetNowTime() - start);
|
||||
}
|
||||
|
||||
void Test17()
|
||||
{
|
||||
static int32_t maxWidth = WindowManager::GetInstance()->GetMaxWidth();
|
||||
static int32_t maxHeight = WindowManager::GetInstance()->GetMaxHeight();
|
||||
constexpr int32_t videoPosition = 100;
|
||||
constexpr int32_t videoWidth = 100;
|
||||
constexpr int32_t videoHeight = 100;
|
||||
Flush(0, 0, 0, WINDOW_TYPE_NORMAL);
|
||||
FlushSubVideo(videoPosition, videoWidth, videoHeight, WINDOW_TYPE_VIDEO);
|
||||
|
||||
static std::function<void()> func = [&]() {
|
||||
constexpr int32_t step = 37;
|
||||
constexpr int32_t minWidthHeight = 100;
|
||||
static int32_t width = maxWidth;
|
||||
static int32_t height = maxHeight;
|
||||
|
||||
width -= step;
|
||||
height -= step;
|
||||
|
||||
if (width < minWidthHeight) {
|
||||
width += maxWidth;
|
||||
}
|
||||
|
||||
if (height < minWidthHeight) {
|
||||
height += maxHeight;
|
||||
}
|
||||
|
||||
g_subWindow->SetSubWindowSize(width, height);
|
||||
|
||||
constexpr uint32_t delayTime = 300;
|
||||
PostTask(func, delayTime);
|
||||
};
|
||||
|
||||
PostTask(func);
|
||||
}
|
||||
|
||||
struct WindowManagerTest {
|
||||
int32_t id;
|
||||
const char *desc;
|
||||
@ -858,6 +894,7 @@ void InitTest(std::vector<struct WindowManagerTest>& tests)
|
||||
ADD_TEST(tests, 14, "subvideo destory");
|
||||
ADD_TEST(tests, 15, "ipc draw");
|
||||
ADD_TEST(tests, 16, "uncompress perf");
|
||||
ADD_TEST(tests, 17, "video resize");
|
||||
}
|
||||
|
||||
void usage(const char* argv0, std::vector<struct WindowManagerTest>& tests)
|
||||
|
Loading…
x
Reference in New Issue
Block a user