we no longer have a public font cache. removed circular refs between font cache

and device context.
This commit is contained in:
michaelp%netscape.com 1998-09-30 18:58:24 +00:00
Родитель be77d1a3d9
Коммит 451b9b2a18
20 изменённых файлов: 133 добавлений и 290 удалений

Просмотреть файл

@ -18,8 +18,8 @@ nsIImageGroup.h
nsIImageRequest.h
nsIImageObserver.h
nsIDeviceContext.h
nsIFontCache.h
nsIImage.h
nsIBlender.h
nsGfxCIID.h
nsIRegion.h
nsDeviceContext.h

Просмотреть файл

@ -36,13 +36,13 @@ LCFLAGS=-D_IMPL_NS_GFX
CPPSRCS=nsColor.cpp nsColorNames.cpp nsColorNamesRGB.cpp nsFont.cpp \
nsImageGroup.cpp nsImageManager.cpp nsImageNetContextAsync.cpp \
nsImageRenderer.cpp nsImageRequest.cpp nsImageSystemServices.cpp \
nsImageURL.cpp nsRect.cpp nsTransform2D.cpp nsFontCache.cpp \
nsImageURL.cpp nsRect.cpp nsTransform2D.cpp \
nsDeviceContext.cpp nsImageNetContextSync.cpp
EXPORTS=nsColor.h nsColorNames.h nsCoord.h nsFont.h nsRect.h nsPoint.h \
nsSize.h nsMargin.h nsTransform2D.h nsIRenderingContext.h \
nsIFontMetrics.h nsIImageManager.h nsIImageGroup.h nsIImageRequest.h \
nsIImageObserver.h nsDeviceContext.h nsIDeviceContext.h nsIFontCache.h nsIImage.h nsIBlender.h \
nsGfxCIID.h nsIRegion.h
nsIImageObserver.h nsIDeviceContext.h nsIImage.h nsIBlender.h \
nsGfxCIID.h nsIRegion.h nsDeviceContext.h
include $(DEPTH)/config/rules.mk

Просмотреть файл

@ -21,7 +21,6 @@
#include "nsDeviceContext.h"
#include "nsUnitConversion.h"
#include "nsIFontCache.h"
#include "nsIWidget.h"
#include "nsIView.h"
#include "nsIRenderingContext.h"
@ -51,9 +50,7 @@ public:
protected:
virtual ~nsDeviceContextMac();
nsresult CreateFontCache();
nsIFontCache *mFontCache;
nsDrawingSurface mSurface ;
PRUint32 mDepth;

Просмотреть файл

@ -95,7 +95,6 @@ nsRenderingContextMac :: nsRenderingContextMac()
{
NS_INIT_REFCNT();
mFontCache = nsnull ;
mFontMetrics = nsnull ;
mContext = nsnull ;
mRenderingSurface = nsnull ;
@ -145,7 +144,6 @@ nsRenderingContextMac :: ~nsRenderingContextMac()
}
NS_IF_RELEASE(mFontMetrics);
NS_IF_RELEASE(mFontCache);
NS_IF_RELEASE(mContext);
}
@ -205,7 +203,6 @@ nsresult nsRenderingContextMac :: CommonInit()
((nsDeviceContextMac *)mContext)->SetDrawingSurface(mRenderingSurface);
//((nsDeviceContextMac *)mContext)->InstallColormap();
mContext->GetFontCache(mFontCache);
mContext->GetDevUnitsToAppUnits(mP2T);
float app2dev;
mContext->GetAppUnitsToDevUnits(app2dev);
@ -518,8 +515,8 @@ nscolor nsRenderingContextMac :: GetColor() const
void nsRenderingContextMac :: SetFont(const nsFont& aFont)
{
NS_IF_RELEASE(mFontMetrics);
if (mFontCache)
mFontCache->GetMetricsFor(aFont, mFontMetrics);
if (mContext)
mContext->GetMetricsFor(aFont, mFontMetrics);
if (mFontMetrics)
nsFontMetricsMac::SetFont(aFont, mContext);

Просмотреть файл

@ -30,7 +30,6 @@
#include "nsIViewManager.h"
#include "nsIWidget.h"
#include "nsRect.h"
#include "nsIFontCache.h"
#include "nsImageMac.h"
#include "nsIDeviceContext.h"
#include "nsVoidArray.h"
@ -114,7 +113,6 @@ protected:
nsDrawingSurfaceMac mFrontBuffer; // current buffer to draw into
nsIDeviceContext *mContext;
nsIFontMetrics *mFontMetrics;
nsIFontCache *mFontCache;
RgnHandle mClipRegion;
RgnHandle mMainRegion;
PRInt32 mCurrFontHandle;

Просмотреть файл

@ -29,13 +29,13 @@ DEFINES=-D_IMPL_NS_GFX -DWIN32_LEAN_AND_MEAN
CPPSRCS=nsColor.cpp nsColorNames.cpp nsColorNamesRGB.cpp nsFont.cpp \
nsImageGroup.cpp nsImageManager.cpp nsImageNetContextAsync.cpp \
nsImageRenderer.cpp nsImageRequest.cpp nsImageSystemServices.cpp \
nsImageURL.cpp nsRect.cpp nsTransform2D.cpp nsFontCache.cpp \
nsImageURL.cpp nsRect.cpp nsTransform2D.cpp \
nsDeviceContext.cpp nsImageNetContextSync.cpp
EXPORTS=nsColor.h nsColorNames.h nsCoord.h nsFont.h nsRect.h nsPoint.h \
nsSize.h nsMargin.h nsTransform2D.h nsIRenderingContext.h \
nsIFontMetrics.h nsIImageManager.h nsIImageGroup.h nsIImageRequest.h \
nsIImageObserver.h nsIDeviceContext.h nsIFontCache.h nsIImage.h nsIBlender.h \
nsIImageObserver.h nsIDeviceContext.h nsIImage.h nsIBlender.h \
nsGfxCIID.h nsIRegion.h nsDeviceContext.h
CPP_OBJS=.\$(OBJDIR)\nsColor.obj .\$(OBJDIR)\nsColorNames.obj \
@ -44,7 +44,7 @@ CPP_OBJS=.\$(OBJDIR)\nsColor.obj .\$(OBJDIR)\nsColorNames.obj \
.\$(OBJDIR)\nsImageNetContextAsync.obj .\$(OBJDIR)\nsImageRenderer.obj \
.\$(OBJDIR)\nsImageRequest.obj .\$(OBJDIR)\nsImageSystemServices.obj \
.\$(OBJDIR)\nsImageURL.obj .\$(OBJDIR)\nsRect.obj \
.\$(OBJDIR)\nsTransform2D.obj .\$(OBJDIR)\nsFontCache.obj \
.\$(OBJDIR)\nsTransform2D.obj \
.\$(OBJDIR)\nsDeviceContext.obj .\$(OBJDIR)\nsImageNetContextSync.obj
LINCS=-I$(PUBLIC)\util -I$(PUBLIC)\img \

Просмотреть файл

@ -21,7 +21,6 @@
#include "nsDeviceContext.h"
#include "nsUnitConversion.h"
#include "nsIFontCache.h"
#include "nsIWidget.h"
#include "nsIView.h"
#include "nsIRenderingContext.h"
@ -75,7 +74,6 @@ public:
protected:
~nsDeviceContextUnix();
nsresult CreateFontCache();
void AllocColors();
uint8 AllocColor(uint8 aRed, uint8 aGreen,
uint8 aBlue, PRBool aCanAlloc);

Просмотреть файл

@ -78,7 +78,6 @@ nsRenderingContextUnix :: nsRenderingContextUnix()
{
NS_INIT_REFCNT();
mFontCache = nsnull ;
mFontMetrics = nsnull ;
mContext = nsnull ;
mFrontBuffer = nsnull ;
@ -133,7 +132,6 @@ nsRenderingContextUnix :: ~nsRenderingContextUnix()
NS_IF_RELEASE(mFontMetrics);
NS_IF_RELEASE(mFontCache);
NS_IF_RELEASE(mContext);
if (nsnull != mDrawStringBuf) {
@ -204,7 +202,6 @@ nsresult nsRenderingContextUnix :: CommonInit()
((nsDeviceContextUnix *)mContext)->SetDrawingSurface(mRenderingSurface);
((nsDeviceContextUnix *)mContext)->InstallColormap();
mContext->GetFontCache(mFontCache);
mContext->GetDevUnitsToAppUnits(mP2T);
float app2dev;
mContext->GetAppUnitsToDevUnits(app2dev);
@ -552,7 +549,7 @@ nscolor nsRenderingContextUnix :: GetColor() const
void nsRenderingContextUnix :: SetFont(const nsFont& aFont)
{
NS_IF_RELEASE(mFontMetrics);
mFontCache->GetMetricsFor(aFont, mFontMetrics);
mContext->GetMetricsFor(aFont, mFontMetrics);
if (mFontMetrics)
{

Просмотреть файл

@ -30,7 +30,6 @@
#include "nsIViewManager.h"
#include "nsIWidget.h"
#include "nsRect.h"
#include "nsIFontCache.h"
#include "nsImageUnix.h"
#include "nsIDeviceContext.h"
#include "nsVoidArray.h"
@ -150,7 +149,6 @@ protected:
nsDrawingSurfaceUnix *mFrontBuffer;
nsIDeviceContext *mContext;
nsIFontMetrics *mFontMetrics;
nsIFontCache *mFontCache;
Region mRegion;
Font mCurrFontHandle;
XChar2b* mDrawStringBuf;

Просмотреть файл

@ -17,7 +17,6 @@
*/
#include "nsDeviceContext.h"
#include "nsIFontCache.h"
#include "nsFont.h"
#include "nsIView.h"
#include "nsGfxCIID.h"
@ -25,6 +24,26 @@
#include "nsImageRequest.h"
#include "nsIImageGroup.h"
#include "il_util.h"
#include "nsVoidArray.h"
#include "nsIFontMetrics.h"
class nsFontCache
{
public:
nsFontCache();
~nsFontCache();
nsresult Init(nsIDeviceContext* aContext);
nsresult GetDeviceContext(nsIDeviceContext *&aContext) const;
nsresult GetMetricsFor(const nsFont& aFont, nsIFontMetrics *&aMetrics);
nsresult Flush();
protected:
nsVoidArray mFontMetrics;
nsIDeviceContext *mContext; //we do not addref this since
//ownership is implied. MMP.
};
static NS_DEFINE_IID(kDeviceContextIID, NS_IDEVICE_CONTEXT_IID);
@ -59,7 +78,11 @@ static PRBool DeleteValue(nsHashKey* aKey, void* aValue, void* closure)
DeviceContextImpl :: ~DeviceContextImpl()
{
NS_IF_RELEASE(mFontCache);
if (nsnull != mFontCache)
{
delete mFontCache;
mFontCache = nsnull;
}
if (nsnull != mGammaTable)
{
@ -165,33 +188,11 @@ NS_IMETHODIMP DeviceContextImpl :: InitRenderingContext(nsIRenderingContext *aCo
return (aContext->Init(this, aWin));
}
NS_IMETHODIMP DeviceContextImpl::GetFontCache(nsIFontCache*& aCache)
{
nsresult rv;
if (nsnull == mFontCache) {
rv = CreateFontCache();
if (NS_FAILED(rv)) {
aCache = nsnull;
return rv;
}
}
NS_ADDREF(mFontCache);
aCache = mFontCache;
return NS_OK;
}
NS_IMETHODIMP DeviceContextImpl::FlushFontCache()
{
NS_IF_RELEASE(mFontCache);
return NS_OK;
}
nsresult DeviceContextImpl::CreateFontCache()
{
nsresult rv = NS_NewFontCache(&mFontCache);
if (NS_OK != rv) {
return rv;
mFontCache = new nsFontCache();
if (nsnull == mFontCache) {
return NS_ERROR_OUT_OF_MEMORY;
}
mFontCache->Init(this);
return NS_OK;
@ -570,3 +571,91 @@ NS_IMETHODIMP DeviceContextImpl::GetPaletteInfo(nsPaletteInfo& aPaletteInfo)
return NS_OK;
}
/////////////////////////////////////////////////////////////
nsFontCache :: nsFontCache()
{
mContext = nsnull;
}
nsFontCache :: ~nsFontCache()
{
Flush();
}
nsresult nsFontCache :: Init(nsIDeviceContext* aContext)
{
NS_PRECONDITION(nsnull != aContext, "null ptr");
// Note: we don't hold a reference to the device context, because it
// holds a reference to us and we don't want circular references
mContext = aContext;
return NS_OK;
}
nsresult nsFontCache :: GetDeviceContext(nsIDeviceContext *&aContext) const
{
NS_IF_ADDREF(mContext);
aContext = mContext;
return NS_OK;
}
nsresult nsFontCache :: GetMetricsFor(const nsFont& aFont, nsIFontMetrics *&aMetrics)
{
// First check our cache
PRInt32 n = mFontMetrics.Count();
for (PRInt32 cnt = 0; cnt < n; cnt++)
{
aMetrics = (nsIFontMetrics*) mFontMetrics.ElementAt(cnt);
const nsFont* font;
aMetrics->GetFont(font);
if (aFont.Equals(*font))
{
NS_ADDREF(aMetrics);
return NS_OK;
}
}
// It's not in the cache. Get font metrics and then cache them.
static NS_DEFINE_IID(kFontMetricsCID, NS_FONT_METRICS_CID);
static NS_DEFINE_IID(kFontMetricsIID, NS_IFONT_METRICS_IID);
nsIFontMetrics* fm;
nsresult rv = nsRepository::CreateInstance(kFontMetricsCID, nsnull,
kFontMetricsIID, (void **)&fm);
if (NS_OK != rv) {
aMetrics = nsnull;
return rv;
}
rv = fm->Init(aFont, mContext);
if (NS_OK != rv) {
aMetrics = nsnull;
return rv;
}
mFontMetrics.AppendElement(fm);
NS_ADDREF(fm);
aMetrics = fm;
return NS_OK;
}
nsresult nsFontCache :: Flush()
{
PRInt32 i, n = mFontMetrics.Count();
for (i = 0; i < n; i++)
{
nsIFontMetrics* fm = (nsIFontMetrics*) mFontMetrics.ElementAt(i);
fm->Destroy();
NS_RELEASE(fm);
}
mFontMetrics.Clear();
return NS_OK;
}

Просмотреть файл

@ -24,6 +24,7 @@
class nsIImageRequest;
class nsHashtable;
class nsFontCache;
class DeviceContextImpl : public nsIDeviceContext
{
@ -46,9 +47,6 @@ public:
NS_IMETHOD GetAppUnitsToDevUnits(float &aAppUnits) const;
NS_IMETHOD GetDevUnitsToAppUnits(float &aDevUnits) const;
NS_IMETHOD GetFontCache(nsIFontCache *&aCache);
NS_IMETHOD FlushFontCache();
NS_IMETHOD GetMetricsFor(const nsFont& aFont, nsIFontMetrics*& aMetrics);
NS_IMETHOD SetZoom(float aZoom);
@ -89,7 +87,7 @@ protected:
float mPixelsToTwips;
float mAppUnitsToDevUnits;
float mDevUnitsToAppUnits;
nsIFontCache *mFontCache;
nsFontCache *mFontCache;
float mZoom;
float mGammaValue;
PRUint8 *mGammaTable;

Просмотреть файл

@ -1,147 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#include "nsIFontCache.h"
#include "nsFont.h"
#include "nsVoidArray.h"
#include "nsIFontMetrics.h"
#include "nsIDeviceContext.h"
#include "nsGfxCIID.h"
static NS_DEFINE_IID(kIFontCacheIID, NS_IFONT_CACHE_IID);
class FontCacheImpl : public nsIFontCache
{
public:
FontCacheImpl();
~FontCacheImpl();
NS_DECL_ISUPPORTS
NS_IMETHOD Init(nsIDeviceContext* aContext);
NS_IMETHOD GetDeviceContext(nsIDeviceContext *&aContext) const;
NS_IMETHOD GetMetricsFor(const nsFont& aFont, nsIFontMetrics *&aMetrics);
NS_IMETHOD Flush();
protected:
nsVoidArray mFontMetrics;
nsIDeviceContext *mContext;
};
FontCacheImpl :: FontCacheImpl()
{
NS_INIT_REFCNT();
mContext = nsnull;
}
FontCacheImpl :: ~FontCacheImpl()
{
Flush();
}
NS_IMPL_ISUPPORTS(FontCacheImpl, kIFontCacheIID)
NS_IMETHODIMP FontCacheImpl :: Init(nsIDeviceContext* aContext)
{
NS_PRECONDITION(nsnull != aContext, "null ptr");
// Note: we don't hold a reference to the device context, because it
// holds a reference to us and we don't want circular references
mContext = aContext;
return NS_OK;
}
NS_IMETHODIMP FontCacheImpl::GetDeviceContext(nsIDeviceContext *&aContext) const
{
NS_IF_ADDREF(mContext);
aContext = mContext;
return NS_OK;
}
NS_IMETHODIMP FontCacheImpl :: GetMetricsFor(const nsFont& aFont, nsIFontMetrics *&aMetrics)
{
// First check our cache
PRInt32 n = mFontMetrics.Count();
for (PRInt32 cnt = 0; cnt < n; cnt++)
{
aMetrics = (nsIFontMetrics*) mFontMetrics.ElementAt(cnt);
const nsFont* font;
aMetrics->GetFont(font);
if (aFont.Equals(*font))
{
NS_ADDREF(aMetrics);
return NS_OK;
}
}
// It's not in the cache. Get font metrics and then cache them.
static NS_DEFINE_IID(kFontMetricsCID, NS_FONT_METRICS_CID);
static NS_DEFINE_IID(kFontMetricsIID, NS_IFONT_METRICS_IID);
nsIFontMetrics* fm;
nsresult rv = nsRepository::CreateInstance(kFontMetricsCID, nsnull,
kFontMetricsIID, (void **)&fm);
if (NS_OK != rv) {
aMetrics = nsnull;
return rv;
}
rv = fm->Init(aFont, mContext);
if (NS_OK != rv) {
aMetrics = nsnull;
return rv;
}
mFontMetrics.AppendElement(fm);
NS_ADDREF(fm);
aMetrics = fm;
return NS_OK;
}
NS_IMETHODIMP FontCacheImpl::Flush()
{
PRInt32 i, n = mFontMetrics.Count();
for (i = 0; i < n; i++) {
nsIFontMetrics* fm = (nsIFontMetrics*) mFontMetrics.ElementAt(i);
fm->Destroy();
NS_RELEASE(fm);
}
mFontMetrics.Clear();
return NS_OK;
}
extern "C" NS_GFX_(nsresult)
NS_NewFontCache(nsIFontCache **aInstancePtrResult)
{
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
if (nsnull == aInstancePtrResult)
return NS_ERROR_NULL_POINTER;
nsIFontCache *cache = new FontCacheImpl();
if (nsnull == cache)
return NS_ERROR_OUT_OF_MEMORY;
return cache->QueryInterface(kIFontCacheIID, (void **) aInstancePtrResult);
}

Просмотреть файл

@ -26,7 +26,6 @@
class nsIRenderingContext;
class nsIView;
class nsIFontCache;
class nsIFontMetrics;
class nsIWidget;
struct nsFont;
@ -91,10 +90,6 @@ public:
//returns the scrollbar dimensions in app units
NS_IMETHOD GetScrollBarDimensions(float &aWidth, float &aHeight) const = 0;
//be sure to Relase() after you are done with the Get()
NS_IMETHOD GetFontCache(nsIFontCache *&aCache) = 0;
NS_IMETHOD FlushFontCache() = 0;
// Get the font metrics for a given font.
NS_IMETHOD GetMetricsFor(const nsFont& aFont, nsIFontMetrics*& aMetrics) = 0;

Просмотреть файл

@ -1,68 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef nsIFontCache_h___
#define nsIFontCache_h___
#include <stdio.h>
#include "nscore.h"
#include "nsISupports.h"
class nsIFontMetrics;
class nsIDeviceContext;
struct nsFont;
// IID for the nsIFontCache interface
#define NS_IFONT_CACHE_IID \
{ 0x894758e0, 0xb49a, 0x11d1, \
{ 0xa8, 0x24, 0x00, 0x40, 0x95, 0x9a, 0x28, 0xc9 } }
/**
* Font cache interface. A font cache is bound to a particular device
* context which it uses to realize the font metrics. The cache uses
* the nsFont as a key.
*/
class nsIFontCache : public nsISupports
{
public:
/**
* Initialize the font cache. Call this after creating the font
* cache and before trying to use it.
*/
NS_IMETHOD Init(nsIDeviceContext* aContext) = 0;
/**
* Get the device context associated with this cache
*/
NS_IMETHOD GetDeviceContext(nsIDeviceContext *&aContext) const = 0;
/**
* Get metrics for a given font.
*/
NS_IMETHOD GetMetricsFor(const nsFont& aFont, nsIFontMetrics *&aMetrics) = 0;
/**
* Flush the cache.
*/
NS_IMETHOD Flush() = 0;
};
extern "C" NS_GFX_(nsresult)
NS_NewFontCache(nsIFontCache **aInstancePtrResult);
#endif

Просмотреть файл

@ -50,7 +50,7 @@ public:
* Initialize the font metrics. Call this after creating the font metrics.
* Font metrics you get from the font cache do NOT need to be initialized
*
* @see nsIFontCache#GetMetricsFor()
* @see nsIDeviceContext#GetMetricsFor()
*/
NS_IMETHOD Init(const nsFont& aFont, nsIDeviceContext *aContext) = 0;

Просмотреть файл

@ -29,7 +29,6 @@ class nsIFontMetrics;
class nsIImage;
class nsTransform2D;
class nsString;
class nsIFontCache;
class nsIDeviceContext;
class nsIRegion;

Просмотреть файл

@ -39,7 +39,7 @@ nsFontMetricsWin :: ~nsFontMetricsWin()
mFontHandle = NULL;
}
NS_IF_RELEASE(mDeviceContext);
mDeviceContext = nsnull;
}
#ifdef LEAK_DEBUG
@ -91,8 +91,8 @@ NS_IMETHODIMP
nsFontMetricsWin :: Init(const nsFont& aFont, nsIDeviceContext *aContext)
{
mFont = new nsFont(aFont);
//don't addref this to avoid circular refs
mDeviceContext = aContext;
NS_ADDREF(aContext);
RealizeFont();
return NS_OK;
}
@ -100,7 +100,7 @@ nsFontMetricsWin :: Init(const nsFont& aFont, nsIDeviceContext *aContext)
NS_IMETHODIMP
nsFontMetricsWin :: Destroy()
{
NS_IF_RELEASE(mDeviceContext);
mDeviceContext = nsnull;
return NS_OK;
}

Просмотреть файл

@ -264,7 +264,6 @@ nsRenderingContextWin :: nsRenderingContextWin()
mMainDC = NULL;
mDCOwner = nsnull;
mFontMetrics = nsnull;
mFontCache = nsnull;
mOrigSolidBrush = NULL;
mBlackBrush = NULL;
mOrigFont = NULL;
@ -296,7 +295,6 @@ nsRenderingContextWin :: ~nsRenderingContextWin()
{
NS_IF_RELEASE(mContext);
NS_IF_RELEASE(mFontMetrics);
NS_IF_RELEASE(mFontCache);
//destroy the initial GraphicsState
@ -483,7 +481,6 @@ nsresult nsRenderingContextWin :: CommonInit(void)
mContext->GetAppUnitsToDevUnits(app2dev);
mTMatrix->AddScale(app2dev, app2dev);
mContext->GetDevUnitsToAppUnits(mP2T);
mContext->GetFontCache(mFontCache);
#ifdef NS_DEBUG
mInitialized = PR_TRUE;
@ -773,7 +770,7 @@ nscolor nsRenderingContextWin :: GetColor() const
void nsRenderingContextWin :: SetFont(const nsFont& aFont)
{
NS_IF_RELEASE(mFontMetrics);
mFontCache->GetMetricsFor(aFont, mFontMetrics);
mContext->GetMetricsFor(aFont, mFontMetrics);
}
const nsFont& nsRenderingContextWin :: GetFont()

Просмотреть файл

@ -30,7 +30,6 @@
#include "nsIViewManager.h"
#include "nsIWidget.h"
#include "nsRect.h"
#include "nsIFontCache.h"
#include "nsImageWin.h"
#include "nsIDeviceContext.h"
#include "nsVoidArray.h"
@ -145,7 +144,6 @@ protected:
nscolor mCurrentColor;
nsTransform2D *mTMatrix; // transform that all the graphics drawn here will obey
nsIFontMetrics *mFontMetrics;
nsIFontCache *mFontCache;
HDC mDC;
HDC mMainDC;
nsDrawingSurfaceWin *mSurface;

Просмотреть файл

@ -21,7 +21,6 @@
#include "nsDeviceContext.h"
#include "nsUnitConversion.h"
#include "nsIFontCache.h"
#include "nsIWidget.h"
#include "nsIView.h"
#include "nsIRenderingContext.h"
@ -51,9 +50,7 @@ public:
protected:
virtual ~nsDeviceContextMac();
nsresult CreateFontCache();
nsIFontCache *mFontCache;
nsDrawingSurface mSurface ;
PRUint32 mDepth;