From c1784a352430ccc8920007e4ae9657b4ab36cd20 Mon Sep 17 00:00:00 2001 From: songcongyi Date: Thu, 29 Jul 2021 19:59:01 +0800 Subject: [PATCH] fix resize window Change-Id: I70818777a80ccbebca2f16a3df915e4d1f700e5c --- engine/flutter/shell/platform/ohos/ohos_surface.h | 2 ++ .../flutter/shell/platform/ohos/ohos_surface_software.cc | 7 +++++++ engine/flutter/shell/platform/ohos/ohos_surface_software.h | 2 ++ engine/flutter/shell/platform/ohos/platform_view_ohos.cc | 7 +++++++ engine/flutter/shell/platform/ohos/platform_view_ohos.h | 1 + 5 files changed, 19 insertions(+) diff --git a/engine/flutter/shell/platform/ohos/ohos_surface.h b/engine/flutter/shell/platform/ohos/ohos_surface.h index 913b945f..599dea11 100644 --- a/engine/flutter/shell/platform/ohos/ohos_surface.h +++ b/engine/flutter/shell/platform/ohos/ohos_surface.h @@ -25,6 +25,8 @@ class OhosSurface { virtual std::unique_ptr CreateGPUSurface() = 0; + virtual bool OnScreenSurfaceResize(const SkISize& size) = 0; + virtual void SetPlatformWindow(::OHOS::Window* window) = 0; }; diff --git a/engine/flutter/shell/platform/ohos/ohos_surface_software.cc b/engine/flutter/shell/platform/ohos/ohos_surface_software.cc index 3395043e..15d41ffa 100644 --- a/engine/flutter/shell/platform/ohos/ohos_surface_software.cc +++ b/engine/flutter/shell/platform/ohos/ohos_surface_software.cc @@ -64,6 +64,13 @@ std::unique_ptr OhosSurfaceSoftware::CreateGPUSurface() return surface; } +bool OhosSurfaceSoftware::OnScreenSurfaceResize(const SkISize& size) +{ + requestConfig_.width = size.fWidth; + requestConfig_.height = size.fHeight; + return true; +} + void OhosSurfaceSoftware::SetPlatformWindow(OHOS::Window* window) { if (window == nullptr) { diff --git a/engine/flutter/shell/platform/ohos/ohos_surface_software.h b/engine/flutter/shell/platform/ohos/ohos_surface_software.h index cab0ee9a..43bead81 100644 --- a/engine/flutter/shell/platform/ohos/ohos_surface_software.h +++ b/engine/flutter/shell/platform/ohos/ohos_surface_software.h @@ -24,6 +24,8 @@ class OhosSurfaceSoftware final : public OhosSurface, std::unique_ptr CreateGPUSurface() override; + bool OnScreenSurfaceResize(const SkISize& size) override; + void SetPlatformWindow(OHOS::Window* window) override; sk_sp AcquireBackingStore(const SkISize& size) override; diff --git a/engine/flutter/shell/platform/ohos/platform_view_ohos.cc b/engine/flutter/shell/platform/ohos/platform_view_ohos.cc index ba09136d..54c227c6 100644 --- a/engine/flutter/shell/platform/ohos/platform_view_ohos.cc +++ b/engine/flutter/shell/platform/ohos/platform_view_ohos.cc @@ -35,6 +35,13 @@ void PlatformViewOhos::NotifyCreated(::OHOS::Window* window) PlatformView::NotifyCreated(); } +void PlatformViewOhos::NotifyChanged(const SkISize& size) +{ + if (surface_) { + surface_->OnScreenSurfaceResize(size); + } +} + std::unique_ptr PlatformViewOhos::CreateRenderingSurface() { if (!surface_) { diff --git a/engine/flutter/shell/platform/ohos/platform_view_ohos.h b/engine/flutter/shell/platform/ohos/platform_view_ohos.h index 1f368c58..9bbbb02d 100644 --- a/engine/flutter/shell/platform/ohos/platform_view_ohos.h +++ b/engine/flutter/shell/platform/ohos/platform_view_ohos.h @@ -17,6 +17,7 @@ public: PlatformViewOhos(PlatformView::Delegate& delegate, flutter::TaskRunners task_runners, bool use_software_rendering); void NotifyCreated(::OHOS::Window* window); + void NotifyChanged(const SkISize& size); std::unique_ptr CreateRenderingSurface(); std::unique_ptr CreateVSyncWaiter(int32_t platform); -- Gitee