make things use NS_GET_IID macros and DECL_ISUPPORTS1 macro. added a CopyClipRegion method

This commit is contained in:
pavlov%netscape.com 1999-09-13 03:42:37 +00:00
Родитель 3ea05ab63b
Коммит 66e73b18eb
11 изменённых файлов: 74 добавлений и 22 удалений

Просмотреть файл

@ -202,6 +202,14 @@ public:
*/
NS_IMETHOD SetClipRegion(const nsIRegion& aRegion, nsClipCombine aCombine, PRBool &aClipEmpty) = 0;
/**
* Gets a copy of the current clipping region for the RenderingContext
* @param aRegion inout parameter representing the clip region.
* if SetClipRegion() is called, do not assume that GetClipRegion()
* will return the same object.
*/
NS_IMETHOD CopyClipRegion(nsIRegion &aRegion) = 0;
/**
* Gets the current clipping region for the RenderingContext
* @param aRegion out parameter representing the clip region.

Просмотреть файл

@ -39,7 +39,6 @@
#define REALLY_NOISY_FONTS
#endif
static NS_DEFINE_IID(kIFontMetricsIID, NS_IFONT_METRICS_IID);
nsFontMetricsGTK::nsFontMetricsGTK()
{
@ -96,7 +95,7 @@ nsFontMetricsGTK::~nsFontMetricsGTK()
}
NS_IMPL_ISUPPORTS(nsFontMetricsGTK, kIFontMetricsIID)
NS_IMPL_ISUPPORTS1(nsFontMetricsGTK, nsIFontMetrics)
#ifdef FONT_SWITCHING

Просмотреть файл

@ -440,16 +440,37 @@ NS_IMETHODIMP nsRenderingContextGTK::SetClipRegion(const nsIRegion& aRegion,
return NS_OK;
}
/**
* Fills in |aRegion| with a copy of the current clip region.
*/
NS_IMETHODIMP nsRenderingContextGTK::CopyClipRegion(nsIRegion &aRegion)
{
aRegion.SetTo(*NS_STATIC_CAST(nsIRegion*, mClipRegion));
return NS_OK;
}
NS_IMETHODIMP nsRenderingContextGTK::GetClipRegion(nsIRegion **aRegion)
{
nsresult rv = NS_OK;
nsresult rv = NS_ERROR_FAILURE;
NS_ASSERTION(!(nsnull == aRegion), "no region ptr");
static NS_DEFINE_IID(kRegionCID, NS_REGION_CID);
if (*aRegion)
if (!aRegion)
return NS_ERROR_NULL_POINTER;
if (*aRegion) // copy it, they should be using CopyClipRegion
{
nsIRegion *nRegion = (nsIRegion*)mClipRegion;;
(*aRegion)->SetTo(*nRegion);
(*aRegion)->SetTo(*NS_STATIC_CAST(nsIRegion*, mClipRegion));
rv = NS_OK;
}
else
{
if ( NS_SUCCEEDED(nsComponentManager::CreateInstance(kRegionCID, 0, NS_GET_IID(nsIRegion), (void**)*aRegion)) )
{
(*aRegion)->Init();
(*aRegion)->SetTo( *NS_STATIC_CAST(nsIRegion*, mClipRegion) );
rv = NS_OK;
}
}
return rv;
@ -751,7 +772,7 @@ NS_IMETHODIMP nsRenderingContextGTK::InvertRect(nscoord aX, nscoord aY, nscoord
// Fill the rect
::gdk_draw_rectangle(mSurface->GetDrawable(), mSurface->GetGC(),
TRUE,
x, y, w, h);
x, y, w+2, h);
// Back to normal copy drawing mode
::gdk_gc_set_function(mSurface->GetGC(),GDK_COPY);

Просмотреть файл

@ -73,6 +73,7 @@ public:
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 CopyClipRegion(nsIRegion &aRegion);
NS_IMETHOD GetClipRegion(nsIRegion **aRegion);
NS_IMETHOD SetLineStyle(nsLineStyle aLineStyle);

Просмотреть файл

@ -707,6 +707,14 @@ NS_IMETHODIMP nsRenderingContextMac::SetClipRegion(const nsIRegion& aRegion, nsC
return NS_OK;
}
/**
* Fills in |aRegion| with a copy of the current clip region.
*/
NS_IMETHODIMP nsRenderingContextMac::CopyClipRegion(nsIRegion &aRegion)
{
return NS_ERROR_FAILURE;
}
//------------------------------------------------------------------------
NS_IMETHODIMP nsRenderingContextMac::GetClipRegion(nsIRegion **aRegion)

Просмотреть файл

@ -67,6 +67,7 @@ public:
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 CopyClipRegion(nsIRegion &aRegion);
NS_IMETHOD GetClipRegion(nsIRegion **aRegion);
NS_IMETHOD SetLineStyle(nsLineStyle aLineStyle);
NS_IMETHOD GetLineStyle(nsLineStyle &aLineStyle);

Просмотреть файл

@ -46,11 +46,7 @@ protected:
};
static NS_DEFINE_IID(kDeviceContextIID, NS_IDEVICE_CONTEXT_IID);
NS_IMPL_QUERY_INTERFACE(DeviceContextImpl, kDeviceContextIID)
NS_IMPL_ADDREF(DeviceContextImpl)
NS_IMPL_RELEASE(DeviceContextImpl)
NS_IMPL_ISUPPORTS1(DeviceContextImpl, nsIDeviceContext)
DeviceContextImpl :: DeviceContextImpl()
{
@ -177,11 +173,10 @@ NS_IMETHODIMP DeviceContextImpl :: CreateRenderingContext(nsIView *aView, nsIRen
aView->GetWidget(win);
nsresult rv;
static NS_DEFINE_IID(kRCCID, NS_RENDERING_CONTEXT_CID);
static NS_DEFINE_IID(kRCIID, NS_IRENDERING_CONTEXT_IID);
static NS_DEFINE_CID(kRCCID, NS_RENDERING_CONTEXT_CID);
aContext = nsnull;
rv = nsComponentManager::CreateInstance(kRCCID, nsnull, kRCIID, (void **)&pContext);
rv = nsComponentManager::CreateInstance(kRCCID, nsnull, NS_GET_IID(nsIRenderingContext), (void **)&pContext);
if (NS_OK == rv) {
rv = InitRenderingContext(pContext, win);
@ -200,11 +195,10 @@ NS_IMETHODIMP DeviceContextImpl :: CreateRenderingContext(nsIWidget *aWidget, ns
nsIRenderingContext *pContext;
nsresult rv;
static NS_DEFINE_IID(kRCCID, NS_RENDERING_CONTEXT_CID);
static NS_DEFINE_IID(kRCIID, NS_IRENDERING_CONTEXT_IID);
static NS_DEFINE_CID(kRCCID, NS_RENDERING_CONTEXT_CID);
aContext = nsnull;
rv = nsComponentManager::CreateInstance(kRCCID, nsnull, kRCIID, (void **)&pContext);
rv = nsComponentManager::CreateInstance(kRCCID, nsnull, NS_GET_IID(nsIRenderingContext), (void **)&pContext);
if (NS_OK == rv) {
rv = InitRenderingContext(pContext, aWidget);
@ -667,12 +661,11 @@ nsresult nsFontCache :: GetMetricsFor(const nsFont& aFont, nsIFontMetrics *&aMet
// It's not in the cache. Get font metrics and then cache them.
static NS_DEFINE_IID(kFontMetricsCID, NS_FONT_METRICS_CID);
static NS_DEFINE_IID(kFontMetricsIID, NS_IFONT_METRICS_IID);
static NS_DEFINE_CID(kFontMetricsCID, NS_FONT_METRICS_CID);
nsIFontMetrics* fm;
nsresult rv = nsComponentManager::CreateInstance(kFontMetricsCID, nsnull,
kFontMetricsIID, (void **)&fm);
NS_GET_IID(nsIFontMetrics), (void **)&fm);
if (NS_OK != rv) {
aMetrics = nsnull;
return rv;

Просмотреть файл

@ -446,6 +446,17 @@ nsRenderingContextPS :: SetClipRegion(const nsIRegion& aRegion, nsClipCombine aC
return NS_OK;
}
/** ---------------------------------------------------
* See documentation in nsIRenderingContext.h
* @update 12/21/98 dwc
*/
NS_IMETHODIMP
nsRenderingContextPS :: CopyClipRegion(nsIRegion &aRegion)
{
//XXX wow, needs to do something.
return NS_OK;
}
/** ---------------------------------------------------
* See documentation in nsIRenderingContext.h
* @update 12/21/98 dwc

Просмотреть файл

@ -79,6 +79,7 @@ public:
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 CopyClipRegion(nsIRegion &aRegion);
NS_IMETHOD GetClipRegion(nsIRegion **aRegion);
NS_IMETHOD SetLineStyle(nsLineStyle aLineStyle);

Просмотреть файл

@ -903,6 +903,14 @@ NS_IMETHODIMP nsRenderingContextWin :: SetClipRegion(const nsIRegion& aRegion, n
return NS_OK;
}
/**
* Fills in |aRegion| with a copy of the current clip region.
*/
NS_IMETHODIMP nsRenderingContextWin::CopyClipRegion(nsIRegion &aRegion)
{
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsRenderingContextWin :: GetClipRegion(nsIRegion **aRegion)
{
nsresult rv = NS_OK;

Просмотреть файл

@ -73,6 +73,7 @@ public:
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 CopyClipRegion(nsIRegion &aRegion);
NS_IMETHOD GetClipRegion(nsIRegion **aRegion);
NS_IMETHOD SetLineStyle(nsLineStyle aLineStyle);