Skip to content

Commit

Permalink
Bug 1732481 - Fix non-unified build errors in gfx. r=gfx-reviewers,jr…
Browse files Browse the repository at this point in the history
…muizel

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
  • Loading branch information
cpeterso committed Sep 24, 2021
1 parent b517c9f commit 67f51f2
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 70 deletions.
2 changes: 1 addition & 1 deletion gfx/2d/DrawTargetCairo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1954,6 +1954,7 @@ already_AddRefed<DrawTarget> 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},
Expand All @@ -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;

Expand Down
3 changes: 1 addition & 2 deletions gfx/2d/FilterNodeSoftware.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
15 changes: 11 additions & 4 deletions gfx/tests/gtest/TestSwizzle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<uint8_t*>(out16), sizeof(out16),
SurfaceFormat::R5G6B5_UINT16, IntSize(5, 1));
EXPECT_TRUE(ArrayEqual(out16, check_16));
Expand Down
5 changes: 0 additions & 5 deletions gfx/tests/gtest/TestTreeTraversal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@
#include <stack>
#include <queue>

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;

Expand Down
32 changes: 0 additions & 32 deletions gfx/thebes/gfxHarfBuzzShaper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
18 changes: 0 additions & 18 deletions gfx/thebes/gfxMacPlatformFontList.mm
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
5 changes: 3 additions & 2 deletions gfx/vr/VRDisplayPresentation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
8 changes: 2 additions & 6 deletions gfx/ycbcr/scale_yuv_argb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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 {
Expand Down

0 comments on commit 67f51f2

Please sign in to comment.