Skip to content

Commit 3413964

Browse files
committed
[webview_flutter_dev] Enable gl compositor at LWE (#14)
Signed-off-by: MuHong Byun <[email protected]>
1 parent e988cf0 commit 3413964

File tree

4 files changed

+17
-15
lines changed

4 files changed

+17
-15
lines changed

packages/webview_flutter/tizen/inc/lwe/LWEWebView.h

+5-3
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ class LWE_EXPORT Settings {
6969
void GetBaseForegroundColor(unsigned char& r, unsigned char& g,
7070
unsigned char& b, unsigned char& a) const;
7171
bool NeedsDownloadWebFontsEarly() const;
72+
uint32_t NeedsDownScaleImageResourceLargerThan() const;
7273
void SetUserAgentString(const std::string& ua);
7374
void SetCacheMode(int mode);
7475
void SetProxyURL(const std::string& proxyURL);
@@ -82,6 +83,8 @@ class LWE_EXPORT Settings {
8283
void SetIdleModeJob(IdleModeJob j);
8384
void SetIdleModeCheckIntervalInMS(uint32_t intervalInMS);
8485
void SetNeedsDownloadWebFontsEarly(bool b);
86+
void SetNeedsDownScaleImageResourceLargerThan(
87+
uint32_t demention); // Experimental
8588

8689
private:
8790
std::string m_defaultUserAgent;
@@ -96,6 +99,7 @@ class LWE_EXPORT Settings {
9699
IdleModeJob m_idleModeJob; // default value is IdleModeJob::IdleModeFull
97100
uint32_t m_idleModeCheckIntervalInMS; // default value is 3000(ms)
98101
bool m_needsDownloadWebFontsEarly;
102+
uint32_t m_needsDownScaleImageResourceLargerThan;
99103
};
100104

101105
class LWE_EXPORT ResourceError {
@@ -353,14 +357,12 @@ class LWE_EXPORT WebView {
353357
virtual void Focus();
354358
virtual void Blur();
355359

360+
virtual WebContainer* FetchWebContainer() = 0;
356361
protected:
357362
WebView(void* impl)
358363
: m_impl(impl)
359364
{
360365
}
361-
362-
virtual WebContainer* FetchWebContainer() = 0;
363-
364366
void* m_impl;
365367
};
366368

Binary file not shown.
128 KB
Binary file not shown.

packages/webview_flutter/tizen/src/webview.cc

+12-12
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ WebView::WebView(flutter::PluginRegistrar* registrar, int viewId,
5454
FlutterTextureRegistrar* textureRegistrar, double width,
5555
double height, const std::string initialUrl)
5656
: PlatformView(registrar, viewId),
57+
tbmSurface_(nullptr),
5758
textureRegistrar_(textureRegistrar),
5859
webViewInstance_(nullptr),
5960
currentUrl_(initialUrl),
@@ -341,7 +342,7 @@ void WebView::DispatchKeyDownEvent(Ecore_Event_Key* keyEvent) {
341342
} else {
342343
webViewInstance_->AddIdleCallback(
343344
[](void* data) {
344-
LWE::WebContainer* self = (LWE::WebContainer*)data;
345+
// LWE::WebContainer* self = (LWE::WebContainer*)data;
345346
// self->HideSoftwareKeyboardIfPossible();
346347
},
347348
webViewInstance_);
@@ -436,23 +437,22 @@ void WebView::InitWebView() {
436437
webViewInstance_ = nullptr;
437438
}
438439
float scaleFactor = 1;
439-
webViewInstance_ = LWE::WebContainer::Create(
440-
width_, height_, scaleFactor, "SamsungOneUI", "ko-KR", "Asia/Seoul");
440+
441+
LWE::WebView* webview = LWE::WebView::Create(nullptr,0,0,width_, height_,scaleFactor, "SamsungOneUI", "ko-KR", "Asia/Seoul");
442+
webViewInstance_ = webview->FetchWebContainer();
441443
webViewInstance_->RegisterPreRenderingHandler(
442444
[this]() -> LWE::WebContainer::RenderInfo {
443445
LWE::WebContainer::RenderInfo result;
444-
{
445-
tbmSurface_ =
446-
tbm_surface_create(width_, height_, TBM_FORMAT_ARGB8888);
447-
tbm_surface_info_s tbmSurfaceInfo;
448-
if (tbm_surface_map(tbmSurface_, TBM_SURF_OPTION_WRITE,
449-
&tbmSurfaceInfo) == TBM_SURFACE_ERROR_NONE) {
450-
result.updatedBufferAddress = tbmSurfaceInfo.planes[0].ptr;
451-
result.bufferStride = tbmSurfaceInfo.planes[0].stride;
452-
}
446+
tbmSurface_ = tbm_surface_create(width_, height_, TBM_FORMAT_ARGB8888);
447+
tbm_surface_info_s tbmSurfaceInfo;
448+
if (tbm_surface_map(tbmSurface_, TBM_SURF_OPTION_WRITE,
449+
&tbmSurfaceInfo) == TBM_SURFACE_ERROR_NONE) {
450+
result.updatedBufferAddress = (void*)tbmSurface_;
451+
result.bufferStride = 0;
453452
}
454453
return result;
455454
});
455+
456456
webViewInstance_->RegisterOnRenderedHandler(
457457
[this](LWE::WebContainer* c, LWE::WebContainer::RenderResult r) {
458458
FlutterMarkExternalTextureFrameAvailable(textureRegistrar_,

0 commit comments

Comments
 (0)