Create common base (nsDeviceContextX) for nsDeviceContextXlib & nsDeviceContextXp to partially remove xprint dependency upon xlib. Also fixes static builds.

Thanks to Roland.Mainz@informatik.med.uni-giessen.de for the patch.
Bug #103371 r=cls sr=waterson


git-svn-id: svn://10.0.0.236/trunk@105876 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
seawood%netscape.com 2001-10-20 08:51:57 +00:00
parent 97b7dec85e
commit e098085005
9 changed files with 30 additions and 20 deletions

View File

@ -78,7 +78,7 @@ static PRLogModuleInfo *DeviceContextXlibLM = PR_NewLogModule("DeviceContextXlib
static XFontStruct *mDefaultFont = nsnull;
nsDeviceContextXlib::nsDeviceContextXlib()
: DeviceContextImpl()
: nsDeviceContextX()
{
PR_LOG(DeviceContextXlibLM, PR_LOG_DEBUG, ("nsDeviceContextXlib::nsDeviceContextXlib()\n"));
mTwipsToPixels = 1.0;

View File

@ -42,10 +42,10 @@
#define nsDeviceContextXlib_h__
#include "nsDeviceContext.h"
#include "nsIRenderingContext.h"
#include "nsRenderingContextXlib.h"
#include "xlibrgb.h"
class nsDeviceContextXlib : public DeviceContextImpl
class nsDeviceContextXlib : public nsDeviceContextX
{
public:
nsDeviceContextXlib();
@ -82,6 +82,8 @@ public:
NS_IMETHOD CreateFontCache();
NS_IMETHOD GetXlibRgbHandle(XlibRgbHandle *&aHandle)
{ aHandle = mXlibRgbHandle; return NS_OK; }
XlibRgbHandle *GetXlibRgbHandle() { return mXlibRgbHandle; }
NS_IMETHOD GetDepth( PRUint32 &depth ) { depth = (PRUint32)mDepth; return NS_OK; }

View File

@ -46,6 +46,7 @@
#include "nscore.h"
#include "nsQuickSort.h"
#include "nsFontMetricsXlib.h"
#include "nsRenderingContextXlib.h"
#include "nsIServiceManager.h"
#include "nsICharsetConverterManager.h"
#include "nsICharsetConverterManager2.h"
@ -777,12 +778,7 @@ nsFontMetricsXlib::InitGlobals(nsIDeviceContext *aDevice)
nsresult rv = NS_OK;
NS_ASSERTION(aDevice!=nsnull, "calling InitGlobals() without a device");
#ifdef USE_XPRINT
if (mPrinterMode)
gXlibRgbHandle = NS_STATIC_CAST(nsDeviceContextXp *,aDevice)->GetXlibRgbHandle();
else
#endif /* USE_XPRINT */
gXlibRgbHandle = NS_STATIC_CAST(nsDeviceContextXlib *,aDevice)->GetXlibRgbHandle();
NS_STATIC_CAST(nsDeviceContextX *, aDevice)->GetXlibRgbHandle(gXlibRgbHandle);
nsServiceManager::GetService(kCharSetManagerCID,
NS_GET_IID(nsICharsetConverterManager2),

View File

@ -50,7 +50,6 @@
#include "nsCRT.h"
#include "nsCOMPtr.h"
#include "nsDeviceContextXlib.h"
#include "nsDrawingSurfaceXlib.h"
#ifdef USE_XPRINT
#include "nsDeviceContextXP.h"

View File

@ -41,7 +41,6 @@
#include "nsImageXlib.h"
#include "nsDrawingSurfaceXlib.h"
#include "nsDeviceContextXlib.h"
#include "nsRenderingContextXlib.h"
#include "xlibrgb.h"
#include "prlog.h"

View File

@ -219,7 +219,7 @@ nsRenderingContextXlib::Init(nsIDeviceContext* aContext, nsIWidget *aWindow)
NS_ASSERTION(nsnull != mContext, "Device context is null.");
nsIDeviceContext *dc = mContext;
mXlibRgbHandle = NS_STATIC_CAST(nsDeviceContextXlib *,dc)->GetXlibRgbHandle();
NS_STATIC_CAST(nsDeviceContextX *, dc)->GetXlibRgbHandle(mXlibRgbHandle);
mDisplay = xxlib_rgb_get_display(mXlibRgbHandle);
mScreen = xxlib_rgb_get_screen(mXlibRgbHandle);
mVisual = xxlib_rgb_get_visual(mXlibRgbHandle);
@ -252,7 +252,7 @@ nsRenderingContextXlib::Init(nsIDeviceContext* aContext, nsDrawingSurface aSurfa
NS_ASSERTION(nsnull != mContext, "Device context is null.");
nsIDeviceContext *dc = mContext;
mXlibRgbHandle = NS_STATIC_CAST(nsDeviceContextXlib *,dc)->GetXlibRgbHandle();
NS_STATIC_CAST(nsDeviceContextX *, dc)->GetXlibRgbHandle(mXlibRgbHandle);
mDisplay = xxlib_rgb_get_display(mXlibRgbHandle);
mScreen = xxlib_rgb_get_screen(mXlibRgbHandle);
mVisual = xxlib_rgb_get_visual(mXlibRgbHandle);

View File

@ -55,10 +55,9 @@
#include "nsRect.h"
#ifdef USE_XPRINT
#include "nsXPrintContext.h"
#include "nsDeviceContextXP.h"
#endif /* USE_XPRINT */
#include "nsDeviceContext.h"
#include "nsImageXlib.h"
#include "nsDeviceContextXlib.h"
#include "nsVoidArray.h"
#include "nsDrawingSurfaceXlib.h"
#include "nsRegionXlib.h"
@ -70,6 +69,20 @@
class GraphicsState;
class nsFontXlib;
class nsDeviceContextX : public DeviceContextImpl
{
public:
nsDeviceContextX()
: DeviceContextImpl()
{
}
virtual ~nsDeviceContextX() {}
NS_IMETHOD GetXlibRgbHandle(XlibRgbHandle *&aHandle) = 0;
};
class nsRenderingContextXlib : public nsRenderingContextImpl
{
public:

View File

@ -54,7 +54,7 @@ static PRLogModuleInfo *nsDeviceContextXpLM = PR_NewLogModule("nsDeviceContextXp
* See documentation in nsIDeviceContext.h
*/
nsDeviceContextXp :: nsDeviceContextXp()
: DeviceContextImpl()
: nsDeviceContextX()
{
mPrintContext = nsnull;
mSpec = nsnull;

View File

@ -45,13 +45,13 @@
#include "nsUnitConversion.h"
#include "nsIWidget.h"
#include "nsIView.h"
#include "nsIRenderingContext.h"
#include "nsRenderingContextXlib.h"
#include "nsVoidArray.h"
#include "nsIDeviceContextXPrint.h"
#include "nsXPrintContext.h"
#include "nsISupportsArray.h"
class nsDeviceContextXp : public DeviceContextImpl,
class nsDeviceContextXp : public nsDeviceContextX,
public nsIDeviceContextXp
{
public:
@ -92,8 +92,9 @@ public:
NS_IMETHOD EndPage(void);
NS_IMETHOD SetSpec(nsIDeviceContextSpec *aSpec);
XlibRgbHandle *GetXlibRgbHandle() { XlibRgbHandle *h; mPrintContext->GetXlibRgbHandle(h); return h; }
NS_IMETHOD GetXlibRgbHandle(XlibRgbHandle *&aHandle)
{ return mPrintContext->GetXlibRgbHandle(aHandle); }
XlibRgbHandle *GetXlibRgbHandle() { XlibRgbHandle *h; mPrintContext->GetXlibRgbHandle(h); return h; }
NS_IMETHOD GetDepth(PRUint32 &depth)
{ depth = xxlib_rgb_get_depth(GetXlibRgbHandle()); return NS_OK; }
NS_IMETHOD GetPrintContext(nsXPrintContext*& aContext);