Skip to content

Commit 6a94b6e

Browse files
committed
[webview_flutter_dev] Enable gl compositor at LWE
Signed-off-by: MuHong Byun <mh.byun@samsung.com>
1 parent 79195da commit 6a94b6e

File tree

4 files changed

+33
-4
lines changed

4 files changed

+33
-4
lines changed

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

Lines changed: 4 additions & 0 deletions
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 {
Binary file not shown.
128 KB
Binary file not shown.

packages/webview_flutter/tizen/src/webview.cc

Lines changed: 29 additions & 4 deletions
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),
@@ -81,6 +82,8 @@ std::string WebView::GetChannelName() {
8182
void WebView::Dispose() {
8283
FlutterUnregisterExternalTexture(textureRegistrar_, GetTextureId());
8384

85+
// Should move to starfish
86+
// glDeleteFramebuffers(1, &fbo_id_);
8487
webViewInstance_->Destroy();
8588
webViewInstance_ = nullptr;
8689
}
@@ -436,27 +439,49 @@ void WebView::InitWebView() {
436439
webViewInstance_ = nullptr;
437440
}
438441
float scaleFactor = 1;
439-
webViewInstance_ = LWE::WebContainer::Create(
440-
width_, height_, scaleFactor, "SamsungOneUI", "ko-KR", "Asia/Seoul");
442+
443+
webViewInstance_ = (LWE::WebContainer*)LWE::WebView::Create(nullptr,0,0,width_, height_,scaleFactor, "SamsungOneUI", "ko-KR", "Asia/Seoul");
441444
webViewInstance_->RegisterPreRenderingHandler(
442445
[this]() -> LWE::WebContainer::RenderInfo {
443446
LWE::WebContainer::RenderInfo result;
444447
{
445-
tbmSurface_ =
446-
tbm_surface_create(width_, height_, TBM_FORMAT_ARGB8888);
448+
// Should move to starfish
449+
// glBindFramebuffer(GL_FRAMEBUFFER, fbo_id_);
450+
451+
tbmSurface_ = tbm_surface_create(width_, height_, TBM_FORMAT_ARGB8888);
447452
tbm_surface_info_s tbmSurfaceInfo;
448453
if (tbm_surface_map(tbmSurface_, TBM_SURF_OPTION_WRITE,
449454
&tbmSurfaceInfo) == TBM_SURFACE_ERROR_NONE) {
450455
result.updatedBufferAddress = tbmSurfaceInfo.planes[0].ptr;
451456
result.bufferStride = tbmSurfaceInfo.planes[0].stride;
457+
458+
// Should move to starfish
459+
460+
// EGLint attribs[] = {EGL_IMAGE_PRESERVED_KHR, EGL_TRUE, EGL_NONE};
461+
// eglImage_ = g_eglCreateImageKHRProc(
462+
// egl_display_, EGL_NO_CONTEXT, EGL_NATIVE_SURFACE_TIZEN,
463+
// (void*)(intptr_t)tbmSurface_, attribs);
464+
// glGenTextures(1, &textureID_);
465+
// glBindTexture(GL_TEXTURE_2D, textureID_);
466+
// g_glEGLImageTargetTexture2DOESProc(GL_TEXTURE_2D, eglImage_);
467+
// glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
468+
// GL_TEXTURE_2D, textureID_, 0);
452469
}
453470
}
454471
return result;
455472
});
473+
456474
webViewInstance_->RegisterOnRenderedHandler(
457475
[this](LWE::WebContainer* c, LWE::WebContainer::RenderResult r) {
476+
// Should move to starfish
477+
// glFlush();
478+
458479
FlutterMarkExternalTextureFrameAvailable(textureRegistrar_,
459480
GetTextureId(), tbmSurface_);
481+
// Should move to starfish
482+
// g_eglDestroyImageKHRProc(egl_display_, eglImage_);
483+
// eglImage_ = nullptr;
484+
// glDeleteTextures(1, &textureID_);
460485
tbm_surface_destroy(tbmSurface_);
461486
tbmSurface_ = nullptr;
462487
});

0 commit comments

Comments
 (0)