diff --git a/gfx/src/thebes/nsThebesFontMetrics.cpp b/gfx/src/thebes/nsThebesFontMetrics.cpp index 36690c1d6f0..530c633a1a6 100644 --- a/gfx/src/thebes/nsThebesFontMetrics.cpp +++ b/gfx/src/thebes/nsThebesFontMetrics.cpp @@ -55,8 +55,6 @@ NS_IMPL_ISUPPORTS1(nsThebesFontMetrics, nsIFontMetrics) #include "gfxAtsuiFonts.h" #endif -#include "gfxTextRunCache.h" - nsThebesFontMetrics::nsThebesFontMetrics() { mFontStyle = nsnull; @@ -66,7 +64,7 @@ nsThebesFontMetrics::nsThebesFontMetrics() nsThebesFontMetrics::~nsThebesFontMetrics() { delete mFontStyle; - //delete mFontGroup; + delete mFontGroup; } NS_IMETHODIMP @@ -297,8 +295,7 @@ nsThebesFontMetrics::GetWidth(const char* aString, PRUint32 aLength, nscoord& aW return GetSpaceWidth(aWidth); const nsDependentCSubstring& theString = nsDependentCSubstring(aString, aString+aLength); - //nsRefPtr textrun = mFontGroup->MakeTextRun(theString); - nsRefPtr textrun = gfxTextRunCache::GetCache()->GetOrMakeTextRun(mFontGroup, theString); + nsRefPtr textrun = mFontGroup->MakeTextRun(theString); textrun->SetRightToLeft(mIsRTL); @@ -322,8 +319,7 @@ nsThebesFontMetrics::GetWidth(const PRUnichar* aString, PRUint32 aLength, return GetSpaceWidth(aWidth); const nsDependentSubstring& theString = nsDependentSubstring(aString, aString+aLength); - //nsRefPtr textrun = mFontGroup->MakeTextRun(theString); - nsRefPtr textrun = gfxTextRunCache::GetCache()->GetOrMakeTextRun(mFontGroup, theString); + nsRefPtr textrun = mFontGroup->MakeTextRun(theString); textrun->SetRightToLeft(mIsRTL); @@ -383,8 +379,7 @@ nsThebesFontMetrics::DrawString(const char *aString, PRUint32 aLength, float app2dev = mDeviceContext->AppUnitsToDevUnits(); const nsDependentCSubstring& theString = nsDependentCSubstring(aString, aString+aLength); - //nsRefPtr textrun = mFontGroup->MakeTextRun(theString); - nsRefPtr textrun = gfxTextRunCache::GetCache()->GetOrMakeTextRun(mFontGroup, theString); + nsRefPtr textrun = mFontGroup->MakeTextRun(theString); textrun->SetRightToLeft(mIsRTL); @@ -419,8 +414,7 @@ nsThebesFontMetrics::DrawString(const PRUnichar* aString, PRUint32 aLength, float app2dev = mDeviceContext->AppUnitsToDevUnits(); const nsDependentSubstring& theString = nsDependentSubstring(aString, aString+aLength); - //nsRefPtr textrun = mFontGroup->MakeTextRun(theString); - nsRefPtr textrun = gfxTextRunCache::GetCache()->GetOrMakeTextRun(mFontGroup, theString); + nsRefPtr textrun = mFontGroup->MakeTextRun(theString); textrun->SetRightToLeft(mIsRTL); diff --git a/gfx/src/thebes/nsThebesFontMetrics.h b/gfx/src/thebes/nsThebesFontMetrics.h index ebbbd919ac4..c691bf40084 100644 --- a/gfx/src/thebes/nsThebesFontMetrics.h +++ b/gfx/src/thebes/nsThebesFontMetrics.h @@ -147,7 +147,7 @@ protected: const gfxFont::Metrics& GetMetrics() const; - nsRefPtr mFontGroup; + gfxFontGroup *mFontGroup; gfxFontStyle *mFontStyle; private: diff --git a/gfx/thebes/public/Makefile.in b/gfx/thebes/public/Makefile.in index 8d2b44e6a38..50794540297 100644 --- a/gfx/thebes/public/Makefile.in +++ b/gfx/thebes/public/Makefile.in @@ -23,7 +23,6 @@ EXPORTS = gfxASurface.h \ gfxRect.h \ gfxRegion.h \ gfxTypes.h \ - gfxTextRunCache.h \ $(NULL) ifdef MOZ_ENABLE_GLITZ diff --git a/gfx/thebes/public/gfxFont.h b/gfx/thebes/public/gfxFont.h index aa3fba94ea4..6ad02699ed6 100644 --- a/gfx/thebes/public/gfxFont.h +++ b/gfx/thebes/public/gfxFont.h @@ -111,18 +111,6 @@ struct THEBES_API gfxFontStyle { void ComputeWeightAndOffset(PRInt8 *outBaseWeight, PRInt8 *outOffset) const; - - PRBool Equals(const gfxFontStyle& other) const { - return (size == other.size) && - (style == other.style) && - (systemFont == other.systemFont) && - (variant == other.variant) && - (familyNameQuirks == other.familyNameQuirks) && - (weight == other.weight) && - (decorations == other.decorations) && - (langGroup.Equals(other.langGroup)) && - (sizeAdjust == other.sizeAdjust); - } }; @@ -172,8 +160,6 @@ protected: class THEBES_API gfxFontGroup { - THEBES_INLINE_DECL_REFCOUNTING(gfxFontGroup) - public: gfxFontGroup(const nsAString& aFamilies, const gfxFontStyle *aStyle); @@ -188,11 +174,6 @@ public: return mFonts.Length(); } - PRBool Equals(const gfxFontGroup& other) const { - return mFamilies.Equals(other.mFamilies) && - mStyle.Equals(other.mStyle); - } - const gfxFontStyle *GetStyle() const { return &mStyle; } /* unicode method */ @@ -216,8 +197,6 @@ public: /* this will call back fc with the a generic font based on the style's langgroup */ void FindGenericFontFromStyle(FontCreationCallback fc, void *closure); - const nsString& GetFamilies() { return mFamilies; } - protected: nsString mFamilies; gfxFontStyle mStyle; diff --git a/gfx/thebes/public/gfxWindowsFonts.h b/gfx/thebes/public/gfxWindowsFonts.h index eb6f680dff2..9b871e744ef 100644 --- a/gfx/thebes/public/gfxWindowsFonts.h +++ b/gfx/thebes/public/gfxWindowsFonts.h @@ -476,8 +476,8 @@ private: class THEBES_API gfxWindowsTextRun : public gfxTextRun { public: - gfxWindowsTextRun(const nsAString& aString, gfxWindowsFontGroup *aFontGroup); - gfxWindowsTextRun(const nsACString& aString, gfxWindowsFontGroup *aFontGroup); + gfxWindowsTextRun(const nsAString *aString, gfxWindowsFontGroup *aFontGroup); + gfxWindowsTextRun(const nsACString *aString, gfxWindowsFontGroup *aFontGroup); ~gfxWindowsTextRun(); virtual void Draw(gfxContext *aContext, gfxPoint pt); @@ -495,8 +495,8 @@ private: nsTArray mSpacing; // These should probably be in a union - nsString mString; - nsCString mCString; + const nsAString *mString; + const nsACString *mCString; const PRBool mIsASCII; diff --git a/gfx/thebes/src/Makefile.in b/gfx/thebes/src/Makefile.in index 07aeea53271..56dff39aef1 100644 --- a/gfx/thebes/src/Makefile.in +++ b/gfx/thebes/src/Makefile.in @@ -27,7 +27,6 @@ CPPSRCS = \ gfxImageSurface.cpp \ gfxFont.cpp \ gfxPlatform.cpp \ - gfxTextRunCache.cpp \ $(NULL) DEFINES += -DIMPL_THEBES diff --git a/gfx/thebes/src/gfxWindowsFonts.cpp b/gfx/thebes/src/gfxWindowsFonts.cpp index c7d1e9f1413..d553df17e10 100644 --- a/gfx/thebes/src/gfxWindowsFonts.cpp +++ b/gfx/thebes/src/gfxWindowsFonts.cpp @@ -443,7 +443,7 @@ gfxWindowsFontGroup::MakeTextRun(const nsAString& aString) NS_WARNING("It is illegal to create a gfxTextRun with empty strings"); return nsnull; } - return new gfxWindowsTextRun(aString, this); + return new gfxWindowsTextRun(&aString, this); } gfxTextRun * @@ -453,7 +453,7 @@ gfxWindowsFontGroup::MakeTextRun(const nsACString& aString) NS_WARNING("It is illegal to create a gfxTextRun with empty strings"); return nsnull; } - return new gfxWindowsTextRun(aString, this); + return new gfxWindowsTextRun(&aString, this); } /********************************************************************** @@ -462,13 +462,13 @@ gfxWindowsFontGroup::MakeTextRun(const nsACString& aString) * **********************************************************************/ -gfxWindowsTextRun::gfxWindowsTextRun(const nsAString& aString, gfxWindowsFontGroup *aFontGroup) - : mGroup(aFontGroup), mString(aString), mIsASCII(PR_FALSE), mLength(-1.0) +gfxWindowsTextRun::gfxWindowsTextRun(const nsAString *aString, gfxWindowsFontGroup *aFontGroup) + : mGroup(aFontGroup), mString(aString), mCString(nsnull), mIsASCII(PR_FALSE), mLength(-1.0) { } -gfxWindowsTextRun::gfxWindowsTextRun(const nsACString& aString, gfxWindowsFontGroup *aFontGroup) - : mGroup(aFontGroup), mCString(aString), mIsASCII(PR_TRUE), mLength(-1.0) +gfxWindowsTextRun::gfxWindowsTextRun(const nsACString *aString, gfxWindowsFontGroup *aFontGroup) + : mGroup(aFontGroup), mString(nsnull), mCString(aString), mIsASCII(PR_TRUE), mLength(-1.0) { } @@ -535,11 +535,11 @@ gfxWindowsTextRun::MeasureOrDrawReallyFast(gfxContext *aContext, PRUint32 aLength; if (mIsASCII) { - aCString = mCString.BeginReading(); - aLength = mCString.Length(); + aCString = mCString->BeginReading(); + aLength = mCString->Length(); } else { - aWString = mString.BeginReading(); - aLength = mString.Length(); + aWString = mString->BeginReading(); + aLength = mString->Length(); if (ScriptIsComplex(aWString, aLength, SIC_COMPLEX) == S_OK) return -1; // try uniscribe instead } @@ -649,11 +649,11 @@ gfxWindowsTextRun::MeasureOrDrawFast(gfxContext *aContext, PRUint32 aLength; if (mIsASCII) { - aCString = mCString.BeginReading(); - aLength = mCString.Length(); + aCString = mCString->BeginReading(); + aLength = mCString->Length(); } else { - aWString = mString.BeginReading(); - aLength = mString.Length(); + aWString = mString->BeginReading(); + aLength = mString->Length(); if (ScriptIsComplex(aWString, aLength, SIC_COMPLEX) == S_OK) return -1; // try uniscribe instead } @@ -1445,10 +1445,10 @@ gfxWindowsTextRun::MeasureOrDrawUniscribe(gfxContext *aContext, NS_ASSERTION(aDC, "No DC"); /* we aren't going to change this. i swear */ - const nsAString *str = &mString; + nsAString *str = NS_CONST_CAST(nsAString*, mString); nsString buf; if (mIsASCII) { - CopyASCIItoUTF16(mCString, buf); + CopyASCIItoUTF16(*mCString, buf); str = &buf; }