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