From 67f51f29e29b8c9de93734deaaf760669477c4b2 Mon Sep 17 00:00:00 2001 From: Chris Peterson Date: Fri, 24 Sep 2021 19:14:46 +0000 Subject: [PATCH] Bug 1732481 - Fix non-unified build errors in gfx. r=gfx-reviewers,jrmuizel Building with ac_add_options --disable-unified-build on macOS hits the following warnings-as-errors: gfx/2d/FilterNodeSoftware.cpp:1022:10 [-Wunreachable-code-return] 'return' will never be executed gfx/2d/DrawTargetCairo.cpp:1957:20 [-Wunused-function] unused function 'GfxMatrixToPixmanTransform' gfx/thebes/gfxHarfBuzzShaper.cpp:1008:23: warning: unused variable 'sDageshForms' [-Wunused-const-variable] gfx/thebes/gfxMacPlatformFontList.mm:818:31 [-Wunused-const-variable] unused variable 'kLangFontsDirs' gfx/tests/gtest/TestSwizzle.cpp:221:21 [-Wunreachable-code] code will never be executed gfx/tests/gtest/TestTreeTraversal.cpp:16:11 [-Wunused-const-variable] unused variable 'PERFORMANCE_TREE_DEPTH' gfx/tests/gtest/TestTreeTraversal.cpp:17:11 [-Wunused-const-variable] unused variable 'PERFORMANCE_TREE_CHILD_COUNT' gfx/tests/gtest/TestTreeTraversal.cpp:18:11 [-Wunused-const-variable] unused variable 'PERFORMANCE_TREE_LEAF_COUNT' gfx/tests/gtest/TestTreeTraversal.cpp:19:11 [-Wunused-const-variable] unused variable 'PERFORMANCE_REGION_XWRAP' gfx/vr/VRDisplayPresentation.cpp:151:3 [-Wunreachable-code-loop-increment] loop will run at most once (loop increment never executed) gfx/ycbcr/scale_yuv_argb.cpp:61:21 [-Wunused-function] unused function 'Abs' Differential Revision: https://phabricator.services.mozilla.com/D126592 --- gfx/2d/DrawTargetCairo.cpp | 2 +- gfx/2d/FilterNodeSoftware.cpp | 3 +-- gfx/tests/gtest/TestSwizzle.cpp | 15 +++++++++---- gfx/tests/gtest/TestTreeTraversal.cpp | 5 ----- gfx/thebes/gfxHarfBuzzShaper.cpp | 32 --------------------------- gfx/thebes/gfxMacPlatformFontList.mm | 18 --------------- gfx/vr/VRDisplayPresentation.cpp | 5 +++-- gfx/ycbcr/scale_yuv_argb.cpp | 8 ++----- 8 files changed, 18 insertions(+), 70 deletions(-) diff --git a/gfx/2d/DrawTargetCairo.cpp b/gfx/2d/DrawTargetCairo.cpp index c64f9d200d373..8e42252275ebd 100644 --- a/gfx/2d/DrawTargetCairo.cpp +++ b/gfx/2d/DrawTargetCairo.cpp @@ -1954,6 +1954,7 @@ already_AddRefed DrawTargetCairo::CreateShadowDrawTarget( return nullptr; } +#ifdef CAIRO_HAS_XLIB_SURFACE static inline bool GfxMatrixToPixmanTransform(const Matrix4x4& aMatrix, pixman_transform* aResult) { pixman_f_transform fTransform = {{{aMatrix._11, aMatrix._21, aMatrix._41}, @@ -1962,7 +1963,6 @@ static inline bool GfxMatrixToPixmanTransform(const Matrix4x4& aMatrix, return pixman_transform_from_pixman_f_transform(aResult, &fTransform); } -#ifdef CAIRO_HAS_XLIB_SURFACE static bool gXRenderInitialized = false; static bool gXRenderHasTransform = false; diff --git a/gfx/2d/FilterNodeSoftware.cpp b/gfx/2d/FilterNodeSoftware.cpp index d238bb74e63ad..af4a7957cedf6 100644 --- a/gfx/2d/FilterNodeSoftware.cpp +++ b/gfx/2d/FilterNodeSoftware.cpp @@ -1015,10 +1015,9 @@ static CompositionOp ToBlendOp(BlendMode aOp) { return CompositionOp::OP_COLOR; case BLEND_MODE_LUMINOSITY: return CompositionOp::OP_LUMINOSITY; - default: - return CompositionOp::OP_OVER; } + MOZ_ASSERT_UNREACHABLE("Unexpected BlendMode"); return CompositionOp::OP_OVER; } diff --git a/gfx/tests/gtest/TestSwizzle.cpp b/gfx/tests/gtest/TestSwizzle.cpp index cc91840ebfa68..da4bb2fefe8b9 100644 --- a/gfx/tests/gtest/TestSwizzle.cpp +++ b/gfx/tests/gtest/TestSwizzle.cpp @@ -217,10 +217,17 @@ TEST(Moz2D, SwizzleData) sizeof(out8), SurfaceFormat::A8, IntSize(5, 1)); EXPECT_TRUE(ArrayEqual(out8, check_a)); - SwizzleData(SurfaceFormat::A8R8G8B8_UINT32 == SurfaceFormat::A8R8G8B8 - ? check_argb - : check_bgra, - sizeof(in_bgra), SurfaceFormat::A8R8G8B8_UINT32, + const uint8_t* uint32_argb; + +#if MOZ_BIG_ENDIAN() + EXPECT_EQ(SurfaceFormat::A8R8G8B8_UINT32, SurfaceFormat::A8R8G8B8); + uint32_argb = check_argb; +#else + EXPECT_EQ(SurfaceFormat::A8R8G8B8_UINT32, SurfaceFormat::B8G8R8A8); + uint32_argb = check_bgra; +#endif + + SwizzleData(uint32_argb, sizeof(in_bgra), SurfaceFormat::A8R8G8B8_UINT32, reinterpret_cast(out16), sizeof(out16), SurfaceFormat::R5G6B5_UINT16, IntSize(5, 1)); EXPECT_TRUE(ArrayEqual(out16, check_16)); diff --git a/gfx/tests/gtest/TestTreeTraversal.cpp b/gfx/tests/gtest/TestTreeTraversal.cpp index 215baeebf4afd..550318eff5e35 100644 --- a/gfx/tests/gtest/TestTreeTraversal.cpp +++ b/gfx/tests/gtest/TestTreeTraversal.cpp @@ -13,11 +13,6 @@ #include #include -const int PERFORMANCE_TREE_DEPTH = 20; -const int PERFORMANCE_TREE_CHILD_COUNT = 2; -const int PERFORMANCE_TREE_LEAF_COUNT = 1048576; // 2 ** 20 -const int PERFORMANCE_REGION_XWRAP = 1024; - using namespace mozilla::layers; using namespace mozilla; diff --git a/gfx/thebes/gfxHarfBuzzShaper.cpp b/gfx/thebes/gfxHarfBuzzShaper.cpp index 2fe44e7656f02..e80a7d1d6a769 100644 --- a/gfx/thebes/gfxHarfBuzzShaper.cpp +++ b/gfx/thebes/gfxHarfBuzzShaper.cpp @@ -999,38 +999,6 @@ static hb_unicode_combining_class_t HBGetCombiningClass( return hb_unicode_combining_class_t(GetCombiningClass(aCh)); } -// Hebrew presentation forms with dagesh, for characters 0x05D0..0x05EA; -// note that some letters do not have a dagesh presForm encoded -static const char16_t sDageshForms[0x05EA - 0x05D0 + 1] = { - 0xFB30, // ALEF - 0xFB31, // BET - 0xFB32, // GIMEL - 0xFB33, // DALET - 0xFB34, // HE - 0xFB35, // VAV - 0xFB36, // ZAYIN - 0, // HET - 0xFB38, // TET - 0xFB39, // YOD - 0xFB3A, // FINAL KAF - 0xFB3B, // KAF - 0xFB3C, // LAMED - 0, // FINAL MEM - 0xFB3E, // MEM - 0, // FINAL NUN - 0xFB40, // NUN - 0xFB41, // SAMEKH - 0, // AYIN - 0xFB43, // FINAL PE - 0xFB44, // PE - 0, // FINAL TSADI - 0xFB46, // TSADI - 0xFB47, // QOF - 0xFB48, // RESH - 0xFB49, // SHIN - 0xFB4A // TAV -}; - static hb_bool_t HBUnicodeCompose(hb_unicode_funcs_t* ufuncs, hb_codepoint_t a, hb_codepoint_t b, hb_codepoint_t* ab, void* user_data) { diff --git a/gfx/thebes/gfxMacPlatformFontList.mm b/gfx/thebes/gfxMacPlatformFontList.mm index 74ee10523c45a..7ce6b8675db41 100644 --- a/gfx/thebes/gfxMacPlatformFontList.mm +++ b/gfx/thebes/gfxMacPlatformFontList.mm @@ -805,24 +805,6 @@ new MacOSFontEntry(NS_ConvertUTF16toUTF8(postscriptFontName), /* gfxMacPlatformFontList */ #pragma mark - -// A bunch of fonts for "additional language support" are shipped in a -// "Language Support" directory, and don't show up in the standard font -// list returned by CTFontManagerCopyAvailableFontFamilyNames unless -// we explicitly activate them. -// -// On macOS Big Sur, the various Noto fonts etc have moved to a new location -// under /System/Fonts. Whether they're exposed in the font list by default -// depends on the SDK used; when built with SDK 10.15, they're absent. So -// we explicitly activate them to be sure they'll be available. -#if __MAC_OS_X_VERSION_MAX_ALLOWED < 101500 -static const nsLiteralCString kLangFontsDirs[] = { - "/Library/Application Support/Apple/Fonts/Language Support"_ns}; -#else -static const nsLiteralCString kLangFontsDirs[] = { - "/Library/Application Support/Apple/Fonts/Language Support"_ns, - "/System/Library/Fonts/Supplemental"_ns}; -#endif - gfxMacPlatformFontList::gfxMacPlatformFontList() : gfxPlatformFontList(false), mDefaultFont(nullptr), mUseSizeSensitiveSystemFont(false) { CheckFamilyList(kBaseFonts); diff --git a/gfx/vr/VRDisplayPresentation.cpp b/gfx/vr/VRDisplayPresentation.cpp index 127225105bb50..c1130d4ccfca4 100644 --- a/gfx/vr/VRDisplayPresentation.cpp +++ b/gfx/vr/VRDisplayPresentation.cpp @@ -148,8 +148,9 @@ VRDisplayPresentation::~VRDisplayPresentation() { } void VRDisplayPresentation::SubmitFrame() { - for (VRLayerChild* layer : mLayers) { + // Currently only one layer supported, submit only the first + if (mLayers.Length() >= 1) { + VRLayerChild* layer = mLayers.ElementAt(0); layer->SubmitFrame(mDisplayClient->GetDisplayInfo()); - break; // Currently only one layer supported, submit only the first } } diff --git a/gfx/ycbcr/scale_yuv_argb.cpp b/gfx/ycbcr/scale_yuv_argb.cpp index 6abe65c18263e..0705cea6dbe2e 100644 --- a/gfx/ycbcr/scale_yuv_argb.cpp +++ b/gfx/ycbcr/scale_yuv_argb.cpp @@ -31,10 +31,10 @@ extern "C" { // // libyuv already has ScaleYUVToARGBBilinearUp(), but its implementation is not // completed yet. Implementations of the functions are based on it. -// At first, ScaleYUVToARGBBilinearUp() was implemented by modidying the +// At first, ScaleYUVToARGBBilinearUp() was implemented by modifying the // libyuv's one. Then all another functions were implemented similarly. // -// Function relationship between yuv_convert.cpp abd scale_argb.cc are like +// Function relationship between yuv_convert.cpp and scale_argb.cc are like // the followings // - ScaleYUVToARGBDown2() <-- ScaleARGBDown2() // - ScaleYUVToARGBDownEven() <-- ScaleARGBDownEven() @@ -58,10 +58,6 @@ extern "C" { // -[4] Color conversion function selections in YUVBuferIter were borrowed from // I444ToARGBMatrix(), I422ToARGBMatrix() and I420ToARGBMatrix() -static __inline int Abs(int v) { - return v >= 0 ? v : -v; -} - typedef mozilla::gfx::YUVColorSpace YUVColorSpace; struct YUVBuferIter {