From 21fae80273926fe153feb4d248de5dfe8a4ffc88 Mon Sep 17 00:00:00 2001 From: "pavlov%pavlov.net" Date: Fri, 2 Mar 2007 22:41:06 +0000 Subject: [PATCH] removing gfx REQUIRES from thebes. bug 372313. r=vlad --- gfx/thebes/src/Makefile.in | 1 - gfx/thebes/src/gfxFontconfigUtils.cpp | 2 -- gfx/thebes/src/gfxPangoFonts.cpp | 25 ++++++++++++------------- gfx/thebes/src/gfxPlatformGtk.cpp | 6 +++--- 4 files changed, 15 insertions(+), 19 deletions(-) diff --git a/gfx/thebes/src/Makefile.in b/gfx/thebes/src/Makefile.in index 3d418fe6a33..db503f5c2d1 100644 --- a/gfx/thebes/src/Makefile.in +++ b/gfx/thebes/src/Makefile.in @@ -18,7 +18,6 @@ REQUIRES = \ pref \ xpcom \ unicharutil \ - gfx \ $(NULL) CPPSRCS = \ diff --git a/gfx/thebes/src/gfxFontconfigUtils.cpp b/gfx/thebes/src/gfxFontconfigUtils.cpp index c2b0976ae25..0548e2e8009 100755 --- a/gfx/thebes/src/gfxFontconfigUtils.cpp +++ b/gfx/thebes/src/gfxFontconfigUtils.cpp @@ -40,8 +40,6 @@ #include -#include "nsUnitConversion.h" - #include "nsIPrefBranch.h" #include "nsIPrefService.h" #include "nsServiceManagerUtils.h" diff --git a/gfx/thebes/src/gfxPangoFonts.cpp b/gfx/thebes/src/gfxPangoFonts.cpp index 587fa0ce180..6ef6eb9bcc6 100644 --- a/gfx/thebes/src/gfxPangoFonts.cpp +++ b/gfx/thebes/src/gfxPangoFonts.cpp @@ -56,7 +56,7 @@ #include "nsIPrefBranch.h" #include "nsIPrefService.h" #include "nsServiceManagerUtils.h" -#include "nsUnitConversion.h" +#include "nsMathUtils.h" #include "nsVoidArray.h" #include "nsPromiseFlatString.h" @@ -93,7 +93,6 @@ #include #define FLOAT_PANGO_SCALE ((gfxFloat)PANGO_SCALE) -#define NSToCoordRound(x) (floor((x) + 0.5)) static PangoLanguage *GetPangoLanguage(const nsACString& aLangGroup); static void GetMozLanguage(const PangoLanguage *aLang, nsACString &aMozLang); @@ -351,7 +350,7 @@ gfxPangoFont::RealizeFont(PRBool force) GetSize("x", 1, isz, lsz); gfxFloat aspect = isz.height / mStyle->size; mAdjustedSize = - PR_MAX(NSToCoordRound(mStyle->size*(mStyle->sizeAdjust/aspect)), 1.0f); + PR_MAX(NS_round(mStyle->size*(mStyle->sizeAdjust/aspect)), 1.0); RealizeFont(PR_TRUE); } @@ -1163,8 +1162,8 @@ gfxPangoTextRun::Draw(gfxContext *aContext, gfxPoint aPt, CompressedGlyph *charGlyphs = mCharacterGlyphs; gfxFloat direction = GetDirection(); - gfxPoint pt(NSToCoordRound(aPt.x*appUnitsToPixels), - NSToCoordRound(aPt.y*appUnitsToPixels)); + gfxPoint pt(NS_round(aPt.x*appUnitsToPixels), + NS_round(aPt.y*appUnitsToPixels)); gfxFloat startX = pt.x; GlyphRunIterator iter(this, aStart, aLength); @@ -1210,8 +1209,8 @@ gfxPangoTextRun::DrawToPath(gfxContext *aContext, gfxPoint aPt, CompressedGlyph *charGlyphs = mCharacterGlyphs; gfxFloat direction = GetDirection(); - gfxPoint pt(NSToCoordRound(aPt.x*appUnitsToPixels), - NSToCoordRound(aPt.y*appUnitsToPixels)); + gfxPoint pt(NS_round(aPt.x*appUnitsToPixels), + NS_round(aPt.y*appUnitsToPixels)); gfxFloat startX = pt.x; GlyphRunIterator iter(this, aStart, aLength); @@ -1284,9 +1283,9 @@ gfxPangoFont::Measure(gfxPangoTextRun *aTextRun, if (aSpacing) { gfxTextRun::PropertyProvider::Spacing *space = &aSpacing[i]; leftSpacePango = - NSToIntRound((isRTL ? space->mAfter : space->mBefore)*appUnitsToPango); + NS_lround((isRTL ? space->mAfter : space->mBefore)*appUnitsToPango); rightSpacePango = - NSToIntRound((isRTL ? space->mBefore : space->mAfter)*appUnitsToPango); + NS_lround((isRTL ? space->mBefore : space->mAfter)*appUnitsToPango); } const gfxPangoTextRun::CompressedGlyph *glyphData = &charGlyphs[i]; if (glyphData->IsSimpleGlyph()) { @@ -1308,14 +1307,14 @@ gfxPangoFont::Measure(gfxPangoTextRun *aTextRun, return gfxTextRun::Metrics(); glyphInfo->attr.is_cluster_start = 0; glyphInfo->glyph = details->mGlyphID; - glyphInfo->geometry.width = NSToIntRound(details->mAdvance*PANGO_SCALE); - glyphInfo->geometry.x_offset = NSToIntRound(details->mXOffset*PANGO_SCALE); + glyphInfo->geometry.width = NS_lround(details->mAdvance*PANGO_SCALE); + glyphInfo->geometry.x_offset = NS_lround(details->mXOffset*PANGO_SCALE); if (firstGlyph) { glyphInfo->geometry.width += leftSpacePango; glyphInfo->geometry.x_offset += leftSpacePango; firstGlyph = PR_FALSE; } - glyphInfo->geometry.y_offset = NSToIntRound(details->mYOffset*PANGO_SCALE); + glyphInfo->geometry.y_offset = NS_lround(details->mYOffset*PANGO_SCALE); if (details->mIsLastGlyph) { glyphInfo->geometry.width += rightSpacePango; break; @@ -2159,7 +2158,7 @@ public: { for (PRUint32 i = 0; i < mGroup->FontListLength(); ++i) mFonts.AppendElement(mGroup->GetFontAt(i)); - mSpaceWidth = NSToIntRound(mGroup->GetFontAt(0)->GetMetrics().spaceWidth * FLOAT_PANGO_SCALE); + mSpaceWidth = NS_lround(mGroup->GetFontAt(0)->GetMetrics().spaceWidth * FLOAT_PANGO_SCALE); } void Run() diff --git a/gfx/thebes/src/gfxPlatformGtk.cpp b/gfx/thebes/src/gfxPlatformGtk.cpp index b28d0295534..a2434451b2a 100644 --- a/gfx/thebes/src/gfxPlatformGtk.cpp +++ b/gfx/thebes/src/gfxPlatformGtk.cpp @@ -63,7 +63,7 @@ #include -#include "nsUnitConversion.h" +#include "nsMathUtils.h" PRInt32 gfxPlatformGtk::sDPI = -1; gfxFontconfigUtils *gfxPlatformGtk::sFontconfigUtils = nsnull; @@ -255,7 +255,7 @@ GetXftDPI() double d = strtod(val, &e); if (e != val) - return NSToCoordRound(d); + return NS_lround(d); } return -1; @@ -319,7 +319,7 @@ GetDPIFromPangoFont() if (ctx) g_object_unref(ctx); - return NSToCoordRound(dblDPI); + return NS_lround(dblDPI); } /* static */