mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-02 09:52:27 -04:00
fix issues with active_img
This commit is contained in:
parent
4a380d4208
commit
6e8cedfcfb
@ -687,23 +687,23 @@ paint_window(HDC dc) {
|
||||
FillRect(bdc, &rect, (HBRUSH)GetStockObject(WHITE_BRUSH));
|
||||
|
||||
// Then paint the background image on top of that.
|
||||
paint_image(bdc, _background_image);
|
||||
paint_image(bdc, _background_image, false);
|
||||
|
||||
// And then, paint the button, if any, on top of *that*.
|
||||
switch (_drawn_bstate) {
|
||||
case BS_hidden:
|
||||
break;
|
||||
case BS_ready:
|
||||
paint_image(bdc, _button_ready_image);
|
||||
paint_image(bdc, _button_ready_image, true);
|
||||
break;
|
||||
case BS_rollover:
|
||||
if (!paint_image(bdc, _button_rollover_image)) {
|
||||
paint_image(bdc, _button_ready_image);
|
||||
if (!paint_image(bdc, _button_rollover_image, true)) {
|
||||
paint_image(bdc, _button_ready_image, true);
|
||||
}
|
||||
break;
|
||||
case BS_click:
|
||||
if (!paint_image(bdc, _button_click_image)) {
|
||||
paint_image(bdc, _button_ready_image);
|
||||
if (!paint_image(bdc, _button_click_image, true)) {
|
||||
paint_image(bdc, _button_ready_image, true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -729,7 +729,7 @@ paint_window(HDC dc) {
|
||||
// is not defined.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
bool P3DWinSplashWindow::
|
||||
paint_image(HDC dc, const WinImageData &image) {
|
||||
paint_image(HDC dc, const WinImageData &image, bool use_alpha) {
|
||||
if (image._bitmap == NULL) {
|
||||
return false;
|
||||
}
|
||||
@ -755,9 +755,14 @@ paint_image(HDC dc, const WinImageData &image) {
|
||||
int p_x = win_cx - image._width / 2;
|
||||
int p_y = win_cy - image._height / 2;
|
||||
|
||||
if (!use_alpha) {
|
||||
BitBlt(dc, p_x, p_y, image._width, image._height,
|
||||
mem_dc, 0, 0, SRCCOPY);
|
||||
} else {
|
||||
AlphaBlend(dc, p_x, p_y, image._width, image._height,
|
||||
mem_dc, 0, 0, image._width, image._height,
|
||||
bf);
|
||||
}
|
||||
|
||||
} else {
|
||||
// The bitmap is larger than the window; scale it down.
|
||||
@ -770,10 +775,21 @@ paint_image(HDC dc, const WinImageData &image) {
|
||||
int p_x = win_cx - sc_width / 2;
|
||||
int p_y = win_cy - sc_height / 2;
|
||||
|
||||
if (!use_alpha) {
|
||||
StretchBlt(dc, p_x, p_y, sc_width, sc_height,
|
||||
mem_dc, 0, 0, image._width, image._height, SRCCOPY);
|
||||
} else {
|
||||
// For some reason, AlphaBlend has issues when scaling a
|
||||
// black-and-white image to draw onto the window: it draws the
|
||||
// image in the last fill color used on the dc, instead of
|
||||
// black. This only happens when the image consists only of
|
||||
// black and white, and only when the image is being scaled.
|
||||
// Weird. But StretchBlt, above, doesn't have this problem.
|
||||
AlphaBlend(dc, p_x, p_y, sc_width, sc_height,
|
||||
mem_dc, 0, 0, image._width, image._height,
|
||||
bf);
|
||||
}
|
||||
}
|
||||
|
||||
SelectObject(mem_dc, NULL);
|
||||
DeleteDC(mem_dc);
|
||||
|
@ -65,7 +65,7 @@ private:
|
||||
void close_window();
|
||||
|
||||
void paint_window(HDC dc);
|
||||
bool paint_image(HDC dc, const WinImageData &image);
|
||||
bool paint_image(HDC dc, const WinImageData &image, bool use_alpha);
|
||||
void paint_progress_bar(HDC dc);
|
||||
LONG window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
|
||||
static LONG WINAPI st_window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
|
||||
|
Loading…
x
Reference in New Issue
Block a user