зеркало из 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:MANIFEST", "$distdirectory:libimg:");
|
||||||
InstallFromManifest(":mozilla:modules:libimg:public_com: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
|
#PLUGIN
|
||||||
InstallFromManifest(":mozilla:modules:plugin:nglsrc:MANIFEST", "$distdirectory:plugin:");
|
InstallFromManifest(":mozilla:modules:plugin:nglsrc:MANIFEST", "$distdirectory:plugin:");
|
||||||
InstallFromManifest(":mozilla:modules:plugin:public: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:libpref:macbuild:libprefIDL.mcp", "libpref");
|
||||||
BuildIDLProject(":mozilla:modules:libutil:macbuild:libutilIDL.mcp", "libutil");
|
BuildIDLProject(":mozilla:modules:libutil:macbuild:libutilIDL.mcp", "libutil");
|
||||||
BuildIDLProject(":mozilla:modules:libjar:macbuild:libjarIDL.mcp", "libjar");
|
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:plugin:macbuild:pluginIDL.mcp", "plugin");
|
||||||
BuildIDLProject(":mozilla:modules:oji:macbuild:ojiIDL.mcp", "oji");
|
BuildIDLProject(":mozilla:modules:oji:macbuild:ojiIDL.mcp", "oji");
|
||||||
BuildIDLProject(":mozilla:js:macbuild:XPConnectIDL.mcp", "xpconnect");
|
BuildIDLProject(":mozilla:js:macbuild:XPConnectIDL.mcp", "xpconnect");
|
||||||
|
@ -1222,6 +1237,34 @@ sub BuildImglibProjects()
|
||||||
EndBuildModule("imglib");
|
EndBuildModule("imglib");
|
||||||
} # 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
|
#// Build international projects
|
||||||
|
@ -1857,6 +1900,7 @@ sub BuildProjects()
|
||||||
BuildRuntimeProjects();
|
BuildRuntimeProjects();
|
||||||
BuildCommonProjects();
|
BuildCommonProjects();
|
||||||
BuildImglibProjects();
|
BuildImglibProjects();
|
||||||
|
BuildImglib2Projects();
|
||||||
BuildNeckoProjects();
|
BuildNeckoProjects();
|
||||||
BuildSecurityProjects();
|
BuildSecurityProjects();
|
||||||
BuildBrowserUtilsProjects();
|
BuildBrowserUtilsProjects();
|
||||||
|
|
|
@ -54,6 +54,9 @@ public:
|
||||||
// used for clipboard.
|
// used for clipboard.
|
||||||
NS_IMETHOD ConvertFromPICT ( PicHandle inPicture ) = 0;
|
NS_IMETHOD ConvertFromPICT ( PicHandle inPicture ) = 0;
|
||||||
|
|
||||||
|
// Get the PixMap for this image
|
||||||
|
NS_IMETHOD GetPixMap ( PixMap** aPixMap ) = 0;
|
||||||
|
|
||||||
}; // nsIImageMac
|
}; // nsIImageMac
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -344,6 +344,59 @@ NS_IMETHODIMP nsImageMac :: Draw(nsIRenderingContext &aContext,
|
||||||
return Draw(aContext,aSurface,0,0,mWidth,mHeight,aX,aY,aWidth,aHeight);
|
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
|
* See documentation in nsImageMac.h
|
||||||
* @update
|
* @update
|
||||||
|
@ -390,9 +443,15 @@ nsImageMac::LockImagePixels(PRBool aMaskPixels)
|
||||||
if (aMaskPixels && !mMaskBitsHandle)
|
if (aMaskPixels && !mMaskBitsHandle)
|
||||||
return NS_ERROR_NOT_INITIALIZED;
|
return NS_ERROR_NOT_INITIALIZED;
|
||||||
|
|
||||||
Handle thePixelsHandle = (aMaskPixels ? mMaskBitsHandle : mImageBitsHandle);
|
Handle thePixelsHandle = (aMaskPixels ? mMaskBitsHandle : mImageBitsHandle);
|
||||||
::HLock(thePixelsHandle);
|
::HLock(thePixelsHandle);
|
||||||
return NS_OK;
|
|
||||||
|
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);
|
Handle thePixelsHandle = (aMaskPixels ? mMaskBitsHandle : mImageBitsHandle);
|
||||||
::HUnlock(thePixelsHandle);
|
::HUnlock(thePixelsHandle);
|
||||||
|
|
||||||
|
if(aMaskPixels)
|
||||||
|
mMaskPixmap.baseAddr = 0;
|
||||||
|
else
|
||||||
|
mImagePixmap.baseAddr = 0;
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -741,11 +806,11 @@ nsImageMac :: ConvertFromPICT ( PicHandle inPicture )
|
||||||
|
|
||||||
} // ConvertFromPICT
|
} // ConvertFromPICT
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
#ifdef USE_IMG2
|
nsImageMac::GetPixMap ( PixMap** aPixMap )
|
||||||
NS_IMETHODIMP nsImageMac::DrawToImage(nsIImage* aDstImage, nscoord aDX, nscoord aDY, nscoord aDWidth, nscoord aDHeight)
|
|
||||||
{
|
{
|
||||||
|
*aPixMap = &mImagePixmap;
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
|
@ -94,6 +94,8 @@ public:
|
||||||
NS_IMETHOD ConvertToPICT ( PicHandle* outPicture ) ;
|
NS_IMETHOD ConvertToPICT ( PicHandle* outPicture ) ;
|
||||||
NS_IMETHOD ConvertFromPICT ( PicHandle inPicture ) ;
|
NS_IMETHOD ConvertFromPICT ( PicHandle inPicture ) ;
|
||||||
|
|
||||||
|
NS_IMETHOD GetPixMap ( PixMap** outPixMap ) ;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
static OSErr CreatePixMap(PRInt32 aWidth, PRInt32 aHeight, PRInt32 aDepth, CTabHandle aColorTable,
|
static OSErr CreatePixMap(PRInt32 aWidth, PRInt32 aHeight, PRInt32 aDepth, CTabHandle aColorTable,
|
||||||
|
|
|
@ -210,8 +210,7 @@ int BeginGIF(
|
||||||
void* aClientData,
|
void* aClientData,
|
||||||
PRUint32 aLogicalScreenWidth,
|
PRUint32 aLogicalScreenWidth,
|
||||||
PRUint32 aLogicalScreenHeight,
|
PRUint32 aLogicalScreenHeight,
|
||||||
GIF_RGB* aBackgroundRGB,
|
PRUint8 aBackgroundRGBIndex)
|
||||||
GIF_RGB* aTransparencyChromaKey)
|
|
||||||
{
|
{
|
||||||
// copy GIF info into imagelib structs
|
// copy GIF info into imagelib structs
|
||||||
nsGIFDecoder2 *decoder = NS_STATIC_CAST(nsGIFDecoder2*, aClientData);
|
nsGIFDecoder2 *decoder = NS_STATIC_CAST(nsGIFDecoder2*, aClientData);
|
||||||
|
@ -233,6 +232,10 @@ int EndGIF(
|
||||||
int aAnimationLoopCount)
|
int aAnimationLoopCount)
|
||||||
{
|
{
|
||||||
nsGIFDecoder2 *decoder = NS_STATIC_CAST(nsGIFDecoder2*, 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);
|
||||||
|
}
|
||||||
|
|
||||||
decoder->mImageContainer->SetLoopCount(aAnimationLoopCount);
|
decoder->mImageContainer->SetLoopCount(aAnimationLoopCount);
|
||||||
decoder->mImageContainer->DecodingComplete();
|
decoder->mImageContainer->DecodingComplete();
|
||||||
|
@ -283,6 +286,7 @@ int EndImageFrame(
|
||||||
if (decoder->mObserver)
|
if (decoder->mObserver)
|
||||||
decoder->mObserver->OnStopFrame(nsnull, nsnull, decoder->mImageFrame);
|
decoder->mObserver->OnStopFrame(nsnull, nsnull, decoder->mImageFrame);
|
||||||
|
|
||||||
|
decoder->mImageFrame = nsnull;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -293,11 +297,6 @@ int EndImageFrame(
|
||||||
int HaveImageAll(
|
int HaveImageAll(
|
||||||
void* aClientData)
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -75,8 +75,7 @@ static int PR_CALLBACK BeginGIF(
|
||||||
void* aClientData,
|
void* aClientData,
|
||||||
PRUint32 aLogicalScreenWidth,
|
PRUint32 aLogicalScreenWidth,
|
||||||
PRUint32 aLogicalScreenHeight,
|
PRUint32 aLogicalScreenHeight,
|
||||||
GIF_RGB* aBackgroundRGB,
|
PRUint8 aBackgroundRGBIndex);
|
||||||
GIF_RGB* aTransparencyChromaKey);
|
|
||||||
|
|
||||||
static int PR_CALLBACK HaveDecodedRow(
|
static int PR_CALLBACK HaveDecodedRow(
|
||||||
void* aClientData,
|
void* aClientData,
|
||||||
|
|
|
@ -437,10 +437,26 @@ nsPNGDecoder::row_callback(png_structp png_ptr, png_bytep new_row,
|
||||||
decoder->mFrame->GetFormat(&format);
|
decoder->mFrame->GetFormat(&format);
|
||||||
PRUint8 *aptr, *cptr;
|
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) {
|
switch (format) {
|
||||||
case gfxIFormats::RGB:
|
case gfxIFormats::RGB:
|
||||||
case gfxIFormats::BGR:
|
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;
|
break;
|
||||||
case gfxIFormats::RGB_A1:
|
case gfxIFormats::RGB_A1:
|
||||||
case gfxIFormats::BGR_A1:
|
case gfxIFormats::BGR_A1:
|
||||||
|
@ -449,6 +465,9 @@ nsPNGDecoder::row_callback(png_structp png_ptr, png_bytep new_row,
|
||||||
aptr = decoder->alphaLine;
|
aptr = decoder->alphaLine;
|
||||||
memset(aptr, 0, abpr);
|
memset(aptr, 0, abpr);
|
||||||
for (PRUint32 x=0; x<iwidth; x++) {
|
for (PRUint32 x=0; x<iwidth; x++) {
|
||||||
|
#ifdef XP_MAC
|
||||||
|
*cptr++ = 0;
|
||||||
|
#endif
|
||||||
*cptr++ = *line++;
|
*cptr++ = *line++;
|
||||||
*cptr++ = *line++;
|
*cptr++ = *line++;
|
||||||
*cptr++ = *line++;
|
*cptr++ = *line++;
|
||||||
|
@ -466,6 +485,9 @@ nsPNGDecoder::row_callback(png_structp png_ptr, png_bytep new_row,
|
||||||
cptr = decoder->colorLine;
|
cptr = decoder->colorLine;
|
||||||
aptr = decoder->alphaLine;
|
aptr = decoder->alphaLine;
|
||||||
for (PRUint32 x=0; x<iwidth; x++) {
|
for (PRUint32 x=0; x<iwidth; x++) {
|
||||||
|
#ifdef XP_MAC
|
||||||
|
*cptr++ = 0;
|
||||||
|
#endif
|
||||||
*cptr++ = *line++;
|
*cptr++ = *line++;
|
||||||
*cptr++ = *line++;
|
*cptr++ = *line++;
|
||||||
*cptr++ = *line++;
|
*cptr++ = *line++;
|
||||||
|
@ -477,7 +499,23 @@ nsPNGDecoder::row_callback(png_structp png_ptr, png_bytep new_row,
|
||||||
break;
|
break;
|
||||||
case gfxIFormats::RGBA:
|
case gfxIFormats::RGBA:
|
||||||
case gfxIFormats::BGRA:
|
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);
|
decoder->mFrame->SetImageData(line, bpr, row_num*bpr);
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче