Exorcism of global variables: part 1.
Have only one access point to the global vars - in nsDeviceContextXlib. Next step will be to invent an interface that can be queried for this stuff to remove the link time dependancy between this gfx lib and the widget lib. Global variables are EVIL. git-svn-id: svn://10.0.0.236/trunk@38030 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -47,6 +47,10 @@ nsDeviceContextXlib::nsDeviceContextXlib()
|
||||
mPaletteInfo.palette = NULL;
|
||||
mNumCells = 0;
|
||||
mSurface = nsnull;
|
||||
mDisplay = nsnull;
|
||||
mScreen = nsnull;
|
||||
mVisual = nsnull;
|
||||
mDepth = 0;
|
||||
}
|
||||
|
||||
nsDeviceContextXlib::~nsDeviceContextXlib()
|
||||
@@ -56,12 +60,24 @@ nsDeviceContextXlib::~nsDeviceContextXlib()
|
||||
mSurface = nsnull;
|
||||
}
|
||||
|
||||
// EVIL
|
||||
extern Display * gDisplay;
|
||||
extern Screen * gScreen;
|
||||
extern Visual * gVisual;
|
||||
extern int gDepth;
|
||||
|
||||
NS_IMETHODIMP nsDeviceContextXlib::Init(nsNativeWidget aNativeWidget)
|
||||
{
|
||||
PR_LOG(DeviceContextXlibLM, PR_LOG_DEBUG, ("nsDeviceContextXlib::Init()\n"));
|
||||
|
||||
mWidget = aNativeWidget;
|
||||
|
||||
// This is EVIL and has to be fixed by inventing an interface for it.
|
||||
mDisplay = gDisplay;
|
||||
mScreen = gScreen;
|
||||
mVisual = gVisual;
|
||||
mDepth = gDepth;
|
||||
|
||||
CommonInit();
|
||||
|
||||
return NS_OK;
|
||||
@@ -87,8 +103,8 @@ nsDeviceContextXlib::CommonInit(void)
|
||||
}
|
||||
else {
|
||||
// Compute dpi of display
|
||||
float screenWidth = float(WidthOfScreen(gScreen));
|
||||
float screenWidthIn = float(WidthMMOfScreen(gScreen)) / 25.4f;
|
||||
float screenWidth = float(WidthOfScreen(mScreen));
|
||||
float screenWidthIn = float(WidthMMOfScreen(mScreen)) / 25.4f;
|
||||
dpi = nscoord(screenWidth / screenWidthIn);
|
||||
}
|
||||
}
|
||||
@@ -118,8 +134,19 @@ NS_IMETHODIMP nsDeviceContextXlib::CreateRenderingContext(nsIRenderingContext *&
|
||||
NS_ADDREF(context);
|
||||
surface = new nsDrawingSurfaceXlib();
|
||||
if (nsnull != surface) {
|
||||
GC gc = XCreateGC(gDisplay, (Drawable)mWidget, 0, NULL);
|
||||
rv = surface->Init((Drawable)mWidget, gc);
|
||||
|
||||
GC gc = XCreateGC(mDisplay,
|
||||
(Drawable) mWidget,
|
||||
0,
|
||||
NULL);
|
||||
|
||||
rv = surface->Init(mDisplay,
|
||||
mScreen,
|
||||
mVisual,
|
||||
mDepth,
|
||||
(Drawable) mWidget,
|
||||
gc);
|
||||
|
||||
if (NS_OK == rv) {
|
||||
rv = context->Init(this, surface);
|
||||
}
|
||||
@@ -293,7 +320,7 @@ NS_IMETHODIMP nsDeviceContextXlib::CheckFontExistence(const nsString& aFontName)
|
||||
fontName, dpi, dpi);
|
||||
delete [] fontName;
|
||||
|
||||
fnames = ::XListFontsWithInfo(gDisplay, wildstring, 1, &numnames, &fonts);
|
||||
fnames = ::XListFontsWithInfo(mDisplay, wildstring, 1, &numnames, &fonts);
|
||||
|
||||
if (numnames > 0)
|
||||
{
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
|
||||
#include "nsDeviceContext.h"
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
|
||||
class nsDeviceContextXlib : public DeviceContextImpl
|
||||
{
|
||||
public:
|
||||
@@ -50,13 +52,25 @@ public:
|
||||
NS_IMETHOD BeginPage(void);
|
||||
NS_IMETHOD EndPage(void);
|
||||
|
||||
Display * GetDisplay() { return mDisplay; }
|
||||
Screen * GetScreen() { return mScreen; }
|
||||
Visual * GetVisual() { return mVisual; }
|
||||
int GetDepth() { return mDepth; }
|
||||
|
||||
protected:
|
||||
|
||||
virtual ~nsDeviceContextXlib();
|
||||
|
||||
private:
|
||||
virtual ~nsDeviceContextXlib();
|
||||
void CommonInit(void);
|
||||
nsPaletteInfo mPaletteInfo;
|
||||
PRBool mWriteable;
|
||||
PRUint32 mNumCells;
|
||||
nsDrawingSurface mSurface;
|
||||
Display * mDisplay;
|
||||
Screen * mScreen;
|
||||
Visual * mVisual;
|
||||
int mDepth;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -23,13 +23,6 @@ static NS_DEFINE_IID(kIDrawingSurfaceIID, NS_IDRAWING_SURFACE_IID);
|
||||
|
||||
static PRLogModuleInfo *DrawingSurfaceXlibLM = PR_NewLogModule("DrawingSurfaceXlib");
|
||||
|
||||
extern Display *gDisplay;
|
||||
extern Screen *gScreen;
|
||||
extern int gScreenNum;
|
||||
extern int gDepth;
|
||||
extern Visual *gVisual;
|
||||
extern XVisualInfo *gVisualInfo;
|
||||
|
||||
extern PRUint32 gRedZeroMask; //red color mask in zero position
|
||||
extern PRUint32 gGreenZeroMask; //green color mask in zero position
|
||||
extern PRUint32 gBlueZeroMask; //blue color mask in zero position
|
||||
@@ -54,6 +47,10 @@ nsDrawingSurfaceXlib::nsDrawingSurfaceXlib()
|
||||
mDrawable = 0;
|
||||
mDestroyDrawable = PR_FALSE;
|
||||
mImage = nsnull;
|
||||
mDisplay = nsnull;
|
||||
mScreen = nsnull;
|
||||
mVisual = nsnull;
|
||||
mDepth = 0;
|
||||
mGC = 0;
|
||||
// set up lock info
|
||||
mLocked = PR_FALSE;
|
||||
@@ -86,7 +83,7 @@ nsDrawingSurfaceXlib::~nsDrawingSurfaceXlib()
|
||||
PR_LOG(DrawingSurfaceXlibLM, PR_LOG_DEBUG, ("nsDrawingSurfaceXlib::~nsDrawingSurfaceXlib()\n"));
|
||||
// if it's been labeled as destroy, it's a pixmap.
|
||||
if (mDestroyDrawable) {
|
||||
XFreePixmap(gDisplay, mDrawable);
|
||||
XFreePixmap(mDisplay, mDrawable);
|
||||
}
|
||||
if (mImage) {
|
||||
XDestroyImage(mImage);
|
||||
@@ -98,8 +95,19 @@ NS_IMPL_ADDREF(nsDrawingSurfaceXlib)
|
||||
NS_IMPL_RELEASE(nsDrawingSurfaceXlib)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDrawingSurfaceXlib::Init(Drawable aDrawable, GC aGC) {
|
||||
nsDrawingSurfaceXlib::Init(Display * aDisplay,
|
||||
Screen * aScreen,
|
||||
Visual * aVisual,
|
||||
int aDepth,
|
||||
Drawable aDrawable,
|
||||
GC aGC)
|
||||
{
|
||||
PR_LOG(DrawingSurfaceXlibLM, PR_LOG_DEBUG, ("nsDrawingSurfaceXlib::Init()\n"));
|
||||
|
||||
mDisplay = aDisplay;
|
||||
mScreen = aScreen;
|
||||
mVisual = aVisual;
|
||||
mDepth = aDepth;
|
||||
mGC = aGC;
|
||||
mDrawable = aDrawable;
|
||||
mIsOffscreen = PR_FALSE;
|
||||
@@ -107,17 +115,31 @@ nsDrawingSurfaceXlib::Init(Drawable aDrawable, GC aGC) {
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDrawingSurfaceXlib::Init (GC aGC,
|
||||
PRUint32 aWidth, PRUint32 aHeight, PRUint32 aFlags) {
|
||||
nsDrawingSurfaceXlib::Init (Display * aDisplay,
|
||||
Screen * aScreen,
|
||||
Visual * aVisual,
|
||||
int aDepth,
|
||||
GC aGC,
|
||||
PRUint32 aWidth,
|
||||
PRUint32 aHeight,
|
||||
PRUint32 aFlags)
|
||||
{
|
||||
mDisplay = aDisplay;
|
||||
mScreen = aScreen;
|
||||
mVisual = aVisual;
|
||||
mDepth = aDepth;
|
||||
mGC = aGC;
|
||||
mWidth = aWidth;
|
||||
mHeight = aHeight;
|
||||
mLockFlags = aFlags;
|
||||
|
||||
mIsOffscreen = PR_TRUE;
|
||||
|
||||
mDrawable = XCreatePixmap(gDisplay, RootWindow(gDisplay, gScreenNum),
|
||||
mWidth, mHeight, gDepth);
|
||||
|
||||
mDrawable = XCreatePixmap(mDisplay,
|
||||
RootWindow(mDisplay, GetScreenNumber()),
|
||||
mWidth,
|
||||
mHeight,
|
||||
mDepth);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -141,7 +163,7 @@ nsDrawingSurfaceXlib::Lock(PRInt32 aX, PRInt32 aY,
|
||||
mLockHeight = aHeight;
|
||||
mLockFlags = aFlags;
|
||||
|
||||
mImage = XGetImage(gDisplay, mDrawable,
|
||||
mImage = XGetImage(mDisplay, mDrawable,
|
||||
mLockX, mLockY,
|
||||
mLockWidth, mLockHeight,
|
||||
0xFFFFFFFF,
|
||||
@@ -166,7 +188,7 @@ nsDrawingSurfaceXlib::Unlock(void)
|
||||
|
||||
// If the lock was not read only, put the bits back on the pixmap
|
||||
if (!(mLockFlags & NS_LOCK_SURFACE_READ_ONLY)) {
|
||||
XPutImage(gDisplay, mDrawable, mGC, mImage,
|
||||
XPutImage(mDisplay, mDrawable, mGC, mImage,
|
||||
0, 0, mLockX, mLockY,
|
||||
mLockWidth, mLockHeight);
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ class nsDrawingSurfaceXlib : public nsIDrawingSurface
|
||||
{
|
||||
public:
|
||||
nsDrawingSurfaceXlib();
|
||||
~nsDrawingSurfaceXlib();
|
||||
virtual ~nsDrawingSurfaceXlib();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
@@ -40,30 +40,56 @@ public:
|
||||
NS_IMETHOD IsOffscreen(PRBool *aOffScreen);
|
||||
NS_IMETHOD IsPixelAddressable(PRBool *aAddressable);
|
||||
NS_IMETHOD GetPixelFormat(nsPixelFormat *aFormat);
|
||||
NS_IMETHOD Init (Drawable aDrawable, GC aGC);
|
||||
NS_IMETHOD Init (GC aGC, PRUint32 aWidth, PRUint32 aHeight, PRUint32 aFlags);
|
||||
|
||||
NS_IMETHOD Init (Display * aDisplay,
|
||||
Screen * aScreen,
|
||||
Visual * aVisual,
|
||||
int aDepth,
|
||||
Drawable aDrawable,
|
||||
GC aGC);
|
||||
|
||||
NS_IMETHOD Init (Display * aDisplay,
|
||||
Screen * aScreen,
|
||||
Visual * aVisual,
|
||||
int aDepth,
|
||||
GC aGC,
|
||||
PRUint32 aWidth,
|
||||
PRUint32 aHeight,
|
||||
PRUint32 aFlags);
|
||||
|
||||
GC GetGC(void) { return mGC; }
|
||||
Drawable GetDrawable(void) { return (mDrawable); }
|
||||
Display * GetDisplay() { return mDisplay; }
|
||||
Screen * GetScreen() { return mScreen; }
|
||||
Visual * GetVisual() { return mVisual; }
|
||||
int GetDepth() { return mDepth; }
|
||||
int GetScreenNumber() { return XScreenNumberOfScreen(mScreen); }
|
||||
|
||||
private:
|
||||
GC mGC;
|
||||
Drawable mDrawable;
|
||||
XImage *mImage;
|
||||
nsPixelFormat mPixFormat;
|
||||
PRUint8 mDepth;
|
||||
Display * mDisplay;
|
||||
Screen * mScreen;
|
||||
Visual * mVisual;
|
||||
int mDepth;
|
||||
GC mGC;
|
||||
Drawable mDrawable;
|
||||
XImage * mImage;
|
||||
nsPixelFormat mPixFormat;
|
||||
|
||||
// for locking
|
||||
PRInt32 mLockX;
|
||||
PRInt32 mLockY;
|
||||
PRUint32 mLockWidth;
|
||||
PRUint32 mLockHeight;
|
||||
PRUint32 mLockFlags;
|
||||
PRBool mLocked;
|
||||
PRInt32 mLockX;
|
||||
PRInt32 mLockY;
|
||||
PRUint32 mLockWidth;
|
||||
PRUint32 mLockHeight;
|
||||
PRUint32 mLockFlags;
|
||||
PRBool mLocked;
|
||||
|
||||
// dimensions
|
||||
PRUint32 mWidth;
|
||||
PRUint32 mHeight;
|
||||
PRUint32 mWidth;
|
||||
PRUint32 mHeight;
|
||||
|
||||
// are we offscreen
|
||||
PRBool mIsOffscreen;
|
||||
PRBool mDestroyDrawable;
|
||||
PRBool mIsOffscreen;
|
||||
PRBool mDestroyDrawable;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -31,8 +31,6 @@
|
||||
|
||||
// these are in the widget set
|
||||
|
||||
extern Display *gDisplay;
|
||||
|
||||
static NS_DEFINE_IID(kIFontMetricsIID, NS_IFONT_METRICS_IID);
|
||||
|
||||
static PRLogModuleInfo * FontMetricsXlibLM = PR_NewLogModule("FontMetricsXlib");
|
||||
@@ -40,6 +38,8 @@ static PRLogModuleInfo * FontMetricsXlibLM = PR_NewLogModule("FontMetricsXlib");
|
||||
nsFontMetricsXlib::nsFontMetricsXlib()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
|
||||
mDisplay = nsnull;
|
||||
mDeviceContext = nsnull;
|
||||
mFont = nsnull;
|
||||
mFontHandle = nsnull;
|
||||
@@ -85,7 +85,7 @@ nsFontMetricsXlib::~nsFontMetricsXlib()
|
||||
#else
|
||||
|
||||
if (0 != mFontHandle) {
|
||||
XFreeFont(gDisplay, mFontHandle);
|
||||
XFreeFont(mDisplay, mFontHandle);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -133,6 +133,8 @@ NS_IMETHODIMP nsFontMetricsXlib::Init(const nsFont& aFont, nsIDeviceContext* aCo
|
||||
|
||||
mDeviceContext = aContext;
|
||||
|
||||
mDisplay = ((nsDeviceContextXlib *) mDeviceContext)->GetDisplay();
|
||||
|
||||
float app2dev;
|
||||
mDeviceContext->GetAppUnitsToDevUnits(app2dev);
|
||||
char* factorStr = getenv("GECKO_FONT_SIZE_FACTOR");
|
||||
@@ -221,7 +223,7 @@ NS_IMETHODIMP nsFontMetricsXlib::Init(const nsFont& aFont, nsIDeviceContext* aCo
|
||||
? 'r'
|
||||
: ((aFont.style == NS_FONT_STYLE_ITALIC) ? 'i' : 'o')),
|
||||
aFont.size / 2);
|
||||
fnames = ::XListFontsWithInfo(gDisplay, &wildstring[namelen + 1],
|
||||
fnames = ::XListFontsWithInfo(mDisplay, &wildstring[namelen + 1],
|
||||
200, &numnames, &fonts);
|
||||
PR_LOG(FontMetricsXlibLM, PR_LOG_DEBUG, (" trying %s[%d]", &wildstring[namelen+1], numnames));
|
||||
}
|
||||
@@ -235,7 +237,7 @@ NS_IMETHODIMP nsFontMetricsXlib::Init(const nsFont& aFont, nsIDeviceContext* aCo
|
||||
(aFont.weight <= NS_FONT_WEIGHT_NORMAL) ? "medium" : "bold",
|
||||
(aFont.style == NS_FONT_STYLE_NORMAL) ? 'r' :
|
||||
((aFont.style == NS_FONT_STYLE_ITALIC) ? 'i' : 'o'), dpi, dpi);
|
||||
fnames = ::XListFontsWithInfo(gDisplay, &wildstring[namelen + 1],
|
||||
fnames = ::XListFontsWithInfo(mDisplay, &wildstring[namelen + 1],
|
||||
200, &numnames, &fonts);
|
||||
|
||||
PR_LOG(FontMetricsXlibLM, PR_LOG_DEBUG, (" trying %s[%d]", &wildstring[namelen+1], numnames));
|
||||
@@ -254,7 +256,7 @@ NS_IMETHODIMP nsFontMetricsXlib::Init(const nsFont& aFont, nsIDeviceContext* aCo
|
||||
(aFont.weight <= NS_FONT_WEIGHT_NORMAL) ? "medium" : "bold",
|
||||
altitalicization, dpi, dpi);
|
||||
|
||||
fnames = ::XListFontsWithInfo(gDisplay, &wildstring[namelen + 1],
|
||||
fnames = ::XListFontsWithInfo(mDisplay, &wildstring[namelen + 1],
|
||||
200, &numnames, &fonts);
|
||||
PR_LOG(FontMetricsXlibLM, PR_LOG_DEBUG, (" trying %s[%d]", &wildstring[namelen+1], numnames));
|
||||
}
|
||||
@@ -273,7 +275,7 @@ NS_IMETHODIMP nsFontMetricsXlib::Init(const nsFont& aFont, nsIDeviceContext* aCo
|
||||
(aFont.style == NS_FONT_STYLE_NORMAL) ? 'r' :
|
||||
((aFont.style == NS_FONT_STYLE_ITALIC) ? 'i' : 'o'),
|
||||
dpi, dpi);
|
||||
fnames = ::XListFontsWithInfo(gDisplay, &wildstring[namelen + 1],
|
||||
fnames = ::XListFontsWithInfo(mDisplay, &wildstring[namelen + 1],
|
||||
200, &numnames, &fonts);
|
||||
PR_LOG(FontMetricsXlibLM, PR_LOG_DEBUG, (" trying %s[%d]", &wildstring[namelen+1], numnames));
|
||||
|
||||
@@ -284,7 +286,7 @@ NS_IMETHODIMP nsFontMetricsXlib::Init(const nsFont& aFont, nsIDeviceContext* aCo
|
||||
newname,
|
||||
(aFont.weight <= NS_FONT_WEIGHT_NORMAL) ? "medium" : "bold",
|
||||
altitalicization, dpi, dpi);
|
||||
fnames = ::XListFontsWithInfo(gDisplay, &wildstring[namelen + 1],
|
||||
fnames = ::XListFontsWithInfo(mDisplay, &wildstring[namelen + 1],
|
||||
200, &numnames, &fonts);
|
||||
PR_LOG(FontMetricsXlibLM, PR_LOG_DEBUG, (" trying %s[%d]", &wildstring[namelen+1], numnames));
|
||||
}
|
||||
@@ -297,7 +299,7 @@ NS_IMETHODIMP nsFontMetricsXlib::Init(const nsFont& aFont, nsIDeviceContext* aCo
|
||||
{
|
||||
char *nametouse = PickAppropriateSize(fnames, fonts, numnames, aFont.size);
|
||||
|
||||
mFontStruct = XLoadQueryFont(gDisplay, nametouse);
|
||||
mFontStruct = XLoadQueryFont(mDisplay, nametouse);
|
||||
mFontHandle = mFontStruct->fid;
|
||||
|
||||
PR_LOG(FontMetricsXlibLM, PR_LOG_DEBUG, (" is: %s\n", nametouse));
|
||||
@@ -310,7 +312,7 @@ NS_IMETHODIMP nsFontMetricsXlib::Init(const nsFont& aFont, nsIDeviceContext* aCo
|
||||
|
||||
PR_LOG(FontMetricsXlibLM, PR_LOG_DEBUG, (" is: %s\n", "fixed (final fallback)"));
|
||||
|
||||
mFontStruct = XLoadQueryFont(gDisplay, "fixed");
|
||||
mFontStruct = XLoadQueryFont(mDisplay, "fixed");
|
||||
mFontHandle = mFontStruct->fid;
|
||||
}
|
||||
|
||||
@@ -1127,7 +1129,7 @@ GetUnderlineInfo(XFontStruct* aFont, unsigned long* aPositionX2,
|
||||
void
|
||||
nsFontXlib::LoadFont(nsFontCharSet* aCharSet, nsFontMetricsXlib* aMetrics)
|
||||
{
|
||||
XFontStruct *xlibFont = XLoadQueryFont(gDisplay, mName);
|
||||
XFontStruct *xlibFont = XLoadQueryFont(aMetrics->mDisplay, mName);
|
||||
if (xlibFont) {
|
||||
mFont = xlibFont;
|
||||
mMap = aCharSet->mInfo->mMap;
|
||||
@@ -1638,13 +1640,13 @@ SearchFamily(PLHashEntry* he, PRIntn i, void* arg)
|
||||
}
|
||||
|
||||
static nsFontFamily*
|
||||
GetFontNames(char* aPattern)
|
||||
GetFontNames(Display * aDisplay,char* aPattern)
|
||||
{
|
||||
nsFontFamily* family = nsnull;
|
||||
|
||||
int count;
|
||||
//PR_LOG(FontMetricsXlibLM, PR_LOG_DEBUG, ("XListFonts %s\n", aPattern));
|
||||
char** list = ::XListFonts(gDisplay, aPattern, INT_MAX, &count);
|
||||
char** list = ::XListFonts(aDisplay, aPattern, INT_MAX, &count);
|
||||
if ((!list) || (count < 1)) {
|
||||
return nsnull;
|
||||
}
|
||||
@@ -1931,7 +1933,7 @@ nsFontMetricsXlib::FindFont(PRUnichar aChar)
|
||||
xName->ToCString(name, sizeof(name));
|
||||
char buf[256];
|
||||
PR_snprintf(buf, sizeof(buf), "-*-%s-*-*-*-*-*-*-*-*-*-*-*-*", name);
|
||||
family = GetFontNames(buf);
|
||||
family = GetFontNames(mDisplay,buf);
|
||||
if (!family) {
|
||||
family = new nsFontFamily; // dummy entry to avoid calling X again
|
||||
if (family) {
|
||||
@@ -1960,7 +1962,7 @@ nsFontMetricsXlib::FindFont(PRUnichar aChar)
|
||||
static int gGotAllFontNames = 0;
|
||||
if (!gGotAllFontNames) {
|
||||
gGotAllFontNames = 1;
|
||||
GetFontNames("-*-*-*-*-*-*-*-*-*-*-*-*-*-*");
|
||||
GetFontNames(mDisplay,"-*-*-*-*-*-*-*-*-*-*-*-*-*-*");
|
||||
}
|
||||
|
||||
PL_HashTableEnumerateEntries(gFamilies, SearchFamily, &search);
|
||||
@@ -2001,12 +2003,12 @@ nsFontMetricsXlib::DrawString(nsDrawingSurfaceXlib* aSurface, nsFontXlib* aFont,
|
||||
(char*) buf, sizeof(buf));
|
||||
XFontStruct *font_struct = aFont->mFont;
|
||||
if ((font_struct->min_byte1 == 0) && (font_struct->max_byte1 == 0))
|
||||
XDrawString(gDisplay,
|
||||
XDrawString(aSurface->GetDisplay(),
|
||||
aSurface->GetDrawable(),
|
||||
aSurface->GetGC(),
|
||||
aX, aY, (char *)buf, len);
|
||||
else
|
||||
XDrawString16(gDisplay,
|
||||
XDrawString16(aSurface->GetDisplay(),
|
||||
aSurface->GetDrawable(),
|
||||
aSurface->GetGC(),
|
||||
aX, aY, buf, len/2);
|
||||
|
||||
@@ -135,6 +135,7 @@ protected:
|
||||
char *PickAppropriateSize(char **names, XFontStruct *fonts, int cnt, nscoord desired);
|
||||
void RealizeFont();
|
||||
|
||||
Display *mDisplay;
|
||||
nsIDeviceContext *mDeviceContext;
|
||||
nsFont *mFont;
|
||||
XFontStruct *mFontHandle;
|
||||
|
||||
@@ -45,6 +45,7 @@ nsImageXlib::nsImageXlib()
|
||||
mAlphaHeight = 0;
|
||||
mLocation.x = 0;
|
||||
mLocation.y = 0;
|
||||
mDisplay = nsnull;
|
||||
}
|
||||
|
||||
nsImageXlib::~nsImageXlib()
|
||||
@@ -57,12 +58,28 @@ nsImageXlib::~nsImageXlib()
|
||||
if (nsnull != mAlphaBits) {
|
||||
delete[] mAlphaBits;
|
||||
mAlphaBits = nsnull;
|
||||
if (mAlphaPixmap != 0) {
|
||||
XFreePixmap(gDisplay, mAlphaPixmap);
|
||||
|
||||
if (mAlphaPixmap != 0)
|
||||
{
|
||||
// The display cant be null. It gets fetched from the drawing
|
||||
// surface used to create the pixmap. It gets assigned once
|
||||
// in Draw()
|
||||
NS_ASSERTION(nsnull != mDisplay,"display is null.");
|
||||
|
||||
printf("XFreePixmap(display = %p)\n",mDisplay);
|
||||
|
||||
XFreePixmap(mDisplay, mAlphaPixmap);
|
||||
|
||||
}
|
||||
}
|
||||
if (mImagePixmap != 0) {
|
||||
XFreePixmap(gDisplay, mImagePixmap);
|
||||
|
||||
if (mImagePixmap != 0)
|
||||
{
|
||||
NS_ASSERTION(nsnull != mDisplay,"display is null.");
|
||||
|
||||
printf("XFreePixmap(display = %p)\n",mDisplay);
|
||||
|
||||
XFreePixmap(mDisplay, mImagePixmap);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,15 +128,24 @@ nsImageXlib::Draw(nsIRenderingContext &aContext,
|
||||
}
|
||||
nsDrawingSurfaceXlib *drawing = (nsDrawingSurfaceXlib*)aSurface;
|
||||
|
||||
// Assign the display only once, since this is will be the only
|
||||
// time we will have a access to a drawing surface - from which
|
||||
// we can fetch the display.
|
||||
if (nsnull == mDisplay)
|
||||
mDisplay = drawing->GetDisplay();
|
||||
|
||||
XImage *x_image = nsnull;
|
||||
GC gc;
|
||||
XGCValues gcv;
|
||||
|
||||
if ((mAlphaBits != nsnull) && (mAlphaPixmap == 0)) {
|
||||
// create a pixmap for this.
|
||||
mAlphaPixmap = XCreatePixmap(gDisplay, RootWindow(gDisplay, gScreenNum), aWidth, aHeight, 1);
|
||||
mAlphaPixmap = XCreatePixmap(mDisplay,
|
||||
RootWindow(mDisplay, drawing->GetScreenNumber()),
|
||||
aWidth, aHeight, 1);
|
||||
// create an x image for it.
|
||||
x_image = XCreateImage(gDisplay, gVisual,
|
||||
x_image = XCreateImage(mDisplay,
|
||||
drawing->GetVisual(),
|
||||
1, /* visual depth - this is a bitmap */
|
||||
XYPixmap,
|
||||
0,
|
||||
@@ -138,11 +164,11 @@ nsImageXlib::Draw(nsIRenderingContext &aContext,
|
||||
x_image->byte_order = MSBFirst;
|
||||
memset(&gcv, 0, sizeof(XGCValues));
|
||||
gcv.function = GXcopy;
|
||||
gc = XCreateGC(gDisplay, mAlphaPixmap, GCFunction, &gcv);
|
||||
XPutImage(gDisplay, mAlphaPixmap, gc, x_image,
|
||||
gc = XCreateGC(mDisplay, mAlphaPixmap, GCFunction, &gcv);
|
||||
XPutImage(mDisplay, mAlphaPixmap, gc, x_image,
|
||||
0, 0, 0, 0,
|
||||
aWidth, aHeight);
|
||||
XFreeGC(gDisplay, gc);
|
||||
XFreeGC(mDisplay, gc);
|
||||
|
||||
// done with the temp image.
|
||||
x_image->data = 0; /* don't free IL_Pixmap's bits */
|
||||
@@ -150,10 +176,14 @@ nsImageXlib::Draw(nsIRenderingContext &aContext,
|
||||
}
|
||||
|
||||
if (nsnull == mImagePixmap) {
|
||||
mImagePixmap = XCreatePixmap(gDisplay, RootWindow(gDisplay, gScreenNum),
|
||||
aWidth, aHeight, gDepth);
|
||||
XSetClipOrigin(gDisplay, drawing->GetGC(), 0, 0);
|
||||
XSetClipMask(gDisplay, drawing->GetGC(), None);
|
||||
mImagePixmap = XCreatePixmap(mDisplay,
|
||||
RootWindow(mDisplay, drawing->GetScreenNumber()),
|
||||
aWidth,
|
||||
aHeight,
|
||||
drawing->GetDepth());
|
||||
|
||||
XSetClipOrigin(mDisplay, drawing->GetGC(), 0, 0);
|
||||
XSetClipMask(mDisplay, drawing->GetGC(), None);
|
||||
xlib_draw_rgb_image (mImagePixmap,
|
||||
drawing->GetGC(),
|
||||
0, 0, aWidth, aHeight,
|
||||
@@ -163,11 +193,11 @@ nsImageXlib::Draw(nsIRenderingContext &aContext,
|
||||
|
||||
if (nsnull != mAlphaPixmap) {
|
||||
// set up the gc to use the alpha pixmap for clipping
|
||||
XSetClipOrigin(gDisplay, drawing->GetGC(), aX, aY);
|
||||
XSetClipMask(gDisplay, drawing->GetGC(), mAlphaPixmap);
|
||||
XSetClipOrigin(mDisplay, drawing->GetGC(), aX, aY);
|
||||
XSetClipMask(mDisplay, drawing->GetGC(), mAlphaPixmap);
|
||||
}
|
||||
|
||||
XCopyArea(gDisplay, // display
|
||||
XCopyArea(mDisplay, // display
|
||||
mImagePixmap, // source
|
||||
drawing->GetDrawable(), // dest
|
||||
drawing->GetGC(), // GC
|
||||
@@ -176,8 +206,8 @@ nsImageXlib::Draw(nsIRenderingContext &aContext,
|
||||
aX, aY); // xdest, ydest
|
||||
|
||||
if (mAlphaPixmap != nsnull) {
|
||||
XSetClipOrigin(gDisplay, drawing->GetGC(), 0, 0);
|
||||
XSetClipMask(gDisplay, drawing->GetGC(), None);
|
||||
XSetClipOrigin(mDisplay, drawing->GetGC(), 0, 0);
|
||||
XSetClipMask(mDisplay, drawing->GetGC(), None);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
@@ -193,6 +223,13 @@ nsImageXlib::Draw(nsIRenderingContext &aContext,
|
||||
{
|
||||
PR_LOG(ImageXlibLM, PR_LOG_DEBUG, ("nsImageXlib::Draw()\n"));
|
||||
nsDrawingSurfaceXlib *drawing = (nsDrawingSurfaceXlib *)aSurface;
|
||||
|
||||
// Assign the display only once, since this is will be the only
|
||||
// time we will have a access to a drawing surface - from which
|
||||
// we can fetch the display.
|
||||
if (nsnull == mDisplay)
|
||||
mDisplay = drawing->GetDisplay();
|
||||
|
||||
xlib_draw_rgb_image (drawing->GetDrawable(),
|
||||
drawing->GetGC(),
|
||||
aDX, aDY, aDWidth, aDHeight,
|
||||
@@ -217,11 +254,11 @@ nsImageXlib::ImageUpdated(nsIDeviceContext *aContext,
|
||||
PR_LOG(ImageXlibLM, PR_LOG_DEBUG, ("nsImageXlib::ImageUpdated()\n"));
|
||||
if (nsImageUpdateFlags_kBitsChanged & aFlags) {
|
||||
if (mAlphaPixmap != 0) {
|
||||
XFreePixmap(gDisplay, mAlphaPixmap);
|
||||
XFreePixmap(mDisplay, mAlphaPixmap);
|
||||
mAlphaPixmap = 0;
|
||||
}
|
||||
if (mImagePixmap != 0) {
|
||||
XFreePixmap(gDisplay, mImagePixmap);
|
||||
XFreePixmap(mDisplay, mImagePixmap);
|
||||
mImagePixmap = 0;
|
||||
}
|
||||
}
|
||||
@@ -242,12 +279,12 @@ nsImageXlib::Init(PRInt32 aWidth, PRInt32 aHeight,
|
||||
delete[] mAlphaBits;
|
||||
mAlphaBits = nsnull;
|
||||
if (mAlphaPixmap != 0) {
|
||||
XFreePixmap(gDisplay, mAlphaPixmap);
|
||||
XFreePixmap(mDisplay, mAlphaPixmap);
|
||||
mAlphaPixmap = 0;
|
||||
}
|
||||
}
|
||||
if (mImagePixmap != 0) {
|
||||
XFreePixmap(gDisplay, mImagePixmap);
|
||||
XFreePixmap(mDisplay, mImagePixmap);
|
||||
mImagePixmap = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,15 +24,6 @@
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/Xos.h>
|
||||
|
||||
// these are defined in the Xlib widget classes but I need access
|
||||
// to them here. fun without an external library.
|
||||
|
||||
extern Display *gDisplay;
|
||||
extern Screen *gScreen;
|
||||
extern int gScreenNum;
|
||||
extern int gDepth;
|
||||
extern Visual *gVisual;
|
||||
|
||||
class nsImageXlib : public nsIImage {
|
||||
public:
|
||||
nsImageXlib();
|
||||
@@ -86,6 +77,7 @@ private:
|
||||
PRUint32 mSizeImage;
|
||||
PRInt8 mNumBytesPixel;
|
||||
Pixmap mImagePixmap;
|
||||
Display * mDisplay;
|
||||
|
||||
// for alpha mask
|
||||
PRUint8 *mAlphaBits;
|
||||
|
||||
@@ -73,6 +73,11 @@ nsRenderingContextXlib::nsRenderingContextXlib()
|
||||
mCurrentLineStyle = nsLineStyle_kSolid;
|
||||
mCurrentColor = NS_RGB(0, 0, 0);
|
||||
|
||||
mDisplay = nsnull;
|
||||
mScreen = nsnull;
|
||||
mVisual = nsnull;
|
||||
mDepth = 0;
|
||||
|
||||
PushState();
|
||||
}
|
||||
|
||||
@@ -149,12 +154,26 @@ nsRenderingContextXlib::Init(nsIDeviceContext* aContext, nsIWidget *aWindow)
|
||||
mContext = aContext;
|
||||
NS_IF_ADDREF(mContext);
|
||||
|
||||
NS_ASSERTION(nsnull != mContext,"Device context is null.");
|
||||
|
||||
mDisplay = ((nsDeviceContextXlib *) mContext)->GetDisplay();
|
||||
mScreen = ((nsDeviceContextXlib *) mContext)->GetScreen();
|
||||
mVisual = ((nsDeviceContextXlib *) mContext)->GetVisual();
|
||||
mDepth = ((nsDeviceContextXlib *) mContext)->GetDepth();
|
||||
|
||||
mRenderingSurface = (nsDrawingSurfaceXlib *)new nsDrawingSurfaceXlib();
|
||||
|
||||
if (mRenderingSurface) {
|
||||
Drawable win = (Drawable)aWindow->GetNativeData(NS_NATIVE_WINDOW);
|
||||
GC gc = (GC)aWindow->GetNativeData(NS_NATIVE_GRAPHIC);
|
||||
mRenderingSurface->Init(win, gc);
|
||||
|
||||
mRenderingSurface->Init(mDisplay,
|
||||
mScreen,
|
||||
mVisual,
|
||||
mDepth,
|
||||
win,
|
||||
gc);
|
||||
|
||||
mOffscreenSurface = mRenderingSurface;
|
||||
NS_ADDREF(mRenderingSurface);
|
||||
}
|
||||
@@ -169,6 +188,13 @@ nsRenderingContextXlib::Init(nsIDeviceContext* aContext, nsDrawingSurface aSurfa
|
||||
mContext = aContext;
|
||||
NS_IF_ADDREF(mContext);
|
||||
|
||||
NS_ASSERTION(nsnull != mContext,"Device context is null.");
|
||||
|
||||
mDisplay = ((nsDeviceContextXlib *) mContext)->GetDisplay();
|
||||
mScreen = ((nsDeviceContextXlib *) mContext)->GetScreen();
|
||||
mVisual = ((nsDeviceContextXlib *) mContext)->GetVisual();
|
||||
mDepth = ((nsDeviceContextXlib *) mContext)->GetDepth();
|
||||
|
||||
mRenderingSurface = (nsDrawingSurfaceXlib *)aSurface;
|
||||
|
||||
if (nsnull != mRenderingSurface) {
|
||||
@@ -185,7 +211,7 @@ nsresult nsRenderingContextXlib::CommonInit(void)
|
||||
unsigned int width, height, border, depth;
|
||||
Window root_win;
|
||||
|
||||
XGetGeometry(gDisplay, mRenderingSurface->GetDrawable(), &root_win,
|
||||
XGetGeometry(mDisplay, mRenderingSurface->GetDrawable(), &root_win,
|
||||
&x, &y, &width, &height, &border, &depth);
|
||||
mClipRegion = new nsRegionXlib();
|
||||
mClipRegion->Init();
|
||||
@@ -325,7 +351,7 @@ nsRenderingContextXlib::PopState(PRBool &aClipState)
|
||||
if (mRenderingSurface && mClipRegion) {
|
||||
Region region;
|
||||
mClipRegion->GetNativeRegion((void *&)region);
|
||||
XSetRegion(gDisplay, mRenderingSurface->GetGC(), region);
|
||||
XSetRegion(mDisplay, mRenderingSurface->GetGC(), region);
|
||||
}
|
||||
|
||||
if (state->mColor != mCurrentColor)
|
||||
@@ -377,7 +403,7 @@ nsRenderingContextXlib::SetClipRect(const nsRect& aRect, nsClipCombine aCombine,
|
||||
aClipState = mClipRegion->IsEmpty();
|
||||
|
||||
mClipRegion->GetNativeRegion((void*&)rgn);
|
||||
XSetRegion(gDisplay, mRenderingSurface->GetGC(), rgn);
|
||||
XSetRegion(mDisplay, mRenderingSurface->GetGC(), rgn);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@@ -421,7 +447,7 @@ nsRenderingContextXlib::SetClipRegion(const nsIRegion& aRegion, nsClipCombine aC
|
||||
|
||||
aClipState = mClipRegion->IsEmpty();
|
||||
mClipRegion->GetNativeRegion((void*&)rgn);
|
||||
XSetRegion(gDisplay, mRenderingSurface->GetGC(),rgn);
|
||||
XSetRegion(mDisplay, mRenderingSurface->GetGC(),rgn);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@@ -465,7 +491,7 @@ nsRenderingContextXlib::SetLineStyle(nsLineStyle aLineStyle)
|
||||
switch(aLineStyle)
|
||||
{
|
||||
case nsLineStyle_kSolid:
|
||||
XSetLineAttributes(gDisplay, mRenderingSurface->GetGC(),
|
||||
XSetLineAttributes(mDisplay, mRenderingSurface->GetGC(),
|
||||
1, // width
|
||||
LineSolid, // line style
|
||||
CapNotLast,// cap style
|
||||
@@ -474,7 +500,7 @@ nsRenderingContextXlib::SetLineStyle(nsLineStyle aLineStyle)
|
||||
case nsLineStyle_kDashed:
|
||||
{
|
||||
static char dashed[2] = {4,4};
|
||||
XSetDashes(gDisplay, mRenderingSurface->GetGC(),
|
||||
XSetDashes(mDisplay, mRenderingSurface->GetGC(),
|
||||
0, dashed, 2);
|
||||
}
|
||||
break;
|
||||
@@ -482,7 +508,7 @@ nsRenderingContextXlib::SetLineStyle(nsLineStyle aLineStyle)
|
||||
case nsLineStyle_kDotted:
|
||||
{
|
||||
static char dotted[2] = {3,1};
|
||||
XSetDashes(gDisplay, mRenderingSurface->GetGC(),
|
||||
XSetDashes(mDisplay, mRenderingSurface->GetGC(),
|
||||
0, dotted, 2);
|
||||
}
|
||||
break;
|
||||
@@ -577,7 +603,7 @@ nsRenderingContextXlib::SetFont(nsIFontMetrics *aFontMetrics)
|
||||
nsFontHandle fontHandle;
|
||||
mFontMetrics->GetFontHandle(fontHandle);
|
||||
mCurrentFont = (XFontStruct *)fontHandle;
|
||||
XSetFont(gDisplay, mRenderingSurface->GetGC(), mCurrentFont->fid);
|
||||
XSetFont(mDisplay, mRenderingSurface->GetGC(), mCurrentFont->fid);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
@@ -628,8 +654,15 @@ nsRenderingContextXlib::CreateDrawingSurface(nsRect *aBounds, PRUint32 aSurfFlag
|
||||
|
||||
if (surf) {
|
||||
NS_ADDREF(surf);
|
||||
surf->Init(mRenderingSurface->GetGC(),
|
||||
aBounds->width, aBounds->height, aSurfFlags);
|
||||
|
||||
surf->Init(mDisplay,
|
||||
mScreen,
|
||||
mVisual,
|
||||
mDepth,
|
||||
mRenderingSurface->GetGC(),
|
||||
aBounds->width,
|
||||
aBounds->height,
|
||||
aSurfFlags);
|
||||
}
|
||||
|
||||
aSurface = (nsDrawingSurface)surf;
|
||||
@@ -658,7 +691,7 @@ nsRenderingContextXlib::DrawLine(nscoord aX0, nscoord aY0, nscoord aX1, nscoord
|
||||
mTMatrix->TransformCoord(&aX0,&aY0);
|
||||
mTMatrix->TransformCoord(&aX1,&aY1);
|
||||
|
||||
::XDrawLine(gDisplay, mRenderingSurface->GetDrawable(),
|
||||
::XDrawLine(mDisplay, mRenderingSurface->GetDrawable(),
|
||||
mRenderingSurface->GetGC(), aX0, aY0, aX1, aY1);
|
||||
|
||||
return NS_OK;
|
||||
@@ -694,7 +727,7 @@ nsRenderingContextXlib::DrawPolyline(const nsPoint aPoints[], PRInt32 aNumPoints
|
||||
mTMatrix->TransformCoord((PRInt32*)&thispoint->x,(PRInt32*)&thispoint->y);
|
||||
}
|
||||
|
||||
::XDrawLines(gDisplay,
|
||||
::XDrawLines(mDisplay,
|
||||
mRenderingSurface->GetDrawable(),
|
||||
mRenderingSurface->GetGC(),
|
||||
xpoints, aNumPoints, CoordModeOrigin);
|
||||
@@ -728,7 +761,7 @@ nsRenderingContextXlib::DrawRect(nscoord aX, nscoord aY, nscoord aWidth, nscoord
|
||||
|
||||
mTMatrix->TransformCoord(&x,&y,&w,&h);
|
||||
|
||||
::XDrawRectangle(gDisplay,
|
||||
::XDrawRectangle(mDisplay,
|
||||
mRenderingSurface->GetDrawable(),
|
||||
mRenderingSurface->GetGC(),
|
||||
x,y,w,h);
|
||||
@@ -759,7 +792,7 @@ nsRenderingContextXlib::FillRect(nscoord aX, nscoord aY, nscoord aWidth, nscoord
|
||||
mTMatrix->TransformCoord(&x,&y,&w,&h);
|
||||
PR_LOG(RenderingContextXlibLM, PR_LOG_DEBUG, ("About to fill window 0x%lxd with rect %d %d %d %d\n",
|
||||
mRenderingSurface->GetDrawable(), x, y, w, h));
|
||||
::XFillRectangle(gDisplay,
|
||||
::XFillRectangle(mDisplay,
|
||||
mRenderingSurface->GetDrawable(),
|
||||
mRenderingSurface->GetGC(),
|
||||
x,y,w,h);
|
||||
@@ -787,7 +820,7 @@ nsRenderingContextXlib::DrawPolygon(const nsPoint aPoints[], PRInt32 aNumPoints)
|
||||
mTMatrix->TransformCoord((PRInt32*)&thispoint->x,(PRInt32*)&thispoint->y);
|
||||
}
|
||||
|
||||
::XDrawLines(gDisplay,
|
||||
::XDrawLines(mDisplay,
|
||||
mRenderingSurface->GetDrawable(),
|
||||
mRenderingSurface->GetGC(),
|
||||
xpoints, aNumPoints, CoordModeOrigin);
|
||||
@@ -820,7 +853,7 @@ nsRenderingContextXlib::FillPolygon(const nsPoint aPoints[], PRInt32 aNumPoints)
|
||||
thispoint->y = y;
|
||||
}
|
||||
|
||||
::XFillPolygon(gDisplay,
|
||||
::XFillPolygon(mDisplay,
|
||||
mRenderingSurface->GetDrawable(),
|
||||
mRenderingSurface->GetGC(),
|
||||
xpoints, aNumPoints, Convex, CoordModeOrigin);
|
||||
@@ -853,7 +886,7 @@ nsRenderingContextXlib::DrawEllipse(nscoord aX, nscoord aY, nscoord aWidth, nsco
|
||||
|
||||
mTMatrix->TransformCoord(&x,&y,&w,&h);
|
||||
|
||||
::XDrawArc(gDisplay,
|
||||
::XDrawArc(mDisplay,
|
||||
mRenderingSurface->GetDrawable(),
|
||||
mRenderingSurface->GetGC(),
|
||||
x,y,w,h, 0, 360 * 64);
|
||||
@@ -884,7 +917,7 @@ nsRenderingContextXlib::FillEllipse(nscoord aX, nscoord aY, nscoord aWidth, nsco
|
||||
|
||||
mTMatrix->TransformCoord(&x,&y,&w,&h);
|
||||
|
||||
::XFillArc(gDisplay,
|
||||
::XFillArc(mDisplay,
|
||||
mRenderingSurface->GetDrawable(),
|
||||
mRenderingSurface->GetGC(),
|
||||
x,y,w,h, 0, 360 * 64);
|
||||
@@ -917,7 +950,7 @@ nsRenderingContextXlib::DrawArc(nscoord aX, nscoord aY, nscoord aWidth, nscoord
|
||||
|
||||
mTMatrix->TransformCoord(&x,&y,&w,&h);
|
||||
|
||||
::XDrawArc(gDisplay,
|
||||
::XDrawArc(mDisplay,
|
||||
mRenderingSurface->GetDrawable(),
|
||||
mRenderingSurface->GetGC(),
|
||||
x,y,w,h, NSToIntRound(aStartAngle * 64.0f),
|
||||
@@ -951,7 +984,7 @@ nsRenderingContextXlib::FillArc(nscoord aX, nscoord aY, nscoord aWidth, nscoord
|
||||
|
||||
mTMatrix->TransformCoord(&x,&y,&w,&h);
|
||||
|
||||
::XFillArc(gDisplay,
|
||||
::XFillArc(mDisplay,
|
||||
mRenderingSurface->GetDrawable(),
|
||||
mRenderingSurface->GetGC(),
|
||||
x,y,w,h, NSToIntRound(aStartAngle * 64.0f),
|
||||
@@ -1098,7 +1131,7 @@ nsRenderingContextXlib::DrawString(const char *aString, PRUint32 aLength,
|
||||
nscoord xx = x;
|
||||
nscoord yy = y;
|
||||
mTMatrix->TransformCoord(&xx, &yy);
|
||||
XDrawString(gDisplay,
|
||||
XDrawString(mDisplay,
|
||||
mRenderingSurface->GetDrawable(),
|
||||
mRenderingSurface->GetGC(),
|
||||
xx, yy, &ch, 1);
|
||||
@@ -1107,7 +1140,7 @@ nsRenderingContextXlib::DrawString(const char *aString, PRUint32 aLength,
|
||||
}
|
||||
else {
|
||||
mTMatrix->TransformCoord(&x, &y);
|
||||
XDrawString(gDisplay,
|
||||
XDrawString(mDisplay,
|
||||
mRenderingSurface->GetDrawable(),
|
||||
mRenderingSurface->GetGC(),
|
||||
x, y, aString, aLength);
|
||||
@@ -1352,7 +1385,7 @@ nsRenderingContextXlib::CopyOffScreenBits(nsDrawingSurface aSrcSurf, PRInt32 aSr
|
||||
//XXX flags are unused. that would seem to mean that there is
|
||||
//inefficiency somewhere... MMP
|
||||
|
||||
XCopyArea(gDisplay,
|
||||
XCopyArea(mDisplay,
|
||||
((nsDrawingSurfaceXlib *)aSrcSurf)->GetDrawable(),
|
||||
destsurf->GetDrawable(),
|
||||
((nsDrawingSurfaceXlib *)aSrcSurf)->GetGC(),
|
||||
|
||||
@@ -46,7 +46,7 @@ class nsRenderingContextXlib : public nsIRenderingContext,
|
||||
{
|
||||
public:
|
||||
nsRenderingContextXlib();
|
||||
~nsRenderingContextXlib();
|
||||
virtual ~nsRenderingContextXlib();
|
||||
|
||||
NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW
|
||||
|
||||
@@ -173,6 +173,10 @@ private:
|
||||
float mP2T;
|
||||
void *mScriptObject;
|
||||
nscolor mCurrentColor;
|
||||
Display * mDisplay;
|
||||
Screen * mScreen;
|
||||
Visual * mVisual;
|
||||
int mDepth;
|
||||
|
||||
// graphics state stuff
|
||||
nsVoidArray *mStateCache;
|
||||
|
||||
Reference in New Issue
Block a user