From 316a8e0c1d8798e962f43635f7cc7d169671b0e7 Mon Sep 17 00:00:00 2001 From: Ting-Yu Lin Date: Sat, 11 Aug 2018 15:17:50 -0700 Subject: [PATCH] Bug 1482665 Part 4 - Remove nsDeviceContext::AppUnitsPerCSSPixel() and replace it with mozilla::AppUnitsPerCSSPixel(). r=dholbert Differential Revision: https://phabricator.services.mozilla.com/D3157 --- gfx/layers/AnimationHelper.cpp | 2 +- gfx/src/nsDeviceContext.h | 6 ------ gfx/src/nsFontMetrics.cpp | 2 +- gfx/src/nsRect.cpp | 8 ++++---- gfx/thebes/gfxFontMissingGlyphs.cpp | 4 ++-- layout/base/nsLayoutUtils.cpp | 2 +- 6 files changed, 9 insertions(+), 15 deletions(-) diff --git a/gfx/layers/AnimationHelper.cpp b/gfx/layers/AnimationHelper.cpp index 1627b9af2ad1..86a8ffe10e23 100644 --- a/gfx/layers/AnimationHelper.cpp +++ b/gfx/layers/AnimationHelper.cpp @@ -72,7 +72,7 @@ CompositorAnimationStorage::GetOMTAValue(const uint64_t& aId) const // nsStyleTransformMatrix::ProcessTranslatePart which is called from // nsDisplayTransform::GetResultingTransformMatrix) double devPerCss = - double(scale) / double(nsDeviceContext::AppUnitsPerCSSPixel()); + double(scale) / double(AppUnitsPerCSSPixel()); transform._41 *= devPerCss; transform._42 *= devPerCss; transform._43 *= devPerCss; diff --git a/gfx/src/nsDeviceContext.h b/gfx/src/nsDeviceContext.h index a62a9bb2576d..592525124c15 100644 --- a/gfx/src/nsDeviceContext.h +++ b/gfx/src/nsDeviceContext.h @@ -81,12 +81,6 @@ public: */ already_AddRefed CreateReferenceRenderingContext(); - /** - * Gets the number of app units in one CSS pixel; this number is global, - * not unique to each device context. - */ - static int32_t AppUnitsPerCSSPixel() { return mozilla::AppUnitsPerCSSPixel(); } - /** * Gets the number of app units in one device pixel; this number * is usually a factor of AppUnitsPerCSSPixel(), although that is diff --git a/gfx/src/nsFontMetrics.cpp b/gfx/src/nsFontMetrics.cpp index 4811e723c1c7..e566a36e795c 100644 --- a/gfx/src/nsFontMetrics.cpp +++ b/gfx/src/nsFontMetrics.cpp @@ -138,7 +138,7 @@ nsFontMetrics::nsFontMetrics(const nsFont& aFont, const Params& aParams, aFont.AddFontVariationsToStyle(&style); gfxFloat devToCssSize = gfxFloat(mP2A) / - gfxFloat(nsDeviceContext::AppUnitsPerCSSPixel()); + gfxFloat(AppUnitsPerCSSPixel()); mFontGroup = gfxPlatform::GetPlatform()-> CreateFontGroup(aFont.fontlist, &style, aParams.textPerf, aParams.userFontSet, devToCssSize); diff --git a/gfx/src/nsRect.cpp b/gfx/src/nsRect.cpp index e9641e92dea3..38767973885b 100644 --- a/gfx/src/nsRect.cpp +++ b/gfx/src/nsRect.cpp @@ -45,16 +45,16 @@ FILE* operator<<(FILE* out, const nsRect& rect) // Output the coordinates in fractional pixels so they're easier to read tmp.Append('{'); tmp.AppendFloat(NSAppUnitsToFloatPixels(rect.X(), - nsDeviceContext::AppUnitsPerCSSPixel())); + AppUnitsPerCSSPixel())); tmp.AppendLiteral(", "); tmp.AppendFloat(NSAppUnitsToFloatPixels(rect.Y(), - nsDeviceContext::AppUnitsPerCSSPixel())); + AppUnitsPerCSSPixel())); tmp.AppendLiteral(", "); tmp.AppendFloat(NSAppUnitsToFloatPixels(rect.Width(), - nsDeviceContext::AppUnitsPerCSSPixel())); + AppUnitsPerCSSPixel())); tmp.AppendLiteral(", "); tmp.AppendFloat(NSAppUnitsToFloatPixels(rect.Height(), - nsDeviceContext::AppUnitsPerCSSPixel())); + AppUnitsPerCSSPixel())); tmp.Append('}'); fputs(NS_LossyConvertUTF16toASCII(tmp).get(), out); return out; diff --git a/gfx/thebes/gfxFontMissingGlyphs.cpp b/gfx/thebes/gfxFontMissingGlyphs.cpp index 9c2a2b029341..a944ae6a0d44 100644 --- a/gfx/thebes/gfxFontMissingGlyphs.cpp +++ b/gfx/thebes/gfxFontMissingGlyphs.cpp @@ -259,7 +259,7 @@ gfxFontMissingGlyphs::DrawMissingGlyph(uint32_t aChar, // We always want integer scaling, otherwise the "bitmap" glyphs will look // even uglier than usual when zoomed int32_t devPixelsPerCSSPx = - std::max(1, nsDeviceContext::AppUnitsPerCSSPixel() / + std::max(1, AppUnitsPerCSSPixel() / aAppUnitsPerDevPixel); Matrix tempMat; @@ -337,6 +337,6 @@ gfxFontMissingGlyphs::GetDesiredMinWidth(uint32_t aChar, HEX_CHAR_GAP + BOX_BORDER_WIDTH + BOX_HORIZONTAL_INSET; // Note that this will give us floating-point division, so the width will // -not- be snapped to integer multiples of its basic pixel value - width *= Float(nsDeviceContext::AppUnitsPerCSSPixel()) / aAppUnitsPerDevPixel; + width *= Float(AppUnitsPerCSSPixel()) / aAppUnitsPerDevPixel; return width; } diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index 20ee1d15143c..46c15d980fab 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -6887,7 +6887,7 @@ nsLayoutUtils::DrawSingleImage(gfxContext& aContext, const nsPoint* aAnchorPoint, const nsRect* aSourceArea) { - nscoord appUnitsPerCSSPixel = nsDeviceContext::AppUnitsPerCSSPixel(); + nscoord appUnitsPerCSSPixel = AppUnitsPerCSSPixel(); CSSIntSize pixelImageSize(ComputeSizeForDrawingWithFallback(aImage, aDest.Size())); if (pixelImageSize.width < 1 || pixelImageSize.height < 1) { NS_ASSERTION(pixelImageSize.width >= 0 && pixelImageSize.height >= 0,