mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-03 12:35:58 +00:00
Fix build and runtime bustage in xlib port. b=75125 r=blizzard@mozilla.org sr=shaver@mozilla.org
This commit is contained in:
parent
aa8dbfcee4
commit
30295f72b6
@ -29,7 +29,7 @@ include $(DEPTH)/config/autoconf.mk
|
||||
MODULE = layout
|
||||
LIBRARY_NAME = gfx_xlib
|
||||
IS_COMPONENT = 1
|
||||
REQUIRES = xpcom string xlibrgb widget dom layout appshell js necko pref img util view uconv locale unicharutil
|
||||
REQUIRES = xpcom string xlibrgb widget dom layout appshell js necko pref img util view uconv locale unicharutil gfx2 mozcomps
|
||||
|
||||
CPPSRCS = \
|
||||
nsDeviceContextSpecFactoryX.cpp \
|
||||
|
@ -1796,12 +1796,6 @@ nsFontXlibNormal::GetBoundingMetrics(const PRUnichar* aString,
|
||||
aBoundingMetrics.width = overall.width;
|
||||
aBoundingMetrics.ascent = overall.ascent;
|
||||
aBoundingMetrics.descent = overall.descent;
|
||||
|
||||
unsigned long pr = 0;
|
||||
if (::XGetFontProperty(mFont, XA_ITALIC_ANGLE, &pr)) {
|
||||
aBoundingMetrics.subItalicCorrection = (int) pr;
|
||||
aBoundingMetrics.supItalicCorrection = (int) pr;
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
@ -2051,12 +2045,6 @@ nsFontXlibUserDefined::GetBoundingMetrics(const PRUnichar* aString,
|
||||
aBoundingMetrics.width = overall.width;
|
||||
aBoundingMetrics.ascent = overall.ascent;
|
||||
aBoundingMetrics.descent = overall.descent;
|
||||
|
||||
unsigned long pr = 0;
|
||||
if (::XGetFontProperty(mFont, XA_ITALIC_ANGLE, &pr)) {
|
||||
aBoundingMetrics.subItalicCorrection = (int) pr;
|
||||
aBoundingMetrics.supItalicCorrection = (int) pr;
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -28,8 +28,6 @@
|
||||
|
||||
#define IsFlagSet(a,b) ((a) & (b))
|
||||
|
||||
static NS_DEFINE_IID(kIImageIID, NS_IIMAGE_IID);
|
||||
|
||||
static PRLogModuleInfo *ImageXlibLM = PR_NewLogModule("ImageXlib");
|
||||
|
||||
nsImageXlib::nsImageXlib()
|
||||
@ -98,7 +96,7 @@ nsImageXlib::~nsImageXlib()
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsImageXlib, kIImageIID);
|
||||
NS_IMPL_ISUPPORTS1(nsImageXlib, nsIImage)
|
||||
|
||||
nsresult nsImageXlib::Init(PRInt32 aWidth, PRInt32 aHeight,
|
||||
PRInt32 aDepth, nsMaskRequirements aMaskRequirements)
|
||||
@ -894,8 +892,6 @@ NS_IMETHODIMP nsImageXlib::DrawTile(nsIRenderingContext &aContext,
|
||||
nsRect &aSrcRect,
|
||||
nsRect &aTileRect)
|
||||
{
|
||||
nsDrawingSurfaceXlib *drawing = (nsDrawingSurfaceXlib*)aSurface;
|
||||
|
||||
PRInt32
|
||||
aY0 = aTileRect.y,
|
||||
aX0 = aTileRect.x,
|
||||
@ -1055,3 +1051,47 @@ nsImageXlib::SetDecodedRect(PRInt32 x1, PRInt32 y1, PRInt32 x2, PRInt32 y2)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
#ifdef USE_IMG2
|
||||
NS_IMETHODIMP nsImageXlib::DrawToImage(nsIImage* aDstImage,
|
||||
nscoord aDX, nscoord aDY,
|
||||
nscoord aDWidth, nscoord aDHeight)
|
||||
{
|
||||
#if 0
|
||||
// XXX This is a copy of the GTK version, partially converted for
|
||||
// the xlib port. I can't figure out how to finish it.
|
||||
nsImageXlib *dest = NS_STATIC_CAST(nsImageXlib *, aDstImage);
|
||||
if (!dest)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsDrawingSurfaceXlib *drawing = /* XXX What should this be!?!?! */ nsnull;
|
||||
NS_ENSURE_TRUE(drawing, NS_ERROR_FAILURE);
|
||||
|
||||
if (!dest->mImagePixmap)
|
||||
dest->CreateOffscreenPixmap(dest->mWidth, dest->mHeight, drawing);
|
||||
|
||||
if (!dest->mImagePixmap || !mImagePixmap)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
if (!mDisplay)
|
||||
mDisplay = drawing->GetDisplay();
|
||||
GC gc = XCreateGC(mDisplay, dest->mImagePixmap, 0, NULL);
|
||||
|
||||
if (mAlphaDepth == 1)
|
||||
CreateAlphaBitmap(mWidth, mHeight, drawing);
|
||||
|
||||
if (mAlphaPixmap) {
|
||||
SetupGCForAlpha(gc, 0, 0);
|
||||
}
|
||||
|
||||
XCopyArea(dest->mDisplay, mImagePixmap, dest->mImagePixmap, gc,
|
||||
0, 0, mWidth, mHeight, aDX, aDY);
|
||||
|
||||
XFreeGC(mDisplay, gc);
|
||||
|
||||
return NS_OK;
|
||||
#else
|
||||
NS_NOTREACHED("nsImageXlib::DrawToImage not yet implemented");
|
||||
return NS_ERROR_FAILURE;
|
||||
#endif
|
||||
}
|
||||
#endif // USE_IMG2
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include "X11/Xlib.h"
|
||||
#include "X11/Xutil.h"
|
||||
#include "X11/Xos.h"
|
||||
class nsDrawingSurfaceXlib;
|
||||
|
||||
class nsImageXlib : public nsIImage {
|
||||
public:
|
||||
@ -67,6 +68,11 @@ public:
|
||||
PRInt32 aSX, PRInt32 aSY, PRInt32 aSWidth, PRInt32 aSHeight,
|
||||
PRInt32 aDX, PRInt32 aDY, PRInt32 aDWidth, PRInt32 aDHeight);
|
||||
|
||||
#ifdef USE_IMG2
|
||||
NS_IMETHOD DrawToImage(nsIImage* aDstImage, nscoord aDX, nscoord aDY,
|
||||
nscoord aDWidth, nscoord aDHeight);
|
||||
#endif
|
||||
|
||||
NS_IMETHOD DrawTile(nsIRenderingContext &aContext,
|
||||
nsDrawingSurface aSurface,
|
||||
nsRect &aSrcRect,
|
||||
|
@ -30,8 +30,6 @@
|
||||
#include "prprf.h"
|
||||
#include "prmem.h"
|
||||
|
||||
static NS_DEFINE_IID(kIRenderingContextIID, NS_IRENDERING_CONTEXT_IID);
|
||||
|
||||
NS_IMPL_THREADSAFE_ISUPPORTS1(nsRenderingContextXlib, nsIRenderingContext)
|
||||
|
||||
static PRLogModuleInfo * RenderingContextXlibLM = PR_NewLogModule("RenderingContextXlib");
|
||||
@ -74,7 +72,7 @@ nsRenderingContextXlib::nsRenderingContextXlib()
|
||||
mRenderingSurface = nsnull;
|
||||
mContext = nsnull;
|
||||
mFontMetrics = nsnull;
|
||||
mTMatrix = nsnull;
|
||||
mTranMatrix = nsnull;
|
||||
mP2T = 1.0f;
|
||||
mStateCache = new nsVoidArray();
|
||||
mCurrentFont = nsnull;
|
||||
@ -104,44 +102,13 @@ nsRenderingContextXlib::~nsRenderingContextXlib()
|
||||
delete mStateCache;
|
||||
mStateCache = nsnull;
|
||||
}
|
||||
if (mTMatrix)
|
||||
delete mTMatrix;
|
||||
if (mTranMatrix)
|
||||
delete mTranMatrix;
|
||||
NS_IF_RELEASE(mOffscreenSurface);
|
||||
NS_IF_RELEASE(mFontMetrics);
|
||||
NS_IF_RELEASE(mContext);
|
||||
}
|
||||
|
||||
#if 0
|
||||
nsresult
|
||||
nsRenderingContextXlib::QueryInterface(const nsIID& aIID, void** aInstancePtr)
|
||||
{
|
||||
if (nsnull == aInstancePtr)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
if (aIID.Equals(kIRenderingContextIID))
|
||||
{
|
||||
nsIRenderingContext* tmp = this;
|
||||
*aInstancePtr = (void*) tmp;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
|
||||
if (aIID.Equals(kISupportsIID))
|
||||
{
|
||||
nsIRenderingContext* tmp = this;
|
||||
nsISupports* tmp2 = tmp;
|
||||
*aInstancePtr = (void*) tmp2;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(nsRenderingContextXlib)
|
||||
NS_IMPL_RELEASE(nsRenderingContextXlib)
|
||||
#endif
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsRenderingContextXlib::Init(nsIDeviceContext* aContext, nsIWidget *aWindow)
|
||||
{
|
||||
@ -232,7 +199,7 @@ nsresult nsRenderingContextXlib::CommonInit(void)
|
||||
mContext->GetDevUnitsToAppUnits(mP2T);
|
||||
float app2dev;
|
||||
mContext->GetAppUnitsToDevUnits(app2dev);
|
||||
mTMatrix->AddScale(app2dev, app2dev);
|
||||
mTranMatrix->AddScale(app2dev, app2dev);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -318,14 +285,14 @@ nsRenderingContextXlib::PushState(void)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
state->mMatrix = mTMatrix;
|
||||
state->mMatrix = mTranMatrix;
|
||||
|
||||
mStateCache->AppendElement(state);
|
||||
|
||||
if (nsnull == mTMatrix)
|
||||
mTMatrix = new nsTransform2D();
|
||||
if (nsnull == mTranMatrix)
|
||||
mTranMatrix = new nsTransform2D();
|
||||
else
|
||||
mTMatrix = new nsTransform2D(mTMatrix);
|
||||
mTranMatrix = new nsTransform2D(mTranMatrix);
|
||||
|
||||
if (mClipRegion) {
|
||||
state->mClipRegion = mClipRegion;
|
||||
@ -355,9 +322,9 @@ nsRenderingContextXlib::PopState(PRBool &aClipState)
|
||||
state = (GraphicsState *)mStateCache->ElementAt(cnt - 1);
|
||||
mStateCache->RemoveElementAt(cnt - 1);
|
||||
|
||||
if (mTMatrix)
|
||||
delete mTMatrix;
|
||||
mTMatrix = state->mMatrix;
|
||||
if (mTranMatrix)
|
||||
delete mTranMatrix;
|
||||
mTranMatrix = state->mMatrix;
|
||||
|
||||
mClipRegion = state->mClipRegion;
|
||||
if (mFontMetrics != state->mFontMetrics)
|
||||
@ -399,7 +366,7 @@ nsRenderingContextXlib::SetClipRect(const nsRect& aRect, nsClipCombine aCombine,
|
||||
PR_LOG(RenderingContextXlibLM, PR_LOG_DEBUG, ("nsRenderingContextXlib::SetClipRect()\n"));
|
||||
nsRect trect = aRect;
|
||||
Region rgn;
|
||||
mTMatrix->TransformCoord(&trect.x, &trect.y,
|
||||
mTranMatrix->TransformCoord(&trect.x, &trect.y,
|
||||
&trect.width, &trect.height);
|
||||
switch(aCombine) {
|
||||
case nsClipCombine_kIntersect:
|
||||
@ -601,7 +568,7 @@ NS_IMETHODIMP
|
||||
nsRenderingContextXlib::Translate(nscoord aX, nscoord aY)
|
||||
{
|
||||
PR_LOG(RenderingContextXlibLM, PR_LOG_DEBUG, ("nsRenderingContextXlib::Translate()\n"));
|
||||
mTMatrix->AddTranslation((float)aX,(float)aY);
|
||||
mTranMatrix->AddTranslation((float)aX,(float)aY);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -609,7 +576,7 @@ NS_IMETHODIMP
|
||||
nsRenderingContextXlib::Scale(float aSx, float aSy)
|
||||
{
|
||||
PR_LOG(RenderingContextXlibLM, PR_LOG_DEBUG, ("nsRenderingContextXlib::Scale()\n"));
|
||||
mTMatrix->AddScale(aSx, aSy);
|
||||
mTranMatrix->AddScale(aSx, aSy);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -617,7 +584,7 @@ NS_IMETHODIMP
|
||||
nsRenderingContextXlib::GetCurrentTransform(nsTransform2D *&aTransform)
|
||||
{
|
||||
PR_LOG(RenderingContextXlibLM, PR_LOG_DEBUG, ("nsRenderingContextXlib::GetCurrentTransform()\n"));
|
||||
aTransform = mTMatrix;
|
||||
aTransform = mTranMatrix;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -667,11 +634,11 @@ nsRenderingContextXlib::DrawLine(nscoord aX0, nscoord aY0, nscoord aX1, nscoord
|
||||
nscoord diffX, diffY;
|
||||
|
||||
PR_LOG(RenderingContextXlibLM, PR_LOG_DEBUG, ("nsRenderingContextXlib::DrawLine()\n"));
|
||||
if (nsnull == mTMatrix || nsnull == mRenderingSurface)
|
||||
if (nsnull == mTranMatrix || nsnull == mRenderingSurface)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
mTMatrix->TransformCoord(&aX0,&aY0);
|
||||
mTMatrix->TransformCoord(&aX1,&aY1);
|
||||
mTranMatrix->TransformCoord(&aX0,&aY0);
|
||||
mTranMatrix->TransformCoord(&aX1,&aY1);
|
||||
|
||||
diffX = aX1-aX0;
|
||||
diffY = aY1-aY0;
|
||||
@ -695,11 +662,11 @@ nsRenderingContextXlib::DrawStdLine(nscoord aX0, nscoord aY0, nscoord aX1, nscoo
|
||||
nscoord diffX, diffY;
|
||||
|
||||
PR_LOG(RenderingContextXlibLM, PR_LOG_DEBUG, ("nsRenderingContextXlib::DrawStdLine()\n"));
|
||||
if (nsnull == mTMatrix || nsnull == mRenderingSurface)
|
||||
if (nsnull == mTranMatrix || nsnull == mRenderingSurface)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
mTMatrix->TransformCoord(&aX0,&aY0);
|
||||
mTMatrix->TransformCoord(&aX1,&aY1);
|
||||
mTranMatrix->TransformCoord(&aX0,&aY0);
|
||||
mTranMatrix->TransformCoord(&aX1,&aY1);
|
||||
|
||||
diffX = aX1-aX0;
|
||||
diffY = aY1-aY0;
|
||||
@ -721,7 +688,7 @@ NS_IMETHODIMP
|
||||
nsRenderingContextXlib::DrawPolyline(const nsPoint aPoints[], PRInt32 aNumPoints)
|
||||
{
|
||||
PR_LOG(RenderingContextXlibLM, PR_LOG_DEBUG, ("nsRenderingContextXlib::DrawPolyLine()\n"));
|
||||
if (nsnull == mTMatrix || nsnull == mRenderingSurface) {
|
||||
if (nsnull == mTranMatrix || nsnull == mRenderingSurface) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
PRInt32 i ;
|
||||
@ -734,7 +701,7 @@ nsRenderingContextXlib::DrawPolyline(const nsPoint aPoints[], PRInt32 aNumPoints
|
||||
thispoint = (xpoints+i);
|
||||
thispoint->x = aPoints[i].x;
|
||||
thispoint->y = aPoints[i].y;
|
||||
mTMatrix->TransformCoord((PRInt32*)&thispoint->x,(PRInt32*)&thispoint->y);
|
||||
mTranMatrix->TransformCoord((PRInt32*)&thispoint->x,(PRInt32*)&thispoint->y);
|
||||
}
|
||||
|
||||
::XDrawLines(mDisplay,
|
||||
@ -758,7 +725,7 @@ NS_IMETHODIMP
|
||||
nsRenderingContextXlib::DrawRect(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight)
|
||||
{
|
||||
PR_LOG(RenderingContextXlibLM, PR_LOG_DEBUG, ("nsRenderingContextXlib::DrawRect()\n"));
|
||||
if (nsnull == mTMatrix || nsnull == mRenderingSurface) {
|
||||
if (nsnull == mTranMatrix || nsnull == mRenderingSurface) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
@ -769,7 +736,7 @@ nsRenderingContextXlib::DrawRect(nscoord aX, nscoord aY, nscoord aWidth, nscoord
|
||||
w = aWidth;
|
||||
h = aHeight;
|
||||
|
||||
mTMatrix->TransformCoord(&x,&y,&w,&h);
|
||||
mTranMatrix->TransformCoord(&x,&y,&w,&h);
|
||||
|
||||
// Don't draw empty rectangles; also, w/h are adjusted down by one
|
||||
// so that the right number of pixels are drawn.
|
||||
@ -798,7 +765,7 @@ NS_IMETHODIMP
|
||||
nsRenderingContextXlib::FillRect(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight)
|
||||
{
|
||||
PR_LOG(RenderingContextXlibLM, PR_LOG_DEBUG, ("nsRenderingContextXlib::FillRect()\n"));
|
||||
if (nsnull == mTMatrix || nsnull == mRenderingSurface) {
|
||||
if (nsnull == mTranMatrix || nsnull == mRenderingSurface) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
nscoord x,y,w,h;
|
||||
@ -807,7 +774,7 @@ nsRenderingContextXlib::FillRect(nscoord aX, nscoord aY, nscoord aWidth, nscoord
|
||||
w = aWidth;
|
||||
h = aHeight;
|
||||
|
||||
mTMatrix->TransformCoord(&x,&y,&w,&h);
|
||||
mTranMatrix->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(mDisplay,
|
||||
@ -827,7 +794,7 @@ nsRenderingContextXlib :: InvertRect(const nsRect& aRect)
|
||||
NS_IMETHODIMP
|
||||
nsRenderingContextXlib :: InvertRect(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight)
|
||||
{
|
||||
if (nsnull == mTMatrix || nsnull == mRenderingSurface)
|
||||
if (nsnull == mTranMatrix || nsnull == mRenderingSurface)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nscoord x,y,w,h;
|
||||
@ -837,7 +804,7 @@ nsRenderingContextXlib :: InvertRect(nscoord aX, nscoord aY, nscoord aWidth, nsc
|
||||
w = aWidth;
|
||||
h = aHeight;
|
||||
|
||||
mTMatrix->TransformCoord(&x,&y,&w,&h);
|
||||
mTranMatrix->TransformCoord(&x,&y,&w,&h);
|
||||
|
||||
// Set XOR drawing mode
|
||||
::XSetFunction(mDisplay,
|
||||
@ -864,7 +831,7 @@ NS_IMETHODIMP
|
||||
nsRenderingContextXlib::DrawPolygon(const nsPoint aPoints[], PRInt32 aNumPoints)
|
||||
{
|
||||
PR_LOG(RenderingContextXlibLM, PR_LOG_DEBUG, ("nsRenderingContextXlib::DrawPolygon()\n"));
|
||||
if (nsnull == mTMatrix || nsnull == mRenderingSurface) {
|
||||
if (nsnull == mTranMatrix || nsnull == mRenderingSurface) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
PRInt32 i ;
|
||||
@ -877,7 +844,7 @@ nsRenderingContextXlib::DrawPolygon(const nsPoint aPoints[], PRInt32 aNumPoints)
|
||||
thispoint = (xpoints+i);
|
||||
thispoint->x = aPoints[i].x;
|
||||
thispoint->y = aPoints[i].y;
|
||||
mTMatrix->TransformCoord((PRInt32*)&thispoint->x,(PRInt32*)&thispoint->y);
|
||||
mTranMatrix->TransformCoord((PRInt32*)&thispoint->x,(PRInt32*)&thispoint->y);
|
||||
}
|
||||
|
||||
::XDrawLines(mDisplay,
|
||||
@ -894,7 +861,7 @@ NS_IMETHODIMP
|
||||
nsRenderingContextXlib::FillPolygon(const nsPoint aPoints[], PRInt32 aNumPoints)
|
||||
{
|
||||
PR_LOG(RenderingContextXlibLM, PR_LOG_DEBUG, ("nsRenderingContextXlib::FillPolygon()\n"));
|
||||
if (nsnull == mTMatrix || nsnull == mRenderingSurface) {
|
||||
if (nsnull == mTranMatrix || nsnull == mRenderingSurface) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
PRInt32 i ;
|
||||
@ -908,7 +875,7 @@ nsRenderingContextXlib::FillPolygon(const nsPoint aPoints[], PRInt32 aNumPoints)
|
||||
thispoint = (xpoints+i);
|
||||
x = aPoints[i].x;
|
||||
y = aPoints[i].y;
|
||||
mTMatrix->TransformCoord(&x,&y);
|
||||
mTranMatrix->TransformCoord(&x,&y);
|
||||
thispoint->x = x;
|
||||
thispoint->y = y;
|
||||
}
|
||||
@ -934,7 +901,7 @@ NS_IMETHODIMP
|
||||
nsRenderingContextXlib::DrawEllipse(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight)
|
||||
{
|
||||
PR_LOG(RenderingContextXlibLM, PR_LOG_DEBUG, ("nsRenderingContextXlib::DrawEllipse()\n"));
|
||||
if (nsnull == mTMatrix || nsnull == mRenderingSurface) {
|
||||
if (nsnull == mTranMatrix || nsnull == mRenderingSurface) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
nscoord x,y,w,h;
|
||||
@ -944,7 +911,7 @@ nsRenderingContextXlib::DrawEllipse(nscoord aX, nscoord aY, nscoord aWidth, nsco
|
||||
w = aWidth;
|
||||
h = aHeight;
|
||||
|
||||
mTMatrix->TransformCoord(&x,&y,&w,&h);
|
||||
mTranMatrix->TransformCoord(&x,&y,&w,&h);
|
||||
|
||||
::XDrawArc(mDisplay,
|
||||
mRenderingSurface->GetDrawable(),
|
||||
@ -965,7 +932,7 @@ NS_IMETHODIMP
|
||||
nsRenderingContextXlib::FillEllipse(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight)
|
||||
{
|
||||
PR_LOG(RenderingContextXlibLM, PR_LOG_DEBUG, ("nsRenderingContextXlib::FillEllipse()\n"));
|
||||
if (nsnull == mTMatrix || nsnull == mRenderingSurface) {
|
||||
if (nsnull == mTranMatrix || nsnull == mRenderingSurface) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
nscoord x,y,w,h;
|
||||
@ -975,7 +942,7 @@ nsRenderingContextXlib::FillEllipse(nscoord aX, nscoord aY, nscoord aWidth, nsco
|
||||
w = aWidth;
|
||||
h = aHeight;
|
||||
|
||||
mTMatrix->TransformCoord(&x,&y,&w,&h);
|
||||
mTranMatrix->TransformCoord(&x,&y,&w,&h);
|
||||
|
||||
::XFillArc(mDisplay,
|
||||
mRenderingSurface->GetDrawable(),
|
||||
@ -998,7 +965,7 @@ nsRenderingContextXlib::DrawArc(nscoord aX, nscoord aY, nscoord aWidth, nscoord
|
||||
float aStartAngle, float aEndAngle)
|
||||
{
|
||||
PR_LOG(RenderingContextXlibLM, PR_LOG_DEBUG, ("nsRenderingContextXlib::DrawArc()\n"));
|
||||
if (nsnull == mTMatrix || nsnull == mRenderingSurface) {
|
||||
if (nsnull == mTranMatrix || nsnull == mRenderingSurface) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
nscoord x,y,w,h;
|
||||
@ -1008,7 +975,7 @@ nsRenderingContextXlib::DrawArc(nscoord aX, nscoord aY, nscoord aWidth, nscoord
|
||||
w = aWidth;
|
||||
h = aHeight;
|
||||
|
||||
mTMatrix->TransformCoord(&x,&y,&w,&h);
|
||||
mTranMatrix->TransformCoord(&x,&y,&w,&h);
|
||||
|
||||
::XDrawArc(mDisplay,
|
||||
mRenderingSurface->GetDrawable(),
|
||||
@ -1032,7 +999,7 @@ nsRenderingContextXlib::FillArc(nscoord aX, nscoord aY, nscoord aWidth, nscoord
|
||||
float aStartAngle, float aEndAngle)
|
||||
{
|
||||
PR_LOG(RenderingContextXlibLM, PR_LOG_DEBUG, ("nsRenderingContextXlib::FillArc()\n"));
|
||||
if (nsnull == mTMatrix || nsnull == mRenderingSurface) {
|
||||
if (nsnull == mTranMatrix || nsnull == mRenderingSurface) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
nscoord x,y,w,h;
|
||||
@ -1042,7 +1009,7 @@ nsRenderingContextXlib::FillArc(nscoord aX, nscoord aY, nscoord aWidth, nscoord
|
||||
w = aWidth;
|
||||
h = aHeight;
|
||||
|
||||
mTMatrix->TransformCoord(&x,&y,&w,&h);
|
||||
mTranMatrix->TransformCoord(&x,&y,&w,&h);
|
||||
|
||||
::XFillArc(mDisplay,
|
||||
mRenderingSurface->GetDrawable(),
|
||||
@ -1173,7 +1140,7 @@ nsRenderingContextXlib::DrawString(const char *aString, PRUint32 aLength,
|
||||
{
|
||||
PR_LOG(RenderingContextXlibLM, PR_LOG_DEBUG, ("nsRenderingContextXlib::DrawString()\n"));
|
||||
if (0 != aLength) {
|
||||
if (mTMatrix == nsnull)
|
||||
if (mTranMatrix == nsnull)
|
||||
return NS_ERROR_FAILURE;
|
||||
if (mRenderingSurface == nsnull)
|
||||
return NS_ERROR_FAILURE;
|
||||
@ -1196,7 +1163,7 @@ nsRenderingContextXlib::DrawString(const char *aString, PRUint32 aLength,
|
||||
char ch = *aString++;
|
||||
nscoord xx = x;
|
||||
nscoord yy = y;
|
||||
mTMatrix->TransformCoord(&xx, &yy);
|
||||
mTranMatrix->TransformCoord(&xx, &yy);
|
||||
XDrawString(mDisplay,
|
||||
mRenderingSurface->GetDrawable(),
|
||||
mRenderingSurface->GetGC(),
|
||||
@ -1205,7 +1172,7 @@ nsRenderingContextXlib::DrawString(const char *aString, PRUint32 aLength,
|
||||
}
|
||||
}
|
||||
else {
|
||||
mTMatrix->TransformCoord(&x, &y);
|
||||
mTranMatrix->TransformCoord(&x, &y);
|
||||
XDrawString(mDisplay,
|
||||
mRenderingSurface->GetDrawable(),
|
||||
mRenderingSurface->GetGC(),
|
||||
@ -1259,7 +1226,7 @@ nsRenderingContextXlib::DrawString(const PRUnichar *aString, PRUint32 aLength,
|
||||
{
|
||||
PR_LOG(RenderingContextXlibLM, PR_LOG_DEBUG, ("nsRenderingContextXlib::DrawString()\n"));
|
||||
if (aLength && mFontMetrics) {
|
||||
if (mTMatrix == nsnull)
|
||||
if (mTranMatrix == nsnull)
|
||||
return NS_ERROR_FAILURE;
|
||||
if (mRenderingSurface == nsnull)
|
||||
return NS_ERROR_FAILURE;
|
||||
@ -1274,7 +1241,7 @@ nsRenderingContextXlib::DrawString(const PRUnichar *aString, PRUint32 aLength,
|
||||
y += aY;
|
||||
aY = y;
|
||||
|
||||
mTMatrix->TransformCoord(&x, &y);
|
||||
mTranMatrix->TransformCoord(&x, &y);
|
||||
|
||||
nsFontMetricsXlib* metrics = (nsFontMetricsXlib*) mFontMetrics;
|
||||
nsFontXlib* prevFont = nsnull;
|
||||
@ -1303,7 +1270,7 @@ FoundFont:
|
||||
while (str < end) {
|
||||
x = aX;
|
||||
y = aY;
|
||||
mTMatrix->TransformCoord(&x, &y);
|
||||
mTranMatrix->TransformCoord(&x, &y);
|
||||
prevFont->DrawString(this, mRenderingSurface, x, y, str, 1);
|
||||
aX += *aSpacing++;
|
||||
str++;
|
||||
@ -1331,7 +1298,7 @@ FoundFont:
|
||||
while (str < end) {
|
||||
x = aX;
|
||||
y = aY;
|
||||
mTMatrix->TransformCoord(&x, &y);
|
||||
mTranMatrix->TransformCoord(&x, &y);
|
||||
prevFont->DrawString(this, mRenderingSurface, x, y, str, 1);
|
||||
aX += *aSpacing++;
|
||||
str++;
|
||||
@ -1390,7 +1357,7 @@ nsRenderingContextXlib::DrawImage(nsIImage *aImage, const nsRect& aRect)
|
||||
|
||||
nsRect tr;
|
||||
tr = aRect;
|
||||
mTMatrix->TransformCoord(&tr.x, &tr.y, &tr.width, &tr.height);
|
||||
mTranMatrix->TransformCoord(&tr.x, &tr.y, &tr.width, &tr.height);
|
||||
return aImage->Draw(*this, mRenderingSurface, tr.x, tr.y, tr.width, tr.height);
|
||||
}
|
||||
|
||||
@ -1401,14 +1368,14 @@ nsRenderingContextXlib::DrawImage(nsIImage *aImage, const nsRect& aSRect, const
|
||||
nsRect sr,dr;
|
||||
|
||||
sr = aSRect;
|
||||
mTMatrix->TransformCoord(&sr.x, &sr.y,
|
||||
mTranMatrix->TransformCoord(&sr.x, &sr.y,
|
||||
&sr.width, &sr.height);
|
||||
sr.x = aSRect.x;
|
||||
sr.y = aSRect.y;
|
||||
mTranMatrix->TransformNoXLateCoord(&sr.x, &sr.y);
|
||||
|
||||
dr = aDRect;
|
||||
mTMatrix->TransformCoord(&dr.x, &dr.y,
|
||||
mTranMatrix->TransformCoord(&dr.x, &dr.y,
|
||||
&dr.width, &dr.height);
|
||||
|
||||
return aImage->Draw(*this, mRenderingSurface,
|
||||
@ -1443,9 +1410,9 @@ nsRenderingContextXlib::DrawTile(nsIImage *aImage,
|
||||
{
|
||||
nsRect tileRect(aTileRect);
|
||||
nsRect srcRect(0, 0, aSrcXOffset, aSrcYOffset);
|
||||
mTMatrix->TransformCoord(&srcRect.x, &srcRect.y, &srcRect.width,
|
||||
mTranMatrix->TransformCoord(&srcRect.x, &srcRect.y, &srcRect.width,
|
||||
&srcRect.height);
|
||||
mTMatrix->TransformCoord(&tileRect.x, &tileRect.y,
|
||||
mTranMatrix->TransformCoord(&tileRect.x, &tileRect.y,
|
||||
&tileRect.width, &tileRect.height);
|
||||
|
||||
if((tileRect.width > 0) && (tileRect.height > 0))
|
||||
@ -1466,7 +1433,7 @@ nsRenderingContextXlib::CopyOffScreenBits(nsDrawingSurface aSrcSurf, PRInt32 aSr
|
||||
|
||||
if (aSrcSurf == nsnull)
|
||||
return NS_ERROR_FAILURE;
|
||||
if (mTMatrix == nsnull)
|
||||
if (mTranMatrix == nsnull)
|
||||
return NS_ERROR_FAILURE;
|
||||
if (mRenderingSurface == nsnull)
|
||||
return NS_ERROR_FAILURE;
|
||||
@ -1479,10 +1446,10 @@ nsRenderingContextXlib::CopyOffScreenBits(nsDrawingSurface aSrcSurf, PRInt32 aSr
|
||||
destsurf = mOffscreenSurface;
|
||||
|
||||
if (aCopyFlags & NS_COPYBITS_XFORM_SOURCE_VALUES)
|
||||
mTMatrix->TransformCoord(&srcX, &srcY);
|
||||
mTranMatrix->TransformCoord(&srcX, &srcY);
|
||||
|
||||
if (aCopyFlags & NS_COPYBITS_XFORM_DEST_VALUES)
|
||||
mTMatrix->TransformCoord(&drect.x, &drect.y, &drect.width, &drect.height);
|
||||
mTranMatrix->TransformCoord(&drect.x, &drect.y, &drect.width, &drect.height);
|
||||
|
||||
//XXX flags are unused. that would seem to mean that there is
|
||||
//inefficiency somewhere... MMP
|
||||
|
@ -203,7 +203,6 @@ private:
|
||||
nsIDeviceContext *mContext;
|
||||
nsIFontMetrics *mFontMetrics;
|
||||
nsCOMPtr<nsIRegion> mClipRegion;
|
||||
nsTransform2D *mTMatrix;
|
||||
float mP2T;
|
||||
nscolor mCurrentColor;
|
||||
Display * mDisplay;
|
||||
|
@ -31,6 +31,8 @@ XPIDL_MODULE = layout
|
||||
LIBRARY_NAME = gkplugin
|
||||
IS_COMPONENT = 1
|
||||
REQUIRES = xpcom string java pref necko gtkxtbin webshell caps intl dom locale layout widget cookie mimetype oji exthandler docshell webbrwsr nkcache gfx2 timer windowwatcher
|
||||
# for xlib port
|
||||
REQUIRES += xlibrgb
|
||||
|
||||
CPPSRCS = \
|
||||
ns4xPlugin.cpp \
|
||||
|
@ -31,6 +31,8 @@ XPIDL_MODULE = layout
|
||||
LIBRARY_NAME = gkplugin
|
||||
IS_COMPONENT = 1
|
||||
REQUIRES = xpcom string java pref necko gtkxtbin webshell caps intl dom locale layout widget cookie mimetype oji exthandler docshell webbrwsr nkcache gfx2 timer windowwatcher
|
||||
# for xlib port
|
||||
REQUIRES += xlibrgb
|
||||
|
||||
CPPSRCS = \
|
||||
ns4xPlugin.cpp \
|
||||
|
@ -26,8 +26,9 @@ VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = webshell_tests
|
||||
LIBRARY_NAME = viewer_xlib_s
|
||||
REQUIRES = xpcom string webshell htmlparser webbrwsr necko widget layout dom js uriloader view docshell util locale timer
|
||||
REQUIRES = xpcom string webshell htmlparser webbrwsr necko widget layout dom js uriloader view docshell util locale timer gfx2
|
||||
|
||||
CPPSRCS = nsXlibMain.cpp
|
||||
|
||||
|
@ -41,6 +41,7 @@ class nsIPopUpMenu;
|
||||
class nsIWidget;
|
||||
class nsIMenuListener;
|
||||
class nsIChangeManager;
|
||||
class nsIContent;
|
||||
|
||||
enum {
|
||||
knsMenuItemNoModifier = 0,
|
||||
|
@ -29,7 +29,7 @@ include $(DEPTH)/config/autoconf.mk
|
||||
MODULE = widget
|
||||
LIBRARY_NAME = widget_xlib
|
||||
IS_COMPONENT = 1
|
||||
REQUIRES = xpcom string appshell layout dom js xlibrgb timer uconv pref webshell htmlparser view necko
|
||||
REQUIRES = xpcom string appshell layout dom js xlibrgb timer uconv pref webshell htmlparser view necko gfx2
|
||||
|
||||
DIRS = window_service
|
||||
|
||||
|
@ -1127,7 +1127,7 @@ nsAppShell::HandleEnterEvent(XEvent *event, nsWidget *aWidget)
|
||||
|
||||
// make sure this is in focus. This will do until I rewrite all the
|
||||
// focus routines. KenF
|
||||
aWidget->SetFocus();
|
||||
aWidget->SetFocus(PR_FALSE);
|
||||
|
||||
NS_ADDREF(aWidget);
|
||||
aWidget->DispatchWindowEvent(enterEvent);
|
||||
|
@ -25,42 +25,11 @@
|
||||
#include "nsIMenuItem.h"
|
||||
#include "nsIMenuListener.h"
|
||||
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
static NS_DEFINE_IID(kIMenuIID, NS_IMENU_IID);
|
||||
static NS_DEFINE_IID(kIMenuItemIID, NS_IMENUITEM_IID);
|
||||
NS_IMPL_ISUPPORTS2(nsMenu, nsIMenu, nsIMenuListener)
|
||||
|
||||
nsresult nsMenu::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||
{
|
||||
if (NULL == aInstancePtr) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
*aInstancePtr = NULL;
|
||||
|
||||
if (aIID.Equals(kIMenuIID)) {
|
||||
*aInstancePtr = (void*)(nsIMenu*) this;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(NS_GET_IID(nsIMenuListener))) {
|
||||
*aInstancePtr = (void*)(nsIMenuListener*)this;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kISupportsIID)) {
|
||||
*aInstancePtr = (void*)(nsISupports*)(nsIMenu*)this;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(nsMenu)
|
||||
NS_IMPL_RELEASE(nsMenu)
|
||||
|
||||
nsMenu::nsMenu() : nsIMenu()
|
||||
nsMenu::nsMenu()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
NS_INIT_ISUPPORTS();
|
||||
mMenuBarParent = nsnull;
|
||||
mMenuParent = nsnull;
|
||||
mListener = nsnull;
|
||||
@ -77,7 +46,10 @@ nsMenu::~nsMenu()
|
||||
mItems->Clear();
|
||||
}
|
||||
|
||||
NS_METHOD nsMenu::Create(nsISupports *aParent, const nsString &aLabel)
|
||||
NS_METHOD nsMenu::Create(nsISupports * aParent, const nsAReadableString &aLabel,
|
||||
const nsAReadableString &aAccessKey,
|
||||
nsIChangeManager* aManager, nsIWebShell* aShell,
|
||||
nsIContent* aContent )
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
@ -92,7 +64,7 @@ NS_METHOD nsMenu::GetLabel(nsString &aText)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsMenu::SetLabel(const nsString &aText)
|
||||
NS_METHOD nsMenu::SetLabel(const nsAReadableString &aText)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
@ -242,7 +214,7 @@ NS_METHOD nsMenu::GetAccessKey(nsString &aText)
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsMenu::SetAccessKey(const nsString &aText)
|
||||
NS_METHOD nsMenu::SetAccessKey(const nsAReadableString &aText)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -27,11 +27,11 @@
|
||||
#include "nsIMenu.h"
|
||||
#include "nsISupportsArray.h"
|
||||
#include "nsIMenuListener.h"
|
||||
class nsIContent;
|
||||
class nsIDOMElement;
|
||||
class nsIDOMNode;
|
||||
|
||||
|
||||
/**
|
||||
* Native Win32 button wrapper
|
||||
*/
|
||||
|
||||
class nsMenu : public nsIMenu, public nsIMenuListener
|
||||
{
|
||||
@ -53,15 +53,17 @@ public:
|
||||
nsEventStatus MenuDestruct(const nsMenuEvent & aMenuEvent);
|
||||
|
||||
|
||||
NS_IMETHOD Create(nsISupports * aParent, const nsString &aLabel);
|
||||
|
||||
|
||||
// nsIMenu Methods
|
||||
NS_IMETHOD Create(nsISupports * aParent, const nsAReadableString &aLabel,
|
||||
const nsAReadableString &aAccessKey,
|
||||
nsIChangeManager* aManager, nsIWebShell* aShell,
|
||||
nsIContent* aContent );
|
||||
|
||||
NS_IMETHOD GetParent(nsISupports *&aParent);
|
||||
NS_IMETHOD GetLabel(nsString &aText);
|
||||
NS_IMETHOD SetLabel(const nsString &aText);
|
||||
NS_IMETHOD SetLabel(const nsAReadableString &aText);
|
||||
NS_IMETHOD GetAccessKey(nsString &aText);
|
||||
NS_IMETHOD SetAccessKey(const nsString &aText);
|
||||
NS_IMETHOD SetAccessKey(const nsAReadableString &aText);
|
||||
|
||||
NS_IMETHOD AddItem(nsISupports * aItem);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user