@@ -54,6 +54,7 @@ WebView::WebView(flutter::PluginRegistrar* registrar, int viewId,
54
54
FlutterTextureRegistrar* textureRegistrar, double width,
55
55
double height, const std::string initialUrl)
56
56
: PlatformView(registrar, viewId),
57
+ tbmSurface_(nullptr ),
57
58
textureRegistrar_(textureRegistrar),
58
59
webViewInstance_(nullptr ),
59
60
currentUrl_(initialUrl),
@@ -81,6 +82,8 @@ std::string WebView::GetChannelName() {
81
82
void WebView::Dispose () {
82
83
FlutterUnregisterExternalTexture (textureRegistrar_, GetTextureId ());
83
84
85
+ // Should move to starfish
86
+ // glDeleteFramebuffers(1, &fbo_id_);
84
87
webViewInstance_->Destroy ();
85
88
webViewInstance_ = nullptr ;
86
89
}
@@ -436,27 +439,49 @@ void WebView::InitWebView() {
436
439
webViewInstance_ = nullptr ;
437
440
}
438
441
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" );
441
444
webViewInstance_->RegisterPreRenderingHandler (
442
445
[this ]() -> LWE::WebContainer::RenderInfo {
443
446
LWE::WebContainer::RenderInfo result;
444
447
{
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);
447
452
tbm_surface_info_s tbmSurfaceInfo;
448
453
if (tbm_surface_map (tbmSurface_, TBM_SURF_OPTION_WRITE,
449
454
&tbmSurfaceInfo) == TBM_SURFACE_ERROR_NONE) {
450
455
result.updatedBufferAddress = tbmSurfaceInfo.planes [0 ].ptr ;
451
456
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);
452
469
}
453
470
}
454
471
return result;
455
472
});
473
+
456
474
webViewInstance_->RegisterOnRenderedHandler (
457
475
[this ](LWE::WebContainer* c, LWE::WebContainer::RenderResult r) {
476
+ // Should move to starfish
477
+ // glFlush();
478
+
458
479
FlutterMarkExternalTextureFrameAvailable (textureRegistrar_,
459
480
GetTextureId (), tbmSurface_);
481
+ // Should move to starfish
482
+ // g_eglDestroyImageKHRProc(egl_display_, eglImage_);
483
+ // eglImage_ = nullptr;
484
+ // glDeleteTextures(1, &textureID_);
460
485
tbm_surface_destroy (tbmSurface_);
461
486
tbmSurface_ = nullptr ;
462
487
});
0 commit comments