зеркало из https://github.com/mozilla/gecko-dev.git
Родитель
78480349db
Коммит
0f88d36e89
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1,238 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Tony Tsui <tony@igelaus.com.au>
|
||||
* Roland Mainz <roland.mainz@informatik.med.uni-giessen,de>
|
||||
*/
|
||||
|
||||
#ifndef nsFontMetricsXp_h__
|
||||
#define nsFontMetricsXp_h__ 1
|
||||
|
||||
#include "nsICharRepresentable.h"
|
||||
#include "nsIDeviceContext.h"
|
||||
#include "nsIFontMetrics.h"
|
||||
#include "nsIFontEnumerator.h"
|
||||
|
||||
#include "nsCRT.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsDeviceContextXP.h"
|
||||
#ifdef XPRINT_NOT_NOW
|
||||
#include "nsDrawingSurfaceXP.h"
|
||||
#else
|
||||
#include "nsXPrintContext.h"
|
||||
#endif
|
||||
#include "nsFont.h"
|
||||
#include "nsRenderingContextXP.h"
|
||||
#include "nsString.h"
|
||||
#include "nsUnitConversion.h"
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/Xos.h>
|
||||
|
||||
// Remove this eventually after I remove all usage from implementation file. TonyT
|
||||
#define FONT_SWITCHING
|
||||
|
||||
#undef FONT_HAS_GLYPH
|
||||
#define FONT_HAS_GLYPH(map, char) IS_REPRESENTABLE(map, char)
|
||||
|
||||
typedef struct nsFontCharSetInfo nsFontCharSetInfo;
|
||||
|
||||
typedef int (*nsFontCharSetConverter)(nsFontCharSetInfo* aSelf,
|
||||
XFontStruct* aFont, const PRUnichar* aSrcBuf, PRInt32 aSrcLen,
|
||||
char* aDestBuf, PRInt32 aDestLen);
|
||||
|
||||
struct nsFontCharSet;
|
||||
struct nsFontFamily;
|
||||
struct nsFontXpNode;
|
||||
struct nsFontXpStretch;
|
||||
|
||||
|
||||
class nsFontXpUserDefined;
|
||||
class nsFontMetricsXp;
|
||||
|
||||
class nsFontXp
|
||||
{
|
||||
public:
|
||||
nsFontXp();
|
||||
virtual ~nsFontXp();
|
||||
NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW
|
||||
|
||||
void LoadFont(void);
|
||||
|
||||
inline int SupportsChar(PRUnichar aChar)
|
||||
{ return mFont && FONT_HAS_GLYPH(mMap, aChar); };
|
||||
|
||||
|
||||
virtual int GetWidth(const PRUnichar* aString, PRUint32 aLength) = 0;
|
||||
#ifdef XPRINT_NOT_NOW
|
||||
virtual int DrawString(nsRenderingContextXp* aContext,
|
||||
nsDrawingSurfaceXp* aSurface,
|
||||
nscoord aX, nscoord aY,
|
||||
const PRUnichar* aString, PRUint32 aLength) = 0;
|
||||
#else
|
||||
virtual int DrawString(nsXPrintContext* aSurface,
|
||||
nscoord aX,
|
||||
nscoord aY, const PRUnichar* aString,
|
||||
PRUint32 aLength) = 0;
|
||||
#endif /* XPRINT_NOT_NOW */
|
||||
|
||||
#ifdef MOZ_MATHML
|
||||
// bounding metrics for a string
|
||||
// remember returned values are not in app units
|
||||
// - to emulate GetWidth () above
|
||||
virtual nsresult
|
||||
GetBoundingMetrics(const PRUnichar* aString,
|
||||
PRUint32 aLength,
|
||||
nsBoundingMetrics& aBoundingMetrics) = 0;
|
||||
#endif /* MOZ_MATHML */
|
||||
|
||||
XFontStruct *mFont;
|
||||
PRUint32 *mMap;
|
||||
nsFontCharSetInfo *mCharSetInfo;
|
||||
char *mName;
|
||||
nsFontXpUserDefined *mUserDefinedFont;
|
||||
PRUint16 mSize;
|
||||
PRInt16 mBaselineAdjust;
|
||||
};
|
||||
|
||||
//typedef struct nsFontSearch nsFontSearch;
|
||||
|
||||
class nsFontMetricsXp : public nsIFontMetrics
|
||||
{
|
||||
public:
|
||||
nsFontMetricsXp();
|
||||
virtual ~nsFontMetricsXp();
|
||||
|
||||
NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_IMETHOD Init(const nsFont& aFont, nsIAtom* aLangGroup,
|
||||
nsIDeviceContext* aContext);
|
||||
NS_IMETHOD Destroy();
|
||||
|
||||
NS_IMETHOD GetXHeight(nscoord& aResult);
|
||||
NS_IMETHOD GetSuperscriptOffset(nscoord& aResult);
|
||||
NS_IMETHOD GetSubscriptOffset(nscoord& aResult);
|
||||
NS_IMETHOD GetStrikeout(nscoord& aOffset, nscoord& aSize);
|
||||
NS_IMETHOD GetUnderline(nscoord& aOffset, nscoord& aSize);
|
||||
|
||||
NS_IMETHOD GetHeight(nscoord &aHeight);
|
||||
NS_IMETHOD GetNormalLineHeight(nscoord &aHeight);
|
||||
NS_IMETHOD GetLeading(nscoord &aLeading);
|
||||
NS_IMETHOD GetEmHeight(nscoord &aHeight);
|
||||
NS_IMETHOD GetEmAscent(nscoord &aAscent);
|
||||
NS_IMETHOD GetEmDescent(nscoord &aDescent);
|
||||
NS_IMETHOD GetMaxHeight(nscoord &aHeight);
|
||||
NS_IMETHOD GetMaxAscent(nscoord &aAscent);
|
||||
NS_IMETHOD GetMaxDescent(nscoord &aDescent);
|
||||
NS_IMETHOD GetMaxAdvance(nscoord &aAdvance);
|
||||
NS_IMETHOD GetFont(const nsFont *&aFont);
|
||||
NS_IMETHOD GetLangGroup(nsIAtom** aLangGroup);
|
||||
NS_IMETHOD GetFontHandle(nsFontHandle &aHandle);
|
||||
|
||||
virtual nsresult GetSpaceWidth(nscoord &aSpaceWidth);
|
||||
|
||||
nsFontXp* FindFont(PRUnichar aChar);
|
||||
nsFontXp* FindUserDefinedFont(PRUnichar aChar);
|
||||
nsFontXp* FindLocalFont(PRUnichar aChar);
|
||||
nsFontXp* FindGenericFont(PRUnichar aChar);
|
||||
nsFontXp* FindGlobalFont(PRUnichar aChar);
|
||||
nsFontXp* FindSubstituteFont(PRUnichar aChar);
|
||||
|
||||
nsFontXp* SearchNode(nsFontXpNode* aNode, PRUnichar aChar);
|
||||
nsFontXp* TryAliases(nsCString* aName, PRUnichar aChar);
|
||||
nsFontXp* TryFamily(nsCString* aName, PRUnichar aChar);
|
||||
nsFontXp* TryNode(nsCString* aName, PRUnichar aChar);
|
||||
|
||||
nsFontXp* PickASizeAndLoad(nsFontXpStretch* aStretch,
|
||||
nsFontCharSetInfo* aCharSet,
|
||||
PRUnichar aChar);
|
||||
|
||||
static nsresult FamilyExists(const nsString& aFontName);
|
||||
|
||||
nsCAutoString mDefaultFont;
|
||||
|
||||
nsCStringArray mFonts;
|
||||
PRUint16 mFontsAlloc;
|
||||
PRUint16 mFontsCount;
|
||||
PRUint16 mFontsIndex;
|
||||
nsVoidArray mFontIsGeneric;
|
||||
|
||||
nsCString *mGeneric;
|
||||
PRUint8 mIsUserDefined;
|
||||
nsCOMPtr<nsIAtom> mLangGroup;
|
||||
|
||||
nsFontXp **mLoadedFonts;
|
||||
PRUint16 mLoadedFontsAlloc;
|
||||
PRUint16 mLoadedFontsCount;
|
||||
|
||||
PRUint8 mTriedAllGenerics;
|
||||
nsFontXp *mSubstituteFont;
|
||||
|
||||
nsCAutoString mUserDefined;
|
||||
|
||||
protected:
|
||||
void RealizeFont();
|
||||
|
||||
nsIDeviceContext *mDeviceContext;
|
||||
nsFont *mFont;
|
||||
XFontStruct *mFontHandle;
|
||||
XFontStruct *mFontStruct;
|
||||
nsFontXp *mWesternFont;
|
||||
|
||||
nscoord mAscent;
|
||||
nscoord mDescent;
|
||||
|
||||
nscoord mLeading;
|
||||
nscoord mEmHeight;
|
||||
nscoord mEmAscent;
|
||||
nscoord mEmDescent;
|
||||
nscoord mMaxHeight;
|
||||
nscoord mMaxAscent;
|
||||
nscoord mMaxDescent;
|
||||
nscoord mMaxAdvance;
|
||||
nscoord mXHeight;
|
||||
nscoord mSuperscriptOffset;
|
||||
nscoord mSubscriptOffset;
|
||||
nscoord mStrikeoutSize;
|
||||
nscoord mStrikeoutOffset;
|
||||
nscoord mUnderlineSize;
|
||||
nscoord mUnderlineOffset;
|
||||
nscoord mSpaceWidth;
|
||||
|
||||
PRUint16 mPixelSize;
|
||||
PRUint8 mStretchIndex;
|
||||
PRUint8 mStyleIndex;
|
||||
};
|
||||
|
||||
class nsFontEnumeratorXp : public nsIFontEnumerator
|
||||
{
|
||||
public:
|
||||
nsFontEnumeratorXp();
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIFONTENUMERATOR
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif /* !nsFontMetricsXp_h__ */
|
||||
|
|
@ -1,322 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "prmem.h"
|
||||
#include "nsRegionXP.h"
|
||||
#include "xregion.h"
|
||||
|
||||
static NS_DEFINE_IID(kRegionIID, NS_IREGION_IID);
|
||||
|
||||
nsRegionXP::nsRegionXP()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
|
||||
mRegion = nsnull;
|
||||
mRegionType = eRegionComplexity_empty;
|
||||
}
|
||||
|
||||
nsRegionXP::~nsRegionXP()
|
||||
{
|
||||
if (mRegion)
|
||||
::XDestroyRegion(mRegion);
|
||||
|
||||
mRegion = NULL;
|
||||
}
|
||||
|
||||
NS_IMPL_QUERY_INTERFACE(nsRegionXP, kRegionIID)
|
||||
NS_IMPL_ADDREF(nsRegionXP)
|
||||
NS_IMPL_RELEASE(nsRegionXP)
|
||||
|
||||
nsresult
|
||||
nsRegionXP::Init()
|
||||
{
|
||||
NS_ADDREF_THIS();
|
||||
|
||||
mRegion = ::XCreateRegion();
|
||||
mRegionType = eRegionComplexity_empty;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsRegionXP::SetTo(const nsIRegion &aRegion)
|
||||
{
|
||||
nsRegionXP * pRegion = (nsRegionXP *)&aRegion;
|
||||
|
||||
SetRegionEmpty();
|
||||
|
||||
Region nRegion = XCreateRegion();
|
||||
::XUnionRegion(mRegion, pRegion->mRegion, nRegion);
|
||||
::XDestroyRegion(mRegion);
|
||||
mRegion = nRegion;
|
||||
}
|
||||
|
||||
void
|
||||
nsRegionXP::SetTo(PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeight)
|
||||
{
|
||||
SetRegionEmpty();
|
||||
|
||||
XRectangle r;
|
||||
|
||||
r.x = aX;
|
||||
r.y = aY;
|
||||
r.width = aWidth;
|
||||
r.height = aHeight;
|
||||
|
||||
Region nRegion = ::XCreateRegion();
|
||||
Region tRegion = ::XCreateRegion();
|
||||
::XUnionRectWithRegion(&r, tRegion, nRegion);
|
||||
::XDestroyRegion(mRegion);
|
||||
::XDestroyRegion(tRegion);
|
||||
mRegion = nRegion;
|
||||
}
|
||||
|
||||
void
|
||||
nsRegionXP::Intersect(const nsIRegion &aRegion)
|
||||
{
|
||||
nsRegionXP * pRegion = (nsRegionXP *)&aRegion;
|
||||
|
||||
Region nRegion = XCreateRegion();
|
||||
::XIntersectRegion(mRegion, pRegion->mRegion, nRegion);
|
||||
::XDestroyRegion(mRegion);
|
||||
mRegion = nRegion;
|
||||
}
|
||||
|
||||
void
|
||||
nsRegionXP::Intersect(PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeight)
|
||||
{
|
||||
Region tRegion = CreateRectRegion(aX, aY, aWidth, aHeight);
|
||||
|
||||
Region nRegion = XCreateRegion();
|
||||
|
||||
::XIntersectRegion(mRegion, tRegion, nRegion);
|
||||
::XDestroyRegion(tRegion);
|
||||
::XDestroyRegion(mRegion);
|
||||
mRegion = nRegion;
|
||||
}
|
||||
|
||||
void
|
||||
nsRegionXP::Union(const nsIRegion &aRegion)
|
||||
{
|
||||
nsRegionXP * pRegion = (nsRegionXP *)&aRegion;
|
||||
|
||||
Region nRegion = XCreateRegion();
|
||||
::XUnionRegion(mRegion, pRegion->mRegion, nRegion);
|
||||
::XDestroyRegion(mRegion);
|
||||
mRegion = nRegion;
|
||||
}
|
||||
|
||||
void
|
||||
nsRegionXP::Union(PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeight)
|
||||
{
|
||||
Region tRegion = CreateRectRegion(aX, aY, aWidth, aHeight);
|
||||
|
||||
Region nRegion = XCreateRegion();
|
||||
::XUnionRegion(mRegion, tRegion, nRegion);
|
||||
::XDestroyRegion(mRegion);
|
||||
::XDestroyRegion(tRegion);
|
||||
mRegion = nRegion;
|
||||
}
|
||||
|
||||
void
|
||||
nsRegionXP::Subtract(const nsIRegion &aRegion)
|
||||
{
|
||||
nsRegionXP * pRegion = (nsRegionXP *)&aRegion;
|
||||
|
||||
Region nRegion = XCreateRegion();
|
||||
::XSubtractRegion(mRegion, pRegion->mRegion, nRegion);
|
||||
::XDestroyRegion(mRegion);
|
||||
mRegion = nRegion;
|
||||
}
|
||||
|
||||
void
|
||||
nsRegionXP::Subtract(PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeight)
|
||||
{
|
||||
Region tRegion = CreateRectRegion(aX, aY, aWidth, aHeight);
|
||||
|
||||
Region nRegion = XCreateRegion();
|
||||
::XSubtractRegion(mRegion, tRegion, nRegion);
|
||||
::XDestroyRegion(mRegion);
|
||||
::XDestroyRegion(tRegion);
|
||||
mRegion = nRegion;
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsRegionXP::IsEmpty(void)
|
||||
{
|
||||
return ::XEmptyRegion(mRegion);
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsRegionXP::IsEqual(const nsIRegion &aRegion)
|
||||
{
|
||||
nsRegionXP *pRegion = (nsRegionXP *)&aRegion;
|
||||
|
||||
return ::XEqualRegion(mRegion, pRegion->mRegion);
|
||||
}
|
||||
|
||||
void
|
||||
nsRegionXP::GetBoundingBox(PRInt32 *aX, PRInt32 *aY,
|
||||
PRInt32 *aWidth, PRInt32 *aHeight)
|
||||
{
|
||||
XRectangle r;
|
||||
|
||||
::XClipBox(mRegion, &r);
|
||||
|
||||
*aX = r.x;
|
||||
*aY = r.y;
|
||||
*aWidth = r.width;
|
||||
*aHeight = r.height;
|
||||
}
|
||||
|
||||
void
|
||||
nsRegionXP::Offset(PRInt32 aXOffset, PRInt32 aYOffset)
|
||||
{
|
||||
::XOffsetRegion(mRegion, aXOffset, aYOffset);
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsRegionXP::ContainsRect(PRInt32 aX, PRInt32 aY,
|
||||
PRInt32 aWidth, PRInt32 aHeight)
|
||||
{
|
||||
return ::XRectInRegion(mRegion, aX, aY, aWidth, aHeight);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsRegionXP::GetRects(nsRegionRectSet **aRects)
|
||||
{
|
||||
nsRegionRectSet *rects;
|
||||
int nbox;
|
||||
BOX *pbox;
|
||||
nsRegionRect *rect;
|
||||
|
||||
NS_ASSERTION(!(nsnull == aRects), "bad ptr");
|
||||
|
||||
//code lifted from old xfe. MMP
|
||||
|
||||
pbox = mRegion->rects;
|
||||
nbox = mRegion->numRects;
|
||||
|
||||
rects = *aRects;
|
||||
|
||||
if ((nsnull == rects) || (rects->mRectsLen < (PRUint32)nbox))
|
||||
{
|
||||
void *buf = PR_Realloc(rects, sizeof(nsRegionRectSet) + (sizeof(nsRegionRect
|
||||
) * (nbox - 1)));
|
||||
|
||||
if (nsnull == buf)
|
||||
{
|
||||
if (nsnull != rects)
|
||||
rects->mNumRects = 0;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
rects = (nsRegionRectSet *)buf;
|
||||
rects->mRectsLen = nbox;
|
||||
}
|
||||
|
||||
rects->mNumRects = nbox;
|
||||
rects->mArea = 0;
|
||||
rect = &rects->mRects[0];
|
||||
|
||||
while (nbox--)
|
||||
{
|
||||
rect->x = pbox->x1;
|
||||
rect->width = (pbox->x2 - pbox->x1);
|
||||
rect->y = pbox->y1;
|
||||
rect->height = (pbox->y2 - pbox->y1);
|
||||
|
||||
rects->mArea += rect->width * rect->height;
|
||||
|
||||
pbox++;
|
||||
rect++;
|
||||
}
|
||||
|
||||
*aRects = rects;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsRegionXP::FreeRects(nsRegionRectSet *aRects)
|
||||
{
|
||||
if (nsnull != aRects)
|
||||
PR_Free((void *)aRects);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsRegionXP::GetNativeRegion(void *&aRegion) const
|
||||
{
|
||||
aRegion = (void *)mRegion;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsRegionXP::GetRegionComplexity(nsRegionComplexity &aComplexity) const
|
||||
{
|
||||
// cast to avoid const-ness problems on some compilers
|
||||
if (((nsRegionXP*)this)->IsEmpty())
|
||||
aComplexity = eRegionComplexity_empty;
|
||||
else
|
||||
aComplexity = eRegionComplexity_rect;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsRegionXP::SetRegionEmpty()
|
||||
{
|
||||
if (!IsEmpty()) {
|
||||
::XDestroyRegion(mRegion);
|
||||
mRegion = XCreateRegion();
|
||||
}
|
||||
}
|
||||
|
||||
Region
|
||||
nsRegionXP::CreateRectRegion(PRInt32 aX,
|
||||
PRInt32 aY,
|
||||
PRInt32 aWidth,
|
||||
PRInt32 aHeight)
|
||||
{
|
||||
Region tRegion = XCreateRegion();
|
||||
XRectangle r;
|
||||
|
||||
r.x = aX;
|
||||
r.y = aY;
|
||||
r.width = aWidth;
|
||||
r.height = aHeight;
|
||||
|
||||
::XUnionRectWithRegion(&r, tRegion, tRegion);
|
||||
|
||||
return (tRegion);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsRegionXP::GetNumRects(PRUint32 *aRects) const
|
||||
{
|
||||
|
||||
*aRects = mRegion->numRects;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
@ -1,71 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsRegionXP_h___
|
||||
#define nsRegionXP_h___
|
||||
|
||||
#include "nsIRegion.h"
|
||||
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
|
||||
class nsRegionXP : public nsIRegion
|
||||
{
|
||||
public:
|
||||
nsRegionXP();
|
||||
virtual ~nsRegionXP();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
nsresult Init();
|
||||
|
||||
void SetTo(const nsIRegion &aRegion);
|
||||
void SetTo(PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeight);
|
||||
void Intersect(const nsIRegion &aRegion);
|
||||
void Intersect(PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeight);
|
||||
void Union(const nsIRegion &aRegion);
|
||||
void Union(PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeight);
|
||||
void Subtract(const nsIRegion &aRegion);
|
||||
void Subtract(PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeight);
|
||||
PRBool IsEmpty(void);
|
||||
PRBool IsEqual(const nsIRegion &aRegion);
|
||||
void GetBoundingBox(PRInt32 *aX, PRInt32 *aY, PRInt32 *aWidth, PRInt32 *aHeight);
|
||||
void Offset(PRInt32 aXOffset, PRInt32 aYOffset);
|
||||
PRBool ContainsRect(PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeight);
|
||||
NS_IMETHOD GetRects(nsRegionRectSet **aRects);
|
||||
NS_IMETHOD FreeRects(nsRegionRectSet *aRects);
|
||||
NS_IMETHOD GetNativeRegion(void *&aRegion) const;
|
||||
NS_IMETHOD GetRegionComplexity(nsRegionComplexity &aComplexity) const;
|
||||
NS_IMETHOD GetNumRects(PRUint32 *aRects) const;
|
||||
|
||||
private:
|
||||
Region mRegion;
|
||||
nsRegionComplexity mRegionType;
|
||||
|
||||
void SetRegionEmpty();
|
||||
Region CreateRectRegion(PRInt32 aX, PRInt32 aY,
|
||||
PRInt32 aWidth, PRInt32 aHeight);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
Загрузка…
Ссылка в новой задаче