From cb3f56f68f918fb8d26a0f8ba7d5a0dfe135436a Mon Sep 17 00:00:00 2001 From: John Stiles Date: Tue, 8 Jun 2021 17:20:28 -0400 Subject: [PATCH] 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 Reviewed-by: Brian Osman Commit-Queue: John Stiles --- src/core/SkRuntimeEffectPriv.h | 4 ++-- tools/skqp/src/skqp_model.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/core/SkRuntimeEffectPriv.h b/src/core/SkRuntimeEffectPriv.h index 07b6356023..a452436b3d 100644 --- a/src/core/SkRuntimeEffectPriv.h +++ b/src/core/SkRuntimeEffectPriv.h @@ -41,7 +41,7 @@ inline sk_sp 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);" diff --git a/tools/skqp/src/skqp_model.h b/tools/skqp/src/skqp_model.h index 0bdb2fa258..745ce63edf 100644 --- a/tools/skqp/src/skqp_model.h +++ b/tools/skqp/src/skqp_model.h @@ -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