|
5 | 5 |
|
6 | 6 | #include "flutter_tizen_engine.h" |
7 | 7 |
|
8 | | -#include <system_info.h> |
9 | | - |
10 | 8 | #include <filesystem> |
11 | 9 | #include <string> |
12 | 10 | #include <vector> |
13 | 11 |
|
14 | 12 | #include "flutter/shell/platform/tizen/tizen_log.h" |
15 | 13 |
|
| 14 | +namespace flutter { |
| 15 | + |
| 16 | +namespace { |
| 17 | + |
16 | 18 | // Unique number associated with platform tasks. |
17 | | -static constexpr size_t kPlatformTaskRunnerIdentifier = 1; |
| 19 | +constexpr size_t kPlatformTaskRunnerIdentifier = 1; |
18 | 20 | #ifdef TIZEN_RENDERER_EVAS_GL |
19 | | -static constexpr size_t kRenderTaskRunnerIdentifier = 2; |
| 21 | +constexpr size_t kRenderTaskRunnerIdentifier = 2; |
20 | 22 | #endif |
21 | 23 |
|
22 | | -namespace flutter { |
| 24 | +#if defined(MOBILE_PROFILE) |
| 25 | +constexpr double kProfileFactor = 0.7; |
| 26 | +#elif defined(WEARABLE_PROFILE) |
| 27 | +constexpr double kProfileFactor = 0.4; |
| 28 | +#elif defined(TV_PROFILE) |
| 29 | +constexpr double kProfileFactor = 2.0; |
| 30 | +#else |
| 31 | +constexpr double kProfileFactor = 1.0; |
| 32 | +#endif |
23 | 33 |
|
24 | | -static DeviceProfile GetDeviceProfile() { |
25 | | - char* feature_profile; |
26 | | - system_info_get_platform_string("http://tizen.org/feature/profile", |
27 | | - &feature_profile); |
28 | | - std::string profile(feature_profile); |
29 | | - free(feature_profile); |
30 | | - |
31 | | - if (profile == "mobile") { |
32 | | - return DeviceProfile::kMobile; |
33 | | - } else if (profile == "wearable") { |
34 | | - return DeviceProfile::kWearable; |
35 | | - } else if (profile == "tv") { |
36 | | - return DeviceProfile::kTV; |
37 | | - } else if (profile == "common") { |
38 | | - return DeviceProfile::kCommon; |
39 | | - } |
40 | | - return DeviceProfile::kUnknown; |
41 | | -} |
| 34 | +} // namespace |
42 | 35 |
|
43 | | -FlutterTizenEngine::FlutterTizenEngine(bool headed) |
44 | | - : device_profile(GetDeviceProfile()) { |
| 36 | +FlutterTizenEngine::FlutterTizenEngine(bool headed) { |
45 | 37 | embedder_api_.struct_size = sizeof(FlutterEngineProcTable); |
46 | 38 | FlutterEngineGetProcAddresses(&embedder_api_); |
47 | 39 |
|
@@ -342,19 +334,12 @@ void FlutterTizenEngine::SendWindowMetrics(int32_t width, |
342 | 334 | // The scale factor is computed based on the display DPI and the current |
343 | 335 | // profile. A fixed DPI value (72) is used on TVs. See: |
344 | 336 | // https://docs.tizen.org/application/native/guides/ui/efl/multiple-screens |
| 337 | +#ifdef TV_PROFILE |
345 | 338 | double dpi = 72.0; |
346 | | - if (renderer && device_profile != DeviceProfile::kTV) { |
347 | | - dpi = static_cast<double>(renderer->GetDpi()); |
348 | | - } |
349 | | - double profile_factor = 1.0; |
350 | | - if (device_profile == DeviceProfile::kWearable) { |
351 | | - profile_factor = 0.4; |
352 | | - } else if (device_profile == DeviceProfile::kMobile) { |
353 | | - profile_factor = 0.7; |
354 | | - } else if (device_profile == DeviceProfile::kTV) { |
355 | | - profile_factor = 2.0; |
356 | | - } |
357 | | - double scale_factor = dpi / 90.0 * profile_factor; |
| 339 | +#else |
| 340 | + double dpi = static_cast<double>(renderer->GetDpi()); |
| 341 | +#endif |
| 342 | + double scale_factor = dpi / 90.0 * kProfileFactor; |
358 | 343 | event.pixel_ratio = std::max(scale_factor, 1.0); |
359 | 344 | } else { |
360 | 345 | event.pixel_ratio = pixel_ratio; |
|
0 commit comments