зеркало из https://github.com/mozilla/gecko-dev.git
added GetNativeRegion() and GetRegionComplexity() methods.
This commit is contained in:
Родитель
fd53cd27e2
Коммит
6cfbcd06d4
|
@ -212,10 +212,16 @@ PRBool nsRegionGTK :: ForEachRect(nsRectInRegionFunc *func, void *closure)
|
|||
return PR_FALSE;
|
||||
}
|
||||
|
||||
|
||||
GdkRegion * nsRegionGTK :: GetGTKRegion(void)
|
||||
NS_IMETHODIMP nsRegionGTK :: GetNativeRegion(void *&aRegion) const
|
||||
{
|
||||
return (mRegion);
|
||||
aRegion = (void *)mRegion;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsRegionGTK :: GetRegionComplexity(nsRegionComplexity &aComplexity) const
|
||||
{
|
||||
aComplexity = mRegionType;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsRegionGTK :: SetRegionType()
|
||||
|
@ -247,11 +253,3 @@ GdkRegion * nsRegionGTK :: CreateRectRegion(PRInt32 aX, PRInt32 aY, PRInt32 aWid
|
|||
|
||||
return (rRegion);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -21,14 +21,6 @@
|
|||
|
||||
#include "nsIRegion.h"
|
||||
|
||||
enum nsRegionType {
|
||||
eRegionType_empty,
|
||||
eRegionType_rect,
|
||||
eRegionType_poly,
|
||||
eRegionType_complex
|
||||
};
|
||||
|
||||
|
||||
class nsRegionGTK : public nsIRegion
|
||||
{
|
||||
public:
|
||||
|
@ -53,12 +45,12 @@ public:
|
|||
virtual void Offset(PRInt32 aXOffset, PRInt32 aYOffset);
|
||||
virtual PRBool ContainsRect(PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeight);
|
||||
virtual PRBool ForEachRect(nsRectInRegionFunc *func, void *closure);
|
||||
|
||||
GdkRegion * GetGTKRegion(void);
|
||||
NS_IMETHOD GetNativeRegion(void *&aRegion) const;
|
||||
NS_IMETHOD GetRegionComplexity(nsRegionComplexity &aComplexity) const;
|
||||
|
||||
private:
|
||||
GdkRegion *mRegion;
|
||||
nsRegionType mRegionType;
|
||||
GdkRegion *mRegion;
|
||||
nsRegionComplexity mRegionType;
|
||||
|
||||
private:
|
||||
virtual void SetRegionType();
|
||||
|
|
|
@ -334,9 +334,9 @@ NS_IMETHODIMP nsRenderingContextGTK::SetClipRegion(const nsIRegion& aRegion,
|
|||
{
|
||||
nsRect rect;
|
||||
GdkRectangle gdk_rect;
|
||||
GdkRegion *gdk_region;
|
||||
|
||||
nsRegionGTK *pRegion = (nsRegionGTK *)&aRegion;
|
||||
GdkRegion *gdk_region = pRegion->GetGTKRegion();
|
||||
aRegion.GetNativeRegion((void *&)gdk_region);
|
||||
|
||||
::gdk_region_get_clipbox (gdk_region, &gdk_rect);
|
||||
|
||||
|
|
|
@ -226,9 +226,19 @@ PRBool nsRegionMac :: ForEachRect(nsRectInRegionFunc *func, void *closure)
|
|||
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
RgnHandle nsRegionMac :: GetRegion(void)
|
||||
|
||||
NS_IMETHODIMP nsRegionMac :: GetNativeRegion(void *&aRegion) const
|
||||
{
|
||||
return (mRegion);
|
||||
aRegion = (void *)mRegion;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
NS_IMETHODIMP nsRegionMac :: GetRegionComplexity(nsRegionComplexity &aComplexity) const
|
||||
{
|
||||
aComplexity = mRegionType;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
|
|
|
@ -22,13 +22,6 @@
|
|||
#include "nsIRegion.h"
|
||||
#include <quickdraw.h>
|
||||
|
||||
enum nsRegionType {
|
||||
eRegionType_empty,
|
||||
eRegionType_rect,
|
||||
eRegionType_poly,
|
||||
eRegionType_complex
|
||||
};
|
||||
|
||||
|
||||
class nsRegionMac : public nsIRegion
|
||||
{
|
||||
|
@ -54,12 +47,12 @@ public:
|
|||
virtual void Offset(PRInt32 aXOffset, PRInt32 aYOffset);
|
||||
virtual PRBool ContainsRect(PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeight);
|
||||
virtual PRBool ForEachRect(nsRectInRegionFunc *func, void *closure);
|
||||
|
||||
RgnHandle GetRegion(void);
|
||||
NS_IMETHOD GetNativeRegion(void *&aRegion) const;
|
||||
NS_IMETHOD GetRegionComplexity(nsRegionComplexity &aComplexity) const;
|
||||
|
||||
private:
|
||||
RgnHandle mRegion;
|
||||
nsRegionType mRegionType;
|
||||
RgnHandle mRegion;
|
||||
nsRegionComplexity mRegionType;
|
||||
|
||||
private:
|
||||
virtual void SetRegionType();
|
||||
|
|
|
@ -475,10 +475,8 @@ NS_IMETHODIMP nsRenderingContextMac :: SetClipRegion(const nsIRegion& aRegion, n
|
|||
nsRect rect;
|
||||
Rect mrect;
|
||||
RgnHandle mregion;
|
||||
|
||||
nsRegionMac *pRegion = (nsRegionMac *)&aRegion;
|
||||
|
||||
mregion = pRegion->GetRegion();
|
||||
aRegion.GetNativeRegion((void *&)mregion);
|
||||
mrect = (**mregion).rgnBBox;
|
||||
|
||||
rect.x = mrect.left;
|
||||
|
|
|
@ -192,10 +192,16 @@ PRBool nsRegionMotif :: ForEachRect(nsRectInRegionFunc *func, void *closure)
|
|||
return PR_FALSE;
|
||||
}
|
||||
|
||||
|
||||
Region nsRegionMotif :: GetXRegion(void)
|
||||
NS_IMETHODIMP nsRegionMotif :: GetNativeRegion(void *&aRegion) const
|
||||
{
|
||||
return (mRegion);
|
||||
aRegion = (void *)mRegion;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsRegionMotif :: GetRegionComplexity(nsRegionComplexity &aComplexity) const
|
||||
{
|
||||
aComplexity = mRegionType;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsRegionMotif :: SetRegionType()
|
||||
|
|
|
@ -24,13 +24,6 @@
|
|||
#include "X11/Xlib.h"
|
||||
#include "X11/Xutil.h"
|
||||
|
||||
enum nsRegionType {
|
||||
eRegionType_empty,
|
||||
eRegionType_rect,
|
||||
eRegionType_poly,
|
||||
eRegionType_complex
|
||||
};
|
||||
|
||||
|
||||
class nsRegionMotif : public nsIRegion
|
||||
{
|
||||
|
@ -56,12 +49,12 @@ public:
|
|||
virtual void Offset(PRInt32 aXOffset, PRInt32 aYOffset);
|
||||
virtual PRBool ContainsRect(PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeight);
|
||||
virtual PRBool ForEachRect(nsRectInRegionFunc *func, void *closure);
|
||||
|
||||
Region GetXRegion(void);
|
||||
NS_IMETHOD GetNativeRegion(void *&aRegion) const;
|
||||
NS_IMETHOD GetRegionComplexity(nsRegionComplexity &aComplexity) const;
|
||||
|
||||
private:
|
||||
Region mRegion;
|
||||
nsRegionType mRegionType;
|
||||
Region mRegion;
|
||||
nsRegionComplexity mRegionType;
|
||||
|
||||
private:
|
||||
virtual void SetRegionType();
|
||||
|
|
|
@ -495,9 +495,9 @@ NS_IMETHODIMP nsRenderingContextMotif :: SetClipRegion(const nsIRegion& aRegion,
|
|||
{
|
||||
nsRect rect;
|
||||
XRectangle xrect;
|
||||
Region xregion;
|
||||
|
||||
nsRegionMotif *pRegion = (nsRegionMotif *)&aRegion;
|
||||
Region xregion = pRegion->GetXRegion();
|
||||
aRegion.GetNativeRegion((void *&)xregion);
|
||||
|
||||
::XClipBox(xregion, &xrect);
|
||||
|
||||
|
|
|
@ -27,6 +27,13 @@
|
|||
// for each rectangle in a region
|
||||
typedef void (*nsRectInRegionFunc)(void *closure, nsRect& rect);
|
||||
|
||||
enum nsRegionComplexity
|
||||
{
|
||||
eRegionComplexity_empty = 0,
|
||||
eRegionComplexity_rect = 1,
|
||||
eRegionComplexity_complex = 2
|
||||
};
|
||||
|
||||
// An implementation of a region primitive that can be used to
|
||||
// represent arbitrary pixel areas. Probably implemented on top
|
||||
// of the native region primitive. The assumption is that, at worst,
|
||||
|
@ -39,7 +46,7 @@ typedef void (*nsRectInRegionFunc)(void *closure, nsRect& rect);
|
|||
class nsIRegion : public nsISupports
|
||||
{
|
||||
public:
|
||||
virtual nsresult Init() = 0;
|
||||
virtual nsresult Init(void) = 0;
|
||||
|
||||
/**
|
||||
* copy operator equivalent that takes another region
|
||||
|
@ -196,6 +203,21 @@ public:
|
|||
*
|
||||
**/
|
||||
virtual PRBool ForEachRect(nsRectInRegionFunc *func, void *closure) = 0;
|
||||
|
||||
/**
|
||||
* Get the native region that this nsIRegion represents.
|
||||
* @param aRegion out parameter for native region handle
|
||||
* @return error status
|
||||
**/
|
||||
NS_IMETHOD GetNativeRegion(void *&aRegion) const = 0;
|
||||
|
||||
/**
|
||||
* Get the complexity of the region as defined by the
|
||||
* nsRegionComplexity enum.
|
||||
* @param aComplexity out parameter for region complexity
|
||||
* @return error status
|
||||
**/
|
||||
NS_IMETHOD GetRegionComplexity(nsRegionComplexity &aComplexity) const = 0;
|
||||
};
|
||||
|
||||
#endif // nsRIegion_h___
|
||||
|
|
|
@ -171,7 +171,29 @@ PRBool nsRegionWin :: ForEachRect(nsRectInRegionFunc *func, void *closure)
|
|||
return PR_FALSE;
|
||||
}
|
||||
|
||||
HRGN nsRegionWin :: GetHRGN(void)
|
||||
NS_IMETHODIMP nsRegionWin :: GetNativeRegion(void *&aRegion) const
|
||||
{
|
||||
return mRegion;
|
||||
aRegion = (void *)mRegion;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsRegionWin :: GetRegionComplexity(nsRegionComplexity &aComplexity) const
|
||||
{
|
||||
switch (mRegionType)
|
||||
{
|
||||
case NULLREGION:
|
||||
aComplexity = eRegionComplexity_empty;
|
||||
break;
|
||||
|
||||
case SIMPLEREGION:
|
||||
aComplexity = eRegionComplexity_rect;
|
||||
break;
|
||||
|
||||
default:
|
||||
case COMPLEXREGION:
|
||||
aComplexity = eRegionComplexity_complex;
|
||||
break;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -45,10 +45,8 @@ public:
|
|||
virtual void Offset(PRInt32 aXOffset, PRInt32 aYOffset);
|
||||
virtual PRBool ContainsRect(PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeight);
|
||||
virtual PRBool ForEachRect(nsRectInRegionFunc *func, void *closure);
|
||||
|
||||
//windows specific
|
||||
|
||||
HRGN GetHRGN(void);
|
||||
NS_IMETHOD GetNativeRegion(void *&aRegion) const;
|
||||
NS_IMETHOD GetRegionComplexity(nsRegionComplexity &aComplexity) const;
|
||||
|
||||
private:
|
||||
~nsRegionWin();
|
||||
|
|
|
@ -928,10 +928,11 @@ NS_IMETHODIMP nsRenderingContextWin :: GetClipRect(nsRect &aRect, PRBool &aClipV
|
|||
|
||||
NS_IMETHODIMP nsRenderingContextWin :: SetClipRegion(const nsIRegion& aRegion, nsClipCombine aCombine, PRBool &aClipEmpty)
|
||||
{
|
||||
nsRegionWin *pRegion = (nsRegionWin *)&aRegion;
|
||||
HRGN hrgn = pRegion->GetHRGN();
|
||||
HRGN hrgn;
|
||||
int cmode, cliptype;
|
||||
|
||||
aRegion.GetNativeRegion((void *&)hrgn);
|
||||
|
||||
switch (aCombine)
|
||||
{
|
||||
case nsClipCombine_kIntersect:
|
||||
|
|
Загрузка…
Ссылка в новой задаче