From 4caf574c569d7c39e44b8ad66b16417ad8653b34 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Tue, 13 Nov 2018 16:34:24 +0100 Subject: Bug 696569: Get rid of drop shadow and use black background when inverted. --- platform/x11/win_main.c | 28 ++++++++++------------------ platform/x11/x11_main.c | 15 ++++----------- 2 files changed, 14 insertions(+), 29 deletions(-) diff --git a/platform/x11/win_main.c b/platform/x11/win_main.c index 9afd2d06..b9d52a7b 100644 --- a/platform/x11/win_main.c +++ b/platform/x11/win_main.c @@ -33,7 +33,6 @@ static HWND hwndframe = NULL; static HWND hwndview = NULL; static HDC hdc; static HBRUSH bgbrush; -static HBRUSH shbrush; static BITMAPINFO *dibinf = NULL; static HCURSOR arrowcurs, handcurs, waitcurs, caretcurs; static LRESULT CALLBACK frameproc(HWND, UINT, WPARAM, LPARAM); @@ -664,7 +663,6 @@ void winopen() /* And a background color */ bgbrush = CreateSolidBrush(RGB(0x70,0x70,0x70)); - shbrush = CreateSolidBrush(RGB(0x40,0x40,0x40)); /* Init DIB info for buffer */ dibinf = malloc(sizeof(BITMAPINFO) + 12); @@ -801,6 +799,7 @@ void winblit() int x1 = gapp.panx + image_w; int y1 = gapp.pany + image_h; RECT r; + HBRUSH brush; if (gapp.image) { @@ -851,29 +850,22 @@ void winblit() } } + if (gapp.invert) + brush = (HBRUSH)GetStockObject(BLACK_BRUSH); + else + brush = bgbrush; + /* Grey background */ r.top = 0; r.bottom = gapp.winh; r.left = 0; r.right = x0; - FillRect(hdc, &r, bgbrush); + FillRect(hdc, &r, brush); r.left = x1; r.right = gapp.winw; - FillRect(hdc, &r, bgbrush); + FillRect(hdc, &r, brush); r.left = 0; r.right = gapp.winw; r.top = 0; r.bottom = y0; - FillRect(hdc, &r, bgbrush); + FillRect(hdc, &r, brush); r.top = y1; r.bottom = gapp.winh; - FillRect(hdc, &r, bgbrush); - - /* Drop shadow */ - r.left = x0 + 2; - r.right = x1 + 2; - r.top = y1; - r.bottom = y1 + 2; - FillRect(hdc, &r, shbrush); - r.left = x1; - r.right = x1 + 2; - r.top = y0 + 2; - r.bottom = y1; - FillRect(hdc, &r, shbrush); + FillRect(hdc, &r, brush); winblitsearch(); } diff --git a/platform/x11/x11_main.c b/platform/x11/x11_main.c index 49156578..f25b8365 100644 --- a/platform/x11/x11_main.c +++ b/platform/x11/x11_main.c @@ -92,7 +92,6 @@ static int transition_dirty = 0; static int dirtysearch = 0; static char *password = ""; static XColor xbgcolor; -static XColor xshcolor; static int reqw = 0; static int reqh = 0; static char copylatin1[1024 * 16] = ""; @@ -226,12 +225,7 @@ static void winopen(void) xbgcolor.green = 0x7000; xbgcolor.blue = 0x7000; - xshcolor.red = 0x4000; - xshcolor.green = 0x4000; - xshcolor.blue = 0x4000; - XAllocColor(xdpy, DefaultColormap(xdpy, xscr), &xbgcolor); - XAllocColor(xdpy, DefaultColormap(xdpy, xscr), &xshcolor); xwin = XCreateWindow(xdpy, DefaultRootWindow(xdpy), 10, 10, 200, 100, 0, @@ -527,16 +521,15 @@ static void winblit(pdfapp_t *app) int x1 = gapp.panx + image_w; int y1 = gapp.pany + image_h; - XSetForeground(xdpy, xgc, xbgcolor.pixel); + if (app->invert) + XSetForeground(xdpy, xgc, BlackPixel(xdpy, DefaultScreen(xdpy))); + else + XSetForeground(xdpy, xgc, xbgcolor.pixel); fillrect(0, 0, x0, gapp.winh); fillrect(x1, 0, gapp.winw - x1, gapp.winh); fillrect(0, 0, gapp.winw, y0); fillrect(0, y1, gapp.winw, gapp.winh - y1); - XSetForeground(xdpy, xgc, xshcolor.pixel); - fillrect(x0+2, y1, image_w, 2); - fillrect(x1, y0+2, 2, image_h); - if (gapp.iscopying || justcopied) { pdfapp_invert(&gapp, gapp.selr); -- cgit v1.2.3