Skip to content

Commit ed3d47e

Browse files
authored
Support TizenRendererEvasGL rotate (#343)
TizenRendererEvasGL does not rotate the flutter. elm_win using EvasGL Renderer gives width and height with rotation applied. The flutter just needs to resize to fit the changed width and height.
1 parent 16c67da commit ed3d47e

File tree

2 files changed

+21
-21
lines changed

2 files changed

+21
-21
lines changed

shell/platform/tizen/flutter_tizen_view.cc

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -167,31 +167,33 @@ void FlutterTizenView::OnResize(int32_t left,
167167
}
168168

169169
void FlutterTizenView::OnRotate(int32_t degree) {
170-
rotation_degree_ = degree;
171-
// Compute renderer transformation based on the angle of rotation.
172-
double rad = (360 - rotation_degree_) * M_PI / 180;
173170
TizenGeometry geometry = tizen_view_->GetGeometry();
174171
int32_t width = geometry.width;
175172
int32_t height = geometry.height;
176173

177-
double trans_x = 0.0, trans_y = 0.0;
178-
if (rotation_degree_ == 90) {
179-
trans_y = height;
180-
} else if (rotation_degree_ == 180) {
181-
trans_x = width;
182-
trans_y = height;
183-
} else if (rotation_degree_ == 270) {
184-
trans_x = width;
185-
}
174+
if (engine_->renderer()->type() == FlutterDesktopRendererType::kEGL) {
175+
rotation_degree_ = degree;
176+
// Compute renderer transformation based on the angle of rotation.
177+
double rad = (360 - rotation_degree_) * M_PI / 180;
178+
double trans_x = 0.0, trans_y = 0.0;
179+
if (rotation_degree_ == 90) {
180+
trans_y = height;
181+
} else if (rotation_degree_ == 180) {
182+
trans_x = width;
183+
trans_y = height;
184+
} else if (rotation_degree_ == 270) {
185+
trans_x = width;
186+
}
186187

187-
flutter_transformation_ = {
188-
cos(rad), -sin(rad), trans_x, // x
189-
sin(rad), cos(rad), trans_y, // y
190-
0.0, 0.0, 1.0 // perspective
191-
};
188+
flutter_transformation_ = {
189+
cos(rad), -sin(rad), trans_x, // x
190+
sin(rad), cos(rad), trans_y, // y
191+
0.0, 0.0, 1.0 // perspective
192+
};
192193

193-
if (rotation_degree_ == 90 || rotation_degree_ == 270) {
194-
std::swap(width, height);
194+
if (rotation_degree_ == 90 || rotation_degree_ == 270) {
195+
std::swap(width, height);
196+
}
195197
}
196198

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

shell/platform/tizen/tizen_window_elementary.cc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,6 @@ void TizenWindowElementary::RegisterEventHandlers() {
140140
auto* self = reinterpret_cast<TizenWindowElementary*>(data);
141141
if (self->view_delegate_) {
142142
if (self->elm_win_ == object) {
143-
// FIXME
144-
FT_UNIMPLEMENTED();
145143
self->view_delegate_->OnRotate(self->GetRotation());
146144
elm_win_wm_rotation_manual_rotation_done(self->elm_win_);
147145
}

0 commit comments

Comments
 (0)