зеркало из https://github.com/mozilla/gecko-dev.git
16 bit speed testing code
This commit is contained in:
Родитель
5a19200215
Коммит
5923c1426c
|
@ -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
|
||||
|
|
|
@ -609,6 +609,8 @@ PRInt16 dspan,sspan,span,savesp;
|
|||
|
||||
for(x=0;x<span;x++)
|
||||
{
|
||||
|
||||
|
||||
t1 = RED16(*d2);
|
||||
t2 = RED16(*s2);
|
||||
red = (t1*val1+t2*val2)>>8;
|
||||
|
@ -628,9 +630,7 @@ PRInt16 dspan,sspan,span,savesp;
|
|||
if(blue>255)
|
||||
blue = 255;
|
||||
|
||||
|
||||
*sv2 = *d2;
|
||||
//red = 255;green = 0;blue=0;
|
||||
*d2 = ((red&0xF8)<<7) | ((green&0xF8)<<2) | (blue&0xF8)>>3;
|
||||
sv2++;
|
||||
d2++;
|
||||
|
@ -638,12 +638,10 @@ PRInt16 dspan,sspan,span,savesp;
|
|||
}
|
||||
|
||||
s1 += sspan;
|
||||
//s1+=458;
|
||||
d1 += dspan;
|
||||
saveptr += savesp;
|
||||
}
|
||||
}
|
||||
#ifdef NEVER
|
||||
else
|
||||
{
|
||||
for(y = 0; y < aNumlines; y++)
|
||||
|
@ -674,7 +672,6 @@ PRInt16 dspan,sspan,span,savesp;
|
|||
d1 += aDLSpan;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
//------------------------------------------------------------
|
||||
|
|
|
@ -86,6 +86,7 @@ extern void SetUpBlend();
|
|||
extern void CleanUpBlend();
|
||||
extern nsresult BuildDIB(LPBITMAPINFOHEADER *aBHead,unsigned char **aBits,PRInt32 aWidth, PRInt32 aHeight, PRInt32 aDepth);
|
||||
extern PRInt32 CalcBytesSpan(PRUint32 aWidth,PRUint32 aBitsPixel);
|
||||
extern PRUint32 SpeedTestBlend(nsIBlender *aBlender,nsIImage *aImage);
|
||||
|
||||
|
||||
#define RED16(x) ((x)&0x7C00)>>7
|
||||
|
@ -388,6 +389,66 @@ nsIRenderingContext *drawCtx = gWindow->GetRenderingContext();
|
|||
|
||||
//------------------------------------------------------------
|
||||
|
||||
PRUint32
|
||||
SpeedTestBlend(nsIBlender *aBlender,nsIImage *aImage)
|
||||
{
|
||||
nsresult result;
|
||||
float blendamount;
|
||||
nsString str;
|
||||
PRInt32 numerror,height,width;
|
||||
POINT cpos;
|
||||
PRUint32 min,seconds,milli,i;
|
||||
SYSTEMTIME thetime;
|
||||
|
||||
if(aBlender && aImage)
|
||||
{
|
||||
gBlendMessage->GetText(str,3);
|
||||
blendamount = (float)(str.ToInteger(&numerror))/100.0f;
|
||||
if(blendamount < 0.0)
|
||||
blendamount = 0.0f;
|
||||
if(blendamount > 1.0)
|
||||
blendamount = 1.0f;
|
||||
|
||||
printf("\nSTARTING TIMING TEST\n");
|
||||
::GetSystemTime(&thetime);
|
||||
min = thetime.wMinute;
|
||||
seconds = thetime.wSecond;
|
||||
milli = thetime.wMilliseconds;
|
||||
|
||||
for(i=0;i<20;i++)
|
||||
{
|
||||
cpos.x = (100*::rand())/32000;
|
||||
cpos.y = (100*::rand())/32000;
|
||||
|
||||
width = gBlendImage->GetWidth();
|
||||
height = gBlendImage->GetHeight();
|
||||
result = Compositetest(aBlender,aImage,cpos.x,cpos.y,width,height,0,0,blendamount,PR_TRUE);
|
||||
|
||||
if(result == NS_OK)
|
||||
Restore(aBlender,aImage);
|
||||
else
|
||||
break;
|
||||
}
|
||||
::GetSystemTime(&thetime);
|
||||
min = thetime.wMinute-min;
|
||||
if(min>0)
|
||||
min = min*60;
|
||||
seconds = min+thetime.wSecond-seconds;
|
||||
if(seconds>0)
|
||||
seconds = (seconds*1000)+thetime.wMilliseconds;
|
||||
else
|
||||
seconds = thetime.wMilliseconds;
|
||||
milli=seconds-milli;
|
||||
printf("The Blending Time was %lu Milliseconds\n",milli);
|
||||
|
||||
return(milli);
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------
|
||||
|
||||
void
|
||||
InterActiveBlend(nsIBlender *aBlender,nsIImage *aImage)
|
||||
{
|
||||
|
@ -929,8 +990,7 @@ PRInt32 numerror;
|
|||
case COMPINT: // compostite interactive
|
||||
InterActiveBlend(gImageblender,gImage);
|
||||
break;
|
||||
case COMPTST: // composite
|
||||
case COMPTSTSPEED: // composit speed test
|
||||
case COMPTST: // composite basic test
|
||||
IsImageLoaded();
|
||||
gBlendMessage->GetText(str,3);
|
||||
blendamount = (float)(str.ToInteger(&numerror))/100.0f;
|
||||
|
@ -938,9 +998,11 @@ PRInt32 numerror;
|
|||
blendamount = 0.0f;
|
||||
if(blendamount > 1.0)
|
||||
blendamount = 1.0f;
|
||||
|
||||
Compositetest(gImageblender,gImage,0,0,0,0,0,0,blendamount,PR_TRUE);
|
||||
break;
|
||||
case COMPTSTSPEED: // composit speed test
|
||||
SpeedTestBlend(gImageblender,gImage);
|
||||
break;
|
||||
case BSTNOOPT:
|
||||
case BSTOPT:
|
||||
IsImageLoaded();
|
||||
|
|
Загрузка…
Ссылка в новой задаче