зеркало из https://github.com/mozilla/gecko-dev.git
Changed palette code to get the palette from the device context
This commit is contained in:
Родитель
136f2cf7a8
Коммит
228d2f5af6
|
@ -30,7 +30,6 @@
|
|||
#include "nsGfxCIID.h"
|
||||
#include "resource.h"
|
||||
#include <commctrl.h>
|
||||
|
||||
#include "prtime.h"
|
||||
|
||||
BOOL nsWindow::sIsRegistered = FALSE;
|
||||
|
@ -1397,8 +1396,8 @@ void nsWindow::SetUpForPaint(HDC aHDC)
|
|||
//-------------------------------------------------------------------------
|
||||
PRBool nsWindow::ProcessMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT *aRetValue)
|
||||
{
|
||||
PRBool result = PR_FALSE; // call the default nsWindow proc
|
||||
|
||||
PRBool result = PR_FALSE; // call the default nsWindow proc
|
||||
nsPaletteInfo palInfo;
|
||||
|
||||
*aRetValue = 0;
|
||||
|
||||
|
@ -1637,45 +1636,38 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT
|
|||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_PALETTECHANGED:
|
||||
if ((HWND)wParam == mWnd) {
|
||||
// We caused the WM_PALETTECHANGED message so avoid realizing
|
||||
// another foreground palette
|
||||
result = PR_TRUE;
|
||||
break;
|
||||
}
|
||||
// fall thru...
|
||||
|
||||
case WM_QUERYNEWPALETTE:
|
||||
if (mPalette) {
|
||||
mContext->GetPaletteInfo(palInfo);
|
||||
if (palInfo.isPaletteDevice && palInfo.palette) {
|
||||
HDC hDC = ::GetDC(mWnd);
|
||||
HPALETTE hOldPal = ::SelectPalette(hDC, mPalette, 0);
|
||||
HPALETTE hOldPal = ::SelectPalette(hDC, (HPALETTE)palInfo.palette, FALSE);
|
||||
|
||||
// Realize the drawing palette
|
||||
int i = ::RealizePalette(hDC);
|
||||
|
||||
::SelectPalette(hDC, hOldPal, 0);
|
||||
::ReleaseDC(mWnd, hDC);
|
||||
// Did the realization change?
|
||||
if (i > 0) {
|
||||
// Yes, so repaint
|
||||
::InvalidateRect(mWnd, (LPRECT)NULL, TRUE);
|
||||
}
|
||||
|
||||
if (i) {
|
||||
::InvalidateRect(mWnd, (LPRECT)(NULL), 1);
|
||||
result = PR_TRUE;
|
||||
}
|
||||
else {
|
||||
result = PR_FALSE;
|
||||
}
|
||||
}
|
||||
else {
|
||||
result = PR_FALSE;
|
||||
::SelectPalette(hDC, hOldPal, TRUE);
|
||||
::RealizePalette(hDC);
|
||||
::ReleaseDC(mWnd, hDC);
|
||||
*aRetValue = (LRESULT)i;
|
||||
}
|
||||
result = PR_TRUE;
|
||||
break;
|
||||
case WM_PALETTECHANGED:
|
||||
if (mPalette && (HWND)wParam != mWnd) {
|
||||
HDC hDC = ::GetDC(mWnd);
|
||||
HPALETTE hOldPal = ::SelectPalette(hDC, mPalette, 0);
|
||||
|
||||
int i = ::RealizePalette(hDC);
|
||||
|
||||
if (i) {
|
||||
::InvalidateRect(mWnd, (LPRECT)(NULL), 1);
|
||||
}
|
||||
|
||||
::SelectPalette(hDC, hOldPal, 0);
|
||||
::ReleaseDC(mWnd, hDC);
|
||||
}
|
||||
result = PR_TRUE;
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
return result;
|
||||
|
|
Загрузка…
Ссылка в новой задаче