Skip to content

Commit

Permalink
[webview_flutter_dev] Enable gl compositor at LWE (flutter-tizen#14)
Browse files Browse the repository at this point in the history
Signed-off-by: MuHong Byun <mh.byun@samsung.com>
  • Loading branch information
bwikbs committed Jan 27, 2021
1 parent e988cf0 commit 3413964
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 15 deletions.
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

0 comments on commit 3413964

Please sign in to comment.