Changed CopyOffScreenBits() to make sure the logical palette is selected

into the screen DC.
This commit is contained in:
troy%netscape.com 1998-08-19 04:41:48 +00:00
parent 5010d6fb70
commit c54b90eb68

View File

@ -1216,7 +1216,18 @@ nsresult nsRenderingContextWin :: CopyOffScreenBits(nsRect &aBounds)
::SelectClipRgn(mMainDC, NULL);
#endif
// If there's a palette make sure it's selected.
// XXX This doesn't seem like the best place to be doing this...
nsPaletteInfo palInfo;
HPALETTE oldPalette;
mContext->GetPaletteInfo(palInfo);
if (palInfo.isPaletteDevice && palInfo.palette) {
oldPalette = ::SelectPalette(mMainDC, (HPALETTE)palInfo.palette, TRUE);
}
::BitBlt(mMainDC, 0, 0, aBounds.width, aBounds.height, mDC, 0, 0, SRCCOPY);
if (palInfo.isPaletteDevice && palInfo.palette) {
::SelectPalette(mMainDC, oldPalette, TRUE);
}
}
else
NS_ASSERTION(0, "attempt to blit with bad DCs");