зеркало из https://github.com/mozilla/gecko-dev.git
changes to support nsIRenderingContext that conforms to COM conventions.
This commit is contained in:
Родитель
0ac93fd542
Коммит
fc225bf7c1
|
@ -91,7 +91,7 @@ NS_IMETHODIMP nsDeviceContextMac :: GetScrollBarDimensions(float &aWidth, float
|
|||
|
||||
NS_IMETHODIMP nsDeviceContextMac :: GetDrawingSurface(nsIRenderingContext &aContext, nsDrawingSurface &aSurface)
|
||||
{
|
||||
aSurface = aContext.CreateDrawingSurface(nsnull, 0);
|
||||
aContext.CreateDrawingSurface(nsnull, 0, aSurface);
|
||||
return nsnull == aSurface ? NS_ERROR_OUT_OF_MEMORY : NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -193,16 +193,16 @@ void nsImageMac :: ImageUpdated(nsIDeviceContext *aContext, PRUint8 aFlags, nsRe
|
|||
//------------------------------------------------------------
|
||||
|
||||
// Draw the bitmap, this method has a source and destination coordinates
|
||||
PRBool nsImageMac :: Draw(nsIRenderingContext &aContext, nsDrawingSurface aSurface, PRInt32 aSX, PRInt32 aSY, PRInt32 aSWidth, PRInt32 aSHeight,
|
||||
PRInt32 aDX, PRInt32 aDY, PRInt32 aDWidth, PRInt32 aDHeight)
|
||||
NS_IMETHODIMP nsImageMac :: Draw(nsIRenderingContext &aContext, nsDrawingSurface aSurface, PRInt32 aSX, PRInt32 aSY, PRInt32 aSWidth, PRInt32 aSHeight,
|
||||
PRInt32 aDX, PRInt32 aDY, PRInt32 aDWidth, PRInt32 aDHeight)
|
||||
{
|
||||
PixMapPtr destpix;
|
||||
RGBColor rgbblack = {0x0000,0x0000,0x0000};
|
||||
RGBColor rgbwhite = {0xFFFF,0xFFFF,0xFFFF};
|
||||
Rect srcrect,dstrect;
|
||||
PixMapPtr destpix;
|
||||
RGBColor rgbblack = {0x0000,0x0000,0x0000};
|
||||
RGBColor rgbwhite = {0xFFFF,0xFFFF,0xFFFF};
|
||||
Rect srcrect,dstrect;
|
||||
|
||||
if (nsnull == mThePixelmap.baseAddr)
|
||||
return PR_FALSE;
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
::SetRect(&srcrect,aSX,aSY,aSX+aSWidth,aSY+aSHeight);
|
||||
::SetRect(&dstrect,aDX,aDY,aDX+aDWidth,aDY+aDHeight);
|
||||
|
@ -214,16 +214,16 @@ Rect srcrect,dstrect;
|
|||
|
||||
::CopyBits((BitMap*)&mThePixelmap,(BitMap*)destpix,&srcrect,&dstrect,ditherCopy,0L);
|
||||
|
||||
return PR_TRUE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------
|
||||
|
||||
// Draw the bitmap, this draw just has destination coordinates
|
||||
PRBool nsImageMac :: Draw(nsIRenderingContext &aContext,
|
||||
nsDrawingSurface aSurface,
|
||||
PRInt32 aX, PRInt32 aY,
|
||||
PRInt32 aWidth, PRInt32 aHeight)
|
||||
NS_IMETHODIMP nsImageMac :: Draw(nsIRenderingContext &aContext,
|
||||
nsDrawingSurface aSurface,
|
||||
PRInt32 aX, PRInt32 aY,
|
||||
PRInt32 aWidth, PRInt32 aHeight)
|
||||
{
|
||||
|
||||
return Draw(aContext,aSurface,0,0,mWidth,mHeight,aX,aY,aWidth,aHeight);
|
||||
|
|
|
@ -38,9 +38,9 @@ public:
|
|||
virtual PRUint8* GetBits() ; //{ return mImageBits; }
|
||||
virtual void* GetBitInfo() { return nsnull; }
|
||||
virtual PRInt32 GetLineStride() {return mRowBytes; }
|
||||
virtual PRBool Draw(nsIRenderingContext &aContext, nsDrawingSurface aSurface, PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeight);
|
||||
virtual PRBool Draw(nsIRenderingContext &aContext, nsDrawingSurface aSurface, PRInt32 aSX, PRInt32 aSY, PRInt32 aSWidth, PRInt32 aSHeight,
|
||||
PRInt32 aDX, PRInt32 aDY, PRInt32 aDWidth, PRInt32 aDHeight);
|
||||
NS_IMETHOD Draw(nsIRenderingContext &aContext, nsDrawingSurface aSurface, PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeight);
|
||||
NS_IMETHOD Draw(nsIRenderingContext &aContext, nsDrawingSurface aSurface, PRInt32 aSX, PRInt32 aSY, PRInt32 aSWidth, PRInt32 aSHeight,
|
||||
PRInt32 aDX, PRInt32 aDY, PRInt32 aDWidth, PRInt32 aDHeight);
|
||||
virtual nsColorMap* GetColorMap() {return nsnull;}
|
||||
virtual void ImageUpdated(nsIDeviceContext *aContext, PRUint8 aFlags, nsRect *aUpdateRect);
|
||||
virtual nsresult Init(PRInt32 aWidth, PRInt32 aHeight, PRInt32 aDepth, nsMaskRequirements aMaskRequirements);
|
||||
|
|
|
@ -156,7 +156,7 @@ NS_IMPL_RELEASE(nsRenderingContextMac);
|
|||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
nsresult nsRenderingContextMac :: Init(nsIDeviceContext* aContext,nsIWidget *aWindow)
|
||||
NS_IMETHODIMP nsRenderingContextMac :: Init(nsIDeviceContext* aContext,nsIWidget *aWindow)
|
||||
{
|
||||
PRInt32 offx,offy;
|
||||
|
||||
|
@ -193,7 +193,7 @@ PRInt32 offx,offy;
|
|||
|
||||
|
||||
// this drawing surface init should only be called for an offscreen drawing surface, without and offset or clip region
|
||||
nsresult nsRenderingContextMac :: Init(nsIDeviceContext* aContext,
|
||||
NS_IMETHODIMP nsRenderingContextMac :: Init(nsIDeviceContext* aContext,
|
||||
nsDrawingSurface aSurface)
|
||||
{
|
||||
|
||||
|
@ -208,7 +208,7 @@ nsresult nsRenderingContextMac :: Init(nsIDeviceContext* aContext,
|
|||
//------------------------------------------------------------------------
|
||||
|
||||
|
||||
nsresult nsRenderingContextMac :: CommonInit()
|
||||
NS_IMETHODIMP nsRenderingContextMac :: CommonInit()
|
||||
{
|
||||
|
||||
((nsDeviceContextMac *)mContext)->SetDrawingSurface(mRenderingSurface);
|
||||
|
@ -218,14 +218,14 @@ nsresult nsRenderingContextMac :: CommonInit()
|
|||
float app2dev;
|
||||
mContext->GetAppUnitsToDevUnits(app2dev);
|
||||
mTMatrix->AddScale(app2dev, app2dev);
|
||||
this->SetColor(mCurrentColor);
|
||||
SetColor(mCurrentColor);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
nsresult nsRenderingContextMac :: SelectOffScreenDrawingSurface(nsDrawingSurface aSurface)
|
||||
NS_IMETHODIMP nsRenderingContextMac :: SelectOffScreenDrawingSurface(nsDrawingSurface aSurface)
|
||||
{
|
||||
if (nsnull == aSurface)
|
||||
mRenderingSurface = mFrontBuffer;
|
||||
|
@ -237,26 +237,27 @@ nsresult nsRenderingContextMac :: SelectOffScreenDrawingSurface(nsDrawingSurface
|
|||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
void nsRenderingContextMac :: Reset()
|
||||
NS_IMETHODIMP nsRenderingContextMac :: Reset(void)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
nsIDeviceContext * nsRenderingContextMac :: GetDeviceContext(void)
|
||||
NS_IMETHODIMP nsRenderingContextMac :: GetDeviceContext(nsIDeviceContext *&aContext)
|
||||
{
|
||||
NS_IF_ADDREF(mContext);
|
||||
return mContext;
|
||||
aContext = mContext;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
void nsRenderingContextMac :: PushState(void)
|
||||
NS_IMETHODIMP nsRenderingContextMac :: PushState(void)
|
||||
{
|
||||
nsRect rect;
|
||||
Rect mac_rect;
|
||||
nsRect rect;
|
||||
Rect mac_rect;
|
||||
|
||||
|
||||
GraphicsState * state = new GraphicsState();
|
||||
|
||||
// Push into this state object, add to vector
|
||||
|
@ -290,15 +291,16 @@ Rect mac_rect;
|
|||
state->mOffy = mOffy;
|
||||
|
||||
state->mColor = mCurrentColor;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
PRBool nsRenderingContextMac :: PopState(void)
|
||||
NS_IMETHODIMP nsRenderingContextMac :: PopState(PRBool &aClipEmpty)
|
||||
{
|
||||
PRBool bEmpty = PR_FALSE;
|
||||
PRBool bEmpty = PR_FALSE;
|
||||
|
||||
|
||||
PRUint32 cnt = mStateCache->Count();
|
||||
GraphicsState * state;
|
||||
|
||||
|
@ -344,24 +346,26 @@ PRBool bEmpty = PR_FALSE;
|
|||
delete state;
|
||||
}
|
||||
|
||||
return bEmpty;
|
||||
return PR_FALSE;
|
||||
aClipEmpty = bEmpty;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
PRBool nsRenderingContextMac :: IsVisibleRect(const nsRect& aRect)
|
||||
NS_IMETHODIMP nsRenderingContextMac :: IsVisibleRect(const nsRect& aRect, PRBool &aVisible)
|
||||
{
|
||||
return PR_TRUE;
|
||||
aVisible = PR_TRUE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
PRBool nsRenderingContextMac :: SetClipRectInPixels(const nsRect& aRect, nsClipCombine aCombine)
|
||||
NS_IMETHODIMP nsRenderingContextMac :: SetClipRectInPixels(const nsRect& aRect, nsClipCombine aCombine, PRBool &aClipEmpty)
|
||||
{
|
||||
PRBool bEmpty = PR_FALSE;
|
||||
nsRect trect = aRect;
|
||||
RgnHandle theregion,tregion;
|
||||
PRBool bEmpty = PR_FALSE;
|
||||
nsRect trect = aRect;
|
||||
RgnHandle theregion,tregion;
|
||||
|
||||
theregion = ::NewRgn();
|
||||
SetRectRgn(theregion,trect.x,trect.y,trect.x+trect.width,trect.y+trect.height);
|
||||
|
@ -426,49 +430,53 @@ RgnHandle theregion,tregion;
|
|||
::SetClip(mClipRegion);
|
||||
}
|
||||
|
||||
return bEmpty;
|
||||
aClipEmpty = bEmpty;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
PRBool nsRenderingContextMac :: SetClipRect(const nsRect& aRect, nsClipCombine aCombine)
|
||||
NS_IMETHODIMP nsRenderingContextMac :: SetClipRect(const nsRect& aRect, nsClipCombine aCombine, PRBool &aClipEmpty)
|
||||
{
|
||||
nsRect trect = aRect;
|
||||
nsRect trect = aRect;
|
||||
|
||||
mTMatrix->TransformCoord(&trect.x, &trect.y,&trect.width, &trect.height);
|
||||
return(SetClipRectInPixels(trect,aCombine));
|
||||
|
||||
return SetClipRectInPixels(trect, aCombine, aClipEmpty);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
PRBool nsRenderingContextMac :: GetClipRect(nsRect &aRect)
|
||||
NS_IMETHODIMP nsRenderingContextMac :: GetClipRect(nsRect &aRect, PRBool &aClipValid)
|
||||
{
|
||||
Rect cliprect;
|
||||
Rect cliprect;
|
||||
|
||||
if (mClipRegion != nsnull)
|
||||
{
|
||||
{
|
||||
cliprect = (**mClipRegion).rgnBBox;
|
||||
aRect.SetRect(cliprect.left, cliprect.top, cliprect.right-cliprect.left, cliprect.bottom-cliprect.top);
|
||||
return(PR_FALSE);
|
||||
}
|
||||
aClipValid = PR_TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
aRect.SetRect(0,0,0,0);
|
||||
return (PR_TRUE);
|
||||
}
|
||||
aClipValid = PR_FALSE;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
PRBool nsRenderingContextMac :: SetClipRegion(const nsIRegion& aRegion, nsClipCombine aCombine)
|
||||
NS_IMETHODIMP nsRenderingContextMac :: SetClipRegion(const nsIRegion& aRegion, nsClipCombine aCombine, PRBool &aClipEmpty)
|
||||
{
|
||||
nsRect rect;
|
||||
Rect mrect;
|
||||
RgnHandle mregion;
|
||||
nsRect rect;
|
||||
Rect mrect;
|
||||
RgnHandle mregion;
|
||||
|
||||
nsRegionMac *pRegion = (nsRegionMac *)&aRegion;
|
||||
|
||||
|
||||
mregion = pRegion->GetRegion();
|
||||
mrect = (**mregion).rgnBBox;
|
||||
|
||||
|
@ -480,38 +488,42 @@ RgnHandle mregion;
|
|||
SetClipRectInPixels(rect, aCombine);
|
||||
|
||||
if (::EmptyRgn(mClipRegion) == PR_TRUE)
|
||||
return PR_TRUE;
|
||||
aClipEmpty = PR_TRUE;
|
||||
else
|
||||
return PR_FALSE;
|
||||
aClipEmpty = PR_FALSE;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
void nsRenderingContextMac :: GetClipRegion(nsIRegion **aRegion)
|
||||
NS_IMETHODIMP nsRenderingContextMac :: GetClipRegion(nsIRegion **aRegion)
|
||||
{
|
||||
nsIRegion * pRegion ;
|
||||
nsIRegion * pRegion;
|
||||
|
||||
static NS_DEFINE_IID(kCRegionCID, NS_REGION_CID);
|
||||
static NS_DEFINE_IID(kIRegionIID, NS_IREGION_IID);
|
||||
|
||||
nsresult rv = nsRepository::CreateInstance(kCRegionCID,nsnull, kIRegionIID, (void **)aRegion);
|
||||
|
||||
if (NS_OK == rv)
|
||||
{
|
||||
if (NS_OK == rv)
|
||||
{
|
||||
nsRect rect;
|
||||
pRegion = (nsIRegion *)&aRegion;
|
||||
pRegion->Init();
|
||||
this->GetClipRect(rect);
|
||||
pRegion->Union(rect.x,rect.y,rect.width,rect.height);
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
void nsRenderingContextMac :: SetColor(nscolor aColor)
|
||||
NS_IMETHODIMP nsRenderingContextMac :: SetColor(nscolor aColor)
|
||||
{
|
||||
RGBColor thecolor;
|
||||
GrafPtr curport;
|
||||
RGBColor thecolor;
|
||||
GrafPtr curport;
|
||||
|
||||
#define COLOR8TOCOLOR16(color8) (color8 == 0xFF ? 0xFFFF : (color8 << 8))
|
||||
|
||||
|
@ -524,25 +536,27 @@ GrafPtr curport;
|
|||
mCurrentColor = aColor ;
|
||||
SetPort(curport);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
nscolor nsRenderingContextMac :: GetColor() const
|
||||
NS_IMETHODIMP nsRenderingContextMac :: GetColor(nscolor &aColor) const
|
||||
{
|
||||
return mCurrentColor;
|
||||
aColor = mCurrentColor;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
nsresult nsRenderingContextMac :: SetLineStyle(nsLineStyle aLineStyle)
|
||||
NS_IMETHODIMP nsRenderingContextMac :: SetLineStyle(nsLineStyle aLineStyle)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
nsresult nsRenderingContextMac :: GetLineStyle(nsLineStyle &aLineStyle)
|
||||
NS_IMETHODIMP nsRenderingContextMac :: GetLineStyle(nsLineStyle &aLineStyle)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -550,99 +564,97 @@ nsresult nsRenderingContextMac :: GetLineStyle(nsLineStyle &aLineStyle)
|
|||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
void nsRenderingContextMac :: SetFont(const nsFont& aFont)
|
||||
NS_IMETHODIMP nsRenderingContextMac :: SetFont(const nsFont& aFont)
|
||||
{
|
||||
NS_IF_RELEASE(mFontMetrics);
|
||||
|
||||
if (mContext)
|
||||
mContext->GetMetricsFor(aFont, mFontMetrics);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
void nsRenderingContextMac :: SetFont(nsIFontMetrics *aFontMetrics)
|
||||
NS_IMETHODIMP nsRenderingContextMac :: SetFont(nsIFontMetrics *aFontMetrics)
|
||||
{
|
||||
NS_IF_RELEASE(mFontMetrics);
|
||||
mFontMetrics = aFontMetrics;
|
||||
NS_IF_ADDREF(mFontMetrics);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
const nsFont& nsRenderingContextMac :: GetFont()
|
||||
{
|
||||
const nsFont* font = nsnull;
|
||||
if(mFontMetrics)
|
||||
mFontMetrics->GetFont(font);
|
||||
return *font;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
nsIFontMetrics* nsRenderingContextMac :: GetFontMetrics()
|
||||
NS_IMETHODIMP nsRenderingContextMac :: GetFontMetrics(nsIFontMetrics *&aFontMetrics)
|
||||
{
|
||||
NS_IF_ADDREF(mFontMetrics);
|
||||
return mFontMetrics;
|
||||
aFontMetrics = mFontMetrics;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
// add the passed in translation to the current translation
|
||||
void nsRenderingContextMac :: Translate(nscoord aX, nscoord aY)
|
||||
NS_IMETHODIMP nsRenderingContextMac :: Translate(nscoord aX, nscoord aY)
|
||||
{
|
||||
|
||||
mTMatrix->AddTranslation((float)aX,(float)aY);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
// add the passed in scale to the current scale
|
||||
void nsRenderingContextMac :: Scale(float aSx, float aSy)
|
||||
NS_IMETHODIMP nsRenderingContextMac :: Scale(float aSx, float aSy)
|
||||
{
|
||||
|
||||
mTMatrix->AddScale(aSx, aSy);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
nsTransform2D * nsRenderingContextMac :: GetCurrentTransform()
|
||||
NS_IMETHODIMP nsRenderingContextMac :: GetCurrentTransform(nsTransform2D *&aTransform)
|
||||
{
|
||||
|
||||
return mTMatrix;
|
||||
aTransform = mTMatrix;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
nsDrawingSurface nsRenderingContextMac :: CreateDrawingSurface(nsRect *aBounds, PRUint32 aSurfFlags)
|
||||
NS_IMETHODIMP nsRenderingContextMac :: CreateDrawingSurface(nsRect *aBounds, PRUint32 aSurfFlags, nsDrawingSurface &aSurface)
|
||||
{
|
||||
PRUint32 depth;
|
||||
GWorldPtr theoff;
|
||||
Rect bounds;
|
||||
QDErr myerr;
|
||||
PRUint32 depth;
|
||||
GWorldPtr theoff;
|
||||
Rect bounds;
|
||||
QDErr myerr;
|
||||
|
||||
// Must make sure this code never gets called when nsRenderingSurface is nsnull
|
||||
mContext->GetDepth(depth);
|
||||
|
||||
if(aBounds!=nsnull)
|
||||
::SetRect(&bounds,aBounds->x,aBounds->y,aBounds->x+aBounds->width,aBounds->height);
|
||||
else
|
||||
::SetRect(&bounds,0,0,2,2);
|
||||
|
||||
myerr = ::NewGWorld(&theoff,depth,&bounds,0,0,0);
|
||||
|
||||
return theoff;
|
||||
aSurface = theoff;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
void nsRenderingContextMac :: DestroyDrawingSurface(nsDrawingSurface aDS)
|
||||
NS_IMETHODIMP nsRenderingContextMac :: DestroyDrawingSurface(nsDrawingSurface aDS)
|
||||
{
|
||||
GWorldPtr theoff;
|
||||
GWorldPtr theoff;
|
||||
|
||||
if(aDS)
|
||||
{
|
||||
{
|
||||
theoff = (GWorldPtr)aDS;
|
||||
DisposeGWorld(theoff);
|
||||
}
|
||||
}
|
||||
|
||||
theoff = nsnull;
|
||||
mRenderingSurface = mFrontBuffer; // point back at the front surface
|
||||
|
@ -652,11 +664,13 @@ GWorldPtr theoff;
|
|||
|
||||
//DisposeRgn(mMainRegion);
|
||||
//mMainRegion = nsnull;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
void nsRenderingContextMac :: DrawLine(nscoord aX0, nscoord aY0, nscoord aX1, nscoord aY1)
|
||||
NS_IMETHODIMP nsRenderingContextMac :: DrawLine(nscoord aX0, nscoord aY0, nscoord aX1, nscoord aY1)
|
||||
{
|
||||
mTMatrix->TransformCoord(&aX0,&aY0);
|
||||
mTMatrix->TransformCoord(&aX1,&aY1);
|
||||
|
@ -665,27 +679,30 @@ void nsRenderingContextMac :: DrawLine(nscoord aX0, nscoord aY0, nscoord aX1, ns
|
|||
::SetClip(mMainRegion);
|
||||
::MoveTo(aX0, aY0);
|
||||
::LineTo(aX1, aY1);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
void nsRenderingContextMac :: DrawPolyline(const nsPoint aPoints[], PRInt32 aNumPoints)
|
||||
NS_IMETHODIMP nsRenderingContextMac :: DrawPolyline(const nsPoint aPoints[], PRInt32 aNumPoints)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
void nsRenderingContextMac :: DrawRect(const nsRect& aRect)
|
||||
NS_IMETHODIMP nsRenderingContextMac :: DrawRect(const nsRect& aRect)
|
||||
{
|
||||
DrawRect(aRect.x, aRect.y, aRect.width, aRect.height);
|
||||
return DrawRect(aRect.x, aRect.y, aRect.width, aRect.height);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
void nsRenderingContextMac :: DrawRect(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight)
|
||||
NS_IMETHODIMP nsRenderingContextMac :: DrawRect(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight)
|
||||
{
|
||||
nscoord x,y,w,h;
|
||||
Rect therect;
|
||||
nscoord x,y,w,h;
|
||||
Rect therect;
|
||||
|
||||
x = aX;
|
||||
y = aY;
|
||||
|
@ -698,21 +715,22 @@ Rect therect;
|
|||
::SetRect(&therect,x,y,x+w,y+h);
|
||||
::FrameRect(&therect);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
void nsRenderingContextMac :: FillRect(const nsRect& aRect)
|
||||
NS_IMETHODIMP nsRenderingContextMac :: FillRect(const nsRect& aRect)
|
||||
{
|
||||
FillRect(aRect.x, aRect.y, aRect.width, aRect.height);
|
||||
return FillRect(aRect.x, aRect.y, aRect.width, aRect.height);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
void nsRenderingContextMac :: FillRect(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight)
|
||||
NS_IMETHODIMP nsRenderingContextMac :: FillRect(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight)
|
||||
{
|
||||
nscoord x,y,w,h;
|
||||
Rect therect;
|
||||
nscoord x,y,w,h;
|
||||
Rect therect;
|
||||
|
||||
x = aX;
|
||||
y = aY;
|
||||
|
@ -726,15 +744,16 @@ Rect therect;
|
|||
::SetRect(&therect,x,y,x+w,y+h);
|
||||
::PaintRect(&therect);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
void nsRenderingContextMac::DrawPolygon(const nsPoint aPoints[], PRInt32 aNumPoints)
|
||||
NS_IMETHODIMP nsRenderingContextMac::DrawPolygon(const nsPoint aPoints[], PRInt32 aNumPoints)
|
||||
{
|
||||
PRUint32 i ;
|
||||
PolyHandle thepoly;
|
||||
PRInt32 x,y;
|
||||
PRUint32 i ;
|
||||
PolyHandle thepoly;
|
||||
PRInt32 x,y;
|
||||
|
||||
SetPort(mRenderingSurface);
|
||||
thepoly = ::OpenPoly();
|
||||
|
@ -743,25 +762,29 @@ PRInt32 x,y;
|
|||
y = aPoints[0].y;
|
||||
mTMatrix->TransformCoord((PRInt32*)&x,(PRInt32*)&y);
|
||||
::MoveTo(x,y);
|
||||
|
||||
for (i = 1; i < aNumPoints; i++)
|
||||
{
|
||||
{
|
||||
x = aPoints[i].x;
|
||||
y = aPoints[i].y;
|
||||
mTMatrix->TransformCoord((PRInt32*)&x,(PRInt32*)&y);
|
||||
::LineTo(x,y);
|
||||
}
|
||||
}
|
||||
|
||||
ClosePoly();
|
||||
|
||||
::FramePoly(thepoly);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
void nsRenderingContextMac::FillPolygon(const nsPoint aPoints[], PRInt32 aNumPoints)
|
||||
NS_IMETHODIMP nsRenderingContextMac::FillPolygon(const nsPoint aPoints[], PRInt32 aNumPoints)
|
||||
{
|
||||
PRUint32 i ;
|
||||
PolyHandle thepoly;
|
||||
PRInt32 x,y;
|
||||
PRUint32 i ;
|
||||
PolyHandle thepoly;
|
||||
PRInt32 x,y;
|
||||
|
||||
::SetPort(mRenderingSurface);
|
||||
::SetClip(mMainRegion);
|
||||
|
@ -771,31 +794,35 @@ PRInt32 x,y;
|
|||
y = aPoints[0].y;
|
||||
mTMatrix->TransformCoord((PRInt32*)&x,(PRInt32*)&y);
|
||||
::MoveTo(x,y);
|
||||
|
||||
for (i = 1; i < aNumPoints; i++)
|
||||
{
|
||||
{
|
||||
x = aPoints[i].x;
|
||||
y = aPoints[i].y;
|
||||
mTMatrix->TransformCoord((PRInt32*)&x,(PRInt32*)&y);
|
||||
::LineTo(x,y);
|
||||
}
|
||||
}
|
||||
|
||||
::ClosePoly();
|
||||
|
||||
::PaintPoly(thepoly);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
void nsRenderingContextMac :: DrawEllipse(const nsRect& aRect)
|
||||
NS_IMETHODIMP nsRenderingContextMac :: DrawEllipse(const nsRect& aRect)
|
||||
{
|
||||
DrawEllipse(aRect.x, aRect.y, aRect.width, aRect.height);
|
||||
return DrawEllipse(aRect.x, aRect.y, aRect.width, aRect.height);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
void nsRenderingContextMac :: DrawEllipse(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight)
|
||||
NS_IMETHODIMP nsRenderingContextMac :: DrawEllipse(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight)
|
||||
{
|
||||
nscoord x,y,w,h;
|
||||
Rect therect;
|
||||
nscoord x,y,w,h;
|
||||
Rect therect;
|
||||
|
||||
x = aX;
|
||||
y = aY;
|
||||
|
@ -807,18 +834,20 @@ Rect therect;
|
|||
mTMatrix->TransformCoord(&x,&y,&w,&h);
|
||||
::SetRect(&therect,x,y,x+w,x+h);
|
||||
::FrameOval(&therect);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
void nsRenderingContextMac :: FillEllipse(const nsRect& aRect)
|
||||
NS_IMETHODIMP nsRenderingContextMac :: FillEllipse(const nsRect& aRect)
|
||||
{
|
||||
FillEllipse(aRect.x, aRect.y, aRect.width, aRect.height);
|
||||
return FillEllipse(aRect.x, aRect.y, aRect.width, aRect.height);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
void nsRenderingContextMac :: FillEllipse(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight)
|
||||
NS_IMETHODIMP nsRenderingContextMac :: FillEllipse(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight)
|
||||
{
|
||||
nscoord x,y,w,h;
|
||||
Rect therect;
|
||||
|
@ -833,23 +862,25 @@ Rect therect;
|
|||
mTMatrix->TransformCoord(&x,&y,&w,&h);
|
||||
::SetRect(&therect,x,y,x+w,x+h);
|
||||
::PaintOval(&therect);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
void nsRenderingContextMac :: DrawArc(const nsRect& aRect,
|
||||
NS_IMETHODIMP nsRenderingContextMac :: DrawArc(const nsRect& aRect,
|
||||
float aStartAngle, float aEndAngle)
|
||||
{
|
||||
this->DrawArc(aRect.x,aRect.y,aRect.width,aRect.height,aStartAngle,aEndAngle);
|
||||
return DrawArc(aRect.x,aRect.y,aRect.width,aRect.height,aStartAngle,aEndAngle);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
void nsRenderingContextMac :: DrawArc(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight,
|
||||
NS_IMETHODIMP nsRenderingContextMac :: DrawArc(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight,
|
||||
float aStartAngle, float aEndAngle)
|
||||
{
|
||||
nscoord x,y,w,h;
|
||||
Rect therect;
|
||||
nscoord x,y,w,h;
|
||||
Rect therect;
|
||||
|
||||
x = aX;
|
||||
y = aY;
|
||||
|
@ -862,23 +893,24 @@ Rect therect;
|
|||
::SetRect(&therect,x,y,x+w,x+h);
|
||||
::FrameArc(&therect,aStartAngle,aEndAngle);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
void nsRenderingContextMac :: FillArc(const nsRect& aRect,
|
||||
NS_IMETHODIMP nsRenderingContextMac :: FillArc(const nsRect& aRect,
|
||||
float aStartAngle, float aEndAngle)
|
||||
{
|
||||
this->FillArc(aRect.x, aRect.y, aRect.width, aRect.height, aStartAngle, aEndAngle);
|
||||
return FillArc(aRect.x, aRect.y, aRect.width, aRect.height, aStartAngle, aEndAngle);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
void nsRenderingContextMac :: FillArc(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight,
|
||||
NS_IMETHODIMP nsRenderingContextMac :: FillArc(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight,
|
||||
float aStartAngle, float aEndAngle)
|
||||
{
|
||||
nscoord x,y,w,h;
|
||||
Rect therect;
|
||||
nscoord x,y,w,h;
|
||||
Rect therect;
|
||||
|
||||
x = aX;
|
||||
y = aY;
|
||||
|
@ -890,6 +922,8 @@ Rect therect;
|
|||
mTMatrix->TransformCoord(&x,&y,&w,&h);
|
||||
::SetRect(&therect,x,y,x+w,x+h);
|
||||
::PaintArc(&therect,aStartAngle,aEndAngle);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
@ -965,7 +999,7 @@ NS_IMETHODIMP nsRenderingContextMac :: GetWidth(const PRUnichar *aString, PRUint
|
|||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
void nsRenderingContextMac :: DrawString(const char *aString, PRUint32 aLength,
|
||||
NS_IMETHODIMP nsRenderingContextMac :: DrawString(const char *aString, PRUint32 aLength,
|
||||
nscoord aX, nscoord aY,
|
||||
nscoord aWidth,
|
||||
const nscoord* aSpacing)
|
||||
|
@ -1020,63 +1054,73 @@ void nsRenderingContextMac :: DrawString(const char *aString, PRUint32 aLength,
|
|||
DrawLine(aX, aY + (height >> 1), aX + aWidth, aY + (height >> 1));
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
void nsRenderingContextMac :: DrawString(const PRUnichar *aString, PRUint32 aLength,
|
||||
NS_IMETHODIMP nsRenderingContextMac :: DrawString(const PRUnichar *aString, PRUint32 aLength,
|
||||
nscoord aX, nscoord aY, nscoord aWidth,
|
||||
const nscoord* aSpacing)
|
||||
{
|
||||
nsString nsStr;
|
||||
nsStr.SetString(aString, aLength);
|
||||
char* cStr = nsStr.ToNewCString();
|
||||
DrawString(cStr, aLength, aX, aY, aWidth,aSpacing);
|
||||
|
||||
nsresult rv = DrawString(cStr, aLength, aX, aY, aWidth,aSpacing);
|
||||
|
||||
delete[] cStr;
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
void nsRenderingContextMac :: DrawString(const nsString& aString,
|
||||
NS_IMETHODIMP nsRenderingContextMac :: DrawString(const nsString& aString,
|
||||
nscoord aX, nscoord aY, nscoord aWidth,
|
||||
const nscoord* aSpacing)
|
||||
{
|
||||
char* cStr = aString.ToNewCString();
|
||||
DrawString(cStr, aString.Length(), aX, aY, aWidth, aSpacing);
|
||||
nsresult rv = DrawString(cStr, aString.Length(), aX, aY, aWidth, aSpacing);
|
||||
|
||||
delete[] cStr;
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
void nsRenderingContextMac :: DrawImage(nsIImage *aImage, nscoord aX, nscoord aY)
|
||||
NS_IMETHODIMP nsRenderingContextMac :: DrawImage(nsIImage *aImage, nscoord aX, nscoord aY)
|
||||
{
|
||||
nscoord width,height;
|
||||
nscoord width,height;
|
||||
|
||||
width = NSToCoordRound(mP2T * aImage->GetWidth());
|
||||
height = NSToCoordRound(mP2T * aImage->GetHeight());
|
||||
|
||||
this->DrawImage(aImage,aX,aY,width,height);
|
||||
return DrawImage(aImage,aX,aY,width,height);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
void nsRenderingContextMac :: DrawImage(nsIImage *aImage, nscoord aX, nscoord aY,
|
||||
NS_IMETHODIMP nsRenderingContextMac :: DrawImage(nsIImage *aImage, nscoord aX, nscoord aY,
|
||||
nscoord aWidth, nscoord aHeight)
|
||||
{
|
||||
nsRect tr;
|
||||
nsRect tr;
|
||||
|
||||
tr.x = aX;
|
||||
tr.y = aY;
|
||||
tr.width = aWidth;
|
||||
tr.height = aHeight;
|
||||
this->DrawImage(aImage,tr);
|
||||
|
||||
return DrawImage(aImage,tr);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
void nsRenderingContextMac :: DrawImage(nsIImage *aImage, const nsRect& aSRect, const nsRect& aDRect)
|
||||
NS_IMETHODIMP nsRenderingContextMac :: DrawImage(nsIImage *aImage, const nsRect& aSRect, const nsRect& aDRect)
|
||||
{
|
||||
nsRect sr,dr;
|
||||
nsRect sr,dr;
|
||||
|
||||
sr = aSRect;
|
||||
mTMatrix ->TransformCoord(&sr.x,&sr.y,&sr.width,&sr.height);
|
||||
|
@ -1084,29 +1128,30 @@ nsRect sr,dr;
|
|||
dr = aDRect;
|
||||
mTMatrix->TransformCoord(&dr.x,&dr.y,&dr.width,&dr.height);
|
||||
|
||||
((nsImageMac*)aImage)->Draw(*this,mRenderingSurface,sr.x,sr.y,sr.width,sr.height,
|
||||
dr.x,dr.y,dr.width,dr.height);
|
||||
return aImage->Draw(*this,mRenderingSurface,sr.x,sr.y,sr.width,sr.height,
|
||||
dr.x,dr.y,dr.width,dr.height);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
void nsRenderingContextMac :: DrawImage(nsIImage *aImage, const nsRect& aRect)
|
||||
NS_IMETHODIMP nsRenderingContextMac :: DrawImage(nsIImage *aImage, const nsRect& aRect)
|
||||
{
|
||||
nsRect tr;
|
||||
nsRect tr;
|
||||
|
||||
tr = aRect;
|
||||
mTMatrix->TransformCoord(&tr.x,&tr.y,&tr.width,&tr.height);
|
||||
|
||||
if (aImage != nsnull)
|
||||
{
|
||||
{
|
||||
::SetPort(mRenderingSurface);
|
||||
::SetClip(mMainRegion);
|
||||
((nsImageMac*)aImage)->Draw(*this,mRenderingSurface,tr.x,tr.y,tr.width,tr.height);
|
||||
}
|
||||
return aImage->Draw(*this,mRenderingSurface,tr.x,tr.y,tr.width,tr.height);
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
printf("Image is NULL!\n");
|
||||
}
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
@ -1166,18 +1211,3 @@ NS_IMETHODIMP nsRenderingContextMac :: CopyOffScreenBits(nsDrawingSurface aSrcSu
|
|||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -54,66 +54,67 @@ public:
|
|||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
virtual nsresult Init(nsIDeviceContext* aContext, nsIWidget *aWindow);
|
||||
virtual nsresult Init(nsIDeviceContext* aContext, nsDrawingSurface aSurface);
|
||||
virtual nsresult CommonInit();
|
||||
NS_IMETHOD Init(nsIDeviceContext* aContext, nsIWidget *aWindow);
|
||||
NS_IMETHOD Init(nsIDeviceContext* aContext, nsDrawingSurface aSurface);
|
||||
|
||||
virtual void Reset();
|
||||
virtual nsIDeviceContext * GetDeviceContext(void);
|
||||
virtual nsresult SelectOffScreenDrawingSurface(nsDrawingSurface aSurface);
|
||||
NS_IMETHOD Reset(void);
|
||||
NS_IMETHOD GetDeviceContext(nsIDeviceContext *&aContext);
|
||||
NS_IMETHOD SelectOffScreenDrawingSurface(nsDrawingSurface aSurface);
|
||||
NS_IMETHOD GetHints(PRUint32& aResult){return NS_OK;};
|
||||
virtual void PushState(void);
|
||||
virtual PRBool PopState(void);
|
||||
virtual PRBool IsVisibleRect(const nsRect& aRect);
|
||||
virtual PRBool SetClipRectInPixels(const nsRect& aRect, nsClipCombine aCombine);
|
||||
virtual PRBool SetClipRect(const nsRect& aRect, nsClipCombine aCombine);
|
||||
virtual PRBool GetClipRect(nsRect &aRect);
|
||||
virtual PRBool SetClipRegion(const nsIRegion& aRegion, nsClipCombine aCombine);
|
||||
virtual void GetClipRegion(nsIRegion **aRegion);
|
||||
NS_IMETHOD SetLineStyle(nsLineStyle aLineStyle);
|
||||
NS_IMETHOD GetLineStyle(nsLineStyle &aLineStyle);
|
||||
virtual void SetColor(nscolor aColor);
|
||||
virtual nscolor GetColor() const;
|
||||
virtual void SetFont(const nsFont& aFont);
|
||||
virtual void SetFont(nsIFontMetrics *aFontMetrics);
|
||||
virtual const nsFont& GetFont();
|
||||
virtual nsIFontMetrics * GetFontMetrics();
|
||||
virtual void Translate(nscoord aX, nscoord aY);
|
||||
virtual void Scale(float aSx, float aSy);
|
||||
virtual nsTransform2D * GetCurrentTransform();
|
||||
virtual nsDrawingSurface CreateDrawingSurface(nsRect *aBounds, PRUint32 aSurfFlags);
|
||||
virtual void DestroyDrawingSurface(nsDrawingSurface aDS);
|
||||
virtual void DrawLine(nscoord aX0, nscoord aY0, nscoord aX1, nscoord aY1);
|
||||
virtual void DrawPolyline(const nsPoint aPoints[], PRInt32 aNumPoints);
|
||||
virtual void DrawRect(const nsRect& aRect);
|
||||
virtual void DrawRect(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight);
|
||||
virtual void FillRect(const nsRect& aRect);
|
||||
virtual void FillRect(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight);
|
||||
virtual void DrawPolygon(const nsPoint aPoints[], PRInt32 aNumPoints);
|
||||
virtual void FillPolygon(const nsPoint aPoints[], PRInt32 aNumPoints);
|
||||
virtual void DrawEllipse(const nsRect& aRect);
|
||||
virtual void DrawEllipse(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight);
|
||||
virtual void FillEllipse(const nsRect& aRect);
|
||||
virtual void FillEllipse(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight);
|
||||
virtual void DrawArc(const nsRect& aRect,float aStartAngle, float aEndAngle);
|
||||
virtual void DrawArc(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight,float aStartAngle, float aEndAngle);
|
||||
virtual void FillArc(const nsRect& aRect,float aStartAngle, float aEndAngle);
|
||||
virtual void FillArc(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight,float aStartAngle, float aEndAngle);
|
||||
NS_IMETHOD GetWidth(char aC, nscoord &aWidth);
|
||||
NS_IMETHOD GetWidth(PRUnichar aC, nscoord &aWidth);
|
||||
NS_IMETHOD GetWidth(const nsString& aString, nscoord &aWidth);
|
||||
NS_IMETHOD GetWidth(const char *aString, nscoord &aWidth);
|
||||
NS_IMETHOD GetWidth(const char* aString, PRUint32 aLength, nscoord& aWidth);
|
||||
NS_IMETHOD GetWidth(const PRUnichar *aString, PRUint32 aLength, nscoord &aWidth);
|
||||
virtual void DrawString(const char *aString, PRUint32 aLength,nscoord aX, nscoord aY,nscoord aWidth, const nscoord* aSpacing);
|
||||
virtual void DrawString(const PRUnichar *aString, PRUint32 aLength, nscoord aX, nscoord aY,nscoord aWidth, const nscoord* aSpacing);
|
||||
virtual void DrawString(const nsString& aString, nscoord aX, nscoord aY,nscoord aWidth, const nscoord* aSpacing);
|
||||
virtual void DrawImage(nsIImage *aImage, nscoord aX, nscoord aY);
|
||||
virtual void DrawImage(nsIImage *aImage, nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight);
|
||||
virtual void DrawImage(nsIImage *aImage, const nsRect& aRect);
|
||||
virtual void DrawImage(nsIImage *aImage, const nsRect& aSRect, const nsRect& aDRect);
|
||||
NS_IMETHOD CopyOffScreenBits(nsDrawingSurface aSrcSurf, PRInt32 aSrcX, PRInt32 aSrcY,
|
||||
const nsRect &aDestBounds, PRUint32 aCopyFlags);
|
||||
NS_IMETHOD PushState(void);
|
||||
NS_IMETHOD PopState(PRBool &aClipEmpty);
|
||||
NS_IMETHOD IsVisibleRect(const nsRect& aRect, PRBool &aVisible);
|
||||
NS_IMETHOD SetClipRect(const nsRect& aRect, nsClipCombine aCombine, PRBool &aClipEmpty);
|
||||
NS_IMETHOD GetClipRect(nsRect &aRect, PRBool &aClipValid);
|
||||
NS_IMETHOD SetClipRegion(const nsIRegion& aRegion, nsClipCombine aCombine, PRBool &aClipEmpty);
|
||||
NS_IMETHOD GetClipRegion(nsIRegion **aRegion);
|
||||
NS_IMETHOD SetLineStyle(nsLineStyle aLineStyle);
|
||||
NS_IMETHOD GetLineStyle(nsLineStyle &aLineStyle);
|
||||
NS_IMETHOD SetColor(nscolor aColor);
|
||||
NS_IMETHOD GetColor(nsColor &aColor) const;
|
||||
NS_IMETHOD SetFont(const nsFont& aFont);
|
||||
NS_IMETHOD SetFont(nsIFontMetrics *aFontMetrics);
|
||||
NS_IMETHOD GetFontMetrics(nsIFontMetrics *&aFontMetrics);
|
||||
NS_IMETHOD Translate(nscoord aX, nscoord aY);
|
||||
NS_IMETHOD Scale(float aSx, float aSy);
|
||||
NS_IMETHOD GetCurrentTransform(nsTransform2D *&aTransform);
|
||||
NS_IMETHOD CreateDrawingSurface(nsRect *aBounds, PRUint32 aSurfFlags, nsDrawingSurface &aSurface);
|
||||
NS_IMETHOD DestroyDrawingSurface(nsDrawingSurface aDS);
|
||||
NS_IMETHOD DrawLine(nscoord aX0, nscoord aY0, nscoord aX1, nscoord aY1);
|
||||
NS_IMETHOD DrawPolyline(const nsPoint aPoints[], PRInt32 aNumPoints);
|
||||
NS_IMETHOD DrawRect(const nsRect& aRect);
|
||||
NS_IMETHOD DrawRect(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight);
|
||||
NS_IMETHOD FillRect(const nsRect& aRect);
|
||||
NS_IMETHOD FillRect(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight);
|
||||
NS_IMETHOD DrawPolygon(const nsPoint aPoints[], PRInt32 aNumPoints);
|
||||
NS_IMETHOD FillPolygon(const nsPoint aPoints[], PRInt32 aNumPoints);
|
||||
NS_IMETHOD DrawEllipse(const nsRect& aRect);
|
||||
NS_IMETHOD DrawEllipse(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight);
|
||||
NS_IMETHOD FillEllipse(const nsRect& aRect);
|
||||
NS_IMETHOD FillEllipse(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight);
|
||||
NS_IMETHOD DrawArc(const nsRect& aRect,float aStartAngle, float aEndAngle);
|
||||
NS_IMETHOD DrawArc(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight,float aStartAngle, float aEndAngle);
|
||||
NS_IMETHOD FillArc(const nsRect& aRect,float aStartAngle, float aEndAngle);
|
||||
NS_IMETHOD FillArc(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight,float aStartAngle, float aEndAngle);
|
||||
NS_IMETHOD GetWidth(char aC, nscoord &aWidth);
|
||||
NS_IMETHOD GetWidth(PRUnichar aC, nscoord &aWidth);
|
||||
NS_IMETHOD GetWidth(const nsString& aString, nscoord &aWidth);
|
||||
NS_IMETHOD GetWidth(const char *aString, nscoord &aWidth);
|
||||
NS_IMETHOD GetWidth(const char* aString, PRUint32 aLength, nscoord& aWidth);
|
||||
NS_IMETHOD GetWidth(const PRUnichar *aString, PRUint32 aLength, nscoord &aWidth);
|
||||
NS_IMETHOD DrawString(const char *aString, PRUint32 aLength,nscoord aX, nscoord aY,nscoord aWidth, const nscoord* aSpacing);
|
||||
NS_IMETHOD DrawString(const PRUnichar *aString, PRUint32 aLength, nscoord aX, nscoord aY,nscoord aWidth, const nscoord* aSpacing);
|
||||
NS_IMETHOD DrawString(const nsString& aString, nscoord aX, nscoord aY,nscoord aWidth, const nscoord* aSpacing);
|
||||
NS_IMETHOD DrawImage(nsIImage *aImage, nscoord aX, nscoord aY);
|
||||
NS_IMETHOD DrawImage(nsIImage *aImage, nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight);
|
||||
NS_IMETHOD DrawImage(nsIImage *aImage, const nsRect& aRect);
|
||||
NS_IMETHOD DrawImage(nsIImage *aImage, const nsRect& aSRect, const nsRect& aDRect);
|
||||
NS_IMETHOD CopyOffScreenBits(nsDrawingSurface aSrcSurf, PRInt32 aSrcX, PRInt32 aSrcY,
|
||||
const nsRect &aDestBounds, PRUint32 aCopyFlags);
|
||||
|
||||
//locals
|
||||
NS_IMETHOD CommonInit(void);
|
||||
NS_IMETHOD SetClipRectInPixels(const nsRect& aRect, nsClipCombine aCombine, PRBool &aClipEmpty);
|
||||
|
||||
protected:
|
||||
nscolor mCurrentColor ;
|
||||
|
@ -132,7 +133,6 @@ protected:
|
|||
|
||||
//state management
|
||||
nsVoidArray *mStateCache;
|
||||
|
||||
};
|
||||
|
||||
#endif /* nsRenderingContextMac_h___ */
|
||||
|
|
|
@ -136,7 +136,7 @@ NS_IMETHODIMP nsDeviceContextUnix :: GetScrollBarDimensions(float &aWidth, float
|
|||
|
||||
NS_IMETHODIMP nsDeviceContextUnix :: GetDrawingSurface(nsIRenderingContext &aContext, nsDrawingSurface &aSurface)
|
||||
{
|
||||
aSurface = aContext.CreateDrawingSurface(nsnull, 0);
|
||||
aContext.CreateDrawingSurface(nsnull, 0, aSurface);
|
||||
return nsnull == aSurface ? NS_ERROR_OUT_OF_MEMORY : NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -183,33 +183,33 @@ void nsImageUnix :: ImageUpdated(nsIDeviceContext *aContext, PRUint8 aFlags, nsR
|
|||
//------------------------------------------------------------
|
||||
|
||||
// Draw the bitmap, this method has a source and destination coordinates
|
||||
PRBool nsImageUnix :: Draw(nsIRenderingContext &aContext, nsDrawingSurface aSurface, PRInt32 aSX, PRInt32 aSY, PRInt32 aSWidth, PRInt32 aSHeight,
|
||||
PRInt32 aDX, PRInt32 aDY, PRInt32 aDWidth, PRInt32 aDHeight)
|
||||
NS_IMETHODIMP nsImageUnix :: Draw(nsIRenderingContext &aContext, nsDrawingSurface aSurface, PRInt32 aSX, PRInt32 aSY, PRInt32 aSWidth, PRInt32 aSHeight,
|
||||
PRInt32 aDX, PRInt32 aDY, PRInt32 aDWidth, PRInt32 aDHeight)
|
||||
{
|
||||
nsDrawingSurfaceUnix *unixdrawing =(nsDrawingSurfaceUnix*) aSurface;
|
||||
nsDrawingSurfaceUnix *unixdrawing =(nsDrawingSurfaceUnix*) aSurface;
|
||||
|
||||
if ((PR_FALSE==mStaticImage) || (nsnull == mImage)) {
|
||||
BuildImage(aSurface);
|
||||
}
|
||||
|
||||
if (nsnull == mImage)
|
||||
return PR_FALSE;
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
XPutImage(unixdrawing->display,unixdrawing->drawable,unixdrawing->gc,mImage,
|
||||
aSX,aSY,aDX,aDY,aDWidth,aDHeight);
|
||||
|
||||
return PR_TRUE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------
|
||||
|
||||
// Draw the bitmap, this draw just has destination coordinates
|
||||
PRBool nsImageUnix :: Draw(nsIRenderingContext &aContext,
|
||||
nsDrawingSurface aSurface,
|
||||
PRInt32 aX, PRInt32 aY,
|
||||
PRInt32 aWidth, PRInt32 aHeight)
|
||||
NS_IMETHODIMP nsImageUnix :: Draw(nsIRenderingContext &aContext,
|
||||
nsDrawingSurface aSurface,
|
||||
PRInt32 aX, PRInt32 aY,
|
||||
PRInt32 aWidth, PRInt32 aHeight)
|
||||
{
|
||||
nsDrawingSurfaceUnix *unixdrawing =(nsDrawingSurfaceUnix*) aSurface;
|
||||
nsDrawingSurfaceUnix *unixdrawing =(nsDrawingSurfaceUnix*) aSurface;
|
||||
|
||||
BuildImage(aSurface);
|
||||
|
||||
|
@ -219,18 +219,17 @@ nsDrawingSurfaceUnix *unixdrawing =(nsDrawingSurfaceUnix*) aSurface;
|
|||
}
|
||||
|
||||
if (nsnull == mImage)
|
||||
return PR_FALSE;
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
XPutImage(unixdrawing->display,unixdrawing->drawable,unixdrawing->gc,mImage,
|
||||
0,0,aX,aY,aWidth,aHeight);
|
||||
return PR_TRUE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------
|
||||
|
||||
void nsImageUnix::CompositeImage(nsIImage *aTheImage, nsPoint *aULLocation,nsBlendQuality aBlendQuality)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//------------------------------------------------------------
|
||||
|
|
|
@ -40,9 +40,9 @@ public:
|
|||
virtual PRUint8* GetBits() { return mImageBits; }
|
||||
virtual void* GetBitInfo() { return nsnull; }
|
||||
virtual PRInt32 GetLineStride() {return mRowBytes; }
|
||||
virtual PRBool Draw(nsIRenderingContext &aContext, nsDrawingSurface aSurface, PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeight);
|
||||
virtual PRBool Draw(nsIRenderingContext &aContext, nsDrawingSurface aSurface, PRInt32 aSX, PRInt32 aSY, PRInt32 aSWidth, PRInt32 aSHeight,
|
||||
PRInt32 aDX, PRInt32 aDY, PRInt32 aDWidth, PRInt32 aDHeight);
|
||||
NS_IMETHOD Draw(nsIRenderingContext &aContext, nsDrawingSurface aSurface, PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeight);
|
||||
NS_IMETHOD Draw(nsIRenderingContext &aContext, nsDrawingSurface aSurface, PRInt32 aSX, PRInt32 aSY, PRInt32 aSWidth, PRInt32 aSHeight,
|
||||
PRInt32 aDX, PRInt32 aDY, PRInt32 aDWidth, PRInt32 aDHeight);
|
||||
virtual nsColorMap* GetColorMap() {return mColorMap;}
|
||||
virtual void ImageUpdated(nsIDeviceContext *aContext, PRUint8 aFlags, nsRect *aUpdateRect);
|
||||
virtual nsresult Init(PRInt32 aWidth, PRInt32 aHeight, PRInt32 aDepth, nsMaskRequirements aMaskRequirements);
|
||||
|
|
|
@ -193,7 +193,7 @@ nsRenderingContextUnix :: Init(nsIDeviceContext* aContext,
|
|||
return (CommonInit());
|
||||
}
|
||||
|
||||
nsresult nsRenderingContextUnix :: CommonInit()
|
||||
NS_IMETHODIMP nsRenderingContextUnix :: CommonInit()
|
||||
{
|
||||
|
||||
#ifdef MITSHM
|
||||
|
@ -262,19 +262,20 @@ nsRenderingContextUnix::GetHints(PRUint32& aResult)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsRenderingContextUnix :: Reset()
|
||||
NS_IMETHODIMP nsRenderingContextUnix :: Reset(void)
|
||||
{
|
||||
return ND_OK;
|
||||
}
|
||||
|
||||
nsIDeviceContext * nsRenderingContextUnix :: GetDeviceContext(void)
|
||||
NS_IMETHODIMP nsRenderingContextUnix :: GetDeviceContext(nsIDeviceContext *&aContext)
|
||||
{
|
||||
NS_IF_ADDREF(mContext);
|
||||
return mContext;
|
||||
aContext = mContext;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsRenderingContextUnix :: PushState(void)
|
||||
NS_IMETHODIMP nsRenderingContextUnix :: PushState(void)
|
||||
{
|
||||
|
||||
nsRect rect;
|
||||
|
||||
GraphicsState * state = new GraphicsState();
|
||||
|
@ -309,11 +310,11 @@ void nsRenderingContextUnix :: PushState(void)
|
|||
state->mColor = mCurrentColor;
|
||||
state->mLineStyle = mCurrentLineStyle;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRBool nsRenderingContextUnix :: PopState(void)
|
||||
NS_IMETHODIMP nsRenderingContextUnix :: PopState(PRBool &aClipEmpty)
|
||||
{
|
||||
|
||||
PRBool bEmpty = PR_FALSE;
|
||||
|
||||
PRUint32 cnt = mStateCache->Count();
|
||||
|
@ -341,10 +342,9 @@ PRBool nsRenderingContextUnix :: PopState(void)
|
|||
// do this IFF we need to draw before the next Pop. We'd need to check the
|
||||
// state flag on every draw operation.
|
||||
if (nsnull != mRegion)
|
||||
::XSetRegion(mRenderingSurface->display,
|
||||
mRenderingSurface->gc,
|
||||
mRegion);
|
||||
|
||||
::XSetRegion(mRenderingSurface->display,
|
||||
mRenderingSurface->gc,
|
||||
mRegion);
|
||||
}
|
||||
|
||||
if (state->mColor != mCurrentColor)
|
||||
|
@ -358,15 +358,18 @@ PRBool nsRenderingContextUnix :: PopState(void)
|
|||
delete state;
|
||||
}
|
||||
|
||||
return bEmpty;
|
||||
aClipEmpty = bEmpty;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRBool nsRenderingContextUnix :: IsVisibleRect(const nsRect& aRect)
|
||||
NS_IMETHODIMP nsRenderingContextUnix :: IsVisibleRect(const nsRect& aRect, PRBool &aVisible)
|
||||
{
|
||||
return PR_TRUE;
|
||||
aVisible = PR_TRUE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRBool nsRenderingContextUnix :: SetClipRectInPixels(const nsRect& aRect, nsClipCombine aCombine)
|
||||
NS_IMETHODIMP nsRenderingContextUnix :: SetClipRectInPixels(const nsRect& aRect, nsClipCombine aCombine, PRBool &aClipEmpty)
|
||||
{
|
||||
PRBool bEmpty = PR_FALSE;
|
||||
|
||||
|
@ -453,37 +456,41 @@ PRBool nsRenderingContextUnix :: SetClipRectInPixels(const nsRect& aRect, nsClip
|
|||
|
||||
}
|
||||
|
||||
return bEmpty;
|
||||
aClipEmpty = bEmpty;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRBool nsRenderingContextUnix :: SetClipRect(const nsRect& aRect, nsClipCombine aCombine)
|
||||
NS_IMETHODIMP nsRenderingContextUnix :: SetClipRect(const nsRect& aRect, nsClipCombine aCombine, PRBool &aClipEmpty)
|
||||
{
|
||||
nsRect trect = aRect;
|
||||
|
||||
mTMatrix->TransformCoord(&trect.x, &trect.y,
|
||||
&trect.width, &trect.height);
|
||||
return(SetClipRectInPixels(trect,aCombine));
|
||||
return SetClipRectInPixels(trect, aCombine, aClipEmpty);
|
||||
}
|
||||
|
||||
PRBool nsRenderingContextUnix :: GetClipRect(nsRect &aRect)
|
||||
NS_IMETHODIMP nsRenderingContextUnix :: GetClipRect(nsRect &aRect, PRBool &aClipValid)
|
||||
{
|
||||
|
||||
if (mRegion != nsnull) {
|
||||
XRectangle xrect;
|
||||
::XClipBox(mRegion, &xrect);
|
||||
aRect.SetRect(xrect.x, xrect.y, xrect.width, xrect.height);
|
||||
} else {
|
||||
aRect.SetRect(0,0,0,0);
|
||||
return (PR_TRUE);
|
||||
aClipValid = PR_TRUE;
|
||||
return NS_OK;
|
||||
}
|
||||
if (::XEmptyRegion(mRegion) == True)
|
||||
return PR_TRUE;
|
||||
else
|
||||
return PR_FALSE;
|
||||
|
||||
if (::XEmptyRegion(mRegion) == True)
|
||||
aClipValid = PR_TRUE;
|
||||
else
|
||||
aClipValid = PR_FALSE;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRBool nsRenderingContextUnix :: SetClipRegion(const nsIRegion& aRegion, nsClipCombine aCombine)
|
||||
NS_IMETHODIMP nsRenderingContextUnix :: SetClipRegion(const nsIRegion& aRegion, nsClipCombine aCombine, PRBool &aClipEmpty)
|
||||
{
|
||||
nsRect rect;
|
||||
XRectangle xrect;
|
||||
|
@ -501,15 +508,15 @@ PRBool nsRenderingContextUnix :: SetClipRegion(const nsIRegion& aRegion, nsClipC
|
|||
SetClipRectInPixels(rect, aCombine);
|
||||
|
||||
if (::XEmptyRegion(mRegion) == True)
|
||||
return PR_TRUE;
|
||||
aClipEmpty = PR_TRUE;
|
||||
else
|
||||
return PR_FALSE;
|
||||
aClipEmpty = PR_FALSE;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsRenderingContextUnix :: GetClipRegion(nsIRegion **aRegion)
|
||||
NS_IMETHODIMP nsRenderingContextUnix :: GetClipRegion(nsIRegion **aRegion)
|
||||
{
|
||||
|
||||
nsIRegion * pRegion ;
|
||||
|
||||
static NS_DEFINE_IID(kCRegionCID, NS_REGION_CID);
|
||||
|
@ -528,16 +535,15 @@ void nsRenderingContextUnix :: GetClipRegion(nsIRegion **aRegion)
|
|||
pRegion->Union(rect.x,rect.y,rect.width,rect.height);
|
||||
}
|
||||
|
||||
return ;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsRenderingContextUnix :: SetColor(nscolor aColor)
|
||||
NS_IMETHODIMP nsRenderingContextUnix :: SetColor(nscolor aColor)
|
||||
{
|
||||
if (nsnull == mContext)
|
||||
return;
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
XGCValues values ;
|
||||
XGCValues values;
|
||||
mContext->ConvertPixel(aColor, mCurrentColor);
|
||||
|
||||
values.foreground = mCurrentColor;
|
||||
|
@ -548,18 +554,19 @@ void nsRenderingContextUnix :: SetColor(nscolor aColor)
|
|||
GCForeground | GCBackground,
|
||||
&values);
|
||||
|
||||
mCurrentColor = aColor ;
|
||||
mCurrentColor = aColor;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nscolor nsRenderingContextUnix :: GetColor() const
|
||||
NS_IMETHODIMP nsRenderingContextUnix :: GetColor(nscolor &aColor) const
|
||||
{
|
||||
return mCurrentColor;
|
||||
aColor = mCurrentColor;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsRenderingContextUnix :: SetLineStyle(nsLineStyle aLineStyle)
|
||||
NS_IMETHODIMP nsRenderingContextUnix :: SetLineStyle(nsLineStyle aLineStyle)
|
||||
{
|
||||
|
||||
if (aLineStyle != mCurrentLineStyle)
|
||||
{
|
||||
XGCValues values ;
|
||||
|
@ -601,13 +608,13 @@ nsresult nsRenderingContextUnix :: SetLineStyle(nsLineStyle aLineStyle)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsRenderingContextUnix :: GetLineStyle(nsLineStyle &aLineStyle)
|
||||
NS_IMETHODIMP nsRenderingContextUnix :: GetLineStyle(nsLineStyle &aLineStyle)
|
||||
{
|
||||
aLineStyle = mCurrentLineStyle;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsRenderingContextUnix :: SetFont(const nsFont& aFont)
|
||||
NS_IMETHODIMP nsRenderingContextUnix :: SetFont(const nsFont& aFont)
|
||||
{
|
||||
NS_IF_RELEASE(mFontMetrics);
|
||||
mContext->GetMetricsFor(aFont, mFontMetrics);
|
||||
|
@ -626,9 +633,11 @@ void nsRenderingContextUnix :: SetFont(const nsFont& aFont)
|
|||
// ::XFlushGC(mRenderingSurface->display,
|
||||
// mRenderingSurface->gc);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsRenderingContextUnix :: SetFont(nsIFontMetrics *aFontMetrics)
|
||||
NS_IMETHODIMP nsRenderingContextUnix :: SetFont(nsIFontMetrics *aFontMetrics)
|
||||
{
|
||||
NS_IF_RELEASE(mFontMetrics);
|
||||
mFontMetrics = aFontMetrics;
|
||||
|
@ -651,43 +660,45 @@ void nsRenderingContextUnix :: SetFont(nsIFontMetrics *aFontMetrics)
|
|||
// ::XFlushGC(mRenderingSurface->display,
|
||||
// mRenderingSurface->gc);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
const nsFont& nsRenderingContextUnix :: GetFont()
|
||||
{
|
||||
const nsFont* font;
|
||||
mFontMetrics->GetFont(font);
|
||||
return *font;
|
||||
}
|
||||
|
||||
nsIFontMetrics* nsRenderingContextUnix :: GetFontMetrics()
|
||||
NS_IMETHODIMP nsRenderingContextUnix :: GetFontMetrics(nsIFontMetrics *&aFontMetrics)
|
||||
{
|
||||
NS_IF_ADDREF(mFontMetrics);
|
||||
return mFontMetrics;
|
||||
aFontMetrics = mFontMetrics;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// add the passed in translation to the current translation
|
||||
void nsRenderingContextUnix :: Translate(nscoord aX, nscoord aY)
|
||||
NS_IMETHODIMP nsRenderingContextUnix :: Translate(nscoord aX, nscoord aY)
|
||||
{
|
||||
mTMatrix->AddTranslation((float)aX,(float)aY);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// add the passed in scale to the current scale
|
||||
void nsRenderingContextUnix :: Scale(float aSx, float aSy)
|
||||
NS_IMETHODIMP nsRenderingContextUnix :: Scale(float aSx, float aSy)
|
||||
{
|
||||
mTMatrix->AddScale(aSx, aSy);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsTransform2D * nsRenderingContextUnix :: GetCurrentTransform()
|
||||
NS_IMETHODIMP nsRenderingContextUnix :: GetCurrentTransform(nsTransform2D *&aTransform)
|
||||
{
|
||||
return mTMatrix;
|
||||
aTransform = mTMatrix;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsDrawingSurface nsRenderingContextUnix :: CreateDrawingSurface(nsRect *aBounds, PRUint32 aSurfFlags)
|
||||
NS_IMETHODIMP nsRenderingContextUnix :: CreateDrawingSurface(nsRect *aBounds, PRUint32 aSurfFlags, nsDrawingSurface &aSurface)
|
||||
{
|
||||
if (nsnull == mRenderingSurface) {
|
||||
return nsnull;
|
||||
aSurface = nsnull;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// Must make sure this code never gets called when nsRenderingSurface is nsnull
|
||||
PRUint32 depth = DefaultDepth(mRenderingSurface->display,
|
||||
DefaultScreen(mRenderingSurface->display));
|
||||
|
@ -794,10 +805,12 @@ nsDrawingSurface nsRenderingContextUnix :: CreateDrawingSurface(nsRect *aBounds,
|
|||
|
||||
#endif
|
||||
|
||||
return ((nsDrawingSurface)surface);
|
||||
aSurface = (nsDrawingSurface)surface;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsRenderingContextUnix :: DestroyDrawingSurface(nsDrawingSurface aDS)
|
||||
NS_IMETHODIMP nsRenderingContextUnix :: DestroyDrawingSurface(nsDrawingSurface aDS)
|
||||
{
|
||||
nsDrawingSurfaceUnix * surface = (nsDrawingSurfaceUnix *) aDS;
|
||||
|
||||
|
@ -820,12 +833,14 @@ void nsRenderingContextUnix :: DestroyDrawingSurface(nsDrawingSurface aDS)
|
|||
mRenderingSurface = nsnull;
|
||||
|
||||
delete aDS;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsRenderingContextUnix :: DrawLine(nscoord aX0, nscoord aY0, nscoord aX1, nscoord aY1)
|
||||
NS_IMETHODIMP nsRenderingContextUnix :: DrawLine(nscoord aX0, nscoord aY0, nscoord aX1, nscoord aY1)
|
||||
{
|
||||
if (nsnull == mTMatrix || nsnull == mRenderingSurface) {
|
||||
return;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
mTMatrix->TransformCoord(&aX0,&aY0);
|
||||
mTMatrix->TransformCoord(&aX1,&aY1);
|
||||
|
@ -834,12 +849,14 @@ void nsRenderingContextUnix :: DrawLine(nscoord aX0, nscoord aY0, nscoord aX1, n
|
|||
mRenderingSurface->drawable,
|
||||
mRenderingSurface->gc,
|
||||
aX0, aY0, aX1, aY1);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsRenderingContextUnix :: DrawPolyline(const nsPoint aPoints[], PRInt32 aNumPoints)
|
||||
NS_IMETHODIMP nsRenderingContextUnix :: DrawPolyline(const nsPoint aPoints[], PRInt32 aNumPoints)
|
||||
{
|
||||
if (nsnull == mTMatrix || nsnull == mRenderingSurface) {
|
||||
return;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
PRUint32 i ;
|
||||
XPoint * xpoints;
|
||||
|
@ -860,17 +877,19 @@ void nsRenderingContextUnix :: DrawPolyline(const nsPoint aPoints[], PRInt32 aNu
|
|||
xpoints, aNumPoints, CoordModeOrigin);
|
||||
|
||||
PR_Free((void *)xpoints);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsRenderingContextUnix :: DrawRect(const nsRect& aRect)
|
||||
NS_IMETHODIMP nsRenderingContextUnix :: DrawRect(const nsRect& aRect)
|
||||
{
|
||||
DrawRect(aRect.x, aRect.y, aRect.width, aRect.height);
|
||||
return DrawRect(aRect.x, aRect.y, aRect.width, aRect.height);
|
||||
}
|
||||
|
||||
void nsRenderingContextUnix :: DrawRect(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight)
|
||||
NS_IMETHODIMP nsRenderingContextUnix :: DrawRect(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight)
|
||||
{
|
||||
if (nsnull == mTMatrix || nsnull == mRenderingSurface) {
|
||||
return;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nscoord x,y,w,h;
|
||||
|
@ -886,17 +905,19 @@ void nsRenderingContextUnix :: DrawRect(nscoord aX, nscoord aY, nscoord aWidth,
|
|||
mRenderingSurface->drawable,
|
||||
mRenderingSurface->gc,
|
||||
x,y,w,h);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsRenderingContextUnix :: FillRect(const nsRect& aRect)
|
||||
NS_IMETHODIMP nsRenderingContextUnix :: FillRect(const nsRect& aRect)
|
||||
{
|
||||
FillRect(aRect.x, aRect.y, aRect.width, aRect.height);
|
||||
return FillRect(aRect.x, aRect.y, aRect.width, aRect.height);
|
||||
}
|
||||
|
||||
void nsRenderingContextUnix :: FillRect(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight)
|
||||
NS_IMETHODIMP nsRenderingContextUnix :: FillRect(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight)
|
||||
{
|
||||
if (nsnull == mTMatrix || nsnull == mRenderingSurface) {
|
||||
return;
|
||||
return NS_ERROR_FAILURE
|
||||
}
|
||||
nscoord x,y,w,h;
|
||||
x = aX;
|
||||
|
@ -910,13 +931,14 @@ void nsRenderingContextUnix :: FillRect(nscoord aX, nscoord aY, nscoord aWidth,
|
|||
mRenderingSurface->gc,
|
||||
x,y,w,h);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
void nsRenderingContextUnix::DrawPolygon(const nsPoint aPoints[], PRInt32 aNumPoints)
|
||||
NS_IMETHODIMP nsRenderingContextUnix::DrawPolygon(const nsPoint aPoints[], PRInt32 aNumPoints)
|
||||
{
|
||||
if (nsnull == mTMatrix || nsnull == mRenderingSurface) {
|
||||
return;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
PRUint32 i ;
|
||||
XPoint * xpoints;
|
||||
|
@ -937,12 +959,14 @@ void nsRenderingContextUnix::DrawPolygon(const nsPoint aPoints[], PRInt32 aNumPo
|
|||
xpoints, aNumPoints, CoordModeOrigin);
|
||||
|
||||
PR_Free((void *)xpoints);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsRenderingContextUnix::FillPolygon(const nsPoint aPoints[], PRInt32 aNumPoints)
|
||||
NS_IMETHODIMP nsRenderingContextUnix::FillPolygon(const nsPoint aPoints[], PRInt32 aNumPoints)
|
||||
{
|
||||
if (nsnull == mTMatrix || nsnull == mRenderingSurface) {
|
||||
return;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
PRUint32 i ;
|
||||
XPoint * xpoints;
|
||||
|
@ -966,17 +990,19 @@ void nsRenderingContextUnix::FillPolygon(const nsPoint aPoints[], PRInt32 aNumPo
|
|||
xpoints, aNumPoints, Convex, CoordModeOrigin);
|
||||
|
||||
PR_Free((void *)xpoints);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsRenderingContextUnix :: DrawEllipse(const nsRect& aRect)
|
||||
NS_IMETHODIMP nsRenderingContextUnix :: DrawEllipse(const nsRect& aRect)
|
||||
{
|
||||
DrawEllipse(aRect.x, aRect.y, aRect.width, aRect.height);
|
||||
return DrawEllipse(aRect.x, aRect.y, aRect.width, aRect.height);
|
||||
}
|
||||
|
||||
void nsRenderingContextUnix :: DrawEllipse(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight)
|
||||
NS_IMETHODIMP nsRenderingContextUnix :: DrawEllipse(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight)
|
||||
{
|
||||
if (nsnull == mTMatrix || nsnull == mRenderingSurface) {
|
||||
return;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
nscoord x,y,w,h;
|
||||
|
||||
|
@ -991,17 +1017,19 @@ void nsRenderingContextUnix :: DrawEllipse(nscoord aX, nscoord aY, nscoord aWidt
|
|||
mRenderingSurface->drawable,
|
||||
mRenderingSurface->gc,
|
||||
x,y,w,h, 0, 360 * 64);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsRenderingContextUnix :: FillEllipse(const nsRect& aRect)
|
||||
NS_IMETHODIMP nsRenderingContextUnix :: FillEllipse(const nsRect& aRect)
|
||||
{
|
||||
FillEllipse(aRect.x, aRect.y, aRect.width, aRect.height);
|
||||
return FillEllipse(aRect.x, aRect.y, aRect.width, aRect.height);
|
||||
}
|
||||
|
||||
void nsRenderingContextUnix :: FillEllipse(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight)
|
||||
NS_IMETHODIMP nsRenderingContextUnix :: FillEllipse(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight)
|
||||
{
|
||||
if (nsnull == mTMatrix || nsnull == mRenderingSurface) {
|
||||
return;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
nscoord x,y,w,h;
|
||||
|
||||
|
@ -1016,19 +1044,21 @@ void nsRenderingContextUnix :: FillEllipse(nscoord aX, nscoord aY, nscoord aWidt
|
|||
mRenderingSurface->drawable,
|
||||
mRenderingSurface->gc,
|
||||
x,y,w,h, 0, 360 * 64);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsRenderingContextUnix :: DrawArc(const nsRect& aRect,
|
||||
NS_IMETHODIMP nsRenderingContextUnix :: DrawArc(const nsRect& aRect,
|
||||
float aStartAngle, float aEndAngle)
|
||||
{
|
||||
this->DrawArc(aRect.x,aRect.y,aRect.width,aRect.height,aStartAngle,aEndAngle);
|
||||
return DrawArc(aRect.x,aRect.y,aRect.width,aRect.height,aStartAngle,aEndAngle);
|
||||
}
|
||||
|
||||
void nsRenderingContextUnix :: DrawArc(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight,
|
||||
NS_IMETHODIMP nsRenderingContextUnix :: DrawArc(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight,
|
||||
float aStartAngle, float aEndAngle)
|
||||
{
|
||||
if (nsnull == mTMatrix || nsnull == mRenderingSurface) {
|
||||
return;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
nscoord x,y,w,h;
|
||||
|
||||
|
@ -1044,19 +1074,21 @@ void nsRenderingContextUnix :: DrawArc(nscoord aX, nscoord aY, nscoord aWidth, n
|
|||
mRenderingSurface->gc,
|
||||
x,y,w,h, NSToIntRound(aStartAngle * 64.0f),
|
||||
NSToIntRound(aEndAngle * 64.0f));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsRenderingContextUnix :: FillArc(const nsRect& aRect,
|
||||
NS_IMETHODIMP nsRenderingContextUnix :: FillArc(const nsRect& aRect,
|
||||
float aStartAngle, float aEndAngle)
|
||||
{
|
||||
this->FillArc(aRect.x, aRect.y, aRect.width, aRect.height, aStartAngle, aEndAngle);
|
||||
return FillArc(aRect.x, aRect.y, aRect.width, aRect.height, aStartAngle, aEndAngle);
|
||||
}
|
||||
|
||||
void nsRenderingContextUnix :: FillArc(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight,
|
||||
NS_IMETHODIMP nsRenderingContextUnix :: FillArc(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight,
|
||||
float aStartAngle, float aEndAngle)
|
||||
{
|
||||
if (nsnull == mTMatrix || nsnull == mRenderingSurface) {
|
||||
return;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
nscoord x,y,w,h;
|
||||
|
||||
|
@ -1072,6 +1104,8 @@ void nsRenderingContextUnix :: FillArc(nscoord aX, nscoord aY, nscoord aWidth, n
|
|||
mRenderingSurface->gc,
|
||||
x,y,w,h, NSToIntRound(aStartAngle * 64.0f),
|
||||
NSToIntRound(aEndAngle * 64.0f));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsRenderingContextUnix :: GetWidth(char ch, nscoord &aWidth)
|
||||
|
@ -1151,7 +1185,7 @@ NS_IMETHODIMP nsRenderingContextUnix :: GetWidth(const PRUnichar *aString,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
NS_IMETHODIMP
|
||||
nsRenderingContextUnix :: DrawString(const char *aString, PRUint32 aLength,
|
||||
nscoord aX, nscoord aY,
|
||||
nscoord aWidth,
|
||||
|
@ -1175,7 +1209,9 @@ nsRenderingContextUnix :: DrawString(const char *aString, PRUint32 aLength,
|
|||
|
||||
if (mFontMetrics)
|
||||
{
|
||||
PRUint8 deco = GetFont().decorations;
|
||||
nsFont *font;
|
||||
mFontMetrics->GetFont(font);
|
||||
PRUint8 deco = font->decorations;
|
||||
|
||||
if (deco & NS_FONT_DECORATION_OVERLINE)
|
||||
DrawLine(aX, aY, aX + aWidth, aY);
|
||||
|
@ -1200,9 +1236,11 @@ nsRenderingContextUnix :: DrawString(const char *aString, PRUint32 aLength,
|
|||
DrawLine(aX, aY + (height >> 1), aX + aWidth, aY + (height >> 1));
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
NS_IMETHODIMP
|
||||
nsRenderingContextUnix :: DrawString(const PRUnichar *aString, PRUint32 aLength,
|
||||
nscoord aX, nscoord aY, nscoord aWidth,
|
||||
const nscoord* aSpacing)
|
||||
|
@ -1248,7 +1286,9 @@ nsRenderingContextUnix :: DrawString(const PRUnichar *aString, PRUint32 aLength,
|
|||
|
||||
if (mFontMetrics)
|
||||
{
|
||||
PRUint8 deco = GetFont().decorations;
|
||||
nsFont *font
|
||||
mFontMetrics->GetFont(font);
|
||||
PRUint8 deco = font->decorations;
|
||||
|
||||
if (deco & NS_FONT_DECORATION_OVERLINE)
|
||||
DrawLine(aX, aY, aX + aWidth, aY);
|
||||
|
@ -1273,26 +1313,28 @@ nsRenderingContextUnix :: DrawString(const PRUnichar *aString, PRUint32 aLength,
|
|||
DrawLine(aX, aY + (height >> 1), aX + aWidth, aY + (height >> 1));
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
NS_IMETHODIMP
|
||||
nsRenderingContextUnix :: DrawString(const nsString& aString,
|
||||
nscoord aX, nscoord aY, nscoord aWidth,
|
||||
const nscoord* aSpacing)
|
||||
{
|
||||
DrawString(aString.GetUnicode(), aString.Length(), aX, aY, aWidth, aSpacing);
|
||||
return DrawString(aString.GetUnicode(), aString.Length(), aX, aY, aWidth, aSpacing);
|
||||
}
|
||||
|
||||
void nsRenderingContextUnix :: DrawImage(nsIImage *aImage, nscoord aX, nscoord aY)
|
||||
NS_IMETHODIMP nsRenderingContextUnix :: DrawImage(nsIImage *aImage, nscoord aX, nscoord aY)
|
||||
{
|
||||
nscoord width,height;
|
||||
width = NSToCoordRound(mP2T * aImage->GetWidth());
|
||||
height = NSToCoordRound(mP2T * aImage->GetHeight());
|
||||
|
||||
this->DrawImage(aImage,aX,aY,width,height);
|
||||
return DrawImage(aImage,aX,aY,width,height);
|
||||
}
|
||||
|
||||
void nsRenderingContextUnix :: DrawImage(nsIImage *aImage, nscoord aX, nscoord aY,
|
||||
NS_IMETHODIMP nsRenderingContextUnix :: DrawImage(nsIImage *aImage, nscoord aX, nscoord aY,
|
||||
nscoord aWidth, nscoord aHeight)
|
||||
{
|
||||
nsRect tr;
|
||||
|
@ -1301,10 +1343,11 @@ void nsRenderingContextUnix :: DrawImage(nsIImage *aImage, nscoord aX, nscoord a
|
|||
tr.y = aY;
|
||||
tr.width = aWidth;
|
||||
tr.height = aHeight;
|
||||
this->DrawImage(aImage,tr);
|
||||
|
||||
return DrawImage(aImage,tr);
|
||||
}
|
||||
|
||||
void nsRenderingContextUnix :: DrawImage(nsIImage *aImage, const nsRect& aSRect, const nsRect& aDRect)
|
||||
NS_IMETHODIMP nsRenderingContextUnix :: DrawImage(nsIImage *aImage, const nsRect& aSRect, const nsRect& aDRect)
|
||||
{
|
||||
nsRect sr,dr;
|
||||
|
||||
|
@ -1314,20 +1357,18 @@ void nsRenderingContextUnix :: DrawImage(nsIImage *aImage, const nsRect& aSRect,
|
|||
dr = aDRect;
|
||||
mTMatrix->TransformCoord(&dr.x,&dr.y,&dr.width,&dr.height);
|
||||
|
||||
((nsImageUnix*)aImage)->Draw(*this,mRenderingSurface,sr.x,sr.y,sr.width,sr.height,
|
||||
dr.x,dr.y,dr.width,dr.height);
|
||||
return aImage->Draw(*this,mRenderingSurface,sr.x,sr.y,sr.width,sr.height,
|
||||
dr.x,dr.y,dr.width,dr.height);
|
||||
}
|
||||
|
||||
void nsRenderingContextUnix :: DrawImage(nsIImage *aImage, const nsRect& aRect)
|
||||
NS_IMETHODIMP nsRenderingContextUnix :: DrawImage(nsIImage *aImage, const nsRect& aRect)
|
||||
{
|
||||
nsRect tr;
|
||||
|
||||
tr = aRect;
|
||||
mTMatrix->TransformCoord(&tr.x,&tr.y,&tr.width,&tr.height);
|
||||
|
||||
if (aImage != nsnull) {
|
||||
((nsImageUnix*)aImage)->Draw(*this,mRenderingSurface,tr.x,tr.y,tr.width,tr.height);
|
||||
}
|
||||
return aImage->Draw(*this,mRenderingSurface,tr.x,tr.y,tr.width,tr.height);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -1367,18 +1408,3 @@ nsRenderingContextUnix :: CopyOffScreenBits(nsDrawingSurface aSrcSurf,
|
|||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -63,98 +63,99 @@ public:
|
|||
|
||||
NS_IMETHOD Init(nsIDeviceContext* aContext, nsIWidget *aWindow);
|
||||
NS_IMETHOD Init(nsIDeviceContext* aContext, nsDrawingSurface aSurface);
|
||||
virtual nsresult CommonInit();
|
||||
|
||||
virtual void Reset();
|
||||
NS_IMETHOD Reset(void);
|
||||
|
||||
virtual nsIDeviceContext * GetDeviceContext(void);
|
||||
NS_IMETHOD GetDeviceContext(nsIDeviceContext *&aContext);
|
||||
|
||||
NS_IMETHOD SelectOffScreenDrawingSurface(nsDrawingSurface aSurface);
|
||||
NS_IMETHOD GetHints(PRUint32& aResult);
|
||||
|
||||
virtual void PushState(void);
|
||||
virtual PRBool PopState(void);
|
||||
NS_IMETHOD PushState(void);
|
||||
NS_IMETHOD PopState(PRBool &aClipEmpty);
|
||||
|
||||
virtual PRBool IsVisibleRect(const nsRect& aRect);
|
||||
NS_IMETHOD IsVisibleRect(const nsRect& aRect, PRBool &aClipEmpty);
|
||||
|
||||
virtual PRBool SetClipRectInPixels(const nsRect& aRect, nsClipCombine aCombine);
|
||||
virtual PRBool SetClipRect(const nsRect& aRect, nsClipCombine aCombine);
|
||||
virtual PRBool GetClipRect(nsRect &aRect);
|
||||
virtual PRBool SetClipRegion(const nsIRegion& aRegion, nsClipCombine aCombine);
|
||||
virtual void GetClipRegion(nsIRegion **aRegion);
|
||||
NS_IMETHOD SetClipRect(const nsRect& aRect, nsClipCombine aCombine, PRBool &aClipEmpty);
|
||||
NS_IMETHOD GetClipRect(nsRect &aRect, PRBool &aClipValid);
|
||||
NS_IMETHOD SetClipRegion(const nsIRegion& aRegion, nsClipCombine aCombine, PRBool &aClipEmpty);
|
||||
NS_IMETHOD GetClipRegion(nsIRegion **aRegion);
|
||||
|
||||
NS_IMETHOD SetLineStyle(nsLineStyle aLineStyle);
|
||||
NS_IMETHOD GetLineStyle(nsLineStyle &aLineStyle);
|
||||
|
||||
virtual void SetColor(nscolor aColor);
|
||||
virtual nscolor GetColor() const;
|
||||
NS_IMETHOD SetColor(nscolor aColor);
|
||||
NS_IMETHOD GetColor(nscolor &aColor) const;
|
||||
|
||||
virtual void SetFont(const nsFont& aFont);
|
||||
virtual void SetFont(nsIFontMetrics *aFontMetrics);
|
||||
virtual const nsFont& GetFont();
|
||||
NS_IMETHOD SetFont(const nsFont& aFont);
|
||||
NS_IMETHOD SetFont(nsIFontMetrics *aFontMetrics);
|
||||
|
||||
virtual nsIFontMetrics * GetFontMetrics();
|
||||
NS_IMETHOD GetFontMetrics(nsIFontMetrics *&aFontMetrics);
|
||||
|
||||
virtual void Translate(nscoord aX, nscoord aY);
|
||||
virtual void Scale(float aSx, float aSy);
|
||||
virtual nsTransform2D * GetCurrentTransform();
|
||||
NS_IMETHOD Translate(nscoord aX, nscoord aY);
|
||||
NS_IMETHOD Scale(float aSx, float aSy);
|
||||
NS_IMETHOD GetCurrentTransform(nsTransform2D *&aTransform);
|
||||
|
||||
virtual nsDrawingSurface CreateDrawingSurface(nsRect *aBounds, PRUint32 aSurfFlags);
|
||||
virtual void DestroyDrawingSurface(nsDrawingSurface aDS);
|
||||
NS_IMETHOD CreateDrawingSurface(nsRect *aBounds, PRUint32 aSurfFlags, nsDrawingSurface &aSurface);
|
||||
NS_IMETHOD DestroyDrawingSurface(nsDrawingSurface aDS);
|
||||
|
||||
virtual void DrawLine(nscoord aX0, nscoord aY0, nscoord aX1, nscoord aY1);
|
||||
virtual void DrawPolyline(const nsPoint aPoints[], PRInt32 aNumPoints);
|
||||
NS_IMETHOD DrawLine(nscoord aX0, nscoord aY0, nscoord aX1, nscoord aY1);
|
||||
NS_IMETHOD DrawPolyline(const nsPoint aPoints[], PRInt32 aNumPoints);
|
||||
|
||||
virtual void DrawRect(const nsRect& aRect);
|
||||
virtual void DrawRect(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight);
|
||||
virtual void FillRect(const nsRect& aRect);
|
||||
virtual void FillRect(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight);
|
||||
NS_IMETHOD DrawRect(const nsRect& aRect);
|
||||
NS_IMETHOD DrawRect(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight);
|
||||
NS_IMETHOD FillRect(const nsRect& aRect);
|
||||
NS_IMETHOD FillRect(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight);
|
||||
|
||||
virtual void DrawPolygon(const nsPoint aPoints[], PRInt32 aNumPoints);
|
||||
virtual void FillPolygon(const nsPoint aPoints[], PRInt32 aNumPoints);
|
||||
NS_IMETHOD DrawPolygon(const nsPoint aPoints[], PRInt32 aNumPoints);
|
||||
NS_IMETHOD FillPolygon(const nsPoint aPoints[], PRInt32 aNumPoints);
|
||||
|
||||
virtual void DrawEllipse(const nsRect& aRect);
|
||||
virtual void DrawEllipse(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight);
|
||||
virtual void FillEllipse(const nsRect& aRect);
|
||||
virtual void FillEllipse(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight);
|
||||
NS_IMETHOD DrawEllipse(const nsRect& aRect);
|
||||
NS_IMETHOD DrawEllipse(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight);
|
||||
NS_IMETHOD FillEllipse(const nsRect& aRect);
|
||||
NS_IMETHOD FillEllipse(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight);
|
||||
|
||||
virtual void DrawArc(const nsRect& aRect,
|
||||
float aStartAngle, float aEndAngle);
|
||||
virtual void DrawArc(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight,
|
||||
float aStartAngle, float aEndAngle);
|
||||
virtual void FillArc(const nsRect& aRect,
|
||||
float aStartAngle, float aEndAngle);
|
||||
virtual void FillArc(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight,
|
||||
float aStartAngle, float aEndAngle);
|
||||
NS_IMETHOD DrawArc(const nsRect& aRect,
|
||||
float aStartAngle, float aEndAngle);
|
||||
NS_IMETHOD DrawArc(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight,
|
||||
float aStartAngle, float aEndAngle);
|
||||
NS_IMETHOD FillArc(const nsRect& aRect,
|
||||
float aStartAngle, float aEndAngle);
|
||||
NS_IMETHOD FillArc(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight,
|
||||
float aStartAngle, float aEndAngle);
|
||||
|
||||
NS_IMETHOD GetWidth(char aC, nscoord &aWidth);
|
||||
NS_IMETHOD GetWidth(PRUnichar aC, nscoord &aWidth);
|
||||
NS_IMETHOD GetWidth(const nsString& aString, nscoord &aWidth);
|
||||
NS_IMETHOD GetWidth(const char *aString, nscoord &aWidth);
|
||||
NS_IMETHOD GetWidth(const char *aString, PRUint32 aLength, nscoord &aWidth);
|
||||
NS_IMETHOD GetWidth(const PRUnichar *aString, PRUint32 aLength, nscoord &aWidth);
|
||||
NS_IMETHOD GetWidth(char aC, nscoord &aWidth);
|
||||
NS_IMETHOD GetWidth(PRUnichar aC, nscoord &aWidth);
|
||||
NS_IMETHOD GetWidth(const nsString& aString, nscoord &aWidth);
|
||||
NS_IMETHOD GetWidth(const char *aString, nscoord &aWidth);
|
||||
NS_IMETHOD GetWidth(const char *aString, PRUint32 aLength, nscoord &aWidth);
|
||||
NS_IMETHOD GetWidth(const PRUnichar *aString, PRUint32 aLength, nscoord &aWidth);
|
||||
|
||||
virtual void DrawString(const char *aString, PRUint32 aLength,
|
||||
nscoord aX, nscoord aY,
|
||||
nscoord aWidth,
|
||||
const nscoord* aSpacing);
|
||||
virtual void DrawString(const PRUnichar *aString, PRUint32 aLength,
|
||||
nscoord aX, nscoord aY,
|
||||
nscoord aWidth,
|
||||
const nscoord* aSpacing);
|
||||
virtual void DrawString(const nsString& aString, nscoord aX, nscoord aY,
|
||||
nscoord aWidth,
|
||||
const nscoord* aSpacing);
|
||||
NS_IMETHOD DrawString(const char *aString, PRUint32 aLength,
|
||||
nscoord aX, nscoord aY,
|
||||
nscoord aWidth,
|
||||
const nscoord* aSpacing);
|
||||
NS_IMETHOD DrawString(const PRUnichar *aString, PRUint32 aLength,
|
||||
nscoord aX, nscoord aY,
|
||||
nscoord aWidth,
|
||||
const nscoord* aSpacing);
|
||||
NS_IMETHOD DrawString(const nsString& aString, nscoord aX, nscoord aY,
|
||||
nscoord aWidth,
|
||||
const nscoord* aSpacing);
|
||||
|
||||
virtual void DrawImage(nsIImage *aImage, nscoord aX, nscoord aY);
|
||||
virtual void DrawImage(nsIImage *aImage, nscoord aX, nscoord aY,
|
||||
nscoord aWidth, nscoord aHeight);
|
||||
virtual void DrawImage(nsIImage *aImage, const nsRect& aRect);
|
||||
virtual void DrawImage(nsIImage *aImage, const nsRect& aSRect, const nsRect& aDRect);
|
||||
NS_IMETHOD DrawImage(nsIImage *aImage, nscoord aX, nscoord aY);
|
||||
NS_IMETHOD DrawImage(nsIImage *aImage, nscoord aX, nscoord aY,
|
||||
nscoord aWidth, nscoord aHeight);
|
||||
NS_IMETHOD DrawImage(nsIImage *aImage, const nsRect& aRect);
|
||||
NS_IMETHOD DrawImage(nsIImage *aImage, const nsRect& aSRect, const nsRect& aDRect);
|
||||
|
||||
NS_IMETHOD CopyOffScreenBits(nsDrawingSurface aSrcSurf, PRInt32 aSrcX, PRInt32 aSrcY,
|
||||
const nsRect &aDestBounds, PRUint32 aCopyFlags);
|
||||
|
||||
//locals
|
||||
NS_IMETHOD CommonInit();
|
||||
NS_IMETHOD SetClipRectInPixels(const nsRect& aRect, nsClipCombine aCombine, PRBool &aClipEmpty);
|
||||
|
||||
protected:
|
||||
|
||||
nscolor mCurrentColor ;
|
||||
|
|
|
@ -169,7 +169,7 @@ public:
|
|||
@param aHeight The destination height of the pixelmap
|
||||
@return if TRUE, no errors
|
||||
*/
|
||||
virtual PRBool Draw(nsIRenderingContext &aContext, nsDrawingSurface aSurface, PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeight) = 0;
|
||||
NS_IMETHOD Draw(nsIRenderingContext &aContext, nsDrawingSurface aSurface, PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeight) = 0;
|
||||
|
||||
/**
|
||||
* BitBlit the pixelmap to a device, the source and dest can be scaled
|
||||
|
@ -184,9 +184,9 @@ public:
|
|||
* @param aDHeight The destination height of the pixelmap
|
||||
* @return if TRUE, no errors
|
||||
*/
|
||||
virtual PRBool Draw(nsIRenderingContext &aContext, nsDrawingSurface aSurface, PRInt32 aSX, PRInt32 aSY, PRInt32 aSWidth, PRInt32 aSHeight,
|
||||
PRInt32 aDX, PRInt32 aDY, PRInt32 aDWidth, PRInt32 aDHeight) = 0;
|
||||
|
||||
NS_IMETHOD Draw(nsIRenderingContext &aContext, nsDrawingSurface aSurface, PRInt32 aSX, PRInt32 aSY, PRInt32 aSWidth, PRInt32 aSHeight,
|
||||
PRInt32 aDX, PRInt32 aDY, PRInt32 aDWidth, PRInt32 aDHeight) = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Composite this image with the passed in image using the alpha mask
|
||||
|
|
|
@ -90,13 +90,13 @@ public:
|
|||
/**
|
||||
* Reset the rendering context
|
||||
*/
|
||||
virtual void Reset() = 0;
|
||||
NS_IMETHOD Reset(void) = 0;
|
||||
|
||||
/**
|
||||
* Get the DeviceContext that this RenderingContext was initialized with
|
||||
* @result the device context
|
||||
*/
|
||||
virtual nsIDeviceContext * GetDeviceContext(void) = 0;
|
||||
NS_IMETHOD GetDeviceContext(nsIDeviceContext *& aDeviceContext) = 0;
|
||||
|
||||
/**
|
||||
* Selects an offscreen drawing surface into the RenderingContext to draw to.
|
||||
|
@ -115,21 +115,21 @@ public:
|
|||
/**
|
||||
* Save a graphical state onto a stack.
|
||||
*/
|
||||
virtual void PushState(void) = 0;
|
||||
NS_IMETHOD PushState(void) = 0;
|
||||
|
||||
/**
|
||||
* Get and and set RenderingContext to this graphical state
|
||||
* @return if PR_TRUE, indicates that the clipping region after
|
||||
* popping state is empty, else PR_FALSE
|
||||
*/
|
||||
virtual PRBool PopState(void) = 0;
|
||||
NS_IMETHOD PopState(PRBool &aClipEmpty) = 0;
|
||||
|
||||
/**
|
||||
* Tells if a given rectangle is visible within the rendering context
|
||||
* @param aRect is the rectangle that will be checked for visiblity
|
||||
* @result If true, that rectanglular area is visable.
|
||||
*/
|
||||
virtual PRBool IsVisibleRect(const nsRect& aRect) = 0;
|
||||
NS_IMETHOD IsVisibleRect(const nsRect& aRect, PRBool &aIsVisible) = 0;
|
||||
|
||||
/**
|
||||
* Sets the clipping for the RenderingContext to the passed in rectangle
|
||||
|
@ -138,7 +138,7 @@ public:
|
|||
* see the bottom of nsIRenderingContext.h
|
||||
* @return PR_TRUE if the clip region is now empty, else PR_FALSE
|
||||
*/
|
||||
virtual PRBool SetClipRect(const nsRect& aRect, nsClipCombine aCombine) = 0;
|
||||
NS_IMETHOD SetClipRect(const nsRect& aRect, nsClipCombine aCombine, PRBool &aClipEmpty) = 0;
|
||||
|
||||
/**
|
||||
* Gets the bounds of the clip region of the RenderingContext
|
||||
|
@ -147,7 +147,7 @@ public:
|
|||
* @return PR_TRUE if the rendering context has a local cliprect set
|
||||
* else aRect is undefined
|
||||
*/
|
||||
virtual PRBool GetClipRect(nsRect &aRect) = 0;
|
||||
NS_IMETHOD GetClipRect(nsRect &aRect, PRBool &aHasLocalClip) = 0;
|
||||
|
||||
/**
|
||||
* Sets the line style for the RenderingContext
|
||||
|
@ -170,7 +170,7 @@ public:
|
|||
* see the bottom of nsIRenderingContext.h
|
||||
* @return PR_TRUE if the clip region is now empty, else PR_FALSE
|
||||
*/
|
||||
virtual PRBool SetClipRegion(const nsIRegion& aRegion, nsClipCombine aCombine) = 0;
|
||||
NS_IMETHOD SetClipRegion(const nsIRegion& aRegion, nsClipCombine aCombine, PRBool &aClipEmpty) = 0;
|
||||
|
||||
/**
|
||||
* Gets the current clipping region for the RenderingContext
|
||||
|
@ -178,65 +178,58 @@ public:
|
|||
* if SetClipRegion() is called, do not assume that GetClipRegion()
|
||||
* will return the same object.
|
||||
*/
|
||||
virtual void GetClipRegion(nsIRegion **aRegion) = 0;
|
||||
NS_IMETHOD GetClipRegion(nsIRegion **aRegion) = 0;
|
||||
|
||||
/**
|
||||
* Sets the forground color for the RenderingContext
|
||||
* @param aColor The color to set the RenderingContext to
|
||||
*/
|
||||
virtual void SetColor(nscolor aColor) = 0;
|
||||
NS_IMETHOD SetColor(nscolor aColor) = 0;
|
||||
|
||||
/**
|
||||
* Get the forground color for the RenderingContext
|
||||
* @return The current forground color of the RenderingContext
|
||||
*/
|
||||
virtual nscolor GetColor() const = 0;
|
||||
NS_IMETHOD GetColor(nscolor &aColor) const = 0;
|
||||
|
||||
/**
|
||||
* Sets the font for the RenderingContext
|
||||
* @param aFont The font to use in the RenderingContext
|
||||
*/
|
||||
virtual void SetFont(const nsFont& aFont) = 0;
|
||||
NS_IMETHOD SetFont(const nsFont& aFont) = 0;
|
||||
|
||||
/**
|
||||
* Sets the font for the RenderingContext
|
||||
* @param aFontMetric The font metrics representing the
|
||||
* font to use in the RenderingContext
|
||||
*/
|
||||
virtual void SetFont(nsIFontMetrics *aFontMetrics) = 0;
|
||||
|
||||
/**
|
||||
* Get the current font for the RenderingContext.
|
||||
* If no font has been Set, the results are undefined.
|
||||
* @return The current font of the RenderingContext
|
||||
*/
|
||||
virtual const nsFont& GetFont() = 0;
|
||||
NS_IMETHOD SetFont(nsIFontMetrics *aFontMetrics) = 0;
|
||||
|
||||
/**
|
||||
* Get the current fontmetrics for the RenderingContext
|
||||
* @return The current font of the RenderingContext
|
||||
*/
|
||||
virtual nsIFontMetrics* GetFontMetrics() = 0;
|
||||
NS_IMETHOD GetFontMetrics(nsIFontMetrics *&aFontMetrics) = 0;
|
||||
|
||||
/**
|
||||
* Add in a translate to the RenderingContext's transformation matrix
|
||||
* @param aX The horizontal translation
|
||||
* @param aY The vertical translation
|
||||
*/
|
||||
virtual void Translate(nscoord aX, nscoord aY) = 0;
|
||||
NS_IMETHOD Translate(nscoord aX, nscoord aY) = 0;
|
||||
|
||||
/**
|
||||
* Add in a scale to the RenderingContext's transformation matrix
|
||||
* @param aX The horizontal scale
|
||||
* @param aY The vertical scale
|
||||
*/
|
||||
virtual void Scale(float aSx, float aSy) = 0;
|
||||
NS_IMETHOD Scale(float aSx, float aSy) = 0;
|
||||
|
||||
/**
|
||||
* Get the current transformation matrix for the RenderingContext
|
||||
* @return The transformation matrix for the RenderingContext
|
||||
*/
|
||||
virtual nsTransform2D * GetCurrentTransform() = 0;
|
||||
NS_IMETHOD GetCurrentTransform(nsTransform2D *&aTransform) = 0;
|
||||
|
||||
/**
|
||||
* Create an offscreen drawing surface compatible with this RenderingContext.
|
||||
|
@ -248,13 +241,13 @@ public:
|
|||
* @param aSurfFlags see bottom of nsIRenderingContext.h
|
||||
* @return A nsDrawingSurface
|
||||
*/
|
||||
virtual nsDrawingSurface CreateDrawingSurface(nsRect *aBounds, PRUint32 aSurfFlags) = 0;
|
||||
NS_IMETHOD CreateDrawingSurface(nsRect *aBounds, PRUint32 aSurfFlags, nsDrawingSurface &aSurface) = 0;
|
||||
|
||||
/**
|
||||
* Destroy a drawing surface created by CreateDrawingSurface()
|
||||
* @param aDS A drawing surface to destroy
|
||||
*/
|
||||
virtual void DestroyDrawingSurface(nsDrawingSurface aDS) = 0;
|
||||
NS_IMETHOD DestroyDrawingSurface(nsDrawingSurface aDS) = 0;
|
||||
|
||||
/**
|
||||
* Draw a line
|
||||
|
@ -263,20 +256,20 @@ public:
|
|||
* @param aX1 end horiztonal coord in twips
|
||||
* @param aY1 end vertical coord in twips
|
||||
*/
|
||||
virtual void DrawLine(nscoord aX0, nscoord aY0, nscoord aX1, nscoord aY1) = 0;
|
||||
NS_IMETHOD DrawLine(nscoord aX0, nscoord aY0, nscoord aX1, nscoord aY1) = 0;
|
||||
|
||||
/**
|
||||
* Draw a polyline
|
||||
* @param aPoints array of endpoints
|
||||
* @param aNumPonts number of points
|
||||
*/
|
||||
virtual void DrawPolyline(const nsPoint aPoints[], PRInt32 aNumPoints) = 0;
|
||||
NS_IMETHOD DrawPolyline(const nsPoint aPoints[], PRInt32 aNumPoints) = 0;
|
||||
|
||||
/**
|
||||
* Draw a rectangle
|
||||
* @param aRect The rectangle to draw
|
||||
*/
|
||||
virtual void DrawRect(const nsRect& aRect) = 0;
|
||||
NS_IMETHOD DrawRect(const nsRect& aRect) = 0;
|
||||
|
||||
/**
|
||||
* Draw a rectangle
|
||||
|
@ -285,13 +278,13 @@ public:
|
|||
* @param aWidth Width of rectangle in twips
|
||||
* @param aHeight Height of rectangle in twips
|
||||
*/
|
||||
virtual void DrawRect(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight) = 0;
|
||||
NS_IMETHOD DrawRect(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight) = 0;
|
||||
|
||||
/**
|
||||
* Fill a rectangle in the current foreground color
|
||||
* @param aRect The rectangle to draw
|
||||
*/
|
||||
virtual void FillRect(const nsRect& aRect) = 0;
|
||||
NS_IMETHOD FillRect(const nsRect& aRect) = 0;
|
||||
|
||||
/**
|
||||
* Fill a rectangle in the current foreground color
|
||||
|
@ -300,27 +293,27 @@ public:
|
|||
* @param aWidth Width of rectangle in twips
|
||||
* @param aHeight Height of rectangle in twips
|
||||
*/
|
||||
virtual void FillRect(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight) = 0;
|
||||
NS_IMETHOD FillRect(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight) = 0;
|
||||
|
||||
/**
|
||||
* Draw a poly in the current foreground color
|
||||
* @param aPoints points to use for the drawing, last must equal first
|
||||
* @param aNumPonts number of points in the polygon
|
||||
*/
|
||||
virtual void DrawPolygon(const nsPoint aPoints[], PRInt32 aNumPoints) = 0;
|
||||
NS_IMETHOD DrawPolygon(const nsPoint aPoints[], PRInt32 aNumPoints) = 0;
|
||||
|
||||
/**
|
||||
* Fill a poly in the current foreground color
|
||||
* @param aPoints points to use for the drawing, last must equal first
|
||||
* @param aNumPonts number of points in the polygon
|
||||
*/
|
||||
virtual void FillPolygon(const nsPoint aPoints[], PRInt32 aNumPoints) = 0;
|
||||
NS_IMETHOD FillPolygon(const nsPoint aPoints[], PRInt32 aNumPoints) = 0;
|
||||
|
||||
/**
|
||||
* Draw an ellipse in the current foreground color
|
||||
* @param aRect The rectangle define bounds of ellipse to draw
|
||||
*/
|
||||
virtual void DrawEllipse(const nsRect& aRect) = 0;
|
||||
NS_IMETHOD DrawEllipse(const nsRect& aRect) = 0;
|
||||
|
||||
/**
|
||||
* Draw an ellipse in the current foreground color
|
||||
|
@ -329,13 +322,14 @@ public:
|
|||
* @param aWidth Width of horizontal axis in twips
|
||||
* @param aHeight Height of vertical axis in twips
|
||||
*/
|
||||
virtual void DrawEllipse(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight) = 0;
|
||||
NS_IMETHOD DrawEllipse(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight) = 0;
|
||||
|
||||
/**
|
||||
* Fill an ellipse in the current foreground color
|
||||
* @param aRect The rectangle define bounds of ellipse to draw
|
||||
*/
|
||||
virtual void FillEllipse(const nsRect& aRect) = 0;
|
||||
NS_IMETHOD FillEllipse(const nsRect& aRect) = 0;
|
||||
|
||||
/**
|
||||
* Fill an ellipse in the current foreground color
|
||||
* @param aX Horizontal left Coordinate in twips
|
||||
|
@ -343,15 +337,17 @@ public:
|
|||
* @param aWidth Width of horizontal axis in twips
|
||||
* @param aHeight Height of vertical axis in twips
|
||||
*/
|
||||
virtual void FillEllipse(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight) = 0;
|
||||
NS_IMETHOD FillEllipse(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight) = 0;
|
||||
|
||||
/**
|
||||
* Draw an arc in the current forground color
|
||||
* @param aRect The rectangle define bounds of ellipse to use
|
||||
* @param aStartAngle the starting angle of the arc, in the ellipse
|
||||
* @param aEndAngle The ending angle of the arc, in the ellipse
|
||||
*/
|
||||
virtual void DrawArc(const nsRect& aRect,
|
||||
float aStartAngle, float aEndAngle) = 0;
|
||||
NS_IMETHOD DrawArc(const nsRect& aRect,
|
||||
float aStartAngle, float aEndAngle) = 0;
|
||||
|
||||
/**
|
||||
* Draw an arc in the current forground color
|
||||
* @param aX Horizontal left Coordinate in twips
|
||||
|
@ -361,16 +357,18 @@ public:
|
|||
* @param aStartAngle the starting angle of the arc, in the ellipse
|
||||
* @param aEndAngle The ending angle of the arc, in the ellipse
|
||||
*/
|
||||
virtual void DrawArc(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight,
|
||||
float aStartAngle, float aEndAngle) = 0;
|
||||
NS_IMETHOD DrawArc(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight,
|
||||
float aStartAngle, float aEndAngle) = 0;
|
||||
|
||||
/**
|
||||
* Fill an arc in the current forground color
|
||||
* @param aRect The rectangle define bounds of ellipse to use
|
||||
* @param aStartAngle the starting angle of the arc, in the ellipse
|
||||
* @param aEndAngle The ending angle of the arc, in the ellipse
|
||||
*/
|
||||
virtual void FillArc(const nsRect& aRect,
|
||||
float aStartAngle, float aEndAngle) = 0;
|
||||
NS_IMETHOD FillArc(const nsRect& aRect,
|
||||
float aStartAngle, float aEndAngle) = 0;
|
||||
|
||||
/**
|
||||
* Fill an arc in the current forground color
|
||||
* @param aX Horizontal left Coordinate in twips
|
||||
|
@ -380,8 +378,8 @@ public:
|
|||
* @param aStartAngle the starting angle of the arc, in the ellipse
|
||||
* @param aEndAngle The ending angle of the arc, in the ellipse
|
||||
*/
|
||||
virtual void FillArc(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight,
|
||||
float aStartAngle, float aEndAngle) = 0;
|
||||
NS_IMETHOD FillArc(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight,
|
||||
float aStartAngle, float aEndAngle) = 0;
|
||||
|
||||
/**
|
||||
* Returns the width (in app units) of an 8-bit character
|
||||
|
@ -390,7 +388,7 @@ public:
|
|||
* @param aWidth out parameter for width
|
||||
* @return error status
|
||||
*/
|
||||
NS_IMETHOD GetWidth(char aC, nscoord &aWidth) = 0;
|
||||
NS_IMETHOD GetWidth(char aC, nscoord &aWidth) = 0;
|
||||
|
||||
/**
|
||||
* Returns the width (in app units) of a unicode character
|
||||
|
@ -399,7 +397,7 @@ public:
|
|||
* @param aWidth out parameter for width
|
||||
* @return error status
|
||||
*/
|
||||
NS_IMETHOD GetWidth(PRUnichar aC, nscoord &aWidth) = 0;
|
||||
NS_IMETHOD GetWidth(PRUnichar aC, nscoord &aWidth) = 0;
|
||||
|
||||
/**
|
||||
* Returns the width (in app units) of an nsString
|
||||
|
@ -408,7 +406,7 @@ public:
|
|||
* @param aWidth out parameter for width
|
||||
* @return error status
|
||||
*/
|
||||
NS_IMETHOD GetWidth(const nsString& aString, nscoord &aWidth) = 0;
|
||||
NS_IMETHOD GetWidth(const nsString& aString, nscoord &aWidth) = 0;
|
||||
|
||||
/**
|
||||
* Returns the width (in app units) of an 8-bit character string
|
||||
|
@ -417,7 +415,7 @@ public:
|
|||
* @param aWidth out parameter for width
|
||||
* @return error status
|
||||
*/
|
||||
NS_IMETHOD GetWidth(const char* aString, nscoord& aWidth) = 0;
|
||||
NS_IMETHOD GetWidth(const char* aString, nscoord& aWidth) = 0;
|
||||
|
||||
/**
|
||||
* Returns the width (in app units) of an 8-bit character string
|
||||
|
@ -427,8 +425,8 @@ public:
|
|||
* @param aWidth out parameter for width
|
||||
* @return error status
|
||||
*/
|
||||
NS_IMETHOD GetWidth(const char* aString, PRUint32 aLength,
|
||||
nscoord& aWidth) = 0;
|
||||
NS_IMETHOD GetWidth(const char* aString, PRUint32 aLength,
|
||||
nscoord& aWidth) = 0;
|
||||
|
||||
/**
|
||||
* Returns the width (in app units) of a Unicode character string
|
||||
|
@ -438,8 +436,8 @@ public:
|
|||
* @param aWidth out parameter for width
|
||||
* @return error status
|
||||
*/
|
||||
NS_IMETHOD GetWidth(const PRUnichar *aString, PRUint32 aLength,
|
||||
nscoord &aWidth) = 0;
|
||||
NS_IMETHOD GetWidth(const PRUnichar *aString, PRUint32 aLength,
|
||||
nscoord &aWidth) = 0;
|
||||
|
||||
/**
|
||||
* Draw a string in the RenderingContext
|
||||
|
@ -450,10 +448,10 @@ public:
|
|||
* @param aWidth Width of the underline
|
||||
* @param aSpacing inter-character spacing to apply
|
||||
*/
|
||||
virtual void DrawString(const char *aString, PRUint32 aLength,
|
||||
nscoord aX, nscoord aY,
|
||||
nscoord aWidth,
|
||||
const nscoord* aSpacing = nsnull) = 0;
|
||||
NS_IMETHOD DrawString(const char *aString, PRUint32 aLength,
|
||||
nscoord aX, nscoord aY,
|
||||
nscoord aWidth,
|
||||
const nscoord* aSpacing = nsnull) = 0;
|
||||
|
||||
/**
|
||||
* Draw a string in the RenderingContext
|
||||
|
@ -464,10 +462,10 @@ public:
|
|||
* @param aWidth length in twips of the underline
|
||||
* @param aSpacing inter-character spacing to apply
|
||||
*/
|
||||
virtual void DrawString(const PRUnichar *aString, PRUint32 aLength,
|
||||
nscoord aX, nscoord aY,
|
||||
nscoord aWidth,
|
||||
const nscoord* aSpacing = nsnull) = 0;
|
||||
NS_IMETHOD DrawString(const PRUnichar *aString, PRUint32 aLength,
|
||||
nscoord aX, nscoord aY,
|
||||
nscoord aWidth,
|
||||
const nscoord* aSpacing = nsnull) = 0;
|
||||
|
||||
/**
|
||||
* Draw a string in the RenderingContext
|
||||
|
@ -477,16 +475,16 @@ public:
|
|||
* @param aWidth Width of the underline
|
||||
* @param aSpacing inter-character spacing to apply
|
||||
*/
|
||||
virtual void DrawString(const nsString& aString, nscoord aX, nscoord aY,
|
||||
nscoord aWidth,
|
||||
const nscoord* aSpacing = nsnull) = 0;
|
||||
NS_IMETHOD DrawString(const nsString& aString, nscoord aX, nscoord aY,
|
||||
nscoord aWidth,
|
||||
const nscoord* aSpacing = nsnull) = 0;
|
||||
|
||||
/**
|
||||
* Copy an image to the RenderingContext
|
||||
* @param aX Horzontal left destination coordinate
|
||||
* @param aY Vertical top of destinatio coordinate
|
||||
*/
|
||||
virtual void DrawImage(nsIImage *aImage, nscoord aX, nscoord aY) = 0;
|
||||
NS_IMETHOD DrawImage(nsIImage *aImage, nscoord aX, nscoord aY) = 0;
|
||||
|
||||
/**
|
||||
* Copy an image to the RenderingContext, scaling can occur if width/hieght does not match source
|
||||
|
@ -495,19 +493,21 @@ public:
|
|||
* @param aWidth Width of destination,
|
||||
* @param aHeight Height of destination
|
||||
*/
|
||||
virtual void DrawImage(nsIImage *aImage, nscoord aX, nscoord aY,
|
||||
nscoord aWidth, nscoord aHeight) = 0;
|
||||
NS_IMETHOD DrawImage(nsIImage *aImage, nscoord aX, nscoord aY,
|
||||
nscoord aWidth, nscoord aHeight) = 0;
|
||||
|
||||
/**
|
||||
* Copy an image to the RenderingContext, scaling can occur if source/dest rects differ
|
||||
* @param aRect Destination rectangle to copy the image to
|
||||
*/
|
||||
virtual void DrawImage(nsIImage *aImage, const nsRect& aRect) = 0;
|
||||
NS_IMETHOD DrawImage(nsIImage *aImage, const nsRect& aRect) = 0;
|
||||
|
||||
/**
|
||||
* Copy an image to the RenderingContext, scaling/clipping can occur if source/dest rects differ
|
||||
* @param aSRect Source rectangle to copy from
|
||||
* @param aDRect Destination rectangle to copy the image to
|
||||
*/
|
||||
virtual void DrawImage(nsIImage *aImage, const nsRect& aSRect, const nsRect& aDRect)=0;
|
||||
NS_IMETHOD DrawImage(nsIImage *aImage, const nsRect& aSRect, const nsRect& aDRect)=0;
|
||||
|
||||
/**
|
||||
* Copy offscreen pixelmap to this RenderingContext.
|
||||
|
|
|
@ -77,7 +77,7 @@ NS_IMETHODIMP nsDeviceContextWin :: GetScrollBarDimensions(float &aWidth, float
|
|||
NS_IMETHODIMP nsDeviceContextWin :: GetDrawingSurface(nsIRenderingContext &aContext, nsDrawingSurface &aSurface)
|
||||
{
|
||||
if (NULL == mSurface) {
|
||||
mSurface = aContext.CreateDrawingSurface(nsnull, 0);
|
||||
aContext.CreateDrawingSurface(nsnull, 0, mSurface);
|
||||
}
|
||||
|
||||
aSurface = mSurface;
|
||||
|
|
|
@ -299,14 +299,14 @@ void nsImageWin :: CreateDDB(nsDrawingSurface aSurface)
|
|||
}
|
||||
|
||||
// Draw the bitmap, this method has a source and destination coordinates
|
||||
PRBool nsImageWin :: Draw(nsIRenderingContext &aContext, nsDrawingSurface aSurface,
|
||||
PRInt32 aSX, PRInt32 aSY, PRInt32 aSWidth, PRInt32 aSHeight,
|
||||
PRInt32 aDX, PRInt32 aDY, PRInt32 aDWidth, PRInt32 aDHeight)
|
||||
NS_IMETHODIMP nsImageWin :: Draw(nsIRenderingContext &aContext, nsDrawingSurface aSurface,
|
||||
PRInt32 aSX, PRInt32 aSY, PRInt32 aSWidth, PRInt32 aSHeight,
|
||||
PRInt32 aDX, PRInt32 aDY, PRInt32 aDWidth, PRInt32 aDHeight)
|
||||
{
|
||||
HDC the_hdc = ((nsDrawingSurfaceWin *)aSurface)->mDC;
|
||||
|
||||
if (mBHead == nsnull)
|
||||
return PR_FALSE;
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
// If the image can be optimized then make sure we've created the DDB
|
||||
if (mIsOptimized && (nsnull == mHBitmap)) {
|
||||
|
@ -333,7 +333,8 @@ PRBool nsImageWin :: Draw(nsIRenderingContext &aContext, nsDrawingSurface aSurfa
|
|||
}
|
||||
else
|
||||
{
|
||||
nsIDeviceContext *dx = aContext.GetDeviceContext();
|
||||
nsIDeviceContext *dx;
|
||||
aContext.GetDeviceContext(dx);
|
||||
nsDrawingSurface ds;
|
||||
dx->GetDrawingSurface(aContext, ds);
|
||||
nsDrawingSurfaceWin *srcds = (nsDrawingSurfaceWin *)ds;
|
||||
|
@ -380,19 +381,19 @@ PRBool nsImageWin :: Draw(nsIRenderingContext &aContext, nsDrawingSurface aSurfa
|
|||
NS_RELEASE(dx);
|
||||
}
|
||||
|
||||
return PR_TRUE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------
|
||||
|
||||
// Draw the bitmap, this draw just has destination coordinates
|
||||
PRBool nsImageWin :: Draw(nsIRenderingContext &aContext, nsDrawingSurface aSurface,
|
||||
PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeight)
|
||||
NS_IMETHODIMP nsImageWin :: Draw(nsIRenderingContext &aContext, nsDrawingSurface aSurface,
|
||||
PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeight)
|
||||
{
|
||||
HDC the_hdc = ((nsDrawingSurfaceWin *)aSurface)->mDC;
|
||||
|
||||
if (mBHead == nsnull)
|
||||
return PR_FALSE;
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
// If the image can be optimized then make sure we've created the DDB
|
||||
if (mIsOptimized && (nsnull == mHBitmap)) {
|
||||
|
@ -419,7 +420,8 @@ PRBool nsImageWin :: Draw(nsIRenderingContext &aContext, nsDrawingSurface aSurfa
|
|||
}
|
||||
else
|
||||
{
|
||||
nsIDeviceContext *dx = aContext.GetDeviceContext();
|
||||
nsIDeviceContext *dx;
|
||||
aContext.GetDeviceContext(dx);
|
||||
nsDrawingSurface ds;
|
||||
dx->GetDrawingSurface(aContext, ds);
|
||||
nsDrawingSurfaceWin *srcds = (nsDrawingSurfaceWin *)ds;
|
||||
|
@ -467,7 +469,7 @@ PRBool nsImageWin :: Draw(nsIRenderingContext &aContext, nsDrawingSurface aSurfa
|
|||
NS_RELEASE(dx);
|
||||
}
|
||||
|
||||
return PR_TRUE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------
|
||||
|
|
|
@ -37,9 +37,9 @@ public:
|
|||
virtual PRInt32 GetWidth() { return mBHead->biWidth; }
|
||||
virtual PRUint8* GetBits() { return mImageBits; }
|
||||
virtual PRInt32 GetLineStride() {return mRowBytes; }
|
||||
virtual PRBool Draw(nsIRenderingContext &aContext, nsDrawingSurface aSurface, PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeight);
|
||||
virtual PRBool Draw(nsIRenderingContext &aContext, nsDrawingSurface aSurface, PRInt32 aSX, PRInt32 aSY, PRInt32 aSWidth, PRInt32 aSHeight,
|
||||
PRInt32 aDX, PRInt32 aDY, PRInt32 aDWidth, PRInt32 aDHeight);
|
||||
NS_IMETHOD Draw(nsIRenderingContext &aContext, nsDrawingSurface aSurface, PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeight);
|
||||
NS_IMETHOD Draw(nsIRenderingContext &aContext, nsDrawingSurface aSurface, PRInt32 aSX, PRInt32 aSY, PRInt32 aSWidth, PRInt32 aSHeight,
|
||||
PRInt32 aDX, PRInt32 aDY, PRInt32 aDWidth, PRInt32 aDHeight);
|
||||
virtual nsColorMap* GetColorMap() {return mColorMap;}
|
||||
virtual void ImageUpdated(nsIDeviceContext *aContext, PRUint8 aFlags, nsRect *aUpdateRect);
|
||||
virtual nsresult Init(PRInt32 aWidth, PRInt32 aHeight, PRInt32 aDepth, nsMaskRequirements aMaskRequirements);
|
||||
|
|
|
@ -386,7 +386,8 @@ nsRenderingContextWin :: ~nsRenderingContextWin()
|
|||
|
||||
//destroy the initial GraphicsState
|
||||
|
||||
PopState();
|
||||
PRBool clipState;
|
||||
PopState(clipState);
|
||||
|
||||
//cleanup the DC so that we can just destroy objects
|
||||
//in the graphics state without worrying that we are
|
||||
|
@ -482,37 +483,46 @@ nsRenderingContextWin :: ~nsRenderingContextWin()
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsRenderingContextWin::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||
nsRenderingContextWin :: QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||
{
|
||||
if (nsnull == aInstancePtr) {
|
||||
if (nsnull == aInstancePtr)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
if (aIID.Equals(kIRenderingContextIID)) {
|
||||
|
||||
if (aIID.Equals(kIRenderingContextIID))
|
||||
{
|
||||
nsIRenderingContext* tmp = this;
|
||||
*aInstancePtr = (void*) tmp;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kIScriptObjectOwnerIID)) {
|
||||
|
||||
if (aIID.Equals(kIScriptObjectOwnerIID))
|
||||
{
|
||||
nsIScriptObjectOwner* tmp = this;
|
||||
*aInstancePtr = (void*) tmp;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kIDOMRenderingContextIID)) {
|
||||
|
||||
if (aIID.Equals(kIDOMRenderingContextIID))
|
||||
{
|
||||
nsIDOMRenderingContext* tmp = this;
|
||||
*aInstancePtr = (void*) tmp;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
if (aIID.Equals(kISupportsIID)) {
|
||||
|
||||
if (aIID.Equals(kISupportsIID))
|
||||
{
|
||||
nsIRenderingContext* tmp = this;
|
||||
nsISupports* tmp2 = tmp;
|
||||
*aInstancePtr = (void*) tmp2;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
|
@ -685,7 +695,7 @@ nsRenderingContextWin :: SelectOffScreenDrawingSurface(nsDrawingSurface aSurface
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsRenderingContextWin::GetHints(PRUint32& aResult)
|
||||
nsRenderingContextWin :: GetHints(PRUint32& aResult)
|
||||
{
|
||||
PRUint32 result = 0;
|
||||
|
||||
|
@ -697,17 +707,19 @@ nsRenderingContextWin::GetHints(PRUint32& aResult)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsRenderingContextWin :: Reset()
|
||||
NS_IMETHODIMP nsRenderingContextWin :: Reset()
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIDeviceContext * nsRenderingContextWin :: GetDeviceContext(void)
|
||||
NS_IMETHODIMP nsRenderingContextWin :: GetDeviceContext(nsIDeviceContext *&aContext)
|
||||
{
|
||||
NS_IF_ADDREF(mContext);
|
||||
return mContext;
|
||||
aContext = mContext;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsRenderingContextWin :: PushState(void)
|
||||
NS_IMETHODIMP nsRenderingContextWin :: PushState(void)
|
||||
{
|
||||
PRInt32 cnt = mStateCache->Count();
|
||||
|
||||
|
@ -749,9 +761,11 @@ void nsRenderingContextWin :: PushState(void)
|
|||
}
|
||||
|
||||
mTMatrix = &mStates->mMatrix;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRBool nsRenderingContextWin :: PopState(void)
|
||||
NS_IMETHODIMP nsRenderingContextWin :: PopState(PRBool &aClipEmpty)
|
||||
{
|
||||
PRBool retval = PR_FALSE;
|
||||
|
||||
|
@ -805,15 +819,18 @@ PRBool nsRenderingContextWin :: PopState(void)
|
|||
mTMatrix = nsnull;
|
||||
}
|
||||
|
||||
return retval;
|
||||
aClipEmpty = retval;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRBool nsRenderingContextWin :: IsVisibleRect(const nsRect& aRect)
|
||||
NS_IMETHODIMP nsRenderingContextWin :: IsVisibleRect(const nsRect& aRect, PRBool &aVisible)
|
||||
{
|
||||
return PR_TRUE;
|
||||
aVisible = PR_TRUE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRBool nsRenderingContextWin :: SetClipRect(const nsRect& aRect, nsClipCombine aCombine)
|
||||
NS_IMETHODIMP nsRenderingContextWin :: SetClipRect(const nsRect& aRect, nsClipCombine aCombine, PRBool &aClipEmpty)
|
||||
{
|
||||
nsRect trect = aRect;
|
||||
int cliptype;
|
||||
|
@ -872,23 +889,27 @@ PRBool nsRenderingContextWin :: SetClipRect(const nsRect& aRect, nsClipCombine a
|
|||
NS_ASSERTION(FALSE, "illegal clip combination");
|
||||
|
||||
if (cliptype == NULLREGION)
|
||||
return PR_TRUE;
|
||||
aClipEmpty = PR_TRUE;
|
||||
else
|
||||
return PR_FALSE;
|
||||
aClipEmpty = PR_FALSE;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRBool nsRenderingContextWin :: GetClipRect(nsRect &aRect)
|
||||
NS_IMETHODIMP nsRenderingContextWin :: GetClipRect(nsRect &aRect, PRBool &aClipValid)
|
||||
{
|
||||
if (mStates->mFlags & FLAG_LOCAL_CLIP_VALID)
|
||||
{
|
||||
aRect = mStates->mLocalClip;
|
||||
return PR_TRUE;
|
||||
aClipValid = PR_TRUE;
|
||||
}
|
||||
else
|
||||
return PR_FALSE;
|
||||
aClipValid = PR_FALSE;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRBool nsRenderingContextWin :: SetClipRegion(const nsIRegion& aRegion, nsClipCombine aCombine)
|
||||
NS_IMETHODIMP nsRenderingContextWin :: SetClipRegion(const nsIRegion& aRegion, nsClipCombine aCombine, PRBool &aClipEmpty)
|
||||
{
|
||||
nsRegionWin *pRegion = (nsRegionWin *)&aRegion;
|
||||
HRGN hrgn = pRegion->GetHRGN();
|
||||
|
@ -924,88 +945,90 @@ PRBool nsRenderingContextWin :: SetClipRegion(const nsIRegion& aRegion, nsClipCo
|
|||
return PR_FALSE;
|
||||
|
||||
if (cliptype == NULLREGION)
|
||||
return PR_TRUE;
|
||||
aClipEmpty = PR_TRUE;
|
||||
else
|
||||
return PR_FALSE;
|
||||
aClipEmpty = PR_FALSE;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsRenderingContextWin :: GetClipRegion(nsIRegion **aRegion)
|
||||
NS_IMETHODIMP nsRenderingContextWin :: GetClipRegion(nsIRegion **aRegion)
|
||||
{
|
||||
//XXX wow, needs to do something.
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsRenderingContextWin :: SetColor(nscolor aColor)
|
||||
NS_IMETHODIMP nsRenderingContextWin :: SetColor(nscolor aColor)
|
||||
{
|
||||
mCurrentColor = aColor;
|
||||
mColor = RGB(mGammaTable[NS_GET_R(aColor)],
|
||||
mGammaTable[NS_GET_G(aColor)],
|
||||
mGammaTable[NS_GET_B(aColor)]);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nscolor nsRenderingContextWin :: GetColor() const
|
||||
NS_IMETHODIMP nsRenderingContextWin :: GetColor(nscolor &aColor) const
|
||||
{
|
||||
return mCurrentColor;
|
||||
aColor = mCurrentColor;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsRenderingContextWin :: SetLineStyle(nsLineStyle aLineStyle)
|
||||
NS_IMETHODIMP nsRenderingContextWin :: SetLineStyle(nsLineStyle aLineStyle)
|
||||
{
|
||||
mCurrLineStyle = aLineStyle;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsRenderingContextWin :: GetLineStyle(nsLineStyle &aLineStyle)
|
||||
NS_IMETHODIMP nsRenderingContextWin :: GetLineStyle(nsLineStyle &aLineStyle)
|
||||
{
|
||||
aLineStyle = mCurrLineStyle;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsRenderingContextWin :: SetFont(const nsFont& aFont)
|
||||
NS_IMETHODIMP nsRenderingContextWin :: SetFont(const nsFont& aFont)
|
||||
{
|
||||
NS_IF_RELEASE(mFontMetrics);
|
||||
mContext->GetMetricsFor(aFont, mFontMetrics);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsRenderingContextWin :: SetFont(nsIFontMetrics *aFontMetrics)
|
||||
NS_IMETHODIMP nsRenderingContextWin :: SetFont(nsIFontMetrics *aFontMetrics)
|
||||
{
|
||||
NS_IF_RELEASE(mFontMetrics);
|
||||
mFontMetrics = aFontMetrics;
|
||||
NS_IF_ADDREF(mFontMetrics);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
const nsFont& nsRenderingContextWin :: GetFont()
|
||||
{
|
||||
const nsFont* font;
|
||||
|
||||
if (nsnull != mFontMetrics)
|
||||
mFontMetrics->GetFont(font);
|
||||
|
||||
return *font;
|
||||
}
|
||||
|
||||
nsIFontMetrics* nsRenderingContextWin :: GetFontMetrics()
|
||||
NS_IMETHODIMP nsRenderingContextWin :: GetFontMetrics(nsIFontMetrics *&aFontMetrics)
|
||||
{
|
||||
NS_IF_ADDREF(mFontMetrics);
|
||||
return mFontMetrics;
|
||||
aFontMetrics = mFontMetrics;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// add the passed in translation to the current translation
|
||||
void nsRenderingContextWin :: Translate(nscoord aX, nscoord aY)
|
||||
NS_IMETHODIMP nsRenderingContextWin :: Translate(nscoord aX, nscoord aY)
|
||||
{
|
||||
mTMatrix->AddTranslation((float)aX,(float)aY);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// add the passed in scale to the current scale
|
||||
void nsRenderingContextWin :: Scale(float aSx, float aSy)
|
||||
NS_IMETHODIMP nsRenderingContextWin :: Scale(float aSx, float aSy)
|
||||
{
|
||||
mTMatrix->AddScale(aSx, aSy);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsTransform2D * nsRenderingContextWin :: GetCurrentTransform()
|
||||
NS_IMETHODIMP nsRenderingContextWin :: GetCurrentTransform(nsTransform2D *&aTransform)
|
||||
{
|
||||
return mTMatrix;
|
||||
aTransform = mTMatrix;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsDrawingSurface nsRenderingContextWin :: CreateDrawingSurface(nsRect *aBounds, PRUint32 aSurfFlags)
|
||||
NS_IMETHODIMP nsRenderingContextWin :: CreateDrawingSurface(nsRect *aBounds, PRUint32 aSurfFlags, nsDrawingSurface &aSurface)
|
||||
{
|
||||
nsDrawingSurfaceWin *surf = new nsDrawingSurfaceWin();
|
||||
|
||||
|
@ -1065,10 +1088,12 @@ nsDrawingSurface nsRenderingContextWin :: CreateDrawingSurface(nsRect *aBounds,
|
|||
}
|
||||
}
|
||||
|
||||
return (nsDrawingSurface)surf;
|
||||
aSurface = (nsDrawingSurface)surf;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsRenderingContextWin :: DestroyDrawingSurface(nsDrawingSurface aDS)
|
||||
NS_IMETHODIMP nsRenderingContextWin :: DestroyDrawingSurface(nsDrawingSurface aDS)
|
||||
{
|
||||
nsDrawingSurfaceWin *surf = (nsDrawingSurfaceWin *)aDS;
|
||||
|
||||
|
@ -1080,12 +1105,14 @@ void nsRenderingContextWin :: DestroyDrawingSurface(nsDrawingSurface aDS)
|
|||
}
|
||||
|
||||
NS_IF_RELEASE(surf);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsRenderingContextWin :: DrawLine(nscoord aX0, nscoord aY0, nscoord aX1, nscoord aY1)
|
||||
NS_IMETHODIMP nsRenderingContextWin :: DrawLine(nscoord aX0, nscoord aY0, nscoord aX1, nscoord aY1)
|
||||
{
|
||||
if (nsLineStyle_kNone == mCurrLineStyle)
|
||||
return;
|
||||
return NS_OK;
|
||||
|
||||
mTMatrix->TransformCoord(&aX0,&aY0);
|
||||
mTMatrix->TransformCoord(&aX1,&aY1);
|
||||
|
@ -1108,12 +1135,14 @@ void nsRenderingContextWin :: DrawLine(nscoord aX0, nscoord aY0, nscoord aX1, ns
|
|||
::MoveToEx(mDC, (int)(aX0), (int)(aY0), NULL);
|
||||
::LineTo(mDC, (int)(aX1), (int)(aY1));
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsRenderingContextWin :: DrawPolyline(const nsPoint aPoints[], PRInt32 aNumPoints)
|
||||
NS_IMETHODIMP nsRenderingContextWin :: DrawPolyline(const nsPoint aPoints[], PRInt32 aNumPoints)
|
||||
{
|
||||
if (nsLineStyle_kNone == mCurrLineStyle)
|
||||
return;
|
||||
return NS_OK;
|
||||
|
||||
// First transform nsPoint's into POINT's; perform coordinate space
|
||||
// transformation at the same time
|
||||
|
@ -1140,9 +1169,11 @@ void nsRenderingContextWin :: DrawPolyline(const nsPoint aPoints[], PRInt32 aNum
|
|||
// Release temporary storage if necessary
|
||||
if (pp0 != pts)
|
||||
delete pp0;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsRenderingContextWin :: DrawRect(const nsRect& aRect)
|
||||
NS_IMETHODIMP nsRenderingContextWin :: DrawRect(const nsRect& aRect)
|
||||
{
|
||||
RECT nr;
|
||||
nsRect tr;
|
||||
|
@ -1155,9 +1186,11 @@ void nsRenderingContextWin :: DrawRect(const nsRect& aRect)
|
|||
nr.bottom = tr.y+tr.height;
|
||||
|
||||
::FrameRect(mDC, &nr, SetupSolidBrush());
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsRenderingContextWin :: DrawRect(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight)
|
||||
NS_IMETHODIMP nsRenderingContextWin :: DrawRect(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight)
|
||||
{
|
||||
RECT nr;
|
||||
|
||||
|
@ -1168,9 +1201,11 @@ void nsRenderingContextWin :: DrawRect(nscoord aX, nscoord aY, nscoord aWidth, n
|
|||
nr.bottom = aY+aHeight;
|
||||
|
||||
::FrameRect(mDC, &nr, SetupSolidBrush());
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsRenderingContextWin :: FillRect(const nsRect& aRect)
|
||||
NS_IMETHODIMP nsRenderingContextWin :: FillRect(const nsRect& aRect)
|
||||
{
|
||||
RECT nr;
|
||||
nsRect tr;
|
||||
|
@ -1183,9 +1218,11 @@ void nsRenderingContextWin :: FillRect(const nsRect& aRect)
|
|||
nr.bottom = tr.y+tr.height;
|
||||
|
||||
::FillRect(mDC, &nr, SetupSolidBrush());
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsRenderingContextWin :: FillRect(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight)
|
||||
NS_IMETHODIMP nsRenderingContextWin :: FillRect(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight)
|
||||
{
|
||||
RECT nr;
|
||||
nsRect tr;
|
||||
|
@ -1197,9 +1234,11 @@ void nsRenderingContextWin :: FillRect(nscoord aX, nscoord aY, nscoord aWidth, n
|
|||
nr.bottom = aY+aHeight;
|
||||
|
||||
::FillRect(mDC, &nr, SetupSolidBrush());
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsRenderingContextWin::DrawPolygon(const nsPoint aPoints[], PRInt32 aNumPoints)
|
||||
NS_IMETHODIMP nsRenderingContextWin :: DrawPolygon(const nsPoint aPoints[], PRInt32 aNumPoints)
|
||||
{
|
||||
// First transform nsPoint's into POINT's; perform coordinate space
|
||||
// transformation at the same time
|
||||
|
@ -1234,9 +1273,11 @@ void nsRenderingContextWin::DrawPolygon(const nsPoint aPoints[], PRInt32 aNumPoi
|
|||
// Release temporary storage if necessary
|
||||
if (pp0 != pts)
|
||||
delete pp0;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsRenderingContextWin::FillPolygon(const nsPoint aPoints[], PRInt32 aNumPoints)
|
||||
NS_IMETHODIMP nsRenderingContextWin :: FillPolygon(const nsPoint aPoints[], PRInt32 aNumPoints)
|
||||
{
|
||||
// First transform nsPoint's into POINT's; perform coordinate space
|
||||
// transformation at the same time
|
||||
|
@ -1270,17 +1311,19 @@ void nsRenderingContextWin::FillPolygon(const nsPoint aPoints[], PRInt32 aNumPoi
|
|||
// Release temporary storage if necessary
|
||||
if (pp0 != pts)
|
||||
delete pp0;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsRenderingContextWin :: DrawEllipse(const nsRect& aRect)
|
||||
NS_IMETHODIMP nsRenderingContextWin :: DrawEllipse(const nsRect& aRect)
|
||||
{
|
||||
DrawEllipse(aRect.x, aRect.y, aRect.width, aRect.height);
|
||||
return DrawEllipse(aRect.x, aRect.y, aRect.width, aRect.height);
|
||||
}
|
||||
|
||||
void nsRenderingContextWin :: DrawEllipse(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight)
|
||||
NS_IMETHODIMP nsRenderingContextWin :: DrawEllipse(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight)
|
||||
{
|
||||
if (nsLineStyle_kNone == mCurrLineStyle)
|
||||
return;
|
||||
return NS_OK;
|
||||
|
||||
mTMatrix->TransformCoord(&aX, &aY, &aWidth, &aHeight);
|
||||
|
||||
|
@ -1290,14 +1333,16 @@ void nsRenderingContextWin :: DrawEllipse(nscoord aX, nscoord aY, nscoord aWidth
|
|||
|
||||
::Ellipse(mDC, aX, aY, aX + aWidth, aY + aHeight);
|
||||
::SelectObject(mDC, oldBrush);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsRenderingContextWin :: FillEllipse(const nsRect& aRect)
|
||||
NS_IMETHODIMP nsRenderingContextWin :: FillEllipse(const nsRect& aRect)
|
||||
{
|
||||
FillEllipse(aRect.x, aRect.y, aRect.width, aRect.height);
|
||||
return FillEllipse(aRect.x, aRect.y, aRect.width, aRect.height);
|
||||
}
|
||||
|
||||
void nsRenderingContextWin :: FillEllipse(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight)
|
||||
NS_IMETHODIMP nsRenderingContextWin :: FillEllipse(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight)
|
||||
{
|
||||
mTMatrix->TransformCoord(&aX, &aY, &aWidth, &aHeight);
|
||||
|
||||
|
@ -1305,19 +1350,21 @@ void nsRenderingContextWin :: FillEllipse(nscoord aX, nscoord aY, nscoord aWidth
|
|||
SetupSolidBrush();
|
||||
|
||||
::Ellipse(mDC, aX, aY, aX + aWidth, aY + aHeight);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsRenderingContextWin :: DrawArc(const nsRect& aRect,
|
||||
NS_IMETHODIMP nsRenderingContextWin :: DrawArc(const nsRect& aRect,
|
||||
float aStartAngle, float aEndAngle)
|
||||
{
|
||||
this->DrawArc(aRect.x,aRect.y,aRect.width,aRect.height,aStartAngle,aEndAngle);
|
||||
return DrawArc(aRect.x,aRect.y,aRect.width,aRect.height,aStartAngle,aEndAngle);
|
||||
}
|
||||
|
||||
void nsRenderingContextWin :: DrawArc(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight,
|
||||
NS_IMETHODIMP nsRenderingContextWin :: DrawArc(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight,
|
||||
float aStartAngle, float aEndAngle)
|
||||
{
|
||||
if (nsLineStyle_kNone == mCurrLineStyle)
|
||||
return;
|
||||
return NS_OK;
|
||||
|
||||
PRInt32 quad1, quad2, sx, sy, ex, ey, cx, cy;
|
||||
float anglerad, distance;
|
||||
|
@ -1346,15 +1393,17 @@ void nsRenderingContextWin :: DrawArc(nscoord aX, nscoord aY, nscoord aWidth, ns
|
|||
::SetArcDirection(mDC, AD_COUNTERCLOCKWISE);
|
||||
|
||||
::Arc(mDC, aX, aY, aX + aWidth, aY + aHeight, sx, sy, ex, ey);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsRenderingContextWin :: FillArc(const nsRect& aRect,
|
||||
NS_IMETHODIMP nsRenderingContextWin :: FillArc(const nsRect& aRect,
|
||||
float aStartAngle, float aEndAngle)
|
||||
{
|
||||
this->FillArc(aRect.x, aRect.y, aRect.width, aRect.height, aStartAngle, aEndAngle);
|
||||
return FillArc(aRect.x, aRect.y, aRect.width, aRect.height, aStartAngle, aEndAngle);
|
||||
}
|
||||
|
||||
void nsRenderingContextWin :: FillArc(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight,
|
||||
NS_IMETHODIMP nsRenderingContextWin :: FillArc(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight,
|
||||
float aStartAngle, float aEndAngle)
|
||||
{
|
||||
PRInt32 quad1, quad2, sx, sy, ex, ey, cx, cy;
|
||||
|
@ -1385,33 +1434,31 @@ void nsRenderingContextWin :: FillArc(nscoord aX, nscoord aY, nscoord aWidth, ns
|
|||
::SetArcDirection(mDC, AD_COUNTERCLOCKWISE);
|
||||
|
||||
::Pie(mDC, aX, aY, aX + aWidth, aY + aHeight, sx, sy, ex, ey);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsRenderingContextWin :: GetWidth(char ch, nscoord& aWidth)
|
||||
NS_IMETHODIMP nsRenderingContextWin :: GetWidth(char ch, nscoord& aWidth)
|
||||
{
|
||||
char buf[1];
|
||||
buf[0] = ch;
|
||||
return GetWidth(buf, 1, aWidth);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsRenderingContextWin :: GetWidth(PRUnichar ch, nscoord &aWidth)
|
||||
NS_IMETHODIMP nsRenderingContextWin :: GetWidth(PRUnichar ch, nscoord &aWidth)
|
||||
{
|
||||
PRUnichar buf[1];
|
||||
buf[0] = ch;
|
||||
return GetWidth(buf, 1, aWidth);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsRenderingContextWin :: GetWidth(const char* aString, nscoord& aWidth)
|
||||
NS_IMETHODIMP nsRenderingContextWin :: GetWidth(const char* aString, nscoord& aWidth)
|
||||
{
|
||||
return GetWidth(aString, strlen(aString), aWidth);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsRenderingContextWin :: GetWidth(const char* aString,
|
||||
NS_IMETHODIMP nsRenderingContextWin :: GetWidth(const char* aString,
|
||||
PRUint32 aLength,
|
||||
nscoord& aWidth)
|
||||
{
|
||||
|
@ -1429,14 +1476,12 @@ nsRenderingContextWin :: GetWidth(const char* aString,
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsRenderingContextWin :: GetWidth(const nsString& aString, nscoord& aWidth)
|
||||
NS_IMETHODIMP nsRenderingContextWin :: GetWidth(const nsString& aString, nscoord& aWidth)
|
||||
{
|
||||
return GetWidth(aString.GetUnicode(), aString.Length(), aWidth);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsRenderingContextWin :: GetWidth(const PRUnichar *aString,
|
||||
NS_IMETHODIMP nsRenderingContextWin :: GetWidth(const PRUnichar *aString,
|
||||
PRUint32 aLength,
|
||||
nscoord &aWidth)
|
||||
{
|
||||
|
@ -1454,8 +1499,7 @@ nsRenderingContextWin :: GetWidth(const PRUnichar *aString,
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
void
|
||||
nsRenderingContextWin :: DrawString(const char *aString, PRUint32 aLength,
|
||||
NS_IMETHODIMP nsRenderingContextWin :: DrawString(const char *aString, PRUint32 aLength,
|
||||
nscoord aX, nscoord aY,
|
||||
nscoord aWidth,
|
||||
const nscoord* aSpacing)
|
||||
|
@ -1485,7 +1529,9 @@ nsRenderingContextWin :: DrawString(const char *aString, PRUint32 aLength,
|
|||
|
||||
if (nsnull != mFontMetrics)
|
||||
{
|
||||
PRUint8 decorations = GetFont().decorations;
|
||||
nsFont *font;
|
||||
mFontMetrics->GetFont(font);
|
||||
PRUint8 decorations = font->decorations;
|
||||
|
||||
if (decorations & NS_FONT_DECORATION_OVERLINE)
|
||||
{
|
||||
|
@ -1495,10 +1541,11 @@ nsRenderingContextWin :: DrawString(const char *aString, PRUint32 aLength,
|
|||
FillRect(aX, aY, aWidth, size);
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsRenderingContextWin :: DrawString(const PRUnichar *aString, PRUint32 aLength,
|
||||
NS_IMETHODIMP nsRenderingContextWin :: DrawString(const PRUnichar *aString, PRUint32 aLength,
|
||||
nscoord aX, nscoord aY, nscoord aWidth,
|
||||
const nscoord* aSpacing)
|
||||
{
|
||||
|
@ -1535,7 +1582,9 @@ nsRenderingContextWin :: DrawString(const PRUnichar *aString, PRUint32 aLength,
|
|||
|
||||
if (nsnull != mFontMetrics)
|
||||
{
|
||||
PRUint8 decorations = GetFont().decorations;
|
||||
nsFont *font;
|
||||
mFontMetrics->GetFont(font);
|
||||
PRUint8 decorations = font->decorations;
|
||||
|
||||
if (decorations & NS_FONT_DECORATION_OVERLINE)
|
||||
{
|
||||
|
@ -1545,17 +1594,18 @@ nsRenderingContextWin :: DrawString(const PRUnichar *aString, PRUint32 aLength,
|
|||
FillRect(aX, aY, aWidth, size);
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsRenderingContextWin :: DrawString(const nsString& aString,
|
||||
NS_IMETHODIMP nsRenderingContextWin :: DrawString(const nsString& aString,
|
||||
nscoord aX, nscoord aY, nscoord aWidth,
|
||||
const nscoord* aSpacing)
|
||||
{
|
||||
DrawString(aString.GetUnicode(), aString.Length(), aX, aY, aWidth, aSpacing);
|
||||
return DrawString(aString.GetUnicode(), aString.Length(), aX, aY, aWidth, aSpacing);
|
||||
}
|
||||
|
||||
void nsRenderingContextWin :: DrawImage(nsIImage *aImage, nscoord aX, nscoord aY)
|
||||
NS_IMETHODIMP nsRenderingContextWin :: DrawImage(nsIImage *aImage, nscoord aX, nscoord aY)
|
||||
{
|
||||
NS_PRECONDITION(PR_TRUE == mInitialized, "!initialized");
|
||||
|
||||
|
@ -1564,10 +1614,10 @@ void nsRenderingContextWin :: DrawImage(nsIImage *aImage, nscoord aX, nscoord aY
|
|||
width = NSToCoordRound(mP2T * aImage->GetWidth());
|
||||
height = NSToCoordRound(mP2T * aImage->GetHeight());
|
||||
|
||||
this->DrawImage(aImage, aX, aY, width, height);
|
||||
return DrawImage(aImage, aX, aY, width, height);
|
||||
}
|
||||
|
||||
void nsRenderingContextWin :: DrawImage(nsIImage *aImage, nscoord aX, nscoord aY,
|
||||
NS_IMETHODIMP nsRenderingContextWin :: DrawImage(nsIImage *aImage, nscoord aX, nscoord aY,
|
||||
nscoord aWidth, nscoord aHeight)
|
||||
{
|
||||
nsRect tr;
|
||||
|
@ -1577,10 +1627,10 @@ void nsRenderingContextWin :: DrawImage(nsIImage *aImage, nscoord aX, nscoord aY
|
|||
tr.width = aWidth;
|
||||
tr.height = aHeight;
|
||||
|
||||
this->DrawImage(aImage, tr);
|
||||
return DrawImage(aImage, tr);
|
||||
}
|
||||
|
||||
void nsRenderingContextWin :: DrawImage(nsIImage *aImage, const nsRect& aSRect, const nsRect& aDRect)
|
||||
NS_IMETHODIMP nsRenderingContextWin :: DrawImage(nsIImage *aImage, const nsRect& aSRect, const nsRect& aDRect)
|
||||
{
|
||||
nsRect sr,dr;
|
||||
|
||||
|
@ -1590,17 +1640,17 @@ void nsRenderingContextWin :: DrawImage(nsIImage *aImage, const nsRect& aSRect,
|
|||
dr = aDRect;
|
||||
mTMatrix->TransformCoord(&dr.x, &dr.y, &dr.width, &dr.height);
|
||||
|
||||
((nsImageWin *)aImage)->Draw(*this, mSurface, sr.x, sr.y, sr.width, sr.height, dr.x, dr.y, dr.width, dr.height);
|
||||
return aImage->Draw(*this, mSurface, sr.x, sr.y, sr.width, sr.height, dr.x, dr.y, dr.width, dr.height);
|
||||
}
|
||||
|
||||
void nsRenderingContextWin :: DrawImage(nsIImage *aImage, const nsRect& aRect)
|
||||
NS_IMETHODIMP nsRenderingContextWin :: DrawImage(nsIImage *aImage, const nsRect& aRect)
|
||||
{
|
||||
nsRect tr;
|
||||
|
||||
tr = aRect;
|
||||
mTMatrix->TransformCoord(&tr.x, &tr.y, &tr.width, &tr.height);
|
||||
|
||||
((nsImageWin *)aImage)->Draw(*this, mSurface, tr.x, tr.y, tr.width, tr.height);
|
||||
return aImage->Draw(*this, mSurface, tr.x, tr.y, tr.width, tr.height);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsRenderingContextWin :: CopyOffScreenBits(nsDrawingSurface aSrcSurf,
|
||||
|
|
|
@ -62,92 +62,91 @@ public:
|
|||
NS_IMETHOD Init(nsIDeviceContext* aContext, nsIWidget *aWindow);
|
||||
NS_IMETHOD Init(nsIDeviceContext* aContext, nsDrawingSurface aSurface);
|
||||
|
||||
virtual void Reset();
|
||||
NS_IMETHOD Reset(void);
|
||||
|
||||
virtual nsIDeviceContext * GetDeviceContext(void);
|
||||
NS_IMETHOD GetDeviceContext(nsIDeviceContext *&aContext);
|
||||
|
||||
NS_IMETHOD SelectOffScreenDrawingSurface(nsDrawingSurface aSurface);
|
||||
NS_IMETHOD GetHints(PRUint32& aResult);
|
||||
|
||||
virtual void PushState(void);
|
||||
virtual PRBool PopState(void);
|
||||
NS_IMETHOD PushState(void);
|
||||
NS_IMETHOD PopState(PRBool &aClipState);
|
||||
|
||||
virtual PRBool IsVisibleRect(const nsRect& aRect);
|
||||
NS_IMETHOD IsVisibleRect(const nsRect& aRect, PRBool &aClipState);
|
||||
|
||||
virtual PRBool SetClipRect(const nsRect& aRect, nsClipCombine aCombine);
|
||||
virtual PRBool GetClipRect(nsRect &aRect);
|
||||
virtual PRBool SetClipRegion(const nsIRegion& aRegion, nsClipCombine aCombine);
|
||||
virtual void GetClipRegion(nsIRegion **aRegion);
|
||||
NS_IMETHOD SetClipRect(const nsRect& aRect, nsClipCombine aCombine, PRBool &aCilpState);
|
||||
NS_IMETHOD GetClipRect(nsRect &aRect, PRBool &aClipState);
|
||||
NS_IMETHOD SetClipRegion(const nsIRegion& aRegion, nsClipCombine aCombine, PRBool &aClipState);
|
||||
NS_IMETHOD GetClipRegion(nsIRegion **aRegion);
|
||||
|
||||
NS_IMETHOD SetLineStyle(nsLineStyle aLineStyle);
|
||||
NS_IMETHOD GetLineStyle(nsLineStyle &aLineStyle);
|
||||
|
||||
virtual void SetColor(nscolor aColor);
|
||||
virtual nscolor GetColor() const;
|
||||
NS_IMETHOD SetColor(nscolor aColor);
|
||||
NS_IMETHOD GetColor(nscolor &aColor) const;
|
||||
|
||||
virtual void SetFont(const nsFont& aFont);
|
||||
virtual void SetFont(nsIFontMetrics *aFontMetrics);
|
||||
virtual const nsFont& GetFont();
|
||||
NS_IMETHOD SetFont(const nsFont& aFont);
|
||||
NS_IMETHOD SetFont(nsIFontMetrics *aFontMetrics);
|
||||
|
||||
virtual nsIFontMetrics * GetFontMetrics();
|
||||
NS_IMETHOD GetFontMetrics(nsIFontMetrics *&aFontMetrics);
|
||||
|
||||
virtual void Translate(nscoord aX, nscoord aY);
|
||||
virtual void Scale(float aSx, float aSy);
|
||||
virtual nsTransform2D * GetCurrentTransform();
|
||||
NS_IMETHOD Translate(nscoord aX, nscoord aY);
|
||||
NS_IMETHOD Scale(float aSx, float aSy);
|
||||
NS_IMETHOD GetCurrentTransform(nsTransform2D *&aTransform);
|
||||
|
||||
virtual nsDrawingSurface CreateDrawingSurface(nsRect *aBounds, PRUint32 aSurfFlags);
|
||||
virtual void DestroyDrawingSurface(nsDrawingSurface aDS);
|
||||
NS_IMETHOD CreateDrawingSurface(nsRect *aBounds, PRUint32 aSurfFlags, nsDrawingSurface &aSurface);
|
||||
NS_IMETHOD DestroyDrawingSurface(nsDrawingSurface aDS);
|
||||
|
||||
virtual void DrawLine(nscoord aX0, nscoord aY0, nscoord aX1, nscoord aY1);
|
||||
virtual void DrawPolyline(const nsPoint aPoints[], PRInt32 aNumPoints);
|
||||
NS_IMETHOD DrawLine(nscoord aX0, nscoord aY0, nscoord aX1, nscoord aY1);
|
||||
NS_IMETHOD DrawPolyline(const nsPoint aPoints[], PRInt32 aNumPoints);
|
||||
|
||||
virtual void DrawRect(const nsRect& aRect);
|
||||
virtual void DrawRect(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight);
|
||||
virtual void FillRect(const nsRect& aRect);
|
||||
virtual void FillRect(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight);
|
||||
NS_IMETHOD DrawRect(const nsRect& aRect);
|
||||
NS_IMETHOD DrawRect(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight);
|
||||
NS_IMETHOD FillRect(const nsRect& aRect);
|
||||
NS_IMETHOD FillRect(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight);
|
||||
|
||||
virtual void DrawPolygon(const nsPoint aPoints[], PRInt32 aNumPoints);
|
||||
virtual void FillPolygon(const nsPoint aPoints[], PRInt32 aNumPoints);
|
||||
NS_IMETHOD DrawPolygon(const nsPoint aPoints[], PRInt32 aNumPoints);
|
||||
NS_IMETHOD FillPolygon(const nsPoint aPoints[], PRInt32 aNumPoints);
|
||||
|
||||
virtual void DrawEllipse(const nsRect& aRect);
|
||||
virtual void DrawEllipse(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight);
|
||||
virtual void FillEllipse(const nsRect& aRect);
|
||||
virtual void FillEllipse(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight);
|
||||
NS_IMETHOD DrawEllipse(const nsRect& aRect);
|
||||
NS_IMETHOD DrawEllipse(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight);
|
||||
NS_IMETHOD FillEllipse(const nsRect& aRect);
|
||||
NS_IMETHOD FillEllipse(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight);
|
||||
|
||||
virtual void DrawArc(const nsRect& aRect,
|
||||
float aStartAngle, float aEndAngle);
|
||||
virtual void DrawArc(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight,
|
||||
float aStartAngle, float aEndAngle);
|
||||
virtual void FillArc(const nsRect& aRect,
|
||||
float aStartAngle, float aEndAngle);
|
||||
virtual void FillArc(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight,
|
||||
float aStartAngle, float aEndAngle);
|
||||
NS_IMETHOD DrawArc(const nsRect& aRect,
|
||||
float aStartAngle, float aEndAngle);
|
||||
NS_IMETHOD DrawArc(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight,
|
||||
float aStartAngle, float aEndAngle);
|
||||
NS_IMETHOD FillArc(const nsRect& aRect,
|
||||
float aStartAngle, float aEndAngle);
|
||||
NS_IMETHOD FillArc(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight,
|
||||
float aStartAngle, float aEndAngle);
|
||||
|
||||
NS_IMETHOD GetWidth(char aC, nscoord& aWidth);
|
||||
NS_IMETHOD GetWidth(PRUnichar aC, nscoord& aWidth);
|
||||
NS_IMETHOD GetWidth(const nsString& aString, nscoord& aWidth);
|
||||
NS_IMETHOD GetWidth(const char* aString, nscoord& aWidth);
|
||||
NS_IMETHOD GetWidth(const char* aString, PRUint32 aLength, nscoord& aWidth);
|
||||
NS_IMETHOD GetWidth(const PRUnichar* aString, PRUint32 aLength,
|
||||
nscoord& aWidth);
|
||||
NS_IMETHOD GetWidth(char aC, nscoord& aWidth);
|
||||
NS_IMETHOD GetWidth(PRUnichar aC, nscoord& aWidth);
|
||||
NS_IMETHOD GetWidth(const nsString& aString, nscoord& aWidth);
|
||||
NS_IMETHOD GetWidth(const char* aString, nscoord& aWidth);
|
||||
NS_IMETHOD GetWidth(const char* aString, PRUint32 aLength, nscoord& aWidth);
|
||||
NS_IMETHOD GetWidth(const PRUnichar* aString, PRUint32 aLength,
|
||||
nscoord& aWidth);
|
||||
|
||||
virtual void DrawString(const char *aString, PRUint32 aLength,
|
||||
nscoord aX, nscoord aY,
|
||||
nscoord aWidth,
|
||||
const nscoord* aSpacing);
|
||||
virtual void DrawString(const PRUnichar *aString, PRUint32 aLength,
|
||||
nscoord aX, nscoord aY,
|
||||
nscoord aWidth,
|
||||
const nscoord* aSpacing);
|
||||
virtual void DrawString(const nsString& aString, nscoord aX, nscoord aY,
|
||||
nscoord aWidth,
|
||||
const nscoord* aSpacing);
|
||||
NS_IMETHOD DrawString(const char *aString, PRUint32 aLength,
|
||||
nscoord aX, nscoord aY,
|
||||
nscoord aWidth,
|
||||
const nscoord* aSpacing);
|
||||
NS_IMETHOD DrawString(const PRUnichar *aString, PRUint32 aLength,
|
||||
nscoord aX, nscoord aY,
|
||||
nscoord aWidth,
|
||||
const nscoord* aSpacing);
|
||||
NS_IMETHOD DrawString(const nsString& aString, nscoord aX, nscoord aY,
|
||||
nscoord aWidth,
|
||||
const nscoord* aSpacing);
|
||||
|
||||
virtual void DrawImage(nsIImage *aImage, nscoord aX, nscoord aY);
|
||||
virtual void DrawImage(nsIImage *aImage, nscoord aX, nscoord aY,
|
||||
nscoord aWidth, nscoord aHeight);
|
||||
virtual void DrawImage(nsIImage *aImage, const nsRect& aRect);
|
||||
virtual void DrawImage(nsIImage *aImage, const nsRect& aSRect, const nsRect& aDRect);
|
||||
NS_IMETHOD DrawImage(nsIImage *aImage, nscoord aX, nscoord aY);
|
||||
NS_IMETHOD DrawImage(nsIImage *aImage, nscoord aX, nscoord aY,
|
||||
nscoord aWidth, nscoord aHeight);
|
||||
NS_IMETHOD DrawImage(nsIImage *aImage, const nsRect& aRect);
|
||||
NS_IMETHOD DrawImage(nsIImage *aImage, const nsRect& aSRect, const nsRect& aDRect);
|
||||
|
||||
NS_IMETHOD CopyOffScreenBits(nsDrawingSurface aSrcSurf, PRInt32 aSrcX, PRInt32 aSrcY,
|
||||
const nsRect &aDestBounds, PRUint32 aCopyFlags);
|
||||
|
|
|
@ -605,7 +605,8 @@ SYSTEMTIME thetime;
|
|||
milli = thetime.wMilliseconds;
|
||||
|
||||
if(aOptimize==PR_TRUE) {
|
||||
nsIDeviceContext* deviceContext = aSurface->GetDeviceContext();
|
||||
nsIDeviceContext* deviceContext;
|
||||
aSurface->GetDeviceContext(deviceContext);
|
||||
aTheImage->Optimize(deviceContext);
|
||||
NS_RELEASE(deviceContext);
|
||||
}
|
||||
|
|
|
@ -929,9 +929,10 @@ nsCSSRendering::PaintBackground(nsIPresContext& aPresContext,
|
|||
PRIntn y = PRIntn(aDirtyRect.y / tileHeight);
|
||||
nscoord ypos = aBounds.y + y * tileHeight + anchor.y;
|
||||
PRIntn xstart = PRIntn(aDirtyRect.x / tileWidth);
|
||||
PRBool clipState;
|
||||
nscoord xpostart = aBounds.x + xstart * tileWidth + anchor.x;
|
||||
aRenderingContext.PushState();
|
||||
aRenderingContext.SetClipRect(aDirtyRect, nsClipCombine_kIntersect);
|
||||
aRenderingContext.SetClipRect(aDirtyRect, nsClipCombine_kIntersect, clipState);
|
||||
for (; y <= yCount; ++y, ypos += tileHeight) {
|
||||
PRIntn x = xstart;
|
||||
nscoord xpos = xpostart;
|
||||
|
@ -939,7 +940,7 @@ nsCSSRendering::PaintBackground(nsIPresContext& aPresContext,
|
|||
aRenderingContext.DrawImage(image, xpos, ypos);
|
||||
}
|
||||
}
|
||||
aRenderingContext.PopState();
|
||||
aRenderingContext.PopState(clipState);
|
||||
} else {
|
||||
if (0 == (aColor.mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT)) {
|
||||
// XXX This step can be avoided if we have an image and it doesn't
|
||||
|
|
|
@ -4474,9 +4474,10 @@ nsBlockFrame::PaintChildren(nsIPresContext& aPresContext,
|
|||
mStyleContext->GetStyleData(eStyleStruct_Display);
|
||||
PRBool hidden = PR_FALSE;
|
||||
if (NS_STYLE_OVERFLOW_HIDDEN == disp->mOverflow) {
|
||||
PRBool clipState;
|
||||
aRenderingContext.PushState();
|
||||
aRenderingContext.SetClipRect(nsRect(0, 0, mRect.width, mRect.height),
|
||||
nsClipCombine_kIntersect);
|
||||
nsClipCombine_kIntersect, clipState);
|
||||
hidden = PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -4518,7 +4519,8 @@ nsBlockFrame::PaintChildren(nsIPresContext& aPresContext,
|
|||
}
|
||||
|
||||
if (hidden) {
|
||||
aRenderingContext.PopState();
|
||||
PRBool clipState;
|
||||
aRenderingContext.PopState(clipState);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4572,7 +4574,8 @@ nsBlockFrame::PaintChild(nsIPresContext& aPresContext,
|
|||
aRenderingContext.DrawRect(0, 0, kidRect.width, kidRect.height);
|
||||
}
|
||||
#endif
|
||||
aRenderingContext.PopState();
|
||||
PRBool clipState;
|
||||
aRenderingContext.PopState(clipState);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4474,9 +4474,10 @@ nsBlockFrame::PaintChildren(nsIPresContext& aPresContext,
|
|||
mStyleContext->GetStyleData(eStyleStruct_Display);
|
||||
PRBool hidden = PR_FALSE;
|
||||
if (NS_STYLE_OVERFLOW_HIDDEN == disp->mOverflow) {
|
||||
PRBool clipState;
|
||||
aRenderingContext.PushState();
|
||||
aRenderingContext.SetClipRect(nsRect(0, 0, mRect.width, mRect.height),
|
||||
nsClipCombine_kIntersect);
|
||||
nsClipCombine_kIntersect, clipState);
|
||||
hidden = PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -4518,7 +4519,8 @@ nsBlockFrame::PaintChildren(nsIPresContext& aPresContext,
|
|||
}
|
||||
|
||||
if (hidden) {
|
||||
aRenderingContext.PopState();
|
||||
PRBool clipState;
|
||||
aRenderingContext.PopState(clipState);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4572,7 +4574,8 @@ nsBlockFrame::PaintChild(nsIPresContext& aPresContext,
|
|||
aRenderingContext.DrawRect(0, 0, kidRect.width, kidRect.height);
|
||||
}
|
||||
#endif
|
||||
aRenderingContext.PopState();
|
||||
PRBool clipState;
|
||||
aRenderingContext.PopState(clipState);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4474,9 +4474,10 @@ nsBlockFrame::PaintChildren(nsIPresContext& aPresContext,
|
|||
mStyleContext->GetStyleData(eStyleStruct_Display);
|
||||
PRBool hidden = PR_FALSE;
|
||||
if (NS_STYLE_OVERFLOW_HIDDEN == disp->mOverflow) {
|
||||
PRBool clipState;
|
||||
aRenderingContext.PushState();
|
||||
aRenderingContext.SetClipRect(nsRect(0, 0, mRect.width, mRect.height),
|
||||
nsClipCombine_kIntersect);
|
||||
nsClipCombine_kIntersect, clipState);
|
||||
hidden = PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -4518,7 +4519,8 @@ nsBlockFrame::PaintChildren(nsIPresContext& aPresContext,
|
|||
}
|
||||
|
||||
if (hidden) {
|
||||
aRenderingContext.PopState();
|
||||
PRBool clipState;
|
||||
aRenderingContext.PopState(clipState);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4572,7 +4574,8 @@ nsBlockFrame::PaintChild(nsIPresContext& aPresContext,
|
|||
aRenderingContext.DrawRect(0, 0, kidRect.width, kidRect.height);
|
||||
}
|
||||
#endif
|
||||
aRenderingContext.PopState();
|
||||
PRBool clipState;
|
||||
aRenderingContext.PopState(clipState);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -160,10 +160,11 @@ void nsContainerFrame::PaintChildren(nsIPresContext& aPresContext,
|
|||
const nsStyleDisplay* disp =
|
||||
(const nsStyleDisplay*)mStyleContext->GetStyleData(eStyleStruct_Display);
|
||||
PRBool hidden = PR_FALSE;
|
||||
PRBool clipState;
|
||||
if (NS_STYLE_OVERFLOW_HIDDEN == disp->mOverflow) {
|
||||
aRenderingContext.PushState();
|
||||
aRenderingContext.SetClipRect(nsRect(0, 0, mRect.width, mRect.height),
|
||||
nsClipCombine_kIntersect);
|
||||
nsClipCombine_kIntersect, clipState);
|
||||
hidden = PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -216,14 +217,14 @@ void nsContainerFrame::PaintChildren(nsIPresContext& aPresContext,
|
|||
aRenderingContext.DrawRect(0, 0, kidRect.width, kidRect.height);
|
||||
}
|
||||
#endif
|
||||
aRenderingContext.PopState();
|
||||
aRenderingContext.PopState(clipState);
|
||||
}
|
||||
}
|
||||
kid->GetNextSibling(kid);
|
||||
}
|
||||
|
||||
if (hidden) {
|
||||
aRenderingContext.PopState();
|
||||
aRenderingContext.PopState(clipState);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -540,7 +540,8 @@ ImageFrame::DisplayAltText(nsIPresContext& aPresContext,
|
|||
aRenderingContext.SetFont(font->mFont);
|
||||
|
||||
// Format the text to display within the formatting rect
|
||||
nsIFontMetrics* fm = aRenderingContext.GetFontMetrics();
|
||||
nsIFontMetrics* fm;
|
||||
aRenderingContext.GetFontMetrics(fm);
|
||||
|
||||
nscoord maxDescent, height;
|
||||
fm->GetMaxDescent(maxDescent);
|
||||
|
@ -597,6 +598,7 @@ ImageFrame::DisplayAltFeedback(nsIPresContext& aPresContext,
|
|||
PRInt32 aIconId)
|
||||
{
|
||||
// Display a recessed one pixel border in the inner area
|
||||
PRBool clipState;
|
||||
nsRect inner;
|
||||
GetInnerArea(&aPresContext, inner);
|
||||
|
||||
|
@ -614,11 +616,12 @@ ImageFrame::DisplayAltFeedback(nsIPresContext& aPresContext,
|
|||
|
||||
// Clip so we don't render outside the inner rect
|
||||
aRenderingContext.PushState();
|
||||
aRenderingContext.SetClipRect(inner, nsClipCombine_kIntersect);
|
||||
aRenderingContext.SetClipRect(inner, nsClipCombine_kIntersect, clipState);
|
||||
|
||||
#ifdef _WIN32
|
||||
// Display the icon
|
||||
nsIDeviceContext* dc = aRenderingContext.GetDeviceContext();
|
||||
nsIDeviceContext* dc;
|
||||
aRenderingContext.GetDeviceContext(dc);
|
||||
nsIImage* icon;
|
||||
|
||||
if (NS_SUCCEEDED(dc->LoadIconImage(aIconId, icon))) {
|
||||
|
@ -644,7 +647,7 @@ ImageFrame::DisplayAltFeedback(nsIPresContext& aPresContext,
|
|||
}
|
||||
}
|
||||
|
||||
aRenderingContext.PopState();
|
||||
aRenderingContext.PopState(clipState);
|
||||
}
|
||||
|
||||
NS_METHOD
|
||||
|
@ -690,11 +693,12 @@ ImageFrame::Paint(nsIPresContext& aPresContext,
|
|||
if (GetShowFrameBorders()) {
|
||||
nsIImageMap* map = GetImageMap();
|
||||
if (nsnull != map) {
|
||||
PRBool clipState;
|
||||
aRenderingContext.SetColor(NS_RGB(0, 0, 0));
|
||||
aRenderingContext.PushState();
|
||||
aRenderingContext.Translate(inner.x, inner.y);
|
||||
map->Draw(aPresContext, aRenderingContext);
|
||||
aRenderingContext.PopState();
|
||||
map->Draw(aPresContext, aRenderingContext);
|
||||
aRenderingContext.PopState(clipState);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2111,7 +2111,8 @@ TextFrame::ComputeWordFragmentWidth(nsLineLayout& aLineLayout,
|
|||
// context has our font in it, not the font that aText is using.
|
||||
nscoord width;
|
||||
nsIRenderingContext& rc = *aReflowState.rendContext;
|
||||
nsIFontMetrics* oldfm = rc.GetFontMetrics();
|
||||
nsIFontMetrics* oldfm;
|
||||
rc.GetFontMetrics(oldfm);
|
||||
|
||||
TextStyle ts(aLineLayout.mPresContext, rc, sc);
|
||||
if (ts.mSmallCaps) {
|
||||
|
|
|
@ -4474,9 +4474,10 @@ nsBlockFrame::PaintChildren(nsIPresContext& aPresContext,
|
|||
mStyleContext->GetStyleData(eStyleStruct_Display);
|
||||
PRBool hidden = PR_FALSE;
|
||||
if (NS_STYLE_OVERFLOW_HIDDEN == disp->mOverflow) {
|
||||
PRBool clipState;
|
||||
aRenderingContext.PushState();
|
||||
aRenderingContext.SetClipRect(nsRect(0, 0, mRect.width, mRect.height),
|
||||
nsClipCombine_kIntersect);
|
||||
nsClipCombine_kIntersect, clipState);
|
||||
hidden = PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -4518,7 +4519,8 @@ nsBlockFrame::PaintChildren(nsIPresContext& aPresContext,
|
|||
}
|
||||
|
||||
if (hidden) {
|
||||
aRenderingContext.PopState();
|
||||
PRBool clipState;
|
||||
aRenderingContext.PopState(clipState);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4572,7 +4574,8 @@ nsBlockFrame::PaintChild(nsIPresContext& aPresContext,
|
|||
aRenderingContext.DrawRect(0, 0, kidRect.width, kidRect.height);
|
||||
}
|
||||
#endif
|
||||
aRenderingContext.PopState();
|
||||
PRBool clipState;
|
||||
aRenderingContext.PopState(clipState);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4474,9 +4474,10 @@ nsBlockFrame::PaintChildren(nsIPresContext& aPresContext,
|
|||
mStyleContext->GetStyleData(eStyleStruct_Display);
|
||||
PRBool hidden = PR_FALSE;
|
||||
if (NS_STYLE_OVERFLOW_HIDDEN == disp->mOverflow) {
|
||||
PRBool clipState;
|
||||
aRenderingContext.PushState();
|
||||
aRenderingContext.SetClipRect(nsRect(0, 0, mRect.width, mRect.height),
|
||||
nsClipCombine_kIntersect);
|
||||
nsClipCombine_kIntersect, clipState);
|
||||
hidden = PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -4518,7 +4519,8 @@ nsBlockFrame::PaintChildren(nsIPresContext& aPresContext,
|
|||
}
|
||||
|
||||
if (hidden) {
|
||||
aRenderingContext.PopState();
|
||||
PRBool clipState;
|
||||
aRenderingContext.PopState(clipState);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4572,7 +4574,8 @@ nsBlockFrame::PaintChild(nsIPresContext& aPresContext,
|
|||
aRenderingContext.DrawRect(0, 0, kidRect.width, kidRect.height);
|
||||
}
|
||||
#endif
|
||||
aRenderingContext.PopState();
|
||||
PRBool clipState;
|
||||
aRenderingContext.PopState(clipState);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4474,9 +4474,10 @@ nsBlockFrame::PaintChildren(nsIPresContext& aPresContext,
|
|||
mStyleContext->GetStyleData(eStyleStruct_Display);
|
||||
PRBool hidden = PR_FALSE;
|
||||
if (NS_STYLE_OVERFLOW_HIDDEN == disp->mOverflow) {
|
||||
PRBool clipState;
|
||||
aRenderingContext.PushState();
|
||||
aRenderingContext.SetClipRect(nsRect(0, 0, mRect.width, mRect.height),
|
||||
nsClipCombine_kIntersect);
|
||||
nsClipCombine_kIntersect, clipState);
|
||||
hidden = PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -4518,7 +4519,8 @@ nsBlockFrame::PaintChildren(nsIPresContext& aPresContext,
|
|||
}
|
||||
|
||||
if (hidden) {
|
||||
aRenderingContext.PopState();
|
||||
PRBool clipState;
|
||||
aRenderingContext.PopState(clipState);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4572,7 +4574,8 @@ nsBlockFrame::PaintChild(nsIPresContext& aPresContext,
|
|||
aRenderingContext.DrawRect(0, 0, kidRect.width, kidRect.height);
|
||||
}
|
||||
#endif
|
||||
aRenderingContext.PopState();
|
||||
PRBool clipState;
|
||||
aRenderingContext.PopState(clipState);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -160,10 +160,11 @@ void nsContainerFrame::PaintChildren(nsIPresContext& aPresContext,
|
|||
const nsStyleDisplay* disp =
|
||||
(const nsStyleDisplay*)mStyleContext->GetStyleData(eStyleStruct_Display);
|
||||
PRBool hidden = PR_FALSE;
|
||||
PRBool clipState;
|
||||
if (NS_STYLE_OVERFLOW_HIDDEN == disp->mOverflow) {
|
||||
aRenderingContext.PushState();
|
||||
aRenderingContext.SetClipRect(nsRect(0, 0, mRect.width, mRect.height),
|
||||
nsClipCombine_kIntersect);
|
||||
nsClipCombine_kIntersect, clipState);
|
||||
hidden = PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -216,14 +217,14 @@ void nsContainerFrame::PaintChildren(nsIPresContext& aPresContext,
|
|||
aRenderingContext.DrawRect(0, 0, kidRect.width, kidRect.height);
|
||||
}
|
||||
#endif
|
||||
aRenderingContext.PopState();
|
||||
aRenderingContext.PopState(clipState);
|
||||
}
|
||||
}
|
||||
kid->GetNextSibling(kid);
|
||||
}
|
||||
|
||||
if (hidden) {
|
||||
aRenderingContext.PopState();
|
||||
aRenderingContext.PopState(clipState);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -540,7 +540,8 @@ ImageFrame::DisplayAltText(nsIPresContext& aPresContext,
|
|||
aRenderingContext.SetFont(font->mFont);
|
||||
|
||||
// Format the text to display within the formatting rect
|
||||
nsIFontMetrics* fm = aRenderingContext.GetFontMetrics();
|
||||
nsIFontMetrics* fm;
|
||||
aRenderingContext.GetFontMetrics(fm);
|
||||
|
||||
nscoord maxDescent, height;
|
||||
fm->GetMaxDescent(maxDescent);
|
||||
|
@ -597,6 +598,7 @@ ImageFrame::DisplayAltFeedback(nsIPresContext& aPresContext,
|
|||
PRInt32 aIconId)
|
||||
{
|
||||
// Display a recessed one pixel border in the inner area
|
||||
PRBool clipState;
|
||||
nsRect inner;
|
||||
GetInnerArea(&aPresContext, inner);
|
||||
|
||||
|
@ -614,11 +616,12 @@ ImageFrame::DisplayAltFeedback(nsIPresContext& aPresContext,
|
|||
|
||||
// Clip so we don't render outside the inner rect
|
||||
aRenderingContext.PushState();
|
||||
aRenderingContext.SetClipRect(inner, nsClipCombine_kIntersect);
|
||||
aRenderingContext.SetClipRect(inner, nsClipCombine_kIntersect, clipState);
|
||||
|
||||
#ifdef _WIN32
|
||||
// Display the icon
|
||||
nsIDeviceContext* dc = aRenderingContext.GetDeviceContext();
|
||||
nsIDeviceContext* dc;
|
||||
aRenderingContext.GetDeviceContext(dc);
|
||||
nsIImage* icon;
|
||||
|
||||
if (NS_SUCCEEDED(dc->LoadIconImage(aIconId, icon))) {
|
||||
|
@ -644,7 +647,7 @@ ImageFrame::DisplayAltFeedback(nsIPresContext& aPresContext,
|
|||
}
|
||||
}
|
||||
|
||||
aRenderingContext.PopState();
|
||||
aRenderingContext.PopState(clipState);
|
||||
}
|
||||
|
||||
NS_METHOD
|
||||
|
@ -690,11 +693,12 @@ ImageFrame::Paint(nsIPresContext& aPresContext,
|
|||
if (GetShowFrameBorders()) {
|
||||
nsIImageMap* map = GetImageMap();
|
||||
if (nsnull != map) {
|
||||
PRBool clipState;
|
||||
aRenderingContext.SetColor(NS_RGB(0, 0, 0));
|
||||
aRenderingContext.PushState();
|
||||
aRenderingContext.Translate(inner.x, inner.y);
|
||||
map->Draw(aPresContext, aRenderingContext);
|
||||
aRenderingContext.PopState();
|
||||
map->Draw(aPresContext, aRenderingContext);
|
||||
aRenderingContext.PopState(clipState);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2111,7 +2111,8 @@ TextFrame::ComputeWordFragmentWidth(nsLineLayout& aLineLayout,
|
|||
// context has our font in it, not the font that aText is using.
|
||||
nscoord width;
|
||||
nsIRenderingContext& rc = *aReflowState.rendContext;
|
||||
nsIFontMetrics* oldfm = rc.GetFontMetrics();
|
||||
nsIFontMetrics* oldfm;
|
||||
rc.GetFontMetrics(oldfm);
|
||||
|
||||
TextStyle ts(aLineLayout.mPresContext, rc, sc);
|
||||
if (ts.mSmallCaps) {
|
||||
|
|
|
@ -929,9 +929,10 @@ nsCSSRendering::PaintBackground(nsIPresContext& aPresContext,
|
|||
PRIntn y = PRIntn(aDirtyRect.y / tileHeight);
|
||||
nscoord ypos = aBounds.y + y * tileHeight + anchor.y;
|
||||
PRIntn xstart = PRIntn(aDirtyRect.x / tileWidth);
|
||||
PRBool clipState;
|
||||
nscoord xpostart = aBounds.x + xstart * tileWidth + anchor.x;
|
||||
aRenderingContext.PushState();
|
||||
aRenderingContext.SetClipRect(aDirtyRect, nsClipCombine_kIntersect);
|
||||
aRenderingContext.SetClipRect(aDirtyRect, nsClipCombine_kIntersect, clipState);
|
||||
for (; y <= yCount; ++y, ypos += tileHeight) {
|
||||
PRIntn x = xstart;
|
||||
nscoord xpos = xpostart;
|
||||
|
@ -939,7 +940,7 @@ nsCSSRendering::PaintBackground(nsIPresContext& aPresContext,
|
|||
aRenderingContext.DrawImage(image, xpos, ypos);
|
||||
}
|
||||
}
|
||||
aRenderingContext.PopState();
|
||||
aRenderingContext.PopState(clipState);
|
||||
} else {
|
||||
if (0 == (aColor.mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT)) {
|
||||
// XXX This step can be avoided if we have an image and it doesn't
|
||||
|
|
|
@ -282,6 +282,7 @@ void nsTableRowFrame::PaintChildren(nsIPresContext& aPresContext,
|
|||
nsRect damageArea;
|
||||
PRBool overlap = damageArea.IntersectRect(aDirtyRect, kidRect);
|
||||
if (overlap) {
|
||||
PRBool clipState;
|
||||
// Translate damage area into kid's coordinate system
|
||||
nsRect kidDamageArea(damageArea.x - kidRect.x,
|
||||
damageArea.y - kidRect.y,
|
||||
|
@ -293,7 +294,7 @@ void nsTableRowFrame::PaintChildren(nsIPresContext& aPresContext,
|
|||
aRenderingContext.SetColor(NS_RGB(255,0,0));
|
||||
aRenderingContext.DrawRect(0, 0, kidRect.width, kidRect.height);
|
||||
}
|
||||
aRenderingContext.PopState();
|
||||
aRenderingContext.PopState(clipState);
|
||||
}
|
||||
}
|
||||
kid->GetNextSibling(kid);
|
||||
|
|
|
@ -202,6 +202,7 @@ void nsTableRowGroupFrame::PaintChildren(nsIPresContext& aPresContext,
|
|||
|
||||
kid->GetView(pView);
|
||||
if (nsnull == pView) {
|
||||
PRBool clipState;
|
||||
nsRect kidRect;
|
||||
kid->GetRect(kidRect);
|
||||
nsRect damageArea(aDirtyRect);
|
||||
|
@ -215,7 +216,7 @@ void nsTableRowGroupFrame::PaintChildren(nsIPresContext& aPresContext,
|
|||
aRenderingContext.SetColor(NS_RGB(255,0,0));
|
||||
aRenderingContext.DrawRect(0, 0, kidRect.width, kidRect.height);
|
||||
}
|
||||
aRenderingContext.PopState();
|
||||
aRenderingContext.PopState(clipState);
|
||||
}
|
||||
kid->GetNextSibling(kid);
|
||||
}
|
||||
|
|
|
@ -282,6 +282,7 @@ void nsTableRowFrame::PaintChildren(nsIPresContext& aPresContext,
|
|||
nsRect damageArea;
|
||||
PRBool overlap = damageArea.IntersectRect(aDirtyRect, kidRect);
|
||||
if (overlap) {
|
||||
PRBool clipState;
|
||||
// Translate damage area into kid's coordinate system
|
||||
nsRect kidDamageArea(damageArea.x - kidRect.x,
|
||||
damageArea.y - kidRect.y,
|
||||
|
@ -293,7 +294,7 @@ void nsTableRowFrame::PaintChildren(nsIPresContext& aPresContext,
|
|||
aRenderingContext.SetColor(NS_RGB(255,0,0));
|
||||
aRenderingContext.DrawRect(0, 0, kidRect.width, kidRect.height);
|
||||
}
|
||||
aRenderingContext.PopState();
|
||||
aRenderingContext.PopState(clipState);
|
||||
}
|
||||
}
|
||||
kid->GetNextSibling(kid);
|
||||
|
|
|
@ -202,6 +202,7 @@ void nsTableRowGroupFrame::PaintChildren(nsIPresContext& aPresContext,
|
|||
|
||||
kid->GetView(pView);
|
||||
if (nsnull == pView) {
|
||||
PRBool clipState;
|
||||
nsRect kidRect;
|
||||
kid->GetRect(kidRect);
|
||||
nsRect damageArea(aDirtyRect);
|
||||
|
@ -215,7 +216,7 @@ void nsTableRowGroupFrame::PaintChildren(nsIPresContext& aPresContext,
|
|||
aRenderingContext.SetColor(NS_RGB(255,0,0));
|
||||
aRenderingContext.DrawRect(0, 0, kidRect.width, kidRect.height);
|
||||
}
|
||||
aRenderingContext.PopState();
|
||||
aRenderingContext.PopState(clipState);
|
||||
}
|
||||
kid->GetNextSibling(kid);
|
||||
}
|
||||
|
|
|
@ -253,7 +253,7 @@ NS_IMETHODIMP CornerView :: Paint(nsIRenderingContext& rc, const nsRect& rect,
|
|||
rc.PushState();
|
||||
GetBounds(brect);
|
||||
|
||||
clipres = rc.SetClipRect(brect, nsClipCombine_kIntersect);
|
||||
rc.SetClipRect(brect, nsClipCombine_kIntersect, clipres);
|
||||
|
||||
if (clipres == PR_FALSE)
|
||||
{
|
||||
|
@ -291,7 +291,8 @@ NS_IMETHODIMP CornerView :: Paint(nsIRenderingContext& rc, const nsRect& rect,
|
|||
nscoord(brect.width * 0.46f),
|
||||
nscoord(brect.height * 0.46f));
|
||||
|
||||
bcolor = tcolor = rc.GetColor();
|
||||
rc.GetColor(bcolor);
|
||||
tcolor = bcolor;
|
||||
|
||||
//this is inefficient, but compact...
|
||||
|
||||
|
@ -319,12 +320,10 @@ NS_IMETHODIMP CornerView :: Paint(nsIRenderingContext& rc, const nsRect& rect,
|
|||
}
|
||||
}
|
||||
|
||||
clipres = rc.PopState();
|
||||
rc.PopState(clipres);
|
||||
|
||||
if (clipres == PR_FALSE)
|
||||
{
|
||||
clipres = rc.SetClipRect(brect, nsClipCombine_kSubtract);
|
||||
}
|
||||
rc.SetClipRect(brect, nsClipCombine_kSubtract, clipres);
|
||||
}
|
||||
|
||||
aResult = clipres;
|
||||
|
@ -615,17 +614,17 @@ NS_IMETHODIMP nsScrollingView :: Paint(nsIRenderingContext& rc, const nsRect& re
|
|||
|
||||
//don't clip if we have a widget
|
||||
if ((mVis == nsViewVisibility_kShow) && (nsnull == mWindow))
|
||||
clipres = rc.SetClipRect(brect, nsClipCombine_kIntersect);
|
||||
rc.SetClipRect(brect, nsClipCombine_kIntersect, clipres);
|
||||
|
||||
if (clipres == PR_FALSE)
|
||||
{
|
||||
nsView::Paint(rc, rect, aPaintFlags | NS_VIEW_FLAG_CLIP_SET, clipres);
|
||||
}
|
||||
|
||||
clipres = rc.PopState();
|
||||
rc.PopState(clipres);
|
||||
|
||||
if ((clipres == PR_FALSE) && (mVis == nsViewVisibility_kShow) && (nsnull == mWindow))
|
||||
clipres = rc.SetClipRect(brect, nsClipCombine_kSubtract);
|
||||
rc.SetClipRect(brect, nsClipCombine_kSubtract, clipres);
|
||||
|
||||
aResult = clipres;
|
||||
return NS_OK;
|
||||
|
|
|
@ -322,10 +322,10 @@ NS_IMETHODIMP nsView :: Paint(nsIRenderingContext& rc, const nsRect& rect,
|
|||
crect.width = mClip.mRight - mClip.mLeft;
|
||||
crect.height = mClip.mBottom - mClip.mTop;
|
||||
|
||||
clipres = rc.SetClipRect(crect, nsClipCombine_kIntersect);
|
||||
rc.SetClipRect(crect, nsClipCombine_kIntersect, clipres);
|
||||
}
|
||||
else if (this != pRoot)
|
||||
clipres = rc.SetClipRect(brect, nsClipCombine_kIntersect);
|
||||
rc.SetClipRect(brect, nsClipCombine_kIntersect, clipres);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -341,7 +341,8 @@ NS_IMETHODIMP nsView :: Paint(nsIRenderingContext& rc, const nsRect& rect,
|
|||
|
||||
if (nsnull != mXForm)
|
||||
{
|
||||
nsTransform2D *pXForm = rc.GetCurrentTransform();
|
||||
nsTransform2D *pXForm;
|
||||
rc.GetCurrentTransform(pXForm);
|
||||
pXForm->Concatenate(mXForm);
|
||||
}
|
||||
|
||||
|
@ -405,6 +406,7 @@ NS_IMETHODIMP nsView :: Paint(nsIRenderingContext& rc, const nsRect& rect,
|
|||
nsDrawingSurface surf = nsnull;
|
||||
nsDrawingSurface redsurf = nsnull;
|
||||
PRBool hasTransparency;
|
||||
PRBool clipState; //for when we want to throw away the clip state
|
||||
|
||||
rc.PushState();
|
||||
|
||||
|
@ -438,8 +440,8 @@ NS_IMETHODIMP nsView :: Paint(nsIRenderingContext& rc, const nsRect& rect,
|
|||
|
||||
nsRect bitrect = nsRect(0, 0, width, height);
|
||||
|
||||
surf = localcx->CreateDrawingSurface(&bitrect, NS_CREATEDRAWINGSURFACE_FOR_PIXEL_ACCESS);
|
||||
redsurf = localcx->CreateDrawingSurface(&bitrect, NS_CREATEDRAWINGSURFACE_FOR_PIXEL_ACCESS);
|
||||
localcx->CreateDrawingSurface(&bitrect, NS_CREATEDRAWINGSURFACE_FOR_PIXEL_ACCESS, surf);
|
||||
localcx->CreateDrawingSurface(&bitrect, NS_CREATEDRAWINGSURFACE_FOR_PIXEL_ACCESS, redsurf);
|
||||
|
||||
if (nsnull != surf)
|
||||
localcx->SelectOffScreenDrawingSurface(surf);
|
||||
|
@ -573,7 +575,7 @@ NS_IMETHODIMP nsView :: Paint(nsIRenderingContext& rc, const nsRect& rect,
|
|||
nsRect *trect = (nsRect *)rects->ElementAt(--idx);
|
||||
delete trect;
|
||||
|
||||
localcx->PopState();
|
||||
localcx->PopState(clipState);
|
||||
isfirst = PR_FALSE;
|
||||
}
|
||||
else
|
||||
|
@ -586,7 +588,7 @@ NS_IMETHODIMP nsView :: Paint(nsIRenderingContext& rc, const nsRect& rect,
|
|||
delete trect;
|
||||
|
||||
//pop the state pushed on the front to back pass...
|
||||
localcx->PopState();
|
||||
localcx->PopState(clipState);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -594,7 +596,7 @@ NS_IMETHODIMP nsView :: Paint(nsIRenderingContext& rc, const nsRect& rect,
|
|||
delete views;
|
||||
}
|
||||
|
||||
localcx->PopState();
|
||||
localcx->PopState(clipState);
|
||||
}
|
||||
|
||||
if (nsnull != redsurf)
|
||||
|
@ -699,12 +701,12 @@ NS_IMETHODIMP nsView :: Paint(nsIRenderingContext& rc, const nsRect& rect,
|
|||
}
|
||||
#endif
|
||||
|
||||
rc.PopState();
|
||||
rc.PopState(clipState);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
clipres = rc.PopState();
|
||||
rc.PopState(clipres);
|
||||
|
||||
//now we need to exclude this view from the rest of the
|
||||
//paint process. only do this if this view is actually
|
||||
|
@ -726,10 +728,10 @@ NS_IMETHODIMP nsView :: Paint(nsIRenderingContext& rc, const nsRect& rect,
|
|||
crect.width = mClip.mRight - mClip.mLeft;
|
||||
crect.height = mClip.mBottom - mClip.mTop;
|
||||
|
||||
clipres = rc.SetClipRect(crect, nsClipCombine_kSubtract);
|
||||
rc.SetClipRect(crect, nsClipCombine_kSubtract, clipres);
|
||||
}
|
||||
else if (this != pRoot)
|
||||
clipres = rc.SetClipRect(brect, nsClipCombine_kSubtract);
|
||||
rc.SetClipRect(brect, nsClipCombine_kSubtract, clipres);
|
||||
}
|
||||
|
||||
aResult = clipres;
|
||||
|
|
|
@ -304,7 +304,8 @@ void nsViewManager :: Refresh(nsIView *aView, nsIRenderingContext *aContext, nsI
|
|||
|
||||
mContext->GetAppUnitsToDevUnits(scale);
|
||||
|
||||
localcx->SetClipRegion(*region, nsClipCombine_kReplace);
|
||||
PRBool result;
|
||||
localcx->SetClipRegion(*region, nsClipCombine_kReplace, result);
|
||||
|
||||
nsRect trect;
|
||||
float p2t;
|
||||
|
@ -314,7 +315,6 @@ void nsViewManager :: Refresh(nsIView *aView, nsIRenderingContext *aContext, nsI
|
|||
region->GetBoundingBox(&trect.x, &trect.y, &trect.width, &trect.height);
|
||||
trect.ScaleRoundOut(p2t);
|
||||
|
||||
PRBool result;
|
||||
// Paint the view. The clipping rect was set above set don't clip again.
|
||||
aView->Paint(*localcx, trect, NS_VIEW_FLAG_CLIP_SET, result);
|
||||
|
||||
|
@ -388,9 +388,10 @@ void nsViewManager :: Refresh(nsIView *aView, nsIRenderingContext *aContext, con
|
|||
|
||||
nsRect trect = *rect;
|
||||
|
||||
localcx->SetClipRect(trect, nsClipCombine_kReplace);
|
||||
|
||||
PRBool result;
|
||||
|
||||
localcx->SetClipRect(trect, nsClipCombine_kReplace, result);
|
||||
|
||||
// Paint the view. The clipping rect was set above set don't clip again.
|
||||
aView->Paint(*localcx, trect, NS_VIEW_FLAG_CLIP_SET, result);
|
||||
|
||||
|
@ -1120,7 +1121,7 @@ nsDrawingSurface nsViewManager :: GetDrawingSurface(nsIRenderingContext &aContex
|
|||
aContext.DestroyDrawingSurface(mDrawingSurface);
|
||||
}
|
||||
|
||||
mDrawingSurface = aContext.CreateDrawingSurface(&aBounds, 0);
|
||||
aContext.CreateDrawingSurface(&aBounds, 0, mDrawingSurface);
|
||||
mDSBounds = aBounds;
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
DEPTH=..\..
|
||||
IGNORE_MANIFEST=1
|
||||
|
||||
!if defined(NGPREFS) || defined(MSSDK)
|
||||
!if ("$(MSSDK)" != "") || defined(NGPREFS)
|
||||
DIRS= \
|
||||
!if "$(MSSDK)" != ""
|
||||
ActiveX \
|
||||
|
@ -28,4 +28,5 @@ DIRS= \
|
|||
!endif
|
||||
$(NULL)
|
||||
!endif
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
|
|
@ -239,10 +239,11 @@ HandleThrobberEvent(nsGUIEvent *aEvent)
|
|||
nsRect bounds;
|
||||
nsIImageRequest *imgreq;
|
||||
nsIImage *img;
|
||||
PRBool clipState;
|
||||
|
||||
pe->widget->GetBounds(bounds);
|
||||
|
||||
cx->SetClipRect(*pe->rect, nsClipCombine_kReplace);
|
||||
cx->SetClipRect(*pe->rect, nsClipCombine_kReplace, clipState);
|
||||
|
||||
cx->SetColor(NS_RGB(255, 255, 255));
|
||||
cx->DrawLine(0, bounds.height - 1, 0, 0);
|
||||
|
@ -269,7 +270,7 @@ HandleThrobberEvent(nsGUIEvent *aEvent)
|
|||
|
||||
cx->SetColor(NS_RGB(255, 255, 255));
|
||||
cx->SetFont(tfont);
|
||||
met = cx->GetFontMetrics();
|
||||
cx->GetFontMetrics(met);
|
||||
if (nsnull != met)
|
||||
{
|
||||
cx->GetWidth(str, w);
|
||||
|
|
|
@ -91,7 +91,7 @@ NS_IMETHODIMP nsDeviceContextMac :: GetScrollBarDimensions(float &aWidth, float
|
|||
|
||||
NS_IMETHODIMP nsDeviceContextMac :: GetDrawingSurface(nsIRenderingContext &aContext, nsDrawingSurface &aSurface)
|
||||
{
|
||||
aSurface = aContext.CreateDrawingSurface(nsnull, 0);
|
||||
aContext.CreateDrawingSurface(nsnull, 0, aSurface);
|
||||
return nsnull == aSurface ? NS_ERROR_OUT_OF_MEMORY : NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -413,7 +413,9 @@ nsresult nsImageButton::PushState(nsIRenderingContext& aRenderingContext)
|
|||
//-----------------------------------------------------------------------------
|
||||
PRBool nsImageButton::PopState(nsIRenderingContext& aRenderingContext)
|
||||
{
|
||||
return (aRenderingContext.PopState());
|
||||
PRBool clipState;
|
||||
aRenderingContext.PopState(clipState);
|
||||
return clipState;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -545,7 +547,7 @@ nsEventStatus nsImageButton::HandleEvent(nsGUIEvent *aEvent)
|
|||
|
||||
nsEventStatus es ;
|
||||
nsRect rect;
|
||||
nsDrawingSurface ds;
|
||||
nsDrawingSurface ds = nsnull;
|
||||
nsIRenderingContext * ctx = ((nsPaintEvent*)aEvent)->renderingContext;
|
||||
|
||||
/*nsRect widgetRect;
|
||||
|
@ -562,7 +564,7 @@ nsEventStatus nsImageButton::HandleEvent(nsGUIEvent *aEvent)
|
|||
aEvent->widget->GetBounds(rect);
|
||||
rect.x = 0;
|
||||
rect.y = 0;
|
||||
ds = ctx->CreateDrawingSurface(&rect, 0);
|
||||
ctx->CreateDrawingSurface(&rect, 0, ds);
|
||||
if (ds == nsnull) {
|
||||
return nsEventStatus_eConsumeNoDefault;
|
||||
}
|
||||
|
|
|
@ -415,7 +415,9 @@ nsresult nsImageButton::PushState(nsIRenderingContext& aRenderingContext)
|
|||
//-----------------------------------------------------------------------------
|
||||
PRBool nsImageButton::PopState(nsIRenderingContext& aRenderingContext)
|
||||
{
|
||||
return (aRenderingContext.PopState());
|
||||
PRBool clipState;
|
||||
aRenderingContext.PopState(clipState);
|
||||
return clipState;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -547,7 +549,7 @@ nsEventStatus nsImageButton::HandleEvent(nsGUIEvent *aEvent)
|
|||
|
||||
nsEventStatus es ;
|
||||
nsRect rect;
|
||||
nsDrawingSurface ds;
|
||||
nsDrawingSurface ds = nsnull;
|
||||
nsIRenderingContext * ctx = ((nsPaintEvent*)aEvent)->renderingContext;
|
||||
|
||||
/*nsRect widgetRect;
|
||||
|
@ -563,7 +565,7 @@ nsEventStatus nsImageButton::HandleEvent(nsGUIEvent *aEvent)
|
|||
aEvent->widget->GetBounds(rect);
|
||||
rect.x = 0;
|
||||
rect.y = 0;
|
||||
ds = ctx->CreateDrawingSurface(&rect, 0);
|
||||
ctx->CreateDrawingSurface(&rect, 0, ds);
|
||||
if (ds == nsnull) {
|
||||
return nsEventStatus_eConsumeNoDefault;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче