!127 修复camera组件无法预览问题

Merge pull request !127 from caocan/master
This commit is contained in:
openharmony_ci 2021-12-30 07:49:37 +00:00 committed by Gitee
commit 0daffc53b7
9 changed files with 29 additions and 0 deletions

View File

@ -38,6 +38,7 @@ public:
virtual void OnPositionChange(WindowPositionChangeFunc func) override;
virtual void OnSizeChange(WindowSizeChangeFunc func) override;
virtual void OnBeforeFrameSubmit(BeforeFrameSubmitFunc func) override;
protected:
virtual ~SubwindowNormalImpl() override;

View File

@ -40,6 +40,7 @@ public:
virtual void OnPositionChange(WindowPositionChangeFunc func) override;
virtual void OnSizeChange(WindowSizeChangeFunc func) override;
virtual void OnBeforeFrameSubmit(BeforeFrameSubmitFunc func) override;
private:
GSError CreateWlSurface(const sptr<WlSurface> &parentWlSurface);

View File

@ -66,6 +66,7 @@ public:
virtual void OnTypeChange(WindowTypeChangeFunc func) override;
virtual void OnModeChange(WindowModeChangeFunc func) override;
virtual void OnSplitStatusChange(SplitStatusChangeFunc func) override;
virtual void OnBeforeFrameSubmit(BeforeFrameSubmitFunc func) override;
// pipMode
virtual bool GetPIPMode() const override;

View File

@ -175,6 +175,11 @@ void SubwindowNormalImpl::OnSizeChange(WindowSizeChangeFunc func)
attr.OnSizeChange(func);
}
void SubwindowNormalImpl::OnBeforeFrameSubmit(BeforeFrameSubmitFunc func)
{
onBeforeFrameSubmitFunc = func;
}
SubwindowNormalImpl::~SubwindowNormalImpl()
{
Destroy();
@ -209,6 +214,10 @@ void SubwindowNormalImpl::OnBufferAvailable()
return;
}
if (onBeforeFrameSubmitFunc != nullptr) {
onBeforeFrameSubmitFunc();
}
if (csurf == nullptr || wlSurface == nullptr) {
WMLOGFE("csurf or wlSurface is nullptr");
return;

View File

@ -266,4 +266,9 @@ SubwindowVideoImpl::~SubwindowVideoImpl()
{
Destroy();
}
void SubwindowVideoImpl::OnBeforeFrameSubmit(BeforeFrameSubmitFunc func)
{
onBeforeFrameSubmitFunc = func;
}
} // namespace OHOS

View File

@ -482,6 +482,11 @@ GSError WindowImpl::OnPIPModeChange(WindowPIPModeChangeFunc func)
return GSERROR_OK;
}
void WindowImpl::OnBeforeFrameSubmit(BeforeFrameSubmitFunc func)
{
onBeforeFrameSubmitFunc = func;
}
GSError WindowImpl::OnTouch(OnTouchFunc cb)
{
CHECK_DESTROY(GSERROR_DESTROYED_OBJECT);
@ -513,6 +518,10 @@ void WindowImpl::OnBufferAvailable()
WMLOGFI("OnBufferAvailable enter");
CHECK_DESTROY();
if (onBeforeFrameSubmitFunc != nullptr) {
onBeforeFrameSubmitFunc();
}
sptr<SurfaceBuffer> sbuffer;
int32_t flushFence;
int64_t timestamp;

View File

@ -50,6 +50,7 @@ public:
MOCK_METHOD1(OnVisibilityChange, void(WindowVisibilityChangeFunc func));
MOCK_METHOD1(OnTypeChange, void(WindowTypeChangeFunc func));
MOCK_METHOD1(OnModeChange, void(WindowModeChangeFunc func));
MOCK_METHOD1(OnBeforeFrameSubmit, void(BeforeFrameSubmitFunc func));
MOCK_METHOD1(OnSplitStatusChange, void(SplitStatusChangeFunc func));
MOCK_METHOD1(OnKey, GSError(OnKeyFunc cb));
MOCK_METHOD1(OnTouch, GSError(OnTouchFunc cb));

View File

@ -33,6 +33,7 @@ public:
virtual void OnPositionChange(WindowPositionChangeFunc func) = 0;
virtual void OnSizeChange(WindowSizeChangeFunc func) = 0;
virtual void OnBeforeFrameSubmit(BeforeFrameSubmitFunc func) = 0;
virtual GSError OnFrameAvailable(FrameAvailableFunc func)
{

View File

@ -56,6 +56,7 @@ public:
virtual void OnTypeChange(WindowTypeChangeFunc func) = 0;
virtual void OnModeChange(WindowModeChangeFunc func) = 0;
virtual void OnSplitStatusChange(SplitStatusChangeFunc func) = 0;
virtual void OnBeforeFrameSubmit(BeforeFrameSubmitFunc func) = 0;
// pip Mode
virtual bool GetPIPMode() const