0

[Text Contrast] Reorganize skia/BUILD.gn to set contrast/gamma properly

In https://chromium-review.googlesource.com/c/chromium/src/+/6150028,
I discovered that SK_GAMMA_EXPONENT and SK_GAMMA_CONTRAST aren't
being picked up for consumers of Skia.

This change fixes that issue by moving them to skia_config.

I attempted Dirk's suggestion to add skia_config to
skia_core_public_headers, but it causes quite a few build breaks
(see Patchset 4).

Bug: 40037626
Change-Id: I83f21884f7409815e2c7dd21cdb0ab5a4c4151b6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6173556
Reviewed-by: Florin Malita <fmalita@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@google.com>
Reviewed-by: Dominik Röttsches <drott@chromium.org>
Commit-Queue: Kurt Catti-Schmidt <kschmi@microsoft.com>
Cr-Commit-Position: refs/heads/main@{#1407053}
This commit is contained in:
Kurt Catti-Schmidt
2025-01-15 17:15:28 -08:00
committed by Chromium LUCI CQ
parent a29f5962f8
commit b2a8dbe485

@ -100,25 +100,38 @@ config("skia_config") {
}
}
if (is_android) {
# `SK_GAMMA_EXPONENT` and `SK_GAMMA_CONTRAST` are settings for text
# blitting, chosen to approximate the system browser.
if (is_linux || is_chromeos) {
defines += [
"SK_GAMMA_EXPONENT=1.2",
"SK_GAMMA_CONTRAST=0.2",
]
} else if (is_android) {
defines += [
"SK_BUILD_FOR_ANDROID",
"USE_CHROMIUM_SKIA",
"SK_GAMMA_APPLY_TO_A8",
"SK_GAMMA_EXPONENT=1.4",
"SK_GAMMA_CONTRAST=0.0",
]
}
if (is_mac) {
defines += [ "SK_BUILD_FOR_MAC" ]
}
if (is_ios) {
} else if (is_mac) {
defines += [
"SK_BUILD_FOR_MAC",
"SK_GAMMA_SRGB",
"SK_GAMMA_CONTRAST=0.0",
]
} else if (is_ios) {
defines += [ "SK_BUILD_FOR_IOS" ]
if (ios_is_app_extension) {
defines += [ "SK_BUILD_FOR_IOS_APP_EXTENSION" ]
}
}
if (is_win) {
defines += [ "GR_GL_FUNCTION_TYPE=__stdcall" ]
} else if (is_win) {
defines += [
"GR_GL_FUNCTION_TYPE=__stdcall",
"SK_GAMMA_SRGB",
"SK_GAMMA_CONTRAST=0.5",
]
}
if (skia_support_gpu) {
@ -188,30 +201,6 @@ config("skia_library_config") {
}
}
# Settings for text blitting, chosen to approximate the system browser.
if (is_linux || is_chromeos) {
defines += [
"SK_GAMMA_EXPONENT=1.2",
"SK_GAMMA_CONTRAST=0.2",
]
} else if (is_android) {
defines += [
"SK_GAMMA_APPLY_TO_A8",
"SK_GAMMA_EXPONENT=1.4",
"SK_GAMMA_CONTRAST=0.0",
]
} else if (is_win) {
defines += [
"SK_GAMMA_SRGB",
"SK_GAMMA_CONTRAST=0.5",
]
} else if (is_mac) {
defines += [
"SK_GAMMA_SRGB",
"SK_GAMMA_CONTRAST=0.0",
]
}
if (is_android) {
defines += [
# Android devices are typically more memory constrained, so default to a