Blending now uses the Upper left to place the source image

This commit is contained in:
dcone 1998-06-26 14:06:34 +00:00
Родитель 6f42819a8f
Коммит 9b6e982736
3 изменённых файлов: 12 добавлений и 14 удалений

Просмотреть файл

@ -27,7 +27,7 @@ REQUIRES=util img xpcom raptor netlib
DEFINES=-D_IMPL_NS_GFX -DWIN32_LEAN_AND_MEAN
CPPSRCS=nsColor.cpp nsColorNames.cpp nsColorNamesRGB.cpp nsFont.cpp \
nsImageGroup.cpp nsImageManager.cpp nsImageNetContextAsync.cpp \
nsImageGroup.cpp nsImageManager.cpp nsImageNetContext.cpp \
nsImageRenderer.cpp nsImageRequest.cpp nsImageSystemServices.cpp \
nsImageURL.cpp nsRect.cpp nsTransform2D.cpp nsFontCache.cpp
@ -40,7 +40,7 @@ EXPORTS=nsColor.h nsColorNames.h nsCoord.h nsFont.h nsRect.h nsPoint.h \
CPP_OBJS=.\$(OBJDIR)\nsColor.obj .\$(OBJDIR)\nsColorNames.obj \
.\$(OBJDIR)\nsColorNamesRGB.obj .\$(OBJDIR)\nsFont.obj \
.\$(OBJDIR)\nsImageGroup.obj .\$(OBJDIR)\nsImageManager.obj \
.\$(OBJDIR)\nsImageNetContextAsync.obj .\$(OBJDIR)\nsImageRenderer.obj \
.\$(OBJDIR)\nsImageNetContext.obj .\$(OBJDIR)\nsImageRenderer.obj \
.\$(OBJDIR)\nsImageRequest.obj .\$(OBJDIR)\nsImageSystemServices.obj \
.\$(OBJDIR)\nsImageURL.obj .\$(OBJDIR)\nsRect.obj \
.\$(OBJDIR)\nsTransform2D.obj .\$(OBJDIR)\nsFontCache.obj

Просмотреть файл

@ -136,8 +136,8 @@ nsColorMap *colormap;
srcloc.y = aSY;
mSrcInfo.bmBits = mSrcBytes;
mDstInfo.bmBits = mDstBytes;
maskloc.x = aSX;
maskloc.y = aSY;
maskloc.x = 0;
maskloc.y = 0;
if(CalcAlphaMetrics(&mSrcInfo,&mDstInfo,&srcloc,NULL,&maskloc,aWidth,aHeight,&numlines,&numbytes,
&s1,&d1,&m1,&slinespan,&dlinespan,&mlinespan))
{
@ -268,12 +268,11 @@ PRInt32 startx,starty;
}
else
{
arect.SetRect(0,0,aDestInfo->bmWidth,aDestInfo->bmHeight);
srect.SetRect(aMaskUL->x,aMaskUL->y,aWidth,aHeight);
arect.IntersectRect(arect,srect);
//arect.SetRect(0,0,aDestInfo->bmWidth,aDestInfo->bmHeight);
//x = y = 0;
//srect.SetRect(aMaskUL->x,aMaskUL->y,aWidth,aHeight);
//arect.IntersectRect(arect,srect);
arect.SetRect(0, 0,aDestInfo->bmWidth, aDestInfo->bmHeight);
}
srect.SetRect(aSrcUL->x, aSrcUL->y, aSrcInfo->bmWidth, aSrcInfo->bmHeight);
@ -287,7 +286,7 @@ PRInt32 startx,starty;
*aNumlines = irect.height;
startx = irect.x;
starty = aDestInfo->bmHeight - (irect.y + irect.height);
*aDImage = ((PRUint8*)aDestInfo->bmBits) + (starty * (*aDLSpan)) + (aDestInfo->bmBitsPixel * startx);
*aDImage = ((PRUint8*)aDestInfo->bmBits) + (starty * (*aDLSpan)) + ((aDestInfo->bmBitsPixel/8) * startx);
// get the intersection relative to the source rectangle
srect.SetRect(0, 0, aSrcInfo->bmWidth, aSrcInfo->bmHeight);
@ -298,7 +297,7 @@ PRInt32 startx,starty;
*aSLSpan = aSrcInfo->bmWidthBytes;
startx = drect.x;
starty = aSrcInfo->bmHeight - (drect.y + drect.height);
*aSImage = ((PRUint8*)aSrcInfo->bmBits) + (starty * (*aSLSpan)) + (aDestInfo->bmBitsPixel * startx);
*aSImage = ((PRUint8*)aSrcInfo->bmBits) + (starty * (*aSLSpan)) + ((aDestInfo->bmBitsPixel/8) * startx);
doalpha = PR_TRUE;

Просмотреть файл

@ -342,7 +342,7 @@ PRBool nsImageWin::CalcAlphaMetrics(nsIImage *aTheImage,nsPoint *aULLocation,PRI
{
PRBool doalpha = PR_FALSE;
nsRect arect,srect,drect,irect;
PRInt32 startx,starty,x,y;
PRInt32 startx,starty;
PRUint8 *alphabits;
if( IsOptimized() )
@ -358,7 +358,6 @@ PRUint8 *alphabits;
else
{
arect.SetRect(0, 0, this->GetWidth(), this->GetHeight());
x = y = 0;
}
srect.SetRect(aULLocation->x, aULLocation->y, aTheImage->GetWidth(), aTheImage->GetHeight());