The X11 protocol does not specify how lines must be drawn when they have zero width. On some implementations (particularly, Xorg), drawing a rectangle with zero width results in the bottom right pixel not being drawn. Setting line width to 1 in this case is properly specified and results in the bottom right pixel being correctly drawn.
Signed-off-by: Giovanni Mascellani gmascellani@codeweavers.com --- dlls/user32/tests/win.c | 24 ++++++++++++------------ dlls/winex11.drv/graphics.c | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c index 30514a05234..a61c50b9b5a 100644 --- a/dlls/user32/tests/win.c +++ b/dlls/user32/tests/win.c @@ -12868,8 +12868,8 @@ static void test_surface_composition(void) flush_events( TRUE );
paint_client_rect(hwnd, BGRA2RGB(COLOR1)); - check_client_surface(hwnd, painted_surface, sizeof(painted_surface), TRUE); - check_screen_surface(hwnd, painted_surface, sizeof(painted_surface), TRUE); + check_client_surface(hwnd, painted_surface, sizeof(painted_surface), FALSE); + check_screen_surface(hwnd, painted_surface, sizeof(painted_surface), FALSE);
paint_d3d9_client_rect(d3d9_ctx1, COLOR2); check_client_surface(hwnd, painted_surface2, sizeof(painted_surface2), TRUE); @@ -12880,16 +12880,16 @@ static void test_surface_composition(void) check_screen_surface(hwnd, painted_surface3, sizeof(painted_surface3), FALSE);
paint_client_rect(hwnd, BGRA2RGB(COLOR4)); - check_client_surface(hwnd, painted_surface4, sizeof(painted_surface4), TRUE); - check_screen_surface(hwnd, painted_surface4, sizeof(painted_surface4), TRUE); + check_client_surface(hwnd, painted_surface4, sizeof(painted_surface4), FALSE); + check_screen_surface(hwnd, painted_surface4, sizeof(painted_surface4), FALSE);
gl_ctx1 = create_gl_context(hwnd); gl_ctx2 = create_gl_context(hwnd); flush_events( TRUE );
paint_client_rect(hwnd, BGRA2RGB(COLOR1)); - check_client_surface(hwnd, painted_surface, sizeof(painted_surface), TRUE); - check_screen_surface(hwnd, painted_surface, sizeof(painted_surface), TRUE); + check_client_surface(hwnd, painted_surface, sizeof(painted_surface), FALSE); + check_screen_surface(hwnd, painted_surface, sizeof(painted_surface), FALSE);
paint_gl_client_rect(gl_ctx1, COLOR2); check_client_surface(hwnd, painted_surface2, sizeof(painted_surface2), TRUE); @@ -12908,8 +12908,8 @@ static void test_surface_composition(void) check_screen_surface(hwnd, painted_surface2, sizeof(painted_surface2), TRUE);
paint_client_rect(hwnd, BGRA2RGB(COLOR1)); - check_client_surface(hwnd, painted_surface, sizeof(painted_surface), TRUE); - check_screen_surface(hwnd, painted_surface, sizeof(painted_surface), TRUE); + check_client_surface(hwnd, painted_surface, sizeof(painted_surface), FALSE); + check_screen_surface(hwnd, painted_surface, sizeof(painted_surface), FALSE);
paint_d3d9_client_rect(d3d9_ctx2, COLOR3); check_client_surface(hwnd, painted_surface3, sizeof(painted_surface3), TRUE); @@ -12940,7 +12940,7 @@ static void test_surface_composition(void) ShowWindow(hwnd, SW_SHOW); flush_events( TRUE ); paint_client_rect(hwnd, BGRA2RGB(COLOR1)); - check_client_surface(hwnd, painted_surface, sizeof(painted_surface), TRUE); + check_client_surface(hwnd, painted_surface, sizeof(painted_surface), FALSE); check_screen_surface(hwnd, layered_const_surface, sizeof(layered_const_surface), TRUE);
paint_d3d9_client_rect(d3d9_ctx1, COLOR2); @@ -12952,14 +12952,14 @@ static void test_surface_composition(void) check_screen_surface(hwnd, layered_const_surface3, sizeof(layered_const_surface3), TRUE);
paint_client_rect(hwnd, BGRA2RGB(COLOR4)); - check_client_surface(hwnd, painted_surface4, sizeof(painted_surface4), TRUE); + check_client_surface(hwnd, painted_surface4, sizeof(painted_surface4), FALSE); check_screen_surface(hwnd, layered_const_surface4, sizeof(layered_const_surface4), TRUE);
gl_ctx1 = create_gl_context(hwnd); gl_ctx2 = create_gl_context(hwnd); flush_events( TRUE ); paint_client_rect(hwnd, BGRA2RGB(COLOR1)); - check_client_surface(hwnd, painted_surface, sizeof(painted_surface), TRUE); + check_client_surface(hwnd, painted_surface, sizeof(painted_surface), FALSE); check_screen_surface(hwnd, layered_const_surface, sizeof(layered_const_surface), TRUE);
paint_gl_client_rect(gl_ctx1, COLOR2); @@ -12975,7 +12975,7 @@ static void test_surface_composition(void) check_screen_surface(hwnd, layered_const_surface4, sizeof(layered_const_surface4), TRUE);
paint_client_rect(hwnd, BGRA2RGB(COLOR2)); - check_client_surface(hwnd, painted_surface2, sizeof(painted_surface2), TRUE); + check_client_surface(hwnd, painted_surface2, sizeof(painted_surface2), FALSE); check_screen_surface(hwnd, layered_const_surface2, sizeof(layered_const_surface2), TRUE);
paint_d3d9_client_rect(d3d9_ctx2, COLOR1); diff --git a/dlls/winex11.drv/graphics.c b/dlls/winex11.drv/graphics.c index 77ca60ec44d..f16db5d16d6 100644 --- a/dlls/winex11.drv/graphics.c +++ b/dlls/winex11.drv/graphics.c @@ -794,7 +794,7 @@ BOOL CDECL X11DRV_Rectangle(PHYSDEV dev, INT left, INT top, INT right, INT botto rc.top += width / 2; rc.bottom -= (width - 1) / 2; } - if(width == 1) width = 0; + if (!width) width = 1; physDev->pen.width = width; oldjoinstyle = physDev->pen.linejoin; if(physDev->pen.type != PS_GEOMETRIC)