Skip to content

Commit

Permalink
TizenRenderer: Remove renderer type getter (#17)
Browse files Browse the repository at this point in the history
The embedder does not require a type getter of renderer because -rtti option is enabled.
So, remove getter method.
  • Loading branch information
JSUYA authored Jan 5, 2023
1 parent 8cf66d2 commit 5a343b3
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 29 deletions.
2 changes: 1 addition & 1 deletion flutter/shell/platform/tizen/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ template("embedder") {
defines += invoker.defines
defines += [ "FLUTTER_ENGINE_NO_PROTOTYPES" ]

if (api_version == "6.5") {
if (api_version == "6.5" && target_name != "flutter_tizen_wearable") {
sources += [
"flutter_tizen_nui.cc",
"tizen_view_nui.cc",
Expand Down
10 changes: 4 additions & 6 deletions flutter/shell/platform/tizen/flutter_tizen.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "flutter/shell/platform/tizen/public/flutter_platform_view.h"
#include "flutter/shell/platform/tizen/tizen_view.h"
#ifdef NUI_SUPPORT
#include "flutter/shell/platform/tizen/tizen_renderer_egl.h"
#include "flutter/shell/platform/tizen/tizen_view_nui.h"
#endif
#include "flutter/shell/platform/tizen/tizen_window.h"
Expand Down Expand Up @@ -280,13 +281,10 @@ void FlutterDesktopViewOnKeyEvent(FlutterDesktopViewRef view,
size_t timestamp,
bool is_down) {
#ifdef NUI_SUPPORT
if (auto* tizen_view = dynamic_cast<flutter::TizenViewNui*>(
if (auto* nui_view = dynamic_cast<flutter::TizenViewNui*>(
ViewFromHandle(view)->tizen_view())) {
if (ViewFromHandle(view)->engine()->renderer()->type() ==
FlutterDesktopRendererType::kEGL) {
tizen_view->OnKey(device_name, device_class, device_subclass, key, string,
nullptr, modifiers, scan_code, timestamp, is_down);
}
nui_view->OnKey(device_name, device_class, device_subclass, key, string,
nullptr, modifiers, scan_code, timestamp, is_down);
}
#else
ViewFromHandle(view)->OnKey(key, string, nullptr, modifiers, scan_code,
Expand Down
4 changes: 2 additions & 2 deletions flutter/shell/platform/tizen/flutter_tizen_engine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ bool FlutterTizenEngine::RunEngine() {

FlutterTaskRunnerDescription render_task_runner = {};

if (IsHeaded() && renderer_->type() == FlutterDesktopRendererType::kEvasGL) {
if (IsHeaded() && dynamic_cast<TizenRendererEvasGL*>(renderer_.get())) {
render_task_runner.struct_size = sizeof(FlutterTaskRunnerDescription);
render_task_runner.user_data = render_loop_.get();
render_task_runner.runs_task_on_current_thread_callback =
Expand Down Expand Up @@ -209,7 +209,7 @@ bool FlutterTizenEngine::RunEngine() {
args.update_semantics_node_callback = OnUpdateSemanticsNode;
args.update_semantics_custom_action_callback = OnUpdateSemanticsCustomActions;

if (IsHeaded() && renderer_->type() == FlutterDesktopRendererType::kEGL) {
if (IsHeaded() && dynamic_cast<TizenRendererEgl*>(renderer_.get())) {
vsync_waiter_ = std::make_unique<TizenVsyncWaiter>(this);
args.vsync_callback = [](void* user_data, intptr_t baton) -> void {
auto* engine = reinterpret_cast<FlutterTizenEngine*>(user_data);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "flutter/shell/platform/tizen/external_texture_surface_evas_gl.h"
#include "flutter/shell/platform/tizen/flutter_tizen_engine.h"
#include "flutter/shell/platform/tizen/logger.h"
#include "flutter/shell/platform/tizen/tizen_renderer_evas_gl.h"

namespace flutter {

Expand Down Expand Up @@ -44,8 +45,8 @@ int64_t FlutterTizenTextureRegistrar::RegisterTexture(
}
}
FlutterDesktopRendererType renderer_type = FlutterDesktopRendererType::kEGL;
if (engine_->renderer()) {
renderer_type = engine_->renderer()->type();
if (dynamic_cast<TizenRendererEvasGL*>(engine_->renderer())) {
renderer_type = FlutterDesktopRendererType::kEvasGL;
}
std::unique_ptr<ExternalTexture> texture_gl =
CreateExternalTexture(texture_info, renderer_type);
Expand Down
15 changes: 9 additions & 6 deletions flutter/shell/platform/tizen/flutter_tizen_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
#ifdef NUI_SUPPORT
#include "flutter/shell/platform/tizen/tizen_view_nui.h"
#endif
#ifndef WEARABLE_PROFILE
#include "flutter/shell/platform/tizen/tizen_renderer_egl.h"
#endif
#include "flutter/shell/platform/tizen/tizen_window.h"

namespace {
Expand Down Expand Up @@ -131,10 +134,9 @@ bool FlutterTizenView::OnMakeResourceCurrent() {
bool FlutterTizenView::OnPresent() {
bool result = engine_->renderer()->OnPresent();
#ifdef NUI_SUPPORT
if (auto* view = dynamic_cast<TizenViewNui*>(tizen_view_.get())) {
if (engine_->renderer()->type() == FlutterDesktopRendererType::kEGL) {
view->RequestRendering();
}
if (auto* nui_view =
dynamic_cast<flutter::TizenViewNui*>(tizen_view_.get())) {
nui_view->RequestRendering();
}
#endif
return result;
Expand Down Expand Up @@ -165,8 +167,8 @@ void FlutterTizenView::OnRotate(int32_t degree) {
TizenGeometry geometry = tizen_view_->GetGeometry();
int32_t width = geometry.width;
int32_t height = geometry.height;

if (engine_->renderer()->type() == FlutterDesktopRendererType::kEGL) {
#ifndef WEARABLE_PROFILE
if (dynamic_cast<TizenRendererEgl*>(engine_->renderer())) {
rotation_degree_ = degree;
// Compute renderer transformation based on the angle of rotation.
double rad = (360 - rotation_degree_) * M_PI / 180;
Expand All @@ -190,6 +192,7 @@ void FlutterTizenView::OnRotate(int32_t degree) {
std::swap(width, height);
}
}
#endif

engine_->renderer()->ResizeSurface(width, height);

Expand Down
6 changes: 0 additions & 6 deletions flutter/shell/platform/tizen/tizen_renderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@

#include <cstdint>

#include "flutter/shell/platform/tizen/public/flutter_tizen.h"

namespace flutter {

class TizenRenderer {
Expand All @@ -26,8 +24,6 @@ class TizenRenderer {

bool IsValid() { return is_valid_; }

FlutterDesktopRendererType type() { return type_; }

virtual bool OnMakeCurrent() = 0;

virtual bool OnClearCurrent() = 0;
Expand All @@ -46,8 +42,6 @@ class TizenRenderer {

protected:
bool is_valid_ = false;

FlutterDesktopRendererType type_;
};

} // namespace flutter
Expand Down
4 changes: 1 addition & 3 deletions flutter/shell/platform/tizen/tizen_renderer_egl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@

namespace flutter {

TizenRendererEgl::TizenRendererEgl() {
type_ = FlutterDesktopRendererType::kEGL;
}
TizenRendererEgl::TizenRendererEgl() {}

TizenRendererEgl::~TizenRendererEgl() {
DestroySurface();
Expand Down
4 changes: 1 addition & 3 deletions flutter/shell/platform/tizen/tizen_renderer_evas_gl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ EVAS_GL_GLOBAL_GLES2_DEFINE();

namespace flutter {

TizenRendererEvasGL::TizenRendererEvasGL() {
type_ = FlutterDesktopRendererType::kEvasGL;
}
TizenRendererEvasGL::TizenRendererEvasGL() {}

TizenRendererEvasGL::~TizenRendererEvasGL() {
DestroySurface();
Expand Down

0 comments on commit 5a343b3

Please sign in to comment.