Fix strings in header files.

`constexpr char` arrays in header files generate a separate object in
each translation unit; we should add `inline` to these.

http://go/totw/140#within-a-header-file-beware

Change-Id: I7e2dd8f81053577127e349e9dc4a691e432c2c05
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/416780
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
This commit is contained in:
John Stiles 2021-06-08 17:20:28 -04:00 committed by Skia Commit-Bot
parent d1b530a785
commit cb3f56f68f
2 changed files with 4 additions and 4 deletions

View File

@ -41,7 +41,7 @@ inline sk_sp<SkRuntimeEffect> SkMakeRuntimeEffect(SkRuntimeEffect::Result (*make
// This is mostly from skvm's rgb->hsl code, with some GPU-related finesse pulled from
// GrHighContrastFilterEffect.fp, see next comment.
constexpr char kRGB_to_HSL_sksl[] =
inline constexpr char kRGB_to_HSL_sksl[] =
"half3 rgb_to_hsl(half3 c) {"
"half mx = max(max(c.r,c.g),c.b),"
" mn = min(min(c.r,c.g),c.b),"
@ -64,7 +64,7 @@ constexpr char kRGB_to_HSL_sksl[] =
"}";
//This is straight out of GrHSLToRGBFilterEffect.fp.
constexpr char kHSL_to_RGB_sksl[] =
inline constexpr char kHSL_to_RGB_sksl[] =
"half3 hsl_to_rgb(half3 hsl) {"
"half C = (1 - abs(2 * hsl.z - 1)) * hsl.y;"
"half3 p = hsl.xxx + half3(0, 2/3.0, 1/3.0);"

View File

@ -26,8 +26,8 @@ constexpr SkColorType kColorType = kRGBA_8888_SkColorType;
constexpr SkAlphaType kAlphaType = kUnpremul_SkAlphaType;
/** Where to find the maximum and minimum of the model. */
constexpr char kMaxPngPath[] = "max.png";
constexpr char kMinPngPath[] = "min.png";
inline constexpr char kMaxPngPath[] = "max.png";
inline constexpr char kMinPngPath[] = "min.png";
struct ModelResult {
SkBitmap fErrors; // Correct pixels are white, failing pixels scale from black