зеркало из https://github.com/mozilla/pjs.git
Finish initial conversion from Photon 1 to Photon 2.
Force all off-screen drawing to be done in video card RAM instead of main system RAM using Pd functions instead of Pm functions. PHOTON ONLY r=kedl
This commit is contained in:
Родитель
fcc693c42f
Коммит
3fecdf94ef
|
@ -1,3 +1,5 @@
|
|||
int kedl=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
|
||||
|
@ -85,8 +87,20 @@ nsDrawingSurfacePh :: ~nsDrawingSurfacePh()
|
|||
|
||||
if (mIsOffscreen)
|
||||
{
|
||||
mMC->dc.gc = NULL; /* leave gc for now (leaks "less") */
|
||||
PmMemReleaseMC( mMC); /* this function releases the GC */
|
||||
// mMC->dc.gc=0; // leave gc for now (leaks "less")
|
||||
//xyz PmMemReleaseMC( mMC); /* this function has an error! */
|
||||
if (mDrawContext)
|
||||
{
|
||||
//printf ("release DC: %p\n",mDrawContext);
|
||||
PhDCSetCurrent( moldDrawContext );
|
||||
// PhDCSetCurrent(NULL);
|
||||
// PgSetGC(mGC);
|
||||
// PgSetRegion(mGC->rid);
|
||||
mDrawContext->gc=0;
|
||||
PdReleaseDirectContext((PdDirectContext_t *)mDrawContext); /* this function has an error! */
|
||||
mDrawContext=0;
|
||||
}
|
||||
// free(mMC);
|
||||
mMC = nsnull;
|
||||
PgShmemDestroy( mPixmap->image );
|
||||
mPixmap->image = nsnull;
|
||||
|
@ -117,6 +131,8 @@ NS_IMETHODIMP nsDrawingSurfacePh :: Lock(PRInt32 aX, PRInt32 aY,
|
|||
void **aBits, PRInt32 *aStride,
|
||||
PRInt32 *aWidthBytes, PRUint32 aFlags)
|
||||
{
|
||||
printf ("kedl: uhoh, calling lock!............................................................\n");
|
||||
|
||||
PR_LOG(PhGfxLog, PR_LOG_DEBUG, ("nsDrawingSurfacePh::Lock this=<%p> mLocked=<%d>\n", this, mLocked));
|
||||
|
||||
if (mLocked)
|
||||
|
@ -134,7 +150,7 @@ NS_IMETHODIMP nsDrawingSurfacePh :: Lock(PRInt32 aX, PRInt32 aY,
|
|||
|
||||
PhImage_t *image;
|
||||
PhDim_t dim;
|
||||
short bytes_per_pixel = 3;
|
||||
short bytes_per_pixel = 4;
|
||||
|
||||
image = (PhImage_t *) PR_CALLOC( sizeof(PhImage_t) );
|
||||
if (image == NULL)
|
||||
|
@ -151,7 +167,7 @@ NS_IMETHODIMP nsDrawingSurfacePh :: Lock(PRInt32 aX, PRInt32 aY,
|
|||
/* Force all the Draw Events out to the image */
|
||||
Flush();
|
||||
|
||||
image->type = Pg_IMAGE_DIRECT_888; // 3 bytes per pixel with this type
|
||||
image->type = Pg_IMAGE_DIRECT_8888; // 4 bytes per pixel with this type
|
||||
image->size = dim;
|
||||
image->image = (char *) PR_Malloc( dim.w * dim.h * bytes_per_pixel);
|
||||
if (image->image == NULL)
|
||||
|
@ -164,13 +180,13 @@ NS_IMETHODIMP nsDrawingSurfacePh :: Lock(PRInt32 aX, PRInt32 aY,
|
|||
|
||||
for (int y=0; y<dim.h; y++)
|
||||
{
|
||||
memcpy( image->image+y*dim.w*3,
|
||||
mPixmap->image+3*mLockX+(mLockY+y)*mPixmap->bpl,
|
||||
dim.w*3);
|
||||
memcpy( image->image+y*dim.w*bytes_per_pixel,
|
||||
mPixmap->image+bytes_per_pixel*mLockX+(mLockY+y)*mPixmap->bpl,
|
||||
dim.w*bytes_per_pixel);
|
||||
}
|
||||
|
||||
*aBits = mImage->image;
|
||||
*aWidthBytes = aWidth*3;
|
||||
*aWidthBytes = aWidth*bytes_per_pixel;
|
||||
*aStride = mImage->bpl; /* kirkj: I think this is wrong... */
|
||||
|
||||
return NS_OK;
|
||||
|
@ -298,7 +314,7 @@ NS_IMETHODIMP nsDrawingSurfacePh :: Init( PhGC_t * &aGC, PRUint32 aWidth,
|
|||
mHeight = aHeight;
|
||||
mFlags = aFlags;
|
||||
|
||||
mIsOffscreen = PR_TRUE;
|
||||
mIsOffsc*‰Š |