Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bin/internal/engine.version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.0.0-06ddbce
3.0.0-1ca5867
9 changes: 9 additions & 0 deletions embedding/cpp/flutter_app.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ bool FlutterApp::OnCreate() {
TizenLog::Error("Could not create a Flutter engine.");
return false;
}
#ifdef WEARABLE_PROFILE
if (renderer_type_ == FlutterRendererType::kEGL) {
TizenLog::Error(
"FlutterRendererType::kEGL is not supported by this profile.");
return false;
}
#endif

FlutterDesktopWindowProperties window_prop = {};
window_prop.x = window_offset_x_;
Expand All @@ -25,6 +32,8 @@ bool FlutterApp::OnCreate() {
window_prop.transparent = is_window_transparent_;
window_prop.focusable = is_window_focusable_;
window_prop.top_level = is_top_level_;
window_prop.renderer_type =
static_cast<FlutterDesktopRendererType>(renderer_type_);

view_ = FlutterDesktopViewCreateFromNewWindow(window_prop,
engine_->RelinquishEngine());
Expand Down
18 changes: 17 additions & 1 deletion embedding/cpp/include/flutter_app.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,21 @@

#include "flutter_engine.h"

enum class FlutterRendererType {
// The renderer based on EvasGL.
kEvasGL,
// The renderer based on EGL.
kEGL,
};

// The app base class for headed Flutter execution.
class FlutterApp : public flutter::PluginRegistry {
public:
explicit FlutterApp() {}
explicit FlutterApp() {
#ifdef WEARABLE_PROFILE
renderer_type_ = FlutterRendererType::kEvasGL;
#endif
}
virtual ~FlutterApp() {}

virtual bool OnCreate();
Expand Down Expand Up @@ -81,6 +92,11 @@ class FlutterApp : public flutter::PluginRegistry {
// must be added to tizen-manifest.xml file.
bool is_top_level_ = false;

// The renderer type of the engine.
//
// Defaults to kEGL. If the profile is wearable, defaults to kEvasGL.
FlutterRendererType renderer_type_ = FlutterRendererType::kEGL;

private:
// The optional entrypoint in the Dart project.
//
Expand Down
37 changes: 37 additions & 0 deletions embedding/csharp/Tizen.Flutter.Embedding/FlutterApplication.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,36 @@

namespace Tizen.Flutter.Embedding
{
/// <summary>
/// Enumeration for the renderer type of the engine.
/// </summary>
public enum FlutterRendererType
{
/// <summary>
/// The renderer based on EvasGL.
/// </summary>
EvasGL = 0,
/// <summary>
/// The renderer based on EGL.
/// </summary>
EGL,
}

/// <summary>
/// The app base class for headed Flutter execution.
/// </summary>
public class FlutterApplication : CoreUIApplication, IPluginRegistry
{
/// <summary>
/// Initialize FlutterApplication.
/// </summary>
public FlutterApplication()
{
#if WEARABLE_PROFILE
RendererType = FlutterRendererType.EvasGL;
#endif
}

/// <summary>
/// The x-coordinate of the top left corner of the window.
/// </summary>
Expand Down Expand Up @@ -51,6 +76,11 @@ public class FlutterApplication : CoreUIApplication, IPluginRegistry
/// </summary>
protected bool IsTopLevel { get; set; } = false;

/// <summary>
/// The renderer type of the engine. Defaults to EGL. If the profile is wearable, defaults to EvasGL.
/// </summary>
protected FlutterRendererType RendererType { get; set; } = FlutterRendererType.EGL;

/// <summary>
/// The optional entrypoint in the Dart project. Defaults to main() if the value is empty.
/// </summary>
Expand Down Expand Up @@ -93,6 +123,12 @@ protected override void OnCreate()
throw new Exception("Could not create a Flutter engine.");
}

#if WEARABLE_PROFILE
if (RendererType == FlutterRendererType.EGL)
{
throw new Exception("FlutterRendererType.kEGL is not supported by this profile.");
}
#endif
var windowProperties = new FlutterDesktopWindowProperties
{
x = WindowOffsetX,
Expand All @@ -102,6 +138,7 @@ protected override void OnCreate()
transparent = IsWindowTransparent,
focusable = IsWindowFocusable,
top_level = IsTopLevel,
renderer_type = (FlutterDesktopRendererType)RendererType,
};

View = FlutterDesktopViewCreateFromNewWindow(ref windowProperties, Engine.Engine);
Expand Down
Empty file modified embedding/csharp/Tizen.Flutter.Embedding/FlutterEngine.cs
100755 → 100644
Empty file.
7 changes: 7 additions & 0 deletions embedding/csharp/Tizen.Flutter.Embedding/Interop/Interop.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ namespace Tizen.Flutter.Embedding
public static class Interop
{
#region flutter_tizen.h
public enum FlutterDesktopRendererType
{
kEvasGL,
kEGL,
};

[StructLayout(LayoutKind.Sequential)]
public struct FlutterDesktopWindowProperties
{
Expand All @@ -24,6 +30,7 @@ public struct FlutterDesktopWindowProperties
public bool focusable;
[MarshalAs(UnmanagedType.U1)]
public bool top_level;
public FlutterDesktopRendererType renderer_type;
}

[StructLayout(LayoutKind.Sequential)]
Expand Down
1 change: 1 addition & 0 deletions lib/build_targets/package.dart
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ class DotnetTpk extends TizenPackage {
if (buildMode.isPrecompiled) 'Release' else 'Debug',
'-o',
'${outputDir.path}/', // The trailing '/' is needed.
'/p:DefineConstants=${buildInfo.deviceProfile.toUpperCase()}_PROFILE',
tizenProject.editableDirectory.path,
]);
if (result.exitCode != 0) {
Expand Down
2 changes: 2 additions & 0 deletions test/general/build_targets/package_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ void main() {
'Release',
'-o',
'${outputDir.path}/tpk/',
'/p:DefineConstants=COMMON_PROFILE',
'${projectDir.path}/tizen',
],
onRun: () {
Expand Down Expand Up @@ -160,6 +161,7 @@ void main() {
'Debug',
'-o',
'${outputDir.path}/tpk/',
'/p:DefineConstants=COMMON_PROFILE',
'${projectDir.path}/tizen',
],
onRun: () {
Expand Down