Fixing bugzilla 102321, regression in scrolling performance. Should also fix 256 color rendering regression. r=dcone, sr=jag
git-svn-id: svn://10.0.0.236/trunk@120464 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -617,7 +617,6 @@ NS_IMETHODIMP nsDeviceContextWin::GetPaletteInfo(nsPaletteInfo& aPaletteInfo)
|
||||
HWND hwnd = (HWND)mWidget;
|
||||
HDC hdc = ::GetDC(hwnd);
|
||||
mPaletteInfo.palette = ::CreateHalftonePalette(hdc);
|
||||
::SetStretchBltMode(hdc, HALFTONE);
|
||||
::ReleaseDC(hwnd, hdc);
|
||||
}
|
||||
|
||||
|
||||
@@ -379,6 +379,12 @@ nsImageWin :: CreateDDB(nsDrawingSurface aSurface)
|
||||
((nsDrawingSurfaceWin *)aSurface)->GetDC(&TheHDC);
|
||||
|
||||
if (TheHDC != NULL){
|
||||
// Temporary fix for bug 135226 until we do better decode-time
|
||||
// dithering and paletized storage of images. Bail on the
|
||||
// optimization to DDB if we're on a paletted device.
|
||||
int rasterCaps = ::GetDeviceCaps(TheHDC, RASTERCAPS);
|
||||
if (RC_PALETTE == (rasterCaps & RC_PALETTE)) return;
|
||||
|
||||
if (mSizeImage > 0){
|
||||
if (mAlphaDepth == 8) {
|
||||
CreateImageWithAlphaBits(TheHDC);
|
||||
@@ -522,12 +528,9 @@ nsImageWin :: Draw(nsIRenderingContext &aContext, nsDrawingSurface aSurface,
|
||||
}
|
||||
}
|
||||
} else {
|
||||
int saveMode = ::GetStretchBltMode(TheHDC);
|
||||
::SetStretchBltMode(TheHDC, HALFTONE);
|
||||
::StretchDIBits(TheHDC, aDX, aDY, aDWidth, aDHeight,aSX, srcy, aSWidth, aSHeight, mAlphaBits,
|
||||
(LPBITMAPINFO)&bmi, DIB_RGB_COLORS, SRCAND);
|
||||
rop = SRCPAINT;
|
||||
::SetStretchBltMode(TheHDC, saveMode);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -546,11 +549,8 @@ nsImageWin :: Draw(nsIRenderingContext &aContext, nsDrawingSurface aSurface,
|
||||
blendFunction.SourceConstantAlpha = 255;
|
||||
blendFunction.AlphaFormat = 1 /*AC_SRC_ALPHA*/;
|
||||
gAlphaBlend(TheHDC, aDX, aDY, aDWidth, aDHeight, srcDC, aSX, aSY, aSWidth, aSHeight, blendFunction);
|
||||
} else {
|
||||
int saveMode = ::GetStretchBltMode(TheHDC);
|
||||
::SetStretchBltMode(TheHDC, HALFTONE);
|
||||
} else {
|
||||
::StretchBlt(TheHDC, aDX, aDY, aDWidth, aDHeight, srcDC, aSX, aSY,aSWidth, aSHeight, rop);
|
||||
::SetStretchBltMode(TheHDC, saveMode);
|
||||
}
|
||||
}else{
|
||||
if (! didComposite)
|
||||
@@ -567,11 +567,8 @@ nsImageWin :: Draw(nsIRenderingContext &aContext, nsDrawingSurface aSurface,
|
||||
blendFunction.SourceConstantAlpha = 255;
|
||||
blendFunction.AlphaFormat = 1 /*AC_SRC_ALPHA*/;
|
||||
gAlphaBlend(TheHDC, aDX, aDY, aDWidth, aDHeight, srcDC, aSX, aSY, aSWidth, aSHeight, blendFunction);
|
||||
} else {
|
||||
int saveMode = ::GetStretchBltMode(TheHDC);
|
||||
::SetStretchBltMode(TheHDC, HALFTONE);
|
||||
} else {
|
||||
::StretchBlt(TheHDC,aDX,aDY,aDWidth,aDHeight,srcDC,aSX,aSY,aSWidth,aSHeight,rop);
|
||||
::SetStretchBltMode(TheHDC, saveMode);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -630,11 +627,8 @@ void nsImageWin::DrawComposited(HDC TheHDC, int aDX, int aDY, int aDWidth, int a
|
||||
DrawComposited24(screenBits, aSX, aSY, aSWidth, aSHeight);
|
||||
|
||||
/* Copy back to the HDC */
|
||||
int saveMode = ::GetStretchBltMode(TheHDC);
|
||||
::SetStretchBltMode(TheHDC, HALFTONE);
|
||||
::StretchBlt(TheHDC, aDX, aDY, aDWidth, aDHeight,
|
||||
memDC, 0, 0, aSWidth, aSHeight, SRCCOPY);
|
||||
::SetStretchBltMode(TheHDC, saveMode);
|
||||
|
||||
::SelectObject(memDC, oldBitmap);
|
||||
::DeleteObject(tmpBitmap);
|
||||
|
||||
@@ -445,7 +445,15 @@ nsresult nsRenderingContextWin :: SetupDC(HDC aOldDC, HDC aNewDC)
|
||||
mCurrTextColor = mCurrentColor;
|
||||
::SetBkMode(aNewDC, TRANSPARENT);
|
||||
::SetPolyFillMode(aNewDC, WINDING);
|
||||
::SetStretchBltMode(aNewDC, HALFTONE);
|
||||
// Temporary fix for bug 135226 until we do better decode-time
|
||||
// dithering and paletized storage of images.
|
||||
nsPaletteInfo palInfo;
|
||||
mContext->GetPaletteInfo(palInfo);
|
||||
if (palInfo.isPaletteDevice)
|
||||
::SetStretchBltMode(aNewDC, HALFTONE);
|
||||
else
|
||||
::SetStretchBltMode(aNewDC, COLORONCOLOR);
|
||||
|
||||
::SetTextAlign(aNewDC, TA_BASELINE);
|
||||
|
||||
if (nsnull != aOldDC)
|
||||
@@ -482,9 +490,6 @@ nsresult nsRenderingContextWin :: SetupDC(HDC aOldDC, HDC aNewDC)
|
||||
#endif
|
||||
|
||||
// If this is a palette device, then select and realize the palette
|
||||
nsPaletteInfo palInfo;
|
||||
mContext->GetPaletteInfo(palInfo);
|
||||
|
||||
if (palInfo.isPaletteDevice && palInfo.palette)
|
||||
{
|
||||
// Select the palette in the background
|
||||
@@ -539,6 +544,7 @@ NS_IMETHODIMP nsRenderingContextWin :: LockDrawingSurface(PRInt32 aX, PRInt32 aY
|
||||
if(palInfo.isPaletteDevice && palInfo.palette){
|
||||
::SelectPalette(mDC,(HPALETTE)palInfo.palette,PR_TRUE);
|
||||
::RealizePalette(mDC);
|
||||
::UpdateColors(mDC);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2636,6 +2642,7 @@ NS_IMETHODIMP nsRenderingContextWin :: CopyOffScreenBits(nsDrawingSurface aSrcSu
|
||||
if (palInfo.isPaletteDevice && palInfo.palette){
|
||||
::SelectPalette(destdc, (HPALETTE)palInfo.palette, PR_TRUE);
|
||||
::RealizePalette(destdc);
|
||||
::UpdateColors(mDC);
|
||||
}
|
||||
|
||||
if (aCopyFlags & NS_COPYBITS_XFORM_SOURCE_VALUES)
|
||||
|
||||
Reference in New Issue
Block a user