Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 10f1bac

Browse files
author
Jonah Williams
authored
Add configuration to support compiling engine with SUPPORT_FRACTIONAL_TRANSLATION (#33393)
1 parent 3ca2b35 commit 10f1bac

File tree

4 files changed

+23
-9
lines changed

4 files changed

+23
-9
lines changed

common/config.gni

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ declare_args() {
2222

2323
# Whether to use a prebuilt Dart SDK instead of building one.
2424
flutter_prebuilt_dart_sdk = false
25+
26+
# Whether layers can be drawn at half pixel boundaries.
27+
support_fractional_translation = false
2528
}
2629

2730
# feature_defines_list ---------------------------------------------------------
@@ -56,6 +59,10 @@ if (flutter_runtime_mode == "debug") {
5659
feature_defines_list += [ "FLUTTER_RUNTIME_MODE=0" ]
5760
}
5861

62+
if (support_fractional_translation) {
63+
feature_defines_list += [ "SUPPORT_FRACTIONAL_TRANSLATION=1" ]
64+
}
65+
5966
if (is_ios || is_mac) {
6067
flutter_cflags_objc = [
6168
"-Werror=overriding-method-mismatch",

shell/testing/BUILD.gn

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,7 @@ executable("testing_fractional_translation") {
5858
]
5959
}
6060

61-
defines = [
62-
"SUPPORT_FRACTIONAL_TRANSLATION=1",
63-
"DISABLE_SOFTWARE_RASTER_CACHE=1",
64-
]
61+
defines = []
6562

6663
deps = [
6764
"//flutter/assets",

shell/testing/tester_main.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,10 @@ class TesterGPUSurfaceSoftware : public GPUSurfaceSoftware {
6868
bool render_to_surface)
6969
: GPUSurfaceSoftware(delegate, render_to_surface) {}
7070

71-
#if DISABLE_SOFTWARE_RASTER_CACHE
71+
#if SUPPORT_FRACTIONAL_TRANSLATION
7272
// |Surface|
7373
bool EnableRasterCache() const override { return false; }
74-
#endif // DISABLE_SOFTWARE_RASTER_CACHE
74+
#endif // SUPPORT_FRACTIONAL_TRANSLATION
7575
};
7676

7777
class TesterPlatformView : public PlatformView,

tools/gn

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ def get_out_dir(args):
5555
if args.target_os == 'fuchsia' and args.fuchsia_cpu is not None:
5656
target_dir.append(args.fuchsia_cpu)
5757

58+
if args.support_fractional_translation:
59+
target_dir.append('fractional')
60+
5861
# This exists for backwards compatibility of tests that are being run
5962
# on LUCI. This can be removed in coordination with a LUCI change:
6063
# https://github.com/flutter/flutter/issues/76547
@@ -312,10 +315,10 @@ def to_gn_args(args):
312315
if runtime_mode == 'debug':
313316
gn_args['dart_runtime_mode'] = 'develop'
314317
elif runtime_mode == 'jit_release':
315-
gn_args['dart_runtime_mode'] = 'release';
318+
gn_args['dart_runtime_mode'] = 'release'
316319
else:
317320
gn_args['dart_runtime_mode'] = runtime_mode
318-
321+
319322
# Desktop embeddings can have more dependencies than the engine library,
320323
# which can be problematic in some build environments (e.g., building on
321324
# Linux will bring in pkg-config dependencies at generation time). These
@@ -330,6 +333,9 @@ def to_gn_args(args):
330333
if args.allow_deprecated_api_calls:
331334
gn_args['allow_deprecated_api_calls'] = args.allow_deprecated_api_calls
332335

336+
if args.support_fractional_translation:
337+
gn_args['support_fractional_translation'] = args.support_fractional_translation
338+
333339
# DBC is not supported anymore.
334340
if args.interpreter:
335341
raise Exception('--interpreter is no longer needed on any supported platform.')
@@ -440,7 +446,7 @@ def to_gn_args(args):
440446
# dart_platform_sdk=True means exclude web-related files, e.g. dart2js,
441447
# dartdevc, web SDK kernel and source files.
442448
gn_args['dart_platform_sdk'] = not args.full_dart_sdk
443-
449+
444450
if args.build_glfw_shell is not None:
445451
gn_args['build_glfw_shell'] = args.build_glfw_shell
446452

@@ -613,6 +619,10 @@ def parse_args(args):
613619

614620
parser.add_argument('--fuchsia-target-api-level', dest='fuchsia_target_api_level')
615621

622+
parser.add_argument('--support-fractional-translation', dest='support_fractional_translation', default=False,
623+
action='store_true', help='Whether to allow layers to render at fraction pixel '
624+
'boundaries.')
625+
616626
# Flags for Dart features.
617627
parser.add_argument('--use-mallinfo2', dest='use_mallinfo2', default=False, action='store_true',
618628
help='Use mallinfo2 to collect malloc stats.')

0 commit comments

Comments
 (0)