зеркало из https://github.com/mozilla/gecko-dev.git
r=mkaply, a=blizzard
Big GFX cleanup for OS/2 - using new logging mechanism
This commit is contained in:
Родитель
d2f5f5a6fd
Коммит
cdd39d37f4
|
@ -35,6 +35,8 @@
|
|||
|
||||
#include "nsGfxDefs.h"
|
||||
|
||||
#define RGB_PRINTING 1 // Makes most things work
|
||||
|
||||
// Size of the color cube
|
||||
#define COLOR_CUBE_SIZE 216
|
||||
|
||||
|
@ -99,15 +101,17 @@ nsDeviceContextOS2::~nsDeviceContextOS2()
|
|||
{
|
||||
if(mPrintDC)
|
||||
{
|
||||
GpiAssociate(mPrintPS, 0);
|
||||
GpiDestroyPS(mPrintPS);
|
||||
GFX (::GpiAssociate (mPrintPS, 0), FALSE);
|
||||
GFX (::GpiDestroyPS (mPrintPS), FALSE);
|
||||
PrnCloseDC(mPrintDC);
|
||||
}
|
||||
|
||||
#ifndef RGB_PRINTING
|
||||
if (!mPaletteInfo.isPaletteDevice) {
|
||||
free(mPaletteInfo.palette);
|
||||
mPaletteInfo.palette = nsnull;
|
||||
}
|
||||
#endif
|
||||
|
||||
NS_IF_RELEASE(mSpec);
|
||||
}
|
||||
|
@ -130,6 +134,8 @@ nsresult nsDeviceContextOS2::Init( nsNativeDeviceContext aContext,
|
|||
|
||||
mPrintDC = (HDC)aContext;
|
||||
|
||||
NS_ASSERTION( mPrintDC, "!ERROR! - Received empty DC for printer");
|
||||
|
||||
#ifdef XP_OS2
|
||||
// Create a print PS now. This is necessary 'cos we need it from
|
||||
// odd places to do font-y things, where the only common reference
|
||||
|
@ -137,8 +143,8 @@ nsresult nsDeviceContextOS2::Init( nsNativeDeviceContext aContext,
|
|||
// PS can be associated with a given DC, and we can't get that PS from
|
||||
// the DC (really?). And it would be slow :-)
|
||||
SIZEL sizel = { 0 , 0 };
|
||||
mPrintPS = GpiCreatePS( 0/*hab*/, mPrintDC, &sizel,
|
||||
PU_PELS | GPIT_MICRO | GPIA_ASSOC);
|
||||
mPrintPS = GFX (::GpiCreatePS ( 0/*hab*/, mPrintDC, &sizel,
|
||||
PU_PELS | GPIT_MICRO | GPIA_ASSOC), GPI_ERROR);
|
||||
#endif
|
||||
|
||||
CommonInit( mPrintDC);
|
||||
|
@ -176,11 +182,11 @@ void nsDeviceContextOS2 :: CommonInit(HDC aDC)
|
|||
{
|
||||
LONG alArray[CAPS_DEVICE_POLYSET_POINTS];
|
||||
|
||||
DevQueryCaps(aDC, CAPS_FAMILY, CAPS_DEVICE_POLYSET_POINTS, alArray);
|
||||
::DevQueryCaps(aDC, CAPS_FAMILY, CAPS_DEVICE_POLYSET_POINTS, alArray);
|
||||
|
||||
// This change breaks opening and closing of sidebar
|
||||
// mTwipsToPixels = (float)alArray [CAPS_VERTICAL_RESOLUTION] / (float)NS_METERS_TO_TWIPS (1);
|
||||
mTwipsToPixels = ((float)alArray[CAPS_VERTICAL_FONT_RES]) / (float)NSIntPointsToTwips(72);
|
||||
mTwipsToPixels = ((float)alArray [CAPS_VERTICAL_FONT_RES]) / (float)NSIntPointsToTwips(72);
|
||||
|
||||
mPixelsToTwips = 1.0f / mTwipsToPixels;
|
||||
|
||||
|
@ -343,7 +349,7 @@ NS_IMETHODIMP nsDeviceContextOS2 :: GetScrollBarDimensions(float &aWidth, float
|
|||
|
||||
nscolor GetSysColorInfo(int iSysColor)
|
||||
{
|
||||
long lColor = WinQuerySysColor( HWND_DESKTOP, iSysColor, 0);
|
||||
long lColor = ::WinQuerySysColor( HWND_DESKTOP, iSysColor, 0);
|
||||
RGB2 *pRGB2 = (RGB2*) &lColor;
|
||||
return NS_RGB( pRGB2->bRed, pRGB2->bGreen, pRGB2->bBlue);
|
||||
}
|
||||
|
@ -613,7 +619,7 @@ nsresult nsDeviceContextOS2::GetDrawingSurface( nsIRenderingContext &aContext, n
|
|||
|
||||
NS_IMETHODIMP nsDeviceContextOS2 :: CheckFontExistence(const nsString& aFontName)
|
||||
{
|
||||
HPS hps = NULL;
|
||||
HPS hps = NULL;
|
||||
PRBool isthere = PR_FALSE;
|
||||
|
||||
if (NULL != mPrintDC){
|
||||
|
@ -628,8 +634,8 @@ NS_IMETHODIMP nsDeviceContextOS2 :: CheckFontExistence(const nsString& aFontName
|
|||
fontName, sizeof(fontName));
|
||||
|
||||
long lWant = 0;
|
||||
long lFonts = GpiQueryFonts( hps, QF_PUBLIC | QF_PRIVATE,
|
||||
fontName, &lWant, 0, 0);
|
||||
long lFonts = GFX (::GpiQueryFonts (hps, QF_PUBLIC | QF_PRIVATE,
|
||||
fontName, &lWant, 0, 0), GPI_ALTERROR);
|
||||
|
||||
if (NULL == mPrintDC)
|
||||
::WinReleasePS(hps);
|
||||
|
@ -650,7 +656,11 @@ NS_IMETHODIMP nsDeviceContextOS2::GetILColorSpace(IL_ColorSpace*& aColorSpace)
|
|||
{
|
||||
if (nsnull == mColorSpace) {
|
||||
// See if we're dealing with an 8-bit palette device
|
||||
#ifndef RGB_PRINTING
|
||||
if (8 == mDepth) {
|
||||
#else
|
||||
if ((8 == mDepth) && mPaletteInfo.isPaletteDevice) {
|
||||
#endif
|
||||
// Create a color cube. We want to use DIB_PAL_COLORS because it's faster
|
||||
// than DIB_RGB_COLORS, so make sure the indexes match that of the
|
||||
// GDI physical palette
|
||||
|
@ -745,9 +755,13 @@ NS_IMETHODIMP nsDeviceContextOS2::GetPaletteInfo(nsPaletteInfo& aPaletteInfo)
|
|||
|
||||
if (NI_PseudoColor == colorSpace->type) {
|
||||
// Create a logical palette
|
||||
PULONG aulTable;
|
||||
ULONG ulCount = COLOR_CUBE_SIZE+NUM_SYS_COLORS;
|
||||
#ifndef RGB_PRINTING
|
||||
PULONG aulTable;
|
||||
aulTable = (PULONG)malloc(ulCount*sizeof(ULONG));
|
||||
#else
|
||||
ULONG aulTable[COLOR_CUBE_SIZE+NUM_SYS_COLORS];
|
||||
#endif
|
||||
|
||||
PRInt32 i, j;
|
||||
// First ten system colors
|
||||
|
@ -773,11 +787,15 @@ NS_IMETHODIMP nsDeviceContextOS2::GetPaletteInfo(nsPaletteInfo& aPaletteInfo)
|
|||
|
||||
if (mPaletteInfo.isPaletteDevice) {
|
||||
// Create a GPI palette
|
||||
mPaletteInfo.palette = (void*)::GpiCreatePalette( (HAB)0, NULL, LCOLF_CONSECRGB, ulCount, aulTable );
|
||||
mPaletteInfo.palette = (void*)GFX (::GpiCreatePalette ((HAB)0, NULL,
|
||||
LCOLF_CONSECRGB, ulCount, aulTable),
|
||||
GPI_ERROR);
|
||||
#ifndef RGB_PRINTING
|
||||
free(aulTable);
|
||||
} else {
|
||||
mPaletteInfo.palette = (void*)aulTable;
|
||||
mPaletteInfo.sizePalette = ulCount;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -50,11 +50,11 @@ void nsDrawingSurfaceOS2::DisposeFonts()
|
|||
if( mHTFonts)
|
||||
{
|
||||
// free font things
|
||||
GpiSetCharSet( mPS, LCID_DEFAULT);
|
||||
GFX (::GpiSetCharSet (mPS, LCID_DEFAULT), FALSE);
|
||||
|
||||
for( int i = 2; i <= mTopID; i++)
|
||||
{
|
||||
if( !GpiDeleteSetId( mPS, i))
|
||||
PMERROR( "GpiDeleteSetId");
|
||||
GFX (::GpiDeleteSetId (mPS, i), FALSE);
|
||||
}
|
||||
delete mHTFonts;
|
||||
mHTFonts = 0;
|
||||
|
@ -78,7 +78,7 @@ void nsDrawingSurfaceOS2::SelectFont( nsIFontMetrics *metrics)
|
|||
// ids used up, need to empty table and start again.
|
||||
FlushFontCache();
|
||||
|
||||
GpiCreateLogFont( mPS, 0, mNextID, &pHandle->fattrs);
|
||||
GFX (::GpiCreateLogFont (mPS, 0, mNextID, &pHandle->fattrs), GPI_ERROR);
|
||||
mHTFonts->Put( &key, (void *) mNextID);
|
||||
mNextID++;
|
||||
if( mTopID < 254)
|
||||
|
@ -125,17 +125,16 @@ nsresult nsOffscreenSurface::Init( HPS aCompatiblePS,
|
|||
nsresult rc = NS_ERROR_FAILURE;
|
||||
|
||||
// Find the compatible device context and create a memory one
|
||||
HDC hdcCompat = GpiQueryDevice( aCompatiblePS);
|
||||
HDC hdcCompat = GFX (::GpiQueryDevice (aCompatiblePS), HDC_ERROR);
|
||||
DEVOPENSTRUC dop = { 0, 0, 0, 0, 0 };
|
||||
mDC = DevOpenDC( 0/*hab*/, OD_MEMORY, "*", 5,
|
||||
(PDEVOPENDATA) &dop, hdcCompat);
|
||||
mDC = ::DevOpenDC( 0/*hab*/, OD_MEMORY, "*", 5, (PDEVOPENDATA) &dop, hdcCompat);
|
||||
|
||||
if( DEV_ERROR != mDC)
|
||||
{
|
||||
// create the PS
|
||||
SIZEL sizel = { 0, 0 };
|
||||
mPS = GpiCreatePS( 0/*hab*/, mDC, &sizel,
|
||||
PU_PELS | GPIT_MICRO | GPIA_ASSOC);
|
||||
mPS = GFX (::GpiCreatePS (0/*hab*/, mDC, &sizel,
|
||||
PU_PELS | GPIT_MICRO | GPIA_ASSOC), GPI_ERROR);
|
||||
|
||||
if( GPI_ERROR != mPS)
|
||||
{
|
||||
|
@ -149,27 +148,21 @@ nsresult nsOffscreenSurface::Init( HPS aCompatiblePS,
|
|||
|
||||
// find bitdepth
|
||||
LONG lBitCount = 0;
|
||||
DevQueryCaps( hdcCompat, CAPS_COLOR_BITCOUNT, 1, &lBitCount);
|
||||
::DevQueryCaps( hdcCompat, CAPS_COLOR_BITCOUNT, 1, &lBitCount);
|
||||
hdr.cBitCount = (USHORT) lBitCount;
|
||||
|
||||
mBitmap = GpiCreateBitmap( mPS, &hdr, 0, 0, 0);
|
||||
mBitmap = GFX (::GpiCreateBitmap (mPS, &hdr, 0, 0, 0), GPI_ERROR);
|
||||
|
||||
if( GPI_ERROR != mBitmap)
|
||||
{
|
||||
// set final stats & select bitmap into ps
|
||||
mHeight = aHeight;
|
||||
mWidth = aWidth;
|
||||
GpiSetBitmap( mPS, mBitmap);
|
||||
GFX (::GpiSetBitmap (mPS, mBitmap), HBM_ERROR);
|
||||
rc = NS_OK;
|
||||
}
|
||||
else
|
||||
PMERROR( "GpiCreateBitmap");
|
||||
}
|
||||
else
|
||||
PMERROR( "GpiCreatePS");
|
||||
}
|
||||
else
|
||||
PMERROR( "DevOpenDC");
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
@ -179,18 +172,15 @@ nsOffscreenSurface::~nsOffscreenSurface()
|
|||
if( mPS)
|
||||
{
|
||||
DisposeFonts();
|
||||
if( HBM_ERROR == GpiSetBitmap( mPS, 0))
|
||||
PMERROR( "GpiSetBitmap");
|
||||
if( !GpiDeleteBitmap( mBitmap))
|
||||
PMERROR( "GpiDeleteBitmap");
|
||||
GFX (::GpiSetBitmap (mPS, 0), HBM_ERROR);
|
||||
GFX (::GpiDeleteBitmap (mBitmap), FALSE);
|
||||
//
|
||||
// Don't need to do this because the PS is a micro-one.
|
||||
//
|
||||
// if( !GpiAssociate( mPS, 0))
|
||||
// PMERROR( "GpiAssociate");
|
||||
//
|
||||
if( !GpiDestroyPS( mPS))
|
||||
PMERROR( "GpiDestroyPS");
|
||||
GFX (::GpiDestroyPS (mPS), FALSE);
|
||||
if( DEV_ERROR == DevCloseDC( mDC))
|
||||
PMERROR( "DevCloseDC");
|
||||
mPS = 0;
|
||||
|
@ -238,8 +228,7 @@ nsresult nsOffscreenSurface::Lock( PRInt32 aX, PRInt32 aY,
|
|||
{
|
||||
BITMAPINFOHEADER bih = { sizeof( BITMAPINFOHEADER), 0, 0, 0, 0 };
|
||||
|
||||
rc = GpiQueryBitmapInfoHeader( mBitmap, (PBITMAPINFOHEADER2) &bih);
|
||||
if( !rc) PMERROR( "GpiQueryInfoHeader");
|
||||
rc = GFX (::GpiQueryBitmapInfoHeader (mBitmap, (PBITMAPINFOHEADER2) &bih), FALSE);
|
||||
|
||||
// alloc space to query pel data into...
|
||||
lStride = RASWIDTH( bih.cx, bih.cBitCount);
|
||||
|
@ -271,8 +260,8 @@ nsresult nsOffscreenSurface::Lock( PRInt32 aX, PRInt32 aY,
|
|||
mYPels = mInfoHeader->cy - aY - aHeight;
|
||||
mScans = aHeight;
|
||||
|
||||
rc = GpiQueryBitmapBits( mPS, mYPels, mScans, (PBYTE) mBits,
|
||||
(PBITMAPINFO2) mInfoHeader);
|
||||
rc = GFX (::GpiQueryBitmapBits (mPS, mYPels, mScans, (PBYTE)mBits,
|
||||
(PBITMAPINFO2)mInfoHeader), GPI_ALTERROR);
|
||||
if( rc != mInfoHeader->cy) PMERROR( "GpiQueryBitmapBits");
|
||||
|
||||
#ifdef DEBUG
|
||||
|
@ -290,9 +279,8 @@ nsresult nsOffscreenSurface::Lock( PRInt32 aX, PRInt32 aY,
|
|||
|
||||
nsresult nsOffscreenSurface::Unlock()
|
||||
{
|
||||
long rc = GpiSetBitmapBits( mPS, mYPels, mScans, (PBYTE) mBits,
|
||||
(PBITMAPINFO2) mInfoHeader);
|
||||
if( rc == GPI_ALTERROR) PMERROR( "GpiSetBitmapBits");
|
||||
GFX (::GpiSetBitmapBits (mPS, mYPels, mScans, (PBYTE)mBits,
|
||||
(PBITMAPINFO2)mInfoHeader), GPI_ALTERROR);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -340,7 +328,8 @@ nsresult nsOffscreenSurface::GetPixelFormat( nsPixelFormat *aFormat)
|
|||
// (prob'ly need to get the FOURCC stuff into the act for 16bpp?)
|
||||
//
|
||||
BITMAPINFOHEADER bih = { sizeof( BITMAPINFOHEADER), 0, 0, 0, 0 };
|
||||
long rc = GpiQueryBitmapInfoHeader( mBitmap, (PBITMAPINFOHEADER2) &bih);
|
||||
long rc = GFX (::GpiQueryBitmapInfoHeader (mBitmap,
|
||||
(PBITMAPINFOHEADER2)&bih), FALSE);
|
||||
|
||||
switch( bih.cBitCount)
|
||||
{
|
||||
|
@ -419,9 +408,8 @@ nsresult nsOnscreenSurface::Lock( PRInt32 aX, PRInt32 aY,
|
|||
PRUint32 width, height;
|
||||
GetDimensions( &width, &height);
|
||||
POINTL pts[3] = { { 0, 0 }, { width, height }, { 0, 0 } };
|
||||
long lHits = GpiBitBlt( mProxySurface->mPS, mPS, 3, pts,
|
||||
ROP_SRCCOPY, BBO_OR);
|
||||
if( GPI_ERROR == lHits) PMERROR( "GpiBitBlt/DSL");
|
||||
long lHits = GFX (::GpiBitBlt (mProxySurface->mPS, mPS, 3, pts,
|
||||
ROP_SRCCOPY, BBO_OR), GPI_ERROR);
|
||||
|
||||
return mProxySurface->Lock( aX, aY, aWidth, aHeight,
|
||||
aBits, aStride, aWidthBytes, aFlags);
|
||||
|
@ -435,9 +423,8 @@ nsresult nsOnscreenSurface::Unlock()
|
|||
PRUint32 width, height;
|
||||
GetDimensions( &width, &height);
|
||||
POINTL pts[3] = { { 0, 0 }, { width, height }, { 0, 0 } };
|
||||
long lHits = GpiBitBlt( mPS, mProxySurface->mPS, 3, pts,
|
||||
ROP_SRCCOPY, BBO_OR);
|
||||
if( GPI_ERROR == lHits) PMERROR( "GpiBitBlt/DSUL");
|
||||
long lHits = GFX (::GpiBitBlt (mPS, mProxySurface->mPS, 3, pts,
|
||||
ROP_SRCCOPY, BBO_OR), GPI_ERROR);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
|
|
@ -35,6 +35,10 @@
|
|||
#include "plhash.h"
|
||||
#include "prprf.h"
|
||||
|
||||
#ifdef MOZ_MATHML
|
||||
#include <math.h>
|
||||
#endif
|
||||
|
||||
#undef USER_DEFINED
|
||||
#define USER_DEFINED "x-user-def"
|
||||
|
||||
|
@ -135,10 +139,8 @@ nsFontHandleOS2::nsFontHandleOS2()
|
|||
|
||||
void nsFontHandleOS2::SelectIntoPS( HPS hps, long lcid)
|
||||
{
|
||||
if( !GpiSetCharBox( hps, &charbox))
|
||||
PMERROR("GpiSetCharBox");
|
||||
if( !GpiSetCharSet( hps, lcid))
|
||||
PMERROR("GpiSetCharSet");
|
||||
GFX (::GpiSetCharBox (hps, &charbox), FALSE);
|
||||
GFX (::GpiSetCharSet (hps, lcid), FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -176,7 +178,7 @@ InitGlobals(void)
|
|||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
ULONG numCP = WinQueryCpList((HAB)0, 0, NULL);
|
||||
ULONG numCP = ::WinQueryCpList((HAB)0, 0, NULL);
|
||||
if (numCP > 0) {
|
||||
ULONG * pCPList = (ULONG*)malloc(numCP*sizeof(ULONG));
|
||||
if (WinQueryCpList( (HAB)0, numCP, pCPList)) {
|
||||
|
@ -190,6 +192,8 @@ InitGlobals(void)
|
|||
free(pCPList);
|
||||
}
|
||||
|
||||
ulSystemCodePage = WinQueryCp(HMQ_CURRENT);
|
||||
|
||||
gInitialized = 1;
|
||||
|
||||
return NS_OK;
|
||||
|
@ -202,9 +206,6 @@ nsFontMetricsOS2::nsFontMetricsOS2()
|
|||
++gFontMetricsOS2Count;
|
||||
// members are zeroed by new operator (hmm) - yeah right
|
||||
mTriedAllGenerics = 0;
|
||||
if (ulSystemCodePage == 0) {
|
||||
ulSystemCodePage = WinQueryCp(HMQ_CURRENT);
|
||||
} /* endif */
|
||||
}
|
||||
|
||||
nsFontMetricsOS2::~nsFontMetricsOS2()
|
||||
|
@ -264,8 +265,9 @@ nsFontMetricsOS2::LoadFont(HPS aPS, nsString* aName)
|
|||
WideCharToMultiByte(0, aName->GetUnicode(), aName->Length() + 1,
|
||||
fontName, sizeof(fontName));
|
||||
long lWant = 0;
|
||||
long lFonts = GpiQueryFonts( aPS, QF_PUBLIC | QF_PRIVATE,
|
||||
fontName, &lWant, 0, 0);
|
||||
long lFonts = GFX (::GpiQueryFonts (aPS, QF_PUBLIC | QF_PRIVATE,
|
||||
fontName, &lWant, 0, 0),
|
||||
GPI_ALTERROR);
|
||||
if (lFonts > 0) {
|
||||
font = new nsFontOS2();
|
||||
strcpy(font->mName, fontName);
|
||||
|
@ -309,6 +311,7 @@ static nsFontFamilyName gFamilyNameTable[] =
|
|||
{ "arial", "Arial" },
|
||||
{ "courier", "Courier" },
|
||||
{ "courier new", "Courier New" },
|
||||
{ "warpsans", "WarpSans" },
|
||||
|
||||
{ nsnull, nsnull }
|
||||
};
|
||||
|
@ -326,6 +329,7 @@ static nsFontFamilyName gFamilyNameTableDBCS[] =
|
|||
{ "courier", "Courier" },
|
||||
{ "courier new", "Courier New" },
|
||||
{ "warpsans", "WarpSans Combined" },
|
||||
|
||||
{ nsnull, nsnull }
|
||||
};
|
||||
|
||||
|
@ -530,8 +534,6 @@ nsFontMetricsOS2::FindFont(HPS aPS, PRUnichar aChar)
|
|||
return font;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static PRBool
|
||||
FontEnumCallback(const nsString& aFamily, PRBool aGeneric, void *aData)
|
||||
{
|
||||
|
@ -575,12 +577,14 @@ FontEnumCallback(const nsString& aFamily, PRBool aGeneric, void *aData)
|
|||
static PFONTMETRICS getMetrics( long &lFonts, PCSZ facename, HPS hps)
|
||||
{
|
||||
LONG lWant = 0;
|
||||
lFonts = GpiQueryFonts( hps, QF_PUBLIC | QF_PRIVATE,
|
||||
facename, &lWant, 0, 0);
|
||||
lFonts = GFX (::GpiQueryFonts (hps, QF_PUBLIC | QF_PRIVATE,
|
||||
facename, &lWant, 0, 0),
|
||||
GPI_ALTERROR);
|
||||
PFONTMETRICS pMetrics = new FONTMETRICS [ lFonts];
|
||||
|
||||
GpiQueryFonts( hps, QF_PUBLIC | QF_PRIVATE, facename, &lFonts,
|
||||
sizeof( FONTMETRICS), pMetrics);
|
||||
GFX (::GpiQueryFonts (hps, QF_PUBLIC | QF_PRIVATE, facename,
|
||||
&lFonts, sizeof (FONTMETRICS), pMetrics),
|
||||
GPI_ALTERROR);
|
||||
|
||||
return pMetrics;
|
||||
}
|
||||
|
@ -693,6 +697,7 @@ HDC ps = NULL;
|
|||
|
||||
ULONG rc = GpiQueryFaceString( ps, szFamily, &fnd,
|
||||
FACESIZE, fh->fattrs.szFacename);
|
||||
|
||||
if( rc == GPI_ERROR)
|
||||
{ // no real font, fake it
|
||||
strcpy( fh->fattrs.szFacename, szFamily);
|
||||
|
@ -754,9 +759,10 @@ HDC ps = NULL;
|
|||
// required, substituting an outline if necessary.
|
||||
if( bImage)
|
||||
{
|
||||
HDC hdc = GpiQueryDevice( ps);
|
||||
HDC hdc = GFX (::GpiQueryDevice (ps), HDC_ERROR);
|
||||
|
||||
long res[ 2];
|
||||
DevQueryCaps( hdc, CAPS_HORIZONTAL_FONT_RES, 2, res);
|
||||
::DevQueryCaps( hdc, CAPS_HORIZONTAL_FONT_RES, 2, res);
|
||||
pMetrics = getMetrics( lFonts, fh->fattrs.szFacename, ps);
|
||||
|
||||
|
||||
|
@ -791,12 +797,11 @@ HDC ps = NULL;
|
|||
|
||||
// 9) Record font handle & record various font metrics to cache
|
||||
mFontHandle = fh;
|
||||
if( GPI_ERROR == GpiCreateLogFont( ps, 0, 1, &fh->fattrs))
|
||||
PMERROR( "GpiCreateLogFont");
|
||||
GFX (::GpiCreateLogFont (ps, 0, 1, &fh->fattrs), GPI_ERROR);
|
||||
fh->SelectIntoPS( ps, 1);
|
||||
|
||||
FONTMETRICS fm;
|
||||
GpiQueryFontMetrics( ps, sizeof fm, &fm);
|
||||
GFX (::GpiQueryFontMetrics (ps, sizeof (fm), &fm), FALSE);
|
||||
|
||||
float dev2app;
|
||||
mDeviceContext->GetDevUnitsToAppUnits( dev2app);
|
||||
|
@ -832,27 +837,41 @@ HDC ps = NULL;
|
|||
|
||||
mAveCharWidth = NSToCoordRound( fm.lAveCharWidth * dev2app);
|
||||
|
||||
#ifdef MOZ_MATHML
|
||||
PRInt32 Degrees = fm.sCharSlope >> 7; // 9 bits (-180 .. 180)
|
||||
PRInt32 Minutes = fm.sCharSlope & 0x7F; // 7 bits (0 .. 59)
|
||||
float Angle = (float)Degrees + ((float)Minutes / 60.0f);
|
||||
mItalicSlope = tanf (Angle * 3.141592 / 180.0);
|
||||
#endif
|
||||
|
||||
// Cache the width of a single space.
|
||||
SIZEL size;
|
||||
::GetTextExtentPoint32(ps, " ", 1, &size);
|
||||
mSpaceWidth = NSToCoordRound(float(size.cx) * dev2app);
|
||||
|
||||
// 10) Clean up
|
||||
GpiSetCharSet( ps, LCID_DEFAULT);
|
||||
if( !GpiDeleteSetId( ps, 1))
|
||||
PMERROR( "GpiDeleteSetID (FM)");
|
||||
GFX (::GpiSetCharSet (ps, LCID_DEFAULT), FALSE);
|
||||
GFX (::GpiDeleteSetId (ps, 1), FALSE);
|
||||
if (NULL == mDeviceContext->mPrintDC)
|
||||
WinReleasePS(ps);
|
||||
::WinReleasePS(ps);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsFontMetricsOS2 :: GetSpaceWidth(nscoord &aSpaceWidth)
|
||||
nsresult nsFontMetricsOS2::GetSpaceWidth(nscoord &aSpaceWidth)
|
||||
{
|
||||
aSpaceWidth = mSpaceWidth;
|
||||
}
|
||||
|
||||
// Other metrics
|
||||
#ifdef MOZ_MATHML
|
||||
NS_IMETHODIMP nsFontMetricsOS2::GetItalicSlope(float& aResult)
|
||||
{
|
||||
aResult = mItalicSlope;
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
NS_IMETHODIMP nsFontMetricsOS2::GetXHeight( nscoord &aResult)
|
||||
{
|
||||
aResult = mXHeight;
|
||||
|
@ -987,9 +1006,12 @@ nsFontMetricsOS2::InitializeGlobalFonts(HPS aPS)
|
|||
static int gInitializedGlobalFonts = 0;
|
||||
if (!gInitializedGlobalFonts) {
|
||||
LONG lRemFonts = 0, lNumFonts;
|
||||
lNumFonts = GpiQueryFonts(aPS, QF_PUBLIC, NULL, &lRemFonts, 0, 0);
|
||||
lNumFonts = GFX (::GpiQueryFonts (aPS, QF_PUBLIC, NULL, &lRemFonts, 0, 0),
|
||||
GPI_ALTERROR);
|
||||
PFONTMETRICS pFontMetrics = (PFONTMETRICS) nsMemory::Alloc(lNumFonts * sizeof(FONTMETRICS));
|
||||
lRemFonts = GpiQueryFonts(aPS, QF_PUBLIC, NULL, &lNumFonts, sizeof(FONTMETRICS), pFontMetrics);
|
||||
lRemFonts = GFX (::GpiQueryFonts (aPS, QF_PUBLIC, NULL, &lNumFonts,
|
||||
sizeof (FONTMETRICS), pFontMetrics),
|
||||
GPI_ALTERROR);
|
||||
for (int i=0; i < lNumFonts; i++) {
|
||||
BOOL fAlreadyFound = FALSE;
|
||||
for (int j = 0; j < gGlobalFontsCount && !fAlreadyFound; j++) {
|
||||
|
@ -1050,7 +1072,7 @@ nsFontMetricsOS2::InitializeGlobalFonts(HPS aPS)
|
|||
gGlobalFontsCount++;
|
||||
|
||||
PRUnichar name[FACESIZE];
|
||||
name[0] = 0;
|
||||
name[0] = L'\0';
|
||||
MultiByteToWideChar(0, pFontMetrics[i].szFacename,
|
||||
strlen(pFontMetrics[i].szFacename) + 1, name, sizeof(name)/sizeof(name[0]));
|
||||
font->name = new nsString(name);
|
||||
|
@ -1058,6 +1080,7 @@ nsFontMetricsOS2::InitializeGlobalFonts(HPS aPS)
|
|||
gGlobalFontsCount--;
|
||||
continue;
|
||||
}
|
||||
|
||||
font->map = nsnull;
|
||||
font->fontMetrics = pFontMetrics[i];
|
||||
font->skip = 0;
|
||||
|
|
|
@ -132,6 +132,9 @@ class nsFontMetricsOS2 : public nsIFontMetrics
|
|||
NS_IMETHOD Destroy();
|
||||
|
||||
// Metrics
|
||||
#ifdef MOZ_MATHML
|
||||
NS_IMETHOD GetItalicSlope(float& aResult);
|
||||
#endif
|
||||
NS_IMETHOD GetXHeight( nscoord &aResult);
|
||||
NS_IMETHOD GetSuperscriptOffset( nscoord &aResult);
|
||||
NS_IMETHOD GetSubscriptOffset( nscoord &aResult);
|
||||
|
|
|
@ -169,11 +169,11 @@ void nsImageOS2::CleanUp(PRBool aCleanUpAll)
|
|||
mAlphaBits = 0;
|
||||
}
|
||||
if( mBitmap) {
|
||||
GpiDeleteBitmap( mBitmap);
|
||||
GFX (::GpiDeleteBitmap (mBitmap), FALSE);
|
||||
mBitmap = 0;
|
||||
}
|
||||
if( mABitmap) {
|
||||
GpiDeleteBitmap( mABitmap);
|
||||
GFX (::GpiDeleteBitmap (mABitmap), FALSE);
|
||||
mABitmap = 0;
|
||||
}
|
||||
}
|
||||
|
@ -281,7 +281,7 @@ nsresult nsImageOS2::Draw( nsIRenderingContext &aContext,
|
|||
// > There's probably a really good reason why ROP_SRCAND does the
|
||||
// > right thing in true colour...
|
||||
|
||||
long lRop = ROP_SRCAND;
|
||||
long lRop = (mDeviceDepth <= 8) ? ROP_NOTSRCAND : ROP_SRCAND;
|
||||
|
||||
// Apply mask to target, clear pels we will fill in from the image
|
||||
DrawBitmap( surf->mPS, 4, aptl, lRop, PR_TRUE);
|
||||
|
@ -324,26 +324,18 @@ struct MASKBMPINFO
|
|||
|
||||
void nsImageOS2::CreateBitmaps( nsDrawingSurfaceOS2 *surf)
|
||||
{
|
||||
mBitmap = GpiCreateBitmap( surf->mPS,
|
||||
(PBITMAPINFOHEADER2) mInfo,
|
||||
CBM_INIT,
|
||||
(PBYTE) mImageBits,
|
||||
mInfo);
|
||||
if( mBitmap == GPI_ERROR)
|
||||
PMERROR("GpiCreateBitmap");
|
||||
mBitmap = GFX (::GpiCreateBitmap (surf->mPS, (PBITMAPINFOHEADER2)mInfo,
|
||||
CBM_INIT, (PBYTE)mImageBits, mInfo),
|
||||
GPI_ERROR);
|
||||
|
||||
if( mAlphaBits)
|
||||
{
|
||||
if( mAlphaDepth == 1)
|
||||
{
|
||||
MASKBMPINFO maskInfo( mInfo);
|
||||
mABitmap = GpiCreateBitmap( surf->mPS,
|
||||
maskInfo,
|
||||
CBM_INIT,
|
||||
(PBYTE) mAlphaBits,
|
||||
maskInfo);
|
||||
if( mABitmap == GPI_ERROR)
|
||||
PMERROR( "GpiCreateBitmap (mask)");
|
||||
mABitmap = GFX (::GpiCreateBitmap (surf->mPS, maskInfo, CBM_INIT,
|
||||
(PBYTE)mAlphaBits, maskInfo),
|
||||
GPI_ERROR);
|
||||
}
|
||||
else
|
||||
printf( "8 bit alpha mask, no chance...\n");
|
||||
|
@ -375,8 +367,7 @@ void nsImageOS2::DrawBitmap( HPS hps, LONG lCount, PPOINTL pPoints,
|
|||
|
||||
void *pBits = bIsMask ? mAlphaBits : mImageBits;
|
||||
|
||||
if (GPI_ERROR == GpiDrawBits (hps, pBits, pBmp2, lCount, pPoints, lRop, BBO_OR))
|
||||
PMERROR( "GpiDrawBits - DrawBitmap");
|
||||
GFX (::GpiDrawBits (hps, pBits, pBmp2, lCount, pPoints, lRop, BBO_OR), GPI_ERROR);
|
||||
|
||||
delete pMaskInfo;
|
||||
}
|
||||
|
@ -427,17 +418,19 @@ nsImageOS2::DrawTile(nsIRenderingContext &aContext, nsDrawingSurface aSurface,
|
|||
nsDrawingSurfaceOS2 *surf = (nsDrawingSurfaceOS2*) aSurface;
|
||||
|
||||
// Find the compatible device context and create a memory one
|
||||
HDC hdcCompat = GpiQueryDevice( surf->mPS);
|
||||
HDC hdcCompat = GFX (::GpiQueryDevice (surf->mPS), HDC_ERROR);
|
||||
|
||||
DEVOPENSTRUC dop = { 0, 0, 0, 0, 0 };
|
||||
HDC mDC = DevOpenDC( (HAB)0, OD_MEMORY, "*", 5,
|
||||
(PDEVOPENDATA) &dop, hdcCompat);
|
||||
HDC mDC = ::DevOpenDC( (HAB)0, OD_MEMORY, "*", 5,
|
||||
(PDEVOPENDATA) &dop, hdcCompat);
|
||||
|
||||
if( DEV_ERROR != mDC)
|
||||
{
|
||||
// create the PS
|
||||
SIZEL sizel = { 0, 0 };
|
||||
HPS mPS = GpiCreatePS( (HAB)0, mDC, &sizel,
|
||||
PU_PELS | GPIT_MICRO | GPIA_ASSOC);
|
||||
HPS mPS = GFX (::GpiCreatePS (0, mDC, &sizel,
|
||||
PU_PELS | GPIT_MICRO | GPIA_ASSOC),
|
||||
GPI_ERROR);
|
||||
|
||||
if( GPI_ERROR != mPS)
|
||||
{
|
||||
|
@ -464,28 +457,30 @@ nsImageOS2::DrawTile(nsIRenderingContext &aContext, nsDrawingSurface aSurface,
|
|||
|
||||
// find bitdepth
|
||||
LONG lBitCount = 0;
|
||||
DevQueryCaps( hdcCompat, CAPS_COLOR_BITCOUNT, 1, &lBitCount);
|
||||
::DevQueryCaps( hdcCompat, CAPS_COLOR_BITCOUNT, 1, &lBitCount);
|
||||
hdr.cBitCount = (USHORT) lBitCount;
|
||||
|
||||
hBmp = GpiCreateBitmap( mPS, &hdr, 0, 0, 0);
|
||||
hBmp = GFX (::GpiCreateBitmap (mPS, &hdr, 0, 0, 0), GPI_ERROR);
|
||||
|
||||
if( GPI_ERROR != hBmp)
|
||||
{
|
||||
if( mAlphaDepth != 0)
|
||||
hBmpMask = GpiCreateBitmap( mPS, &hdr, 0, 0, 0);
|
||||
{
|
||||
hBmpMask = GFX (::GpiCreateBitmap (mPS, &hdr, 0, 0, 0), GPI_ERROR);
|
||||
}
|
||||
|
||||
nsRect trect( aX0, aY0, tileWidth, tileHeight);
|
||||
RECTL rcl;
|
||||
((nsRenderingContextOS2 &)aContext).NS2PM_ININ( trect, rcl); // !! !! !!
|
||||
|
||||
GpiSetBitmap( mPS, hBmp);
|
||||
GFX (::GpiSetBitmap (mPS, hBmp), HBM_ERROR);
|
||||
PRInt32 notLoadedDY = 0;
|
||||
if( mDecodedY2 < mInfo->cy)
|
||||
{
|
||||
// If bitmap not fully loaded, fill unloaded area
|
||||
notLoadedDY = mInfo->cy - mDecodedY2;
|
||||
RECTL rect = { 0, 0, aWidth, notLoadedDY };
|
||||
WinFillRect( mPS, &rect, CLR_BACKGROUND);
|
||||
::WinFillRect( mPS, &rect, CLR_BACKGROUND);
|
||||
}
|
||||
|
||||
// Set up blit coord array
|
||||
|
@ -496,11 +491,12 @@ nsImageOS2::DrawTile(nsIRenderingContext &aContext, nsDrawingSurface aSurface,
|
|||
|
||||
// Draw bitmap once into temporary PS
|
||||
DrawBitmap( mPS, 4, aptl, ROP_SRCCOPY, PR_FALSE);
|
||||
|
||||
if( hBmpMask)
|
||||
{
|
||||
GpiSetBitmap( mPS, hBmpMask);
|
||||
DrawBitmap( mPS, 4, aptl, ROP_SRCCOPY, PR_TRUE);
|
||||
GpiSetBitmap( mPS, hBmp);
|
||||
GFX (::GpiSetBitmap (mPS, hBmpMask), HBM_ERROR);
|
||||
DrawBitmap (mPS, 4, aptl, ROP_SRCCOPY, PR_TRUE);
|
||||
GFX (::GpiSetBitmap (mPS, hBmp), HBM_ERROR);
|
||||
}
|
||||
|
||||
// Copy bitmap horizontally, doubling each time
|
||||
|
@ -511,12 +507,13 @@ nsImageOS2::DrawTile(nsIRenderingContext &aContext, nsDrawingSurface aSurface,
|
|||
{ 0, 0 },
|
||||
{ aWidth, aHeight } };
|
||||
|
||||
GpiBitBlt( mPS, mPS, 4, aptlCopy, ROP_SRCCOPY, 0L);
|
||||
if( hBmpMask)
|
||||
GFX (::GpiBitBlt (mPS, mPS, 4, aptlCopy, ROP_SRCCOPY, 0L), GPI_ERROR);
|
||||
|
||||
if (hBmpMask)
|
||||
{
|
||||
GpiSetBitmap( mPS, hBmpMask);
|
||||
GpiBitBlt( mPS, mPS, 4, aptlCopy, ROP_SRCCOPY, 0L);
|
||||
GpiSetBitmap( mPS, hBmp);
|
||||
GFX (::GpiSetBitmap (mPS, hBmpMask), HBM_ERROR);
|
||||
GFX (::GpiBitBlt (mPS, mPS, 4, aptlCopy, ROP_SRCCOPY, 0L), GPI_ERROR);
|
||||
GFX (::GpiSetBitmap (mPS, hBmp), HBM_ERROR);
|
||||
}
|
||||
aWidth *= 2;
|
||||
}
|
||||
|
@ -528,12 +525,13 @@ nsImageOS2::DrawTile(nsIRenderingContext &aContext, nsDrawingSurface aSurface,
|
|||
{ 0, 0 },
|
||||
{ aWidth, aHeight } };
|
||||
|
||||
GpiBitBlt( mPS, mPS, 4, aptlCopy, ROP_SRCCOPY, 0L);
|
||||
if( hBmpMask)
|
||||
GFX (::GpiBitBlt (mPS, mPS, 4, aptlCopy, ROP_SRCCOPY, 0L), GPI_ERROR);
|
||||
|
||||
if (hBmpMask)
|
||||
{
|
||||
GpiSetBitmap( mPS, hBmpMask);
|
||||
GpiBitBlt( mPS, mPS, 4, aptlCopy, ROP_SRCCOPY, 0L);
|
||||
GpiSetBitmap( mPS, hBmp);
|
||||
GFX (::GpiSetBitmap (mPS, hBmpMask), HBM_ERROR);
|
||||
GFX (::GpiBitBlt (mPS, mPS, 4, aptlCopy, ROP_SRCCOPY, 0L), GPI_ERROR);
|
||||
GFX (::GpiSetBitmap (mPS, hBmp), HBM_ERROR);
|
||||
}
|
||||
aHeight *= 2;
|
||||
}
|
||||
|
@ -547,33 +545,34 @@ nsImageOS2::DrawTile(nsIRenderingContext &aContext, nsDrawingSurface aSurface,
|
|||
if( mAlphaDepth == 0)
|
||||
{
|
||||
// no transparency, just blit it
|
||||
GpiBitBlt( surf->mPS, mPS, 4, aptlTile, ROP_SRCCOPY, 0L);
|
||||
GFX (::GpiBitBlt (surf->mPS, mPS, 4, aptlTile, ROP_SRCCOPY, 0L), GPI_ERROR);
|
||||
}
|
||||
else
|
||||
{
|
||||
// For some reason, only ROP_NOTSRCAND seems to work here....
|
||||
long lRop = ROP_SRCAND;
|
||||
long lRop = (mDeviceDepth <= 8) ? ROP_NOTSRCAND : ROP_SRCAND;
|
||||
|
||||
// Apply mask to target, clear pels we will fill in from the image
|
||||
GpiSetBitmap( mPS, hBmpMask);
|
||||
GpiBitBlt( surf->mPS, mPS, 4, aptlTile, lRop, 0L);
|
||||
GFX (::GpiSetBitmap (mPS, hBmpMask), HBM_ERROR);
|
||||
GFX (::GpiBitBlt (surf->mPS, mPS, 4, aptlTile, lRop, 0L), GPI_ERROR);
|
||||
// Now combine image with target
|
||||
GpiSetBitmap( mPS, hBmp);
|
||||
GpiBitBlt( surf->mPS, mPS, 4, aptlTile, ROP_SRCPAINT, 0L);
|
||||
GFX (::GpiSetBitmap (mPS, hBmp), HBM_ERROR);
|
||||
GFX (::GpiBitBlt (surf->mPS, mPS, 4, aptlTile, ROP_SRCPAINT, 0L), GPI_ERROR);
|
||||
}
|
||||
|
||||
// Tiling successful
|
||||
didTile = PR_TRUE;
|
||||
|
||||
// Must deselect bitmap from PS before freeing bitmap and PS.
|
||||
GpiSetBitmap( mPS, NULLHANDLE);
|
||||
GpiDeleteBitmap( hBmp);
|
||||
GFX (::GpiSetBitmap (mPS, NULLHANDLE), HBM_ERROR);
|
||||
GFX (::GpiDeleteBitmap (hBmp), FALSE);
|
||||
|
||||
if( hBmpMask)
|
||||
{
|
||||
GpiDeleteBitmap( hBmpMask);
|
||||
GFX (::GpiDeleteBitmap (hBmpMask), FALSE);
|
||||
}
|
||||
}
|
||||
GpiDestroyPS( mPS);
|
||||
GFX (::GpiDestroyPS (mPS), FALSE);
|
||||
}
|
||||
DevCloseDC( mDC);
|
||||
}
|
||||
|
|
|
@ -58,8 +58,9 @@ nsRegionOS2::nsRegionOS2()
|
|||
nsRegionOS2::~nsRegionOS2()
|
||||
{
|
||||
if( mRegion)
|
||||
if( !GpiDestroyRegion( nsRgnPS, mRegion))
|
||||
PMERROR( "GpiDestroyRegion (nsR)");
|
||||
{
|
||||
GFX (::GpiDestroyRegion (nsRgnPS, mRegion), FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsRegionOS2, NS_GET_IID(nsIRegion))
|
||||
|
@ -67,9 +68,7 @@ NS_IMPL_ISUPPORTS(nsRegionOS2, NS_GET_IID(nsIRegion))
|
|||
// Create empty region
|
||||
nsresult nsRegionOS2::Init()
|
||||
{
|
||||
mRegion = GpiCreateRegion( nsRgnPS, 0, 0);
|
||||
if( mRegion == RGN_ERROR)
|
||||
PMERROR("GpiCreateRegion");
|
||||
mRegion = GFX (::GpiCreateRegion (nsRgnPS, 0, 0), RGN_ERROR);
|
||||
mRegionType = RGN_NULL;
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -79,8 +78,8 @@ void nsRegionOS2::SetTo( const nsIRegion &aRegion)
|
|||
{
|
||||
nsRegionOS2 *pRegion = (nsRegionOS2 *) &aRegion;
|
||||
|
||||
mRegionType = GpiCombineRegion( nsRgnPS, mRegion, pRegion->mRegion,
|
||||
0, CRGN_COPY);
|
||||
mRegionType = GFX (::GpiCombineRegion (nsRgnPS, mRegion, pRegion->mRegion,
|
||||
0, CRGN_COPY), RGN_ERROR);
|
||||
}
|
||||
|
||||
void nsRegionOS2::SetTo( PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeight)
|
||||
|
@ -90,7 +89,7 @@ void nsRegionOS2::SetTo( PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeight
|
|||
|
||||
RECTL rcl = { aX, aY, aX + aWidth, aY + aHeight }; // in-ex
|
||||
|
||||
GpiSetRegion( nsRgnPS, mRegion, 1, &rcl);
|
||||
GFX (::GpiSetRegion (nsRgnPS, mRegion, 1, &rcl), FALSE);
|
||||
|
||||
mRegionType = (aWidth && aHeight) ? RGN_RECT : RGN_NULL;
|
||||
}
|
||||
|
@ -99,26 +98,20 @@ void nsRegionOS2::SetTo( PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeight
|
|||
void nsRegionOS2::combine( long lOp, PRInt32 aX, PRInt32 aY, PRInt32 aW, PRInt32 aH)
|
||||
{
|
||||
RECTL rcl = { aX, aY, aX + aW, aY + aH }; // in-ex
|
||||
HRGN rgn = GpiCreateRegion( nsRgnPS, 1, &rcl);
|
||||
if( rgn == RGN_ERROR)
|
||||
HRGN rgn = GFX (::GpiCreateRegion (nsRgnPS, 1, &rcl), RGN_ERROR);
|
||||
if (rgn == RGN_ERROR)
|
||||
{
|
||||
PMERROR( "GpiCreateRegion #2 ");
|
||||
printf( "X Y W H is %d %d %d %d\n", aX, aY, aW, aH);
|
||||
}
|
||||
mRegionType = GpiCombineRegion( nsRgnPS, mRegion, mRegion, rgn, lOp);
|
||||
if( mRegionType == RGN_ERROR)
|
||||
PMERROR( "GpiCombineRegion #2 ");
|
||||
if( !GpiDestroyRegion( nsRgnPS, rgn))
|
||||
PMERROR( "GpiDestroyRegion (nsR::c)");
|
||||
mRegionType = GFX (::GpiCombineRegion (nsRgnPS, mRegion, mRegion, rgn, lOp), RGN_ERROR);
|
||||
GFX (::GpiDestroyRegion (nsRgnPS, rgn), FALSE);
|
||||
}
|
||||
|
||||
void nsRegionOS2::combine( long lOp, const nsIRegion &aRegion)
|
||||
{
|
||||
nsRegionOS2 *pRegion = (nsRegionOS2 *)&aRegion;
|
||||
mRegionType = GpiCombineRegion( nsRgnPS, mRegion, mRegion,
|
||||
pRegion->mRegion, lOp);
|
||||
if( mRegionType == RGN_ERROR)
|
||||
PMERROR( "GpiCombineRegion");
|
||||
mRegionType = GFX (::GpiCombineRegion (nsRgnPS, mRegion, mRegion,
|
||||
pRegion->mRegion, lOp), RGN_ERROR);
|
||||
}
|
||||
|
||||
#define DECL_COMBINE(name,token) \
|
||||
|
@ -143,7 +136,7 @@ PRBool nsRegionOS2::IsEqual( const nsIRegion &aRegion)
|
|||
{
|
||||
nsRegionOS2 *pRegion = (nsRegionOS2 *)&aRegion;
|
||||
|
||||
long lrc = GpiEqualRegion( nsRgnPS, mRegion, pRegion->mRegion);
|
||||
long lrc = GFX (::GpiEqualRegion (nsRgnPS, mRegion, pRegion->mRegion), EQRGN_ERROR);
|
||||
|
||||
return lrc == EQRGN_EQUAL ? PR_TRUE : PR_FALSE;
|
||||
}
|
||||
|
@ -153,8 +146,7 @@ void nsRegionOS2::GetBoundingBox( PRInt32 *aX, PRInt32 *aY, PRInt32 *aWidth, PRI
|
|||
if( mRegionType != RGN_NULL)
|
||||
{
|
||||
RECTL rcl;
|
||||
if( RGN_ERROR == GpiQueryRegionBox( nsRgnPS, mRegion, &rcl))
|
||||
PMERROR( "GpiQueryRegionBox");
|
||||
GFX (::GpiQueryRegionBox (nsRgnPS, mRegion, &rcl), RGN_ERROR);
|
||||
|
||||
*aX = rcl.xLeft;
|
||||
*aY = rcl.yBottom;
|
||||
|
@ -169,14 +161,14 @@ void nsRegionOS2::GetBoundingBox( PRInt32 *aX, PRInt32 *aY, PRInt32 *aWidth, PRI
|
|||
void nsRegionOS2::Offset( PRInt32 aXOffset, PRInt32 aYOffset)
|
||||
{
|
||||
POINTL ptl = { aXOffset, aYOffset };
|
||||
GpiOffsetRegion( nsRgnPS, mRegion, &ptl);
|
||||
GFX (::GpiOffsetRegion (nsRgnPS, mRegion, &ptl), FALSE);
|
||||
}
|
||||
|
||||
// hittest - precise spec, rect must be completely contained.
|
||||
PRBool nsRegionOS2::ContainsRect( PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeight)
|
||||
{
|
||||
RECTL rcl = { aX, aY, aX + aWidth, aY + aHeight }; // in-ex
|
||||
long lRC = GpiRectInRegion( nsRgnPS, mRegion, &rcl);
|
||||
long lRC = GFX (::GpiRectInRegion (nsRgnPS, mRegion, &rcl), RRGN_ERROR);
|
||||
return lRC == RRGN_INSIDE ? PR_TRUE : PR_FALSE;
|
||||
}
|
||||
|
||||
|
@ -253,7 +245,7 @@ static void RealQueryRects( HRGN hrgn,
|
|||
for( ;;)
|
||||
{
|
||||
// get a batch of rectangles
|
||||
GpiQueryRegionRects( hps, hrgn, 0, &rgnRect, rects);
|
||||
GFX (::GpiQueryRegionRects (hps, hrgn, 0, &rgnRect, rects), FALSE);
|
||||
// call them out
|
||||
for( PRUint32 i = 0; i < rgnRect.crcReturned; i++)
|
||||
{
|
||||
|
@ -305,7 +297,7 @@ HRGN nsRegionOS2::GetHRGN( PRUint32 ulHeight, HPS hps)
|
|||
|
||||
GetRects_Native( mRegion, nsRgnPS, &getRects);
|
||||
|
||||
return GpiCreateRegion( hps, getRects.ulUsed, getRects.pRects);
|
||||
return GFX (::GpiCreateRegion (hps, getRects.ulUsed, getRects.pRects), RGN_ERROR);
|
||||
}
|
||||
|
||||
// For copying from an existing region who has height & possibly diff. hdc
|
||||
|
@ -317,8 +309,8 @@ nsresult nsRegionOS2::Init( HRGN copy, PRUint32 ulHeight, HPS hps)
|
|||
|
||||
Init();
|
||||
|
||||
mRegionType = GpiSetRegion( nsRgnPS, mRegion,
|
||||
getRects.ulUsed, getRects.pRects);
|
||||
mRegionType = GFX (::GpiSetRegion (nsRgnPS, mRegion, getRects.ulUsed,
|
||||
getRects.pRects), FALSE);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -53,10 +53,12 @@
|
|||
#include "libimg.h"
|
||||
#include "prprf.h"
|
||||
|
||||
#define RGB_PRINTING 1 // Makes most things work
|
||||
|
||||
// helper clip region functions - defined at the bottom of this file.
|
||||
LONG OS2_CombineClipRegion( HPS hps, HRGN hrgnCombine, LONG lMode);
|
||||
HRGN OS2_CopyClipRegion( HPS hps);
|
||||
#define OS2_SetClipRegion2(hps,hrgn) OS2_CombineClipRegion(hps, hrgn, CRGN_COPY)
|
||||
#define OS2_SetClipRegion(hps,hrgn) OS2_CombineClipRegion(hps, hrgn, CRGN_COPY)
|
||||
|
||||
// Use these instead of native GpiSave/RestorePS because: need to store ----
|
||||
// more information, and need to be able to push from onscreen & pop onto
|
||||
|
@ -240,8 +242,7 @@ nsRenderingContextOS2::~nsRenderingContextOS2()
|
|||
{
|
||||
if( pNext->mClipRegion)
|
||||
{
|
||||
if( !GpiDestroyRegion( mSurface->mPS, pNext->mClipRegion))
|
||||
PMERROR( "GpiDestroyRegion (~RC)");
|
||||
GFX (::GpiDestroyRegion (mSurface->mPS, pNext->mClipRegion), FALSE);
|
||||
pNext->mClipRegion = 0;
|
||||
}
|
||||
pTemp = pNext->mNext;
|
||||
|
@ -304,7 +305,7 @@ nsresult nsRenderingContextOS2::Init( nsIDeviceContext *aContext,
|
|||
// to pels. Note there is *no* guarantee that app units == twips.
|
||||
nsresult nsRenderingContextOS2::CommonInit()
|
||||
{
|
||||
mContext->GetGammaTable(mGammaTable);
|
||||
mContext->GetGammaTable(mGammaTable);
|
||||
float app2dev = 0;
|
||||
mContext->GetAppUnitsToDevUnits( app2dev);
|
||||
mTMatrix.AddScale( app2dev, app2dev);
|
||||
|
@ -317,18 +318,21 @@ nsresult nsRenderingContextOS2::CommonInit()
|
|||
if (palInfo.isPaletteDevice && palInfo.palette)
|
||||
{
|
||||
ULONG cclr;
|
||||
|
||||
// Select the palette in the background
|
||||
::GpiSelectPalette(mSurface->mPS, (HPAL)palInfo.palette);
|
||||
GFX (::GpiSelectPalette (mSurface->mPS, (HPAL)palInfo.palette), PAL_ERROR);
|
||||
::WinRealizePalette((HWND)mDCOwner->GetNativeData(NS_NATIVE_WINDOW),mSurface->mPS, &cclr);
|
||||
} else if (!palInfo.isPaletteDevice && palInfo.palette) {
|
||||
GpiCreateLogColorTable( mSurface->mPS, LCOL_RESET,
|
||||
LCOLF_CONSECRGB, 0,
|
||||
palInfo.sizePalette, (PLONG) palInfo.palette);
|
||||
}
|
||||
#ifndef RGB_PRINTING
|
||||
else if (!palInfo.isPaletteDevice && palInfo.palette) {
|
||||
GFX (::GpiCreateLogColorTable (mSurface->mPS, LCOL_RESET, LCOLF_CONSECRGB,
|
||||
0, palInfo.sizePalette, (PLONG)palInfo.palette),
|
||||
FALSE);
|
||||
}
|
||||
#endif
|
||||
else
|
||||
{
|
||||
GpiCreateLogColorTable( mSurface->mPS, 0,
|
||||
LCOLF_RGB, 0, 0, 0);
|
||||
GFX (::GpiCreateLogColorTable (mSurface->mPS, 0, LCOLF_RGB, 0, 0, 0), FALSE);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -351,19 +355,19 @@ nsresult nsRenderingContextOS2::SelectOffScreenDrawingSurface( nsDrawingSurface
|
|||
{
|
||||
ULONG cclr;
|
||||
// Select the palette in the background
|
||||
::GpiSelectPalette(mSurface->mPS, (HPAL)palInfo.palette);
|
||||
GFX (::GpiSelectPalette (mSurface->mPS, (HPAL)palInfo.palette), PAL_ERROR);
|
||||
::WinRealizePalette((HWND)mDCOwner->GetNativeData(NS_NATIVE_WINDOW),mSurface->mPS, &cclr);
|
||||
} else if (!palInfo.isPaletteDevice && palInfo.palette) {
|
||||
// GpiCreateLogColorTable( mSurface->mPS, LCOL_RESET | LCOL_PURECOLOR,
|
||||
GpiCreateLogColorTable( mSurface->mPS, LCOL_RESET,
|
||||
LCOLF_CONSECRGB, 0,
|
||||
palInfo.sizePalette, (PLONG) palInfo.palette);
|
||||
}
|
||||
#ifndef RGB_PRINTING
|
||||
else if (!palInfo.isPaletteDevice && palInfo.palette) {
|
||||
GFX (::GpiCreateLogColorTable (mSurface->mPS, LCOL_RESET, LCOLF_CONSECRGB,
|
||||
0, palInfo.sizePalette, (PLONG)palInfo.palette),
|
||||
FALSE);
|
||||
}
|
||||
#endif
|
||||
else
|
||||
{
|
||||
// GpiCreateLogColorTable( mSurface->mPS, LCOL_PURECOLOR,
|
||||
GpiCreateLogColorTable( mSurface->mPS, 0,
|
||||
LCOLF_RGB, 0, 0, 0);
|
||||
GFX (::GpiCreateLogColorTable (mSurface->mPS, 0, LCOLF_RGB, 0, 0, 0), FALSE);
|
||||
}
|
||||
}
|
||||
else // deselect current offscreen...
|
||||
|
@ -537,7 +541,8 @@ nsresult nsRenderingContextOS2::PopState( PRBool &aClipEmpty)
|
|||
state->mFontMetrics = nsnull;
|
||||
|
||||
// Clip region
|
||||
OS2_SetClipRegion2( mSurface->mPS, state->mClipRegion);
|
||||
OS2_SetClipRegion( mSurface->mPS, state->mClipRegion);
|
||||
|
||||
if( state->mClipRegion != 0)
|
||||
{
|
||||
state->mClipRegion = 0;
|
||||
|
@ -611,7 +616,7 @@ nsresult nsRenderingContextOS2::IsVisibleRect( const nsRect &aRect,
|
|||
RECTL rcl;
|
||||
NS2PM_ININ( trect, rcl);
|
||||
|
||||
long rc = GpiRectVisible( mSurface->mPS, &rcl);
|
||||
LONG rc = GFX (::GpiRectVisible( mSurface->mPS, &rcl), RVIS_ERROR);
|
||||
|
||||
aIsVisible = (rc == RVIS_PARTIAL || rc == RVIS_VISIBLE) ? PR_TRUE : PR_FALSE;
|
||||
|
||||
|
@ -623,20 +628,15 @@ nsresult nsRenderingContextOS2::IsVisibleRect( const nsRect &aRect,
|
|||
nsresult nsRenderingContextOS2::SetClipRect( const nsRect& aRect, nsClipCombine aCombine, PRBool &aClipEmpty)
|
||||
{
|
||||
nsRect trect = aRect;
|
||||
mTMatrix.TransformCoord( &trect.x, &trect.y,
|
||||
&trect.width, &trect.height);
|
||||
mTMatrix.TransformCoord( &trect.x, &trect.y, &trect.width, &trect.height);
|
||||
long lrc = RGN_ERROR;
|
||||
|
||||
if( trect.width == 0 || trect.height == 0)
|
||||
{
|
||||
if( aCombine == nsClipCombine_kIntersect || aCombine == nsClipCombine_kReplace)
|
||||
{
|
||||
lrc = OS2_CombineClipRegion( mSurface->mPS, 0, CRGN_COPY);
|
||||
}
|
||||
lrc = OS2_SetClipRegion( mSurface->mPS, 0);
|
||||
else
|
||||
{
|
||||
lrc = OS2_CombineClipRegion( mSurface->mPS, 0, CRGN_OR);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -660,7 +660,7 @@ nsresult nsRenderingContextOS2::SetClipRect( const nsRect& aRect, nsClipCombine
|
|||
NS2PM_INEX( trect, rcl);
|
||||
HRGN hrgn = GpiCreateRegion( mSurface->mPS, 1, &rcl);
|
||||
if( hrgn && aCombine == nsClipCombine_kReplace)
|
||||
lrc = OS2_SetClipRegion2( mSurface->mPS, hrgn);
|
||||
lrc = OS2_SetClipRegion( mSurface->mPS, hrgn);
|
||||
else if( hrgn)
|
||||
lrc = OS2_CombineClipRegion( mSurface->mPS, hrgn, CRGN_OR);
|
||||
break;
|
||||
|
@ -685,7 +685,8 @@ nsresult nsRenderingContextOS2::SetClipRect( const nsRect& aRect, nsClipCombine
|
|||
nsresult nsRenderingContextOS2::GetClipRect( nsRect &aRect, PRBool &aHasLocalClip)
|
||||
{
|
||||
RECTL rcl;
|
||||
long rc = GpiQueryClipBox( mSurface->mPS, &rcl);
|
||||
long rc = GFX (::GpiQueryClipBox (mSurface->mPS, &rcl), RGN_ERROR);
|
||||
|
||||
PRBool brc = PR_FALSE;
|
||||
|
||||
if( rc != RGN_NULL && rc != RGN_ERROR)
|
||||
|
@ -753,7 +754,8 @@ nsresult nsRenderingContextOS2::GetClipRegion( nsIRegion **aRegion)
|
|||
// Get current clip region
|
||||
HRGN hrgnClip = 0;
|
||||
|
||||
GpiSetClipRegion( mSurface->mPS, 0, &hrgnClip);
|
||||
GFX (::GpiSetClipRegion (mSurface->mPS, 0, &hrgnClip), RGN_ERROR);
|
||||
|
||||
if( hrgnClip && hrgnClip != HRGN_ERROR)
|
||||
{
|
||||
// There was a clip region, so get it & init.
|
||||
|
@ -761,7 +763,7 @@ nsresult nsRenderingContextOS2::GetClipRegion( nsIRegion **aRegion)
|
|||
PRUint32 ulHeight;
|
||||
GetTargetHeight( ulHeight);
|
||||
pRegion->Init( hrgnClip, ulHeight, mSurface->mPS);
|
||||
GpiSetClipRegion( mSurface->mPS, hrgnClip, &hrgnDummy);
|
||||
GFX (::GpiSetClipRegion (mSurface->mPS, hrgnClip, &hrgnDummy), RGN_ERROR);
|
||||
}
|
||||
else
|
||||
pRegion->Init();
|
||||
|
@ -879,7 +881,6 @@ void nsRenderingContextOS2::SetupDrawingColor( BOOL bForce)
|
|||
{
|
||||
if( bForce || mColor != mCurrDrawingColor || !mAlreadySetDrawingColor)
|
||||
{
|
||||
|
||||
AREABUNDLE areaBundle;
|
||||
LINEBUNDLE lineBundle;
|
||||
|
||||
|
@ -887,7 +888,15 @@ void nsRenderingContextOS2::SetupDrawingColor( BOOL bForce)
|
|||
long gcolor = MK_RGB( mGammaTable[NS_GET_R(mColor)],
|
||||
mGammaTable[NS_GET_G(mColor)],
|
||||
mGammaTable[NS_GET_B(mColor)]);
|
||||
long lColor = GpiQueryColorIndex( mSurface->mPS, 0, gcolor);
|
||||
|
||||
nsPaletteInfo palInfo;
|
||||
mContext->GetPaletteInfo(palInfo);
|
||||
|
||||
long lColor;
|
||||
if (palInfo.palette)
|
||||
lColor = GFX (::GpiQueryColorIndex (mSurface->mPS, 0, gcolor), GPI_ALTERROR);
|
||||
else
|
||||
lColor = gcolor;
|
||||
|
||||
long lLineFlags = LBB_COLOR;
|
||||
long lAreaFlags = ABB_COLOR;
|
||||
|
@ -897,25 +906,19 @@ void nsRenderingContextOS2::SetupDrawingColor( BOOL bForce)
|
|||
|
||||
if (((nsDeviceContextOS2 *) mContext)->mPrintDC )
|
||||
{
|
||||
|
||||
areaBundle.lBackColor = CLR_BACKGROUND;
|
||||
lineBundle.lBackColor = CLR_BACKGROUND;
|
||||
|
||||
// areaBundle.usMixMode = FM_LEAVEALONE;
|
||||
// areaBundle.usBackMixMode = BM_LEAVEALONE;
|
||||
areaBundle.usMixMode = FM_OVERPAINT;
|
||||
areaBundle.usBackMixMode = BM_OVERPAINT;
|
||||
|
||||
|
||||
lLineFlags = lLineFlags | LBB_BACK_COLOR ;
|
||||
lAreaFlags = lAreaFlags | ABB_BACK_COLOR | ABB_MIX_MODE | ABB_BACK_MIX_MODE;
|
||||
|
||||
}
|
||||
|
||||
GpiSetAttrs( mSurface->mPS, PRIM_LINE,lLineFlags, 0, (PBUNDLE)&lineBundle);
|
||||
|
||||
GpiSetAttrs( mSurface->mPS, PRIM_AREA,lAreaFlags, 0, (PBUNDLE)&areaBundle);
|
||||
|
||||
GFX (::GpiSetAttrs (mSurface->mPS, PRIM_LINE,lLineFlags, 0, (PBUNDLE)&lineBundle), FALSE);
|
||||
GFX (::GpiSetAttrs (mSurface->mPS, PRIM_AREA,lAreaFlags, 0, (PBUNDLE)&areaBundle), FALSE);
|
||||
|
||||
mCurrDrawingColor = mColor;
|
||||
mAlreadySetDrawingColor = PR_TRUE;
|
||||
|
@ -934,7 +937,7 @@ void nsRenderingContextOS2::SetupDrawingColor( BOOL bForce)
|
|||
NS_ASSERTION(0, "Unexpected line style");
|
||||
break;
|
||||
}
|
||||
GpiSetLineType( mSurface->mPS, ltype);
|
||||
GFX (::GpiSetLineType (mSurface->mPS, ltype), FALSE);
|
||||
mCurrLineStyle = mLineStyle;
|
||||
}
|
||||
}
|
||||
|
@ -957,17 +960,22 @@ void nsRenderingContextOS2::SetupFontAndColor( BOOL bForce)
|
|||
long gcolor = MK_RGB( mGammaTable[NS_GET_R(mColor)],
|
||||
mGammaTable[NS_GET_G(mColor)],
|
||||
mGammaTable[NS_GET_B(mColor)]);
|
||||
cBundle.lColor = GpiQueryColorIndex( mSurface->mPS, 0, gcolor);
|
||||
|
||||
nsPaletteInfo palInfo;
|
||||
mContext->GetPaletteInfo(palInfo);
|
||||
|
||||
if (palInfo.palette)
|
||||
cBundle.lColor = GFX (::GpiQueryColorIndex (mSurface->mPS, 0, gcolor), GPI_ALTERROR);
|
||||
else
|
||||
cBundle.lColor = gcolor;
|
||||
|
||||
cBundle.usMixMode = FM_OVERPAINT;
|
||||
|
||||
cBundle.usBackMixMode = BM_LEAVEALONE;
|
||||
|
||||
GpiSetAttrs( mSurface->mPS,
|
||||
PRIM_CHAR,
|
||||
CBB_COLOR | CBB_MIX_MODE | CBB_BACK_MIX_MODE,
|
||||
0,
|
||||
&cBundle);
|
||||
GFX (::GpiSetAttrs (mSurface->mPS, PRIM_CHAR,
|
||||
CBB_COLOR | CBB_MIX_MODE | CBB_BACK_MIX_MODE,
|
||||
0, &cBundle),
|
||||
FALSE);
|
||||
|
||||
mCurrTextColor = mColor;
|
||||
}
|
||||
|
@ -994,8 +1002,9 @@ nsresult nsRenderingContextOS2::DrawLine( nscoord aX0, nscoord aY0, nscoord aX1,
|
|||
|
||||
SetupDrawingColor();
|
||||
|
||||
GpiMove( mSurface->mPS, ptls);
|
||||
GpiLine( mSurface->mPS, ptls + 1);
|
||||
GFX (::GpiMove (mSurface->mPS, ptls), FALSE);
|
||||
GFX (::GpiLine (mSurface->mPS, ptls + 1), GPI_ERROR);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -1047,7 +1056,7 @@ void nsRenderingContextOS2::PMDrawPoly( const nsPoint aPoints[], PRInt32 aNumPoi
|
|||
// because the API to this class specifies that the last point must
|
||||
// be the same as the first one...
|
||||
|
||||
GpiMove( mSurface->mPS, pts);
|
||||
GFX (::GpiMove (mSurface->mPS, pts), FALSE);
|
||||
|
||||
if( bFilled == PR_TRUE)
|
||||
{
|
||||
|
@ -1055,12 +1064,11 @@ void nsRenderingContextOS2::PMDrawPoly( const nsPoint aPoints[], PRInt32 aNumPoi
|
|||
//IBM-AKR changed from boundary and inclusive to be noboundary and
|
||||
// exclusive to fix bug with text fields, buttons, etc. borders
|
||||
// being 1 pel too thick. Bug 56853
|
||||
GpiPolygons( mSurface->mPS, 1, &pgon,
|
||||
POLYGON_NOBOUNDARY, POLYGON_EXCL);
|
||||
GFX (::GpiPolygons (mSurface->mPS, 1, &pgon, POLYGON_NOBOUNDARY, POLYGON_EXCL), GPI_ERROR);
|
||||
}
|
||||
else
|
||||
{
|
||||
GpiPolyLine( mSurface->mPS, aNumPoints - 1, pts + 1);
|
||||
GFX (::GpiPolyLine (mSurface->mPS, aNumPoints - 1, pts + 1), GPI_ERROR);
|
||||
}
|
||||
|
||||
if( aNumPoints > 20)
|
||||
|
@ -1108,9 +1116,9 @@ nsRenderingContextOS2 :: InvertRect(nscoord aX, nscoord aY, nscoord aWidth, nsco
|
|||
// mTMatrix.TransformCoord(&aX, &aY, &aWidth, &aHeight);
|
||||
// ConditionRect(aX, aY, aWidth, aHeight);
|
||||
nsRect tr(aX, aY, aWidth, aHeight);
|
||||
GpiSetMix(mSurface->mPS, FM_XOR);
|
||||
GFX (::GpiSetMix (mSurface->mPS, FM_XOR), FALSE);
|
||||
PMDrawRect(tr, FALSE);
|
||||
GpiSetMix(mSurface->mPS, FM_DEFAULT);
|
||||
GFX (::GpiSetMix (mSurface->mPS, FM_DEFAULT), FALSE);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -1123,19 +1131,17 @@ void nsRenderingContextOS2::PMDrawRect( nsRect &rect, BOOL fill)
|
|||
|
||||
SetupDrawingColor();
|
||||
|
||||
GpiMove( mSurface->mPS, (PPOINTL) &rcl);
|
||||
if (rcl.xLeft == rcl.xRight ||
|
||||
rcl.yTop == rcl.yBottom )
|
||||
GFX (::GpiMove (mSurface->mPS, (PPOINTL) &rcl), FALSE);
|
||||
|
||||
if (rcl.xLeft == rcl.xRight || rcl.yTop == rcl.yBottom)
|
||||
{
|
||||
GpiLine( mSurface->mPS, ((PPOINTL)&rcl) + 1);
|
||||
GFX (::GpiLine (mSurface->mPS, ((PPOINTL)&rcl) + 1), GPI_ERROR);
|
||||
}
|
||||
else
|
||||
{
|
||||
long lOps = DRO_OUTLINE;
|
||||
if( fill)
|
||||
lOps = DRO_FILL;
|
||||
long lOps = (fill) ? DRO_FILL : DRO_OUTLINE;
|
||||
|
||||
GpiBox( mSurface->mPS, lOps, ((PPOINTL)&rcl) + 1, 0, 0);
|
||||
GFX (::GpiBox (mSurface->mPS, lOps, ((PPOINTL)&rcl) + 1, 0, 0), GPI_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1215,20 +1221,19 @@ void nsRenderingContextOS2::PMDrawArc( nsRect &rect, PRBool bFilled, PRBool bFul
|
|||
long lWidth = rect.width / 2;
|
||||
long lHeight = rect.height / 2;
|
||||
ARCPARAMS arcparams = { lWidth, lHeight, 0, 0 };
|
||||
GpiSetArcParams( mSurface->mPS, &arcparams);
|
||||
GFX (::GpiSetArcParams (mSurface->mPS, &arcparams), FALSE);
|
||||
|
||||
// move to center
|
||||
rcl.xLeft += lWidth;
|
||||
rcl.yBottom += lHeight;
|
||||
GpiMove( mSurface->mPS, (PPOINTL)&rcl);
|
||||
GFX (::GpiMove (mSurface->mPS, (PPOINTL)&rcl), FALSE);
|
||||
|
||||
|
||||
if( bFull)
|
||||
if (bFull)
|
||||
{
|
||||
long lOps = (bFilled) ? DRO_FILL : DRO_OUTLINE;
|
||||
|
||||
// draw ellipse
|
||||
GpiFullArc( mSurface->mPS, lOps, MAKEFIXED(1,0));
|
||||
GFX (::GpiFullArc (mSurface->mPS, lOps, MAKEFIXED(1,0)), GPI_ERROR);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1239,21 +1244,21 @@ void nsRenderingContextOS2::PMDrawArc( nsRect &rect, PRBool bFilled, PRBool bFul
|
|||
if (SweepAngle < 0) SweepAngle += MAKEFIXED (360, 0);
|
||||
|
||||
// draw an arc or a pie
|
||||
if( bFilled)
|
||||
if (bFilled)
|
||||
{
|
||||
GpiBeginArea( mSurface->mPS, BA_NOBOUNDARY);
|
||||
GpiPartialArc( mSurface->mPS, (PPOINTL)&rcl, MAKEFIXED(1,0), StartAngle, SweepAngle);
|
||||
GpiEndArea( mSurface->mPS);
|
||||
GFX (::GpiBeginArea (mSurface->mPS, BA_NOBOUNDARY), FALSE);
|
||||
GFX (::GpiPartialArc (mSurface->mPS, (PPOINTL)&rcl, MAKEFIXED(1,0), StartAngle, SweepAngle), GPI_ERROR);
|
||||
GFX (::GpiEndArea (mSurface->mPS), GPI_ERROR);
|
||||
}
|
||||
else
|
||||
{
|
||||
// draw an invisible partialarc to get to the start of the arc.
|
||||
long lLineType = GpiQueryLineType( mSurface->mPS);
|
||||
GpiSetLineType( mSurface->mPS, LINETYPE_INVISIBLE);
|
||||
GpiPartialArc( mSurface->mPS, (PPOINTL)&rcl, MAKEFIXED(1,0), StartAngle, MAKEFIXED (0,0));
|
||||
long lLineType = GFX (::GpiQueryLineType (mSurface->mPS), LINETYPE_ERROR);
|
||||
GFX (::GpiSetLineType (mSurface->mPS, LINETYPE_INVISIBLE), FALSE);
|
||||
GFX (::GpiPartialArc (mSurface->mPS, (PPOINTL)&rcl, MAKEFIXED(1,0), StartAngle, MAKEFIXED (0,0)), GPI_ERROR);
|
||||
// now draw a real arc
|
||||
GpiSetLineType( mSurface->mPS, lLineType);
|
||||
GpiPartialArc( mSurface->mPS, (PPOINTL)&rcl, MAKEFIXED(1,0), StartAngle, SweepAngle);
|
||||
GFX (::GpiSetLineType (mSurface->mPS, lLineType), FALSE);
|
||||
GFX (::GpiPartialArc (mSurface->mPS, (PPOINTL)&rcl, MAKEFIXED(1,0), StartAngle, SweepAngle), GPI_ERROR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1487,7 +1492,6 @@ NS_IMETHODIMP nsRenderingContextOS2::GetWidth( const PRUnichar *aString,
|
|||
return temp;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsRenderingContextOS2 :: DrawString(const char *aString, PRUint32 aLength,
|
||||
nscoord aX, nscoord aY,
|
||||
const nscoord* aSpacing)
|
||||
|
@ -1657,7 +1661,7 @@ nsresult nsRenderingContextOS2::CopyOffScreenBits(
|
|||
{
|
||||
// Set clip region on dest surface to be that from the hps
|
||||
// in the passed-in drawing surface.
|
||||
OS2_SetClipRegion2( hpsTarget, OS2_CopyClipRegion( theSurf->mPS));
|
||||
OS2_SetClipRegion( hpsTarget, OS2_CopyClipRegion( theSurf->mPS));
|
||||
}
|
||||
|
||||
// Windows wants to select palettes here. I don't think I do.
|
||||
|
@ -1687,10 +1691,7 @@ nsresult nsRenderingContextOS2::CopyOffScreenBits(
|
|||
rcls[1].xLeft = aSrcX;
|
||||
rcls[1].yBottom = ulHeight - aSrcY - drect.height;
|
||||
|
||||
long lRC = GpiBitBlt( hpsTarget, theSurf->mPS,
|
||||
3, (PPOINTL) rcls, ROP_SRCCOPY, BBO_OR);
|
||||
if( lRC == GPI_ERROR)
|
||||
PMERROR("GpiBitBlt");
|
||||
GFX (::GpiBitBlt (hpsTarget, theSurf->mPS, 3, (PPOINTL)rcls, ROP_SRCCOPY, BBO_OR), GPI_ERROR);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -1712,41 +1713,40 @@ LONG OS2_CombineClipRegion( HPS hps, HRGN hrgnCombine, LONG lMode)
|
|||
{
|
||||
if (!hps) return RGN_ERROR;
|
||||
|
||||
HRGN hrgnClip = NULL;
|
||||
HRGN hrgnClip = 0;
|
||||
LONG rc = RGN_NULL;
|
||||
|
||||
GpiSetClipRegion (hps, NULL, &hrgnClip); // Get the current clip region and deselect it
|
||||
GFX (::GpiSetClipRegion (hps, 0, &hrgnClip), RGN_ERROR); // Get the current clip region and deselect it
|
||||
|
||||
if (hrgnClip && hrgnClip != HRGN_ERROR)
|
||||
{
|
||||
if (lMode != CRGN_COPY) // If necessarry combine with previous clip region
|
||||
GpiCombineRegion (hps, hrgnCombine, hrgnClip, hrgnCombine, lMode);
|
||||
GFX (::GpiCombineRegion (hps, hrgnCombine, hrgnClip, hrgnCombine, lMode), RGN_ERROR);
|
||||
|
||||
if (!GpiDestroyRegion (hps, hrgnClip))
|
||||
PMERROR( "GpiDestroyRegion [Gpi_CombineClipRegion]");
|
||||
GFX (::GpiDestroyRegion (hps, hrgnClip), FALSE);
|
||||
}
|
||||
|
||||
if (hrgnCombine)
|
||||
{
|
||||
rc = GpiSetClipRegion (hps, hrgnCombine, NULL); // Set new clip region
|
||||
}
|
||||
rc = GFX (::GpiSetClipRegion (hps, hrgnCombine, NULL), RGN_ERROR); // Set new clip region
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* Return value is HRGN_ */
|
||||
/* Return value is HRGN_ */
|
||||
HRGN OS2_CopyClipRegion( HPS hps)
|
||||
{
|
||||
if (!hps) return HRGN_ERROR;
|
||||
|
||||
HRGN hrgn = 0, hrgnClip;
|
||||
|
||||
GpiSetClipRegion (hps, 0, &hrgnClip); // Get current clip region
|
||||
// Get current clip region
|
||||
GFX (::GpiSetClipRegion (hps, 0, &hrgnClip), RGN_ERROR);
|
||||
|
||||
if (hrgnClip && hrgnClip != HRGN_ERROR)
|
||||
{
|
||||
hrgn = GpiCreateRegion (hps, 0, NULL); // Create empty region and combine with current
|
||||
GpiCombineRegion (hps, hrgn, hrgnClip, 0, CRGN_COPY);
|
||||
GpiSetClipRegion (hps, hrgnClip, NULL); // restore current clip region
|
||||
hrgn = GFX (::GpiCreateRegion (hps, 0, NULL), RGN_ERROR); // Create empty region and combine with current
|
||||
GFX (::GpiCombineRegion (hps, hrgn, hrgnClip, 0, CRGN_COPY), RGN_ERROR);
|
||||
GFX (::GpiSetClipRegion (hps, hrgnClip, NULL), RGN_ERROR); // restore current clip region
|
||||
}
|
||||
|
||||
return hrgn;
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
*/
|
||||
|
||||
#include "nsScreenOS2.h"
|
||||
#include "nsGfxDefs.h"
|
||||
|
||||
#define INCL_PM
|
||||
#include <os2.h>
|
||||
|
@ -51,10 +52,10 @@ nsScreenOS2 :: GetRect(PRInt32 *outLeft, PRInt32 *outTop, PRInt32 *outWidth, PRI
|
|||
{
|
||||
LONG alArray[2];
|
||||
|
||||
HPS hps = WinGetScreenPS( HWND_DESKTOP);
|
||||
HDC hdc = GpiQueryDevice( hps);
|
||||
HPS hps = ::WinGetScreenPS( HWND_DESKTOP);
|
||||
HDC hdc = GFX (::GpiQueryDevice (hps), HDC_ERROR);
|
||||
|
||||
DevQueryCaps(hdc, CAPS_WIDTH, 2, alArray);
|
||||
::DevQueryCaps(hdc, CAPS_WIDTH, 2, alArray);
|
||||
|
||||
*outTop = 0;
|
||||
*outLeft = 0;
|
||||
|
@ -71,8 +72,8 @@ nsScreenOS2 :: GetAvailRect(PRInt32 *outLeft, PRInt32 *outTop, PRInt32 *outWidth
|
|||
{
|
||||
*outTop = 0;
|
||||
*outLeft = 0;
|
||||
*outWidth = WinQuerySysValue( HWND_DESKTOP, SV_CXFULLSCREEN );
|
||||
*outHeight = WinQuerySysValue( HWND_DESKTOP, SV_CYFULLSCREEN );
|
||||
*outWidth = ::WinQuerySysValue( HWND_DESKTOP, SV_CXFULLSCREEN );
|
||||
*outHeight = ::WinQuerySysValue( HWND_DESKTOP, SV_CYFULLSCREEN );
|
||||
|
||||
return NS_OK;
|
||||
|
||||
|
@ -84,10 +85,10 @@ nsScreenOS2 :: GetPixelDepth(PRInt32 *aPixelDepth)
|
|||
{
|
||||
LONG lCap;
|
||||
|
||||
HPS hps = WinGetScreenPS( HWND_DESKTOP);
|
||||
HDC hdc = GpiQueryDevice( hps);
|
||||
HPS hps = ::WinGetScreenPS( HWND_DESKTOP);
|
||||
HDC hdc = GFX (::GpiQueryDevice (hps), HDC_ERROR);
|
||||
|
||||
DevQueryCaps(hdc, CAPS_COLOR_BITCOUNT, 1, &lCap);
|
||||
::DevQueryCaps(hdc, CAPS_COLOR_BITCOUNT, 1, &lCap);
|
||||
|
||||
*aPixelDepth = (PRInt32)lCap;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче