mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 06:11:37 +00:00
initialize the Rendering Context from a GrafPort to fix a crash on print
This commit is contained in:
parent
6da61fa838
commit
abd275880c
@ -80,7 +80,7 @@ double pix_inch;
|
||||
*/
|
||||
NS_IMETHODIMP nsDeviceContextMac :: CreateRenderingContext(nsIRenderingContext *&aContext)
|
||||
{
|
||||
nsIRenderingContext *pContext;
|
||||
nsRenderingContextMac *pContext;
|
||||
nsresult rv;
|
||||
GrafPtr thePort;
|
||||
|
||||
|
@ -464,6 +464,24 @@ NS_IMETHODIMP nsRenderingContextMac::Init(nsIDeviceContext* aContext, nsDrawingS
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
// used by nsDeviceContextMac::CreateRenderingContext() for printing
|
||||
nsresult nsRenderingContextMac::Init(nsIDeviceContext* aContext, GrafPtr aPort)
|
||||
{
|
||||
mContext = aContext;
|
||||
NS_IF_ADDREF(mContext);
|
||||
|
||||
if (mOriginalSurface->GetPort() == nsnull)
|
||||
mOriginalSurface->Init(aPort);
|
||||
|
||||
// select the surface
|
||||
mFrontSurface->Init(aPort);
|
||||
SelectDrawingSurface(mFrontSurface);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
void nsRenderingContextMac::SelectDrawingSurface(DrawingSurface* aSurface)
|
||||
{
|
||||
if (! aSurface)
|
||||
|
@ -111,6 +111,7 @@ public:
|
||||
//locals
|
||||
NS_IMETHOD SetClipRectInPixels(const nsRect& aRect, nsClipCombine aCombine, PRBool &aClipEmpty);
|
||||
NS_IMETHOD SetPortTextState();
|
||||
nsresult Init(nsIDeviceContext* aContext, GrafPtr aPort);
|
||||
|
||||
protected:
|
||||
void SelectDrawingSurface(DrawingSurface* aSurface);
|
||||
|
@ -80,7 +80,7 @@ double pix_inch;
|
||||
*/
|
||||
NS_IMETHODIMP nsDeviceContextMac :: CreateRenderingContext(nsIRenderingContext *&aContext)
|
||||
{
|
||||
nsIRenderingContext *pContext;
|
||||
nsRenderingContextMac *pContext;
|
||||
nsresult rv;
|
||||
GrafPtr thePort;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user