Skip to content

Commit

Permalink
Add configuration to support compiling engine with SUPPORT_FRACTIONAL…
Browse files Browse the repository at this point in the history
…_TRANSLATION (flutter#33393)
  • Loading branch information
jonahwilliams committed May 16, 2022
1 parent 3ca2b35 commit 10f1bac
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 9 deletions.
7 changes: 7 additions & 0 deletions common/config.gni
Expand Up @@ -22,6 +22,9 @@ declare_args() {

# Whether to use a prebuilt Dart SDK instead of building one.
flutter_prebuilt_dart_sdk = false

# Whether layers can be drawn at half pixel boundaries.
support_fractional_translation = false
}

# feature_defines_list ---------------------------------------------------------
Expand Down Expand Up @@ -56,6 +59,10 @@ if (flutter_runtime_mode == "debug") {
feature_defines_list += [ "FLUTTER_RUNTIME_MODE=0" ]
}

if (support_fractional_translation) {
feature_defines_list += [ "SUPPORT_FRACTIONAL_TRANSLATION=1" ]
}

if (is_ios || is_mac) {
flutter_cflags_objc = [
"-Werror=overriding-method-mismatch",
Expand Down
5 changes: 1 addition & 4 deletions shell/testing/BUILD.gn
Expand Up @@ -58,10 +58,7 @@ executable("testing_fractional_translation") {
]
}

defines = [
"SUPPORT_FRACTIONAL_TRANSLATION=1",
"DISABLE_SOFTWARE_RASTER_CACHE=1",
]
defines = []

deps = [
"//flutter/assets",
Expand Down
4 changes: 2 additions & 2 deletions shell/testing/tester_main.cc
Expand Up @@ -68,10 +68,10 @@ class TesterGPUSurfaceSoftware : public GPUSurfaceSoftware {
bool render_to_surface)
: GPUSurfaceSoftware(delegate, render_to_surface) {}

#if DISABLE_SOFTWARE_RASTER_CACHE
#if SUPPORT_FRACTIONAL_TRANSLATION
// |Surface|
bool EnableRasterCache() const override { return false; }
#endif // DISABLE_SOFTWARE_RASTER_CACHE
#endif // SUPPORT_FRACTIONAL_TRANSLATION
};

class TesterPlatformView : public PlatformView,
Expand Down
16 changes: 13 additions & 3 deletions tools/gn
Expand Up @@ -55,6 +55,9 @@ def get_out_dir(args):
if args.target_os == 'fuchsia' and args.fuchsia_cpu is not None:
target_dir.append(args.fuchsia_cpu)

if args.support_fractional_translation:
target_dir.append('fractional')

# This exists for backwards compatibility of tests that are being run
# on LUCI. This can be removed in coordination with a LUCI change:
# https://github.com/flutter/flutter/issues/76547
Expand Down Expand Up @@ -312,10 +315,10 @@ def to_gn_args(args):
if runtime_mode == 'debug':
gn_args['dart_runtime_mode'] = 'develop'
elif runtime_mode == 'jit_release':
gn_args['dart_runtime_mode'] = 'release';
gn_args['dart_runtime_mode'] = 'release'
else:
gn_args['dart_runtime_mode'] = runtime_mode

# Desktop embeddings can have more dependencies than the engine library,
# which can be problematic in some build environments (e.g., building on
# Linux will bring in pkg-config dependencies at generation time). These
Expand All @@ -330,6 +333,9 @@ def to_gn_args(args):
if args.allow_deprecated_api_calls:
gn_args['allow_deprecated_api_calls'] = args.allow_deprecated_api_calls

if args.support_fractional_translation:
gn_args['support_fractional_translation'] = args.support_fractional_translation

# DBC is not supported anymore.
if args.interpreter:
raise Exception('--interpreter is no longer needed on any supported platform.')
Expand Down Expand Up @@ -440,7 +446,7 @@ def to_gn_args(args):
# dart_platform_sdk=True means exclude web-related files, e.g. dart2js,
# dartdevc, web SDK kernel and source files.
gn_args['dart_platform_sdk'] = not args.full_dart_sdk

if args.build_glfw_shell is not None:
gn_args['build_glfw_shell'] = args.build_glfw_shell

Expand Down Expand Up @@ -613,6 +619,10 @@ def parse_args(args):

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

parser.add_argument('--support-fractional-translation', dest='support_fractional_translation', default=False,
action='store_true', help='Whether to allow layers to render at fraction pixel '
'boundaries.')

# Flags for Dart features.
parser.add_argument('--use-mallinfo2', dest='use_mallinfo2', default=False, action='store_true',
help='Use mallinfo2 to collect malloc stats.')
Expand Down

0 comments on commit 10f1bac

Please sign in to comment.