Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[webview_flutter_dev] Enable gl compositor at LWE #14

Merged
merged 1 commit into from Dec 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 5 additions & 3 deletions packages/webview_flutter/tizen/inc/lwe/LWEWebView.h
Expand Up @@ -69,6 +69,7 @@ class LWE_EXPORT Settings {
void GetBaseForegroundColor(unsigned char& r, unsigned char& g,
unsigned char& b, unsigned char& a) const;
bool NeedsDownloadWebFontsEarly() const;
uint32_t NeedsDownScaleImageResourceLargerThan() const;
void SetUserAgentString(const std::string& ua);
void SetCacheMode(int mode);
void SetProxyURL(const std::string& proxyURL);
Expand All @@ -82,6 +83,8 @@ class LWE_EXPORT Settings {
void SetIdleModeJob(IdleModeJob j);
void SetIdleModeCheckIntervalInMS(uint32_t intervalInMS);
void SetNeedsDownloadWebFontsEarly(bool b);
void SetNeedsDownScaleImageResourceLargerThan(
uint32_t demention); // Experimental

private:
std::string m_defaultUserAgent;
Expand All @@ -96,6 +99,7 @@ class LWE_EXPORT Settings {
IdleModeJob m_idleModeJob; // default value is IdleModeJob::IdleModeFull
uint32_t m_idleModeCheckIntervalInMS; // default value is 3000(ms)
bool m_needsDownloadWebFontsEarly;
uint32_t m_needsDownScaleImageResourceLargerThan;
};

class LWE_EXPORT ResourceError {
Expand Down Expand Up @@ -353,14 +357,12 @@ class LWE_EXPORT WebView {
virtual void Focus();
virtual void Blur();

virtual WebContainer* FetchWebContainer() = 0;
protected:
WebView(void* impl)
: m_impl(impl)
{
}

virtual WebContainer* FetchWebContainer() = 0;

void* m_impl;
};

Expand Down
Binary file not shown.
Binary file modified packages/webview_flutter/tizen/lib/liblightweight-web-engine.so 100644 → 100755
Binary file not shown.
24 changes: 12 additions & 12 deletions packages/webview_flutter/tizen/src/webview.cc
Expand Up @@ -54,6 +54,7 @@ WebView::WebView(flutter::PluginRegistrar* registrar, int viewId,
FlutterTextureRegistrar* textureRegistrar, double width,
double height, const std::string initialUrl)
: PlatformView(registrar, viewId),
tbmSurface_(nullptr),
textureRegistrar_(textureRegistrar),
webViewInstance_(nullptr),
currentUrl_(initialUrl),
Expand Down Expand Up @@ -341,7 +342,7 @@ void WebView::DispatchKeyDownEvent(Ecore_Event_Key* keyEvent) {
} else {
webViewInstance_->AddIdleCallback(
[](void* data) {
LWE::WebContainer* self = (LWE::WebContainer*)data;
// LWE::WebContainer* self = (LWE::WebContainer*)data;
// self->HideSoftwareKeyboardIfPossible();
},
webViewInstance_);
Expand Down Expand Up @@ -436,23 +437,22 @@ void WebView::InitWebView() {
webViewInstance_ = nullptr;
}
float scaleFactor = 1;
webViewInstance_ = LWE::WebContainer::Create(
width_, height_, scaleFactor, "SamsungOneUI", "ko-KR", "Asia/Seoul");

LWE::WebView* webview = LWE::WebView::Create(nullptr,0,0,width_, height_,scaleFactor, "SamsungOneUI", "ko-KR", "Asia/Seoul");
webViewInstance_ = webview->FetchWebContainer();
webViewInstance_->RegisterPreRenderingHandler(
[this]() -> LWE::WebContainer::RenderInfo {
LWE::WebContainer::RenderInfo result;
{
tbmSurface_ =
tbm_surface_create(width_, height_, TBM_FORMAT_ARGB8888);
tbm_surface_info_s tbmSurfaceInfo;
if (tbm_surface_map(tbmSurface_, TBM_SURF_OPTION_WRITE,
&tbmSurfaceInfo) == TBM_SURFACE_ERROR_NONE) {
result.updatedBufferAddress = tbmSurfaceInfo.planes[0].ptr;
result.bufferStride = tbmSurfaceInfo.planes[0].stride;
}
tbmSurface_ = tbm_surface_create(width_, height_, TBM_FORMAT_ARGB8888);
tbm_surface_info_s tbmSurfaceInfo;
if (tbm_surface_map(tbmSurface_, TBM_SURF_OPTION_WRITE,
&tbmSurfaceInfo) == TBM_SURFACE_ERROR_NONE) {
result.updatedBufferAddress = (void*)tbmSurface_;
result.bufferStride = 0;
}
return result;
});

webViewInstance_->RegisterOnRenderedHandler(
[this](LWE::WebContainer* c, LWE::WebContainer::RenderResult r) {
FlutterMarkExternalTextureFrameAvailable(textureRegistrar_,
Expand Down