зеркало из https://github.com/mozilla/pjs.git
like MIR, libpr0n is landing for mac
This commit is contained in:
Родитель
975022bff0
Коммит
fde0a19635
|
@ -571,6 +571,15 @@ sub BuildClientDist()
|
|||
InstallFromManifest(":mozilla:modules:libimg:public:MANIFEST", "$distdirectory:libimg:");
|
||||
InstallFromManifest(":mozilla:modules:libimg:public_com:MANIFEST", "$distdirectory:libimg:");
|
||||
|
||||
if ($main::options{useimg2}) {
|
||||
#GFX2
|
||||
InstallFromManifest(":mozilla:gfx2:public:MANIFEST", "$distdirectory:gfx2:");
|
||||
InstallFromManifest(":mozilla:gfx2:public:MANIFEST_IDL", "$distdirectory:idl:");
|
||||
|
||||
#LIBIMG2
|
||||
InstallFromManifest(":mozilla:modules:libpr0n:public:MANIFEST_IDL", "$distdirectory:libimg2:");
|
||||
}
|
||||
|
||||
#PLUGIN
|
||||
InstallFromManifest(":mozilla:modules:plugin:nglsrc:MANIFEST", "$distdirectory:plugin:");
|
||||
InstallFromManifest(":mozilla:modules:plugin:public:MANIFEST", "$distdirectory:plugin:");
|
||||
|
@ -984,6 +993,12 @@ sub BuildIDLProjects()
|
|||
BuildIDLProject(":mozilla:modules:libpref:macbuild:libprefIDL.mcp", "libpref");
|
||||
BuildIDLProject(":mozilla:modules:libutil:macbuild:libutilIDL.mcp", "libutil");
|
||||
BuildIDLProject(":mozilla:modules:libjar:macbuild:libjarIDL.mcp", "libjar");
|
||||
|
||||
if ($main::options{useimg2}) {
|
||||
BuildIDLProject(":mozilla:gfx2:macbuild:gfx2IDL.mcp", "gfx2");
|
||||
BuildIDLProject(":mozilla:modules:libpr0n:macbuild:libimg2IDL.mcp", "libimg2");
|
||||
}
|
||||
|
||||
BuildIDLProject(":mozilla:modules:plugin:macbuild:pluginIDL.mcp", "plugin");
|
||||
BuildIDLProject(":mozilla:modules:oji:macbuild:ojiIDL.mcp", "oji");
|
||||
BuildIDLProject(":mozilla:js:macbuild:XPConnectIDL.mcp", "xpconnect");
|
||||
|
@ -1222,6 +1237,34 @@ sub BuildImglibProjects()
|
|||
EndBuildModule("imglib");
|
||||
} # imglib
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// Build libimg2 projects
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
|
||||
sub BuildImglib2Projects()
|
||||
{
|
||||
#unless( $main::options{useimg2} ) { return; }
|
||||
|
||||
# $D becomes a suffix to target names for selecting either the debug or non-debug target of a project
|
||||
my($D) = $main::DEBUG ? "Debug" : "";
|
||||
|
||||
StartBuildModule("libimg2");
|
||||
|
||||
BuildOneProject(":mozilla:gfx2:macbuild:gfx2.mcp", "gfx2$D.shlb", 1, $main::ALIAS_SYM_FILES, 1);
|
||||
BuildOneProject(":mozilla:modules:libpr0n:macbuild:libimg2.mcp", "libimg2$D.shlb", 1, $main::ALIAS_SYM_FILES, 1);
|
||||
BuildOneProject(":mozilla:modules:libpr0n:macbuild:pngdecoder2.mcp", "pngdecoder2$D.shlb", 1, $main::ALIAS_SYM_FILES, 1);
|
||||
BuildOneProject(":mozilla:modules:libpr0n:macbuild:gifdecoder2.mcp", "gifdecoder2$D.shlb", 1, $main::ALIAS_SYM_FILES, 1);
|
||||
BuildOneProject(":mozilla:modules:libpr0n:macbuild:jpegdecoder2.mcp", "jpegdecoder2$D.shlb", 1, $main::ALIAS_SYM_FILES, 1);
|
||||
|
||||
# MNG
|
||||
if ($main::options{mng})
|
||||
{
|
||||
#BuildOneProject(":mozilla:modules:libimg:macbuild:mng.mcp", "mng$D.o", 0, 0, 0);
|
||||
#BuildOneProject(":mozilla:modules:libimg:macbuild:mngdecoder.mcp", "mngdecoder$D.shlb", 1, $main::ALIAS_SYM_FILES, 1);
|
||||
}
|
||||
|
||||
EndBuildModule("libimg2");
|
||||
} # imglib
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// Build international projects
|
||||
|
@ -1857,6 +1900,7 @@ sub BuildProjects()
|
|||
BuildRuntimeProjects();
|
||||
BuildCommonProjects();
|
||||
BuildImglibProjects();
|
||||
BuildImglib2Projects();
|
||||
BuildNeckoProjects();
|
||||
BuildSecurityProjects();
|
||||
BuildBrowserUtilsProjects();
|
||||
|
|
|
@ -54,6 +54,9 @@ public:
|
|||
// used for clipboard.
|
||||
NS_IMETHOD ConvertFromPICT ( PicHandle inPicture ) = 0;
|
||||
|
||||
// Get the PixMap for this image
|
||||
NS_IMETHOD GetPixMap ( PixMap** aPixMap ) = 0;
|
||||
|
||||
}; // nsIImageMac
|
||||
|
||||
|
||||
|
|
|
@ -344,6 +344,59 @@ NS_IMETHODIMP nsImageMac :: Draw(nsIRenderingContext &aContext,
|
|||
return Draw(aContext,aSurface,0,0,mWidth,mHeight,aX,aY,aWidth,aHeight);
|
||||
}
|
||||
|
||||
#ifdef USE_IMG2
|
||||
/** ---------------------------------------------------
|
||||
* See documentation in nsImageMac.h
|
||||
* @update
|
||||
*/
|
||||
NS_IMETHODIMP nsImageMac :: DrawToImage(nsIImage* aDstImage, PRInt32 aDX, PRInt32 aDY, PRInt32 aDWidth, PRInt32 aDHeight)
|
||||
{
|
||||
Rect srcRect, dstRect, maskRect;
|
||||
|
||||
if (!mImageBitsHandle)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
// lock and set up bits handles
|
||||
this->LockImagePixels(PR_FALSE);
|
||||
this->LockImagePixels(PR_TRUE);
|
||||
|
||||
::SetRect(&srcRect, 0, 0, mWidth, mHeight);
|
||||
maskRect = srcRect;
|
||||
::SetRect(&dstRect, aDX, aDY, aDX + aDWidth, aDY + aDHeight);
|
||||
|
||||
::ForeColor(blackColor);
|
||||
::BackColor(whiteColor);
|
||||
|
||||
// get the destination pix map
|
||||
aDstImage->LockImagePixels(PR_FALSE);
|
||||
aDstImage->LockImagePixels(PR_TRUE);
|
||||
//nsImageMac* dstMacImage = static_cast<nsImageMac*>(aDstImage);
|
||||
nsCOMPtr<nsIImageMac> dstMacImage( do_QueryInterface(aDstImage));
|
||||
|
||||
PixMap* destPixels;
|
||||
dstMacImage->GetPixMap(&destPixels);
|
||||
NS_ASSERTION(destPixels, "No dest pixels!");
|
||||
|
||||
if (!mMaskBitsHandle)
|
||||
{
|
||||
::CopyBits((BitMap*)&mImagePixmap, (BitMap*)destPixels, &srcRect, &dstRect, srcCopy, nsnull);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mAlphaDepth > 1)
|
||||
::CopyDeepMask((BitMap*)&mImagePixmap, (BitMap*)&mMaskPixmap, (BitMap*)destPixels, &srcRect, &maskRect, &dstRect, srcCopy, nsnull);
|
||||
else
|
||||
::CopyMask((BitMap*)&mImagePixmap, (BitMap*)&mMaskPixmap, (BitMap*)destPixels, &srcRect, &maskRect, &dstRect);
|
||||
}
|
||||
aDstImage->UnlockImagePixels(PR_FALSE);
|
||||
aDstImage->UnlockImagePixels(PR_TRUE);
|
||||
this->UnlockImagePixels(PR_FALSE);
|
||||
this->UnlockImagePixels(PR_TRUE);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
#endif // USE_IMG2
|
||||
|
||||
/** ---------------------------------------------------
|
||||
* See documentation in nsImageMac.h
|
||||
* @update
|
||||
|
@ -390,9 +443,15 @@ nsImageMac::LockImagePixels(PRBool aMaskPixels)
|
|||
if (aMaskPixels && !mMaskBitsHandle)
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
Handle thePixelsHandle = (aMaskPixels ? mMaskBitsHandle : mImageBitsHandle);
|
||||
::HLock(thePixelsHandle);
|
||||
return NS_OK;
|
||||
Handle thePixelsHandle = (aMaskPixels ? mMaskBitsHandle : mImageBitsHandle);
|
||||
::HLock(thePixelsHandle);
|
||||
|
||||
if(aMaskPixels)
|
||||
mMaskPixmap.baseAddr = *thePixelsHandle;
|
||||
else
|
||||
mImagePixmap.baseAddr = *thePixelsHandle;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/** ---------------------------------------------------
|
||||
|
@ -409,6 +468,12 @@ nsImageMac::UnlockImagePixels(PRBool aMaskPixels)
|
|||
|
||||
Handle thePixelsHandle = (aMaskPixels ? mMaskBitsHandle : mImageBitsHandle);
|
||||
::HUnlock(thePixelsHandle);
|
||||
|
||||
if(aMaskPixels)
|
||||
mMaskPixmap.baseAddr = 0;
|
||||
else
|
||||
mImagePixmap.baseAddr = 0;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -741,11 +806,11 @@ nsImageMac :: ConvertFromPICT ( PicHandle inPicture )
|
|||
|
||||
} // ConvertFromPICT
|
||||
|
||||
|
||||
#ifdef USE_IMG2
|
||||
NS_IMETHODIMP nsImageMac::DrawToImage(nsIImage* aDstImage, nscoord aDX, nscoord aDY, nscoord aDWidth, nscoord aDHeight)
|
||||
NS_IMETHODIMP
|
||||
nsImageMac::GetPixMap ( PixMap** aPixMap )
|
||||
{
|
||||
*aPixMap = &mImagePixmap;
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
@ -94,6 +94,8 @@ public:
|
|||
NS_IMETHOD ConvertToPICT ( PicHandle* outPicture ) ;
|
||||
NS_IMETHOD ConvertFromPICT ( PicHandle inPicture ) ;
|
||||
|
||||
NS_IMETHOD GetPixMap ( PixMap** outPixMap ) ;
|
||||
|
||||
protected:
|
||||
|
||||
static OSErr CreatePixMap(PRInt32 aWidth, PRInt32 aHeight, PRInt32 aDepth, CTabHandle aColorTable,
|
||||
|
|
|
@ -210,8 +210,7 @@ int BeginGIF(
|
|||
void* aClientData,
|
||||
PRUint32 aLogicalScreenWidth,
|
||||
PRUint32 aLogicalScreenHeight,
|
||||
GIF_RGB* aBackgroundRGB,
|
||||
GIF_RGB* aTransparencyChromaKey)
|
||||
PRUint8 aBackgroundRGBIndex)
|
||||
{
|
||||
// copy GIF info into imagelib structs
|
||||
nsGIFDecoder2 *decoder = NS_STATIC_CAST(nsGIFDecoder2*, aClientData);
|
||||
|
@ -233,6 +232,10 @@ int EndGIF(
|
|||
int aAnimationLoopCount)
|
||||
{
|
||||
nsGIFDecoder2 *decoder = NS_STATIC_CAST(nsGIFDecoder2*, aClientData);
|
||||
if (decoder->mObserver) {
|
||||
decoder->mObserver->OnStopContainer(nsnull, nsnull, decoder->mImageContainer);
|
||||
decoder->mObserver->OnStopDecode(nsnull, nsnull, NS_OK, nsnull);
|
||||
}
|
||||
|
||||
decoder->mImageContainer->SetLoopCount(aAnimationLoopCount);
|
||||
decoder->mImageContainer->DecodingComplete();
|
||||
|
@ -283,6 +286,7 @@ int EndImageFrame(
|
|||
if (decoder->mObserver)
|
||||
decoder->mObserver->OnStopFrame(nsnull, nsnull, decoder->mImageFrame);
|
||||
|
||||
decoder->mImageFrame = nsnull;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -293,11 +297,6 @@ int EndImageFrame(
|
|||
int HaveImageAll(
|
||||
void* aClientData)
|
||||
{
|
||||
nsGIFDecoder2* decoder = NS_STATIC_CAST(nsGIFDecoder2*, aClientData);
|
||||
if (decoder->mObserver) {
|
||||
decoder->mObserver->OnStopContainer(nsnull, nsnull, decoder->mImageContainer);
|
||||
decoder->mObserver->OnStopDecode(nsnull, nsnull, NS_OK, nsnull);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -75,8 +75,7 @@ static int PR_CALLBACK BeginGIF(
|
|||
void* aClientData,
|
||||
PRUint32 aLogicalScreenWidth,
|
||||
PRUint32 aLogicalScreenHeight,
|
||||
GIF_RGB* aBackgroundRGB,
|
||||
GIF_RGB* aTransparencyChromaKey);
|
||||
PRUint8 aBackgroundRGBIndex);
|
||||
|
||||
static int PR_CALLBACK HaveDecodedRow(
|
||||
void* aClientData,
|
||||
|
|
|
@ -437,10 +437,26 @@ nsPNGDecoder::row_callback(png_structp png_ptr, png_bytep new_row,
|
|||
decoder->mFrame->GetFormat(&format);
|
||||
PRUint8 *aptr, *cptr;
|
||||
|
||||
// The mac specific ifdefs in the code below are there to make sure we
|
||||
// always fill in 4 byte pixels right now, which is what the mac always
|
||||
// allocates for its pixel buffers in true color mode. This will change
|
||||
// when we start storing images with color palettes when they don't need
|
||||
// true color support (GIFs).
|
||||
switch (format) {
|
||||
case gfxIFormats::RGB:
|
||||
case gfxIFormats::BGR:
|
||||
decoder->mFrame->SetImageData((PRUint8*)line, bpr, row_num*bpr);
|
||||
#ifdef XP_MAC
|
||||
cptr = decoder->colorLine;
|
||||
for (PRUint32 x=0; x<iwidth; x++) {
|
||||
*cptr++ = 0;
|
||||
*cptr++ = *line++;
|
||||
*cptr++ = *line++;
|
||||
*cptr++ = *line++;
|
||||
}
|
||||
decoder->mFrame->SetImageData(decoder->colorLine, bpr, row_num*bpr);
|
||||
#else
|
||||
decoder->mFrame->SetImageData((PRUint8*)line, bpr, row_num*bpr);
|
||||
#endif
|
||||
break;
|
||||
case gfxIFormats::RGB_A1:
|
||||
case gfxIFormats::BGR_A1:
|
||||
|
@ -449,6 +465,9 @@ nsPNGDecoder::row_callback(png_structp png_ptr, png_bytep new_row,
|
|||
aptr = decoder->alphaLine;
|
||||
memset(aptr, 0, abpr);
|
||||
for (PRUint32 x=0; x<iwidth; x++) {
|
||||
#ifdef XP_MAC
|
||||
*cptr++ = 0;
|
||||
#endif
|
||||
*cptr++ = *line++;
|
||||
*cptr++ = *line++;
|
||||
*cptr++ = *line++;
|
||||
|
@ -466,6 +485,9 @@ nsPNGDecoder::row_callback(png_structp png_ptr, png_bytep new_row,
|
|||
cptr = decoder->colorLine;
|
||||
aptr = decoder->alphaLine;
|
||||
for (PRUint32 x=0; x<iwidth; x++) {
|
||||
#ifdef XP_MAC
|
||||
*cptr++ = 0;
|
||||
#endif
|
||||
*cptr++ = *line++;
|
||||
*cptr++ = *line++;
|
||||
*cptr++ = *line++;
|
||||
|
@ -477,7 +499,23 @@ nsPNGDecoder::row_callback(png_structp png_ptr, png_bytep new_row,
|
|||
break;
|
||||
case gfxIFormats::RGBA:
|
||||
case gfxIFormats::BGRA:
|
||||
#ifdef XP_MAC
|
||||
{
|
||||
cptr = decoder->colorLine;
|
||||
aptr = decoder->alphaLine;
|
||||
for (PRUint32 x=0; x<iwidth; x++) {
|
||||
*cptr++ = 0;
|
||||
*cptr++ = *line++;
|
||||
*cptr++ = *line++;
|
||||
*cptr++ = *line++;
|
||||
*aptr++ = *line++;
|
||||
}
|
||||
decoder->mFrame->SetImageData(decoder->colorLine, bpr, row_num*bpr);
|
||||
decoder->mFrame->SetAlphaData(decoder->alphaLine, abpr, row_num*abpr);
|
||||
}
|
||||
#else
|
||||
decoder->mFrame->SetImageData(line, bpr, row_num*bpr);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче