https://bugs.winehq.org/show_bug.cgi?id=36891
Bug ID: 36891 Summary: Polygon() draws different edges than in Windows Product: Wine Version: 1.7.22 Hardware: x86 OS: Linux Status: UNCONFIRMED Severity: minor Priority: P2 Component: gdi32 Assignee: wine-bugs@winehq.org Reporter: sashoalm@gmail.com
The Polygon() function does not draw in the same way in Wine as in Windows. While it looks very similar visually, there are some pixels at the edges that are different. Since the goal of Wine is to replicate Windows behavior perfectly, this deviation would be a bug.
The difference is difficult to spot, but it can be noticed if you rapidly switch between the images, or if you compare them pixel by pixel with a program.
I have made a test program that draws an inclined rectangle using XFORM and Polygon() into a memory DC, which I then save to a bitmap. The resulting bitmaps when ran under Windows and Wine are slightly different.
Image under Windows: https://drive.google.com/file/d/0B9PGUhmmnsm1Q00waFJLSGtEeEU/edit?usp=sharin... Image under Wine: https://drive.google.com/file/d/0B9PGUhmmnsm1X1ZVR1UtbDBPMHc/edit?usp=sharin...
This is the relevant code I used to draw the image. Note that it's the XFORM matrix that makes the rectangle be inclined (it would be parallel to the coordinate system without a world-transform):
XFORM xform; memset(&xform, 0, sizeof(xform)); double angle = 15*(PI/180); // 15 degrees incline. xform.eM11 = cos(angle); xform.eM12 = sin(angle); xform.eM21 = -sin(angle); xform.eM22 = cos(angle); xform.eDx = 0; xform.eDy = 0; SetGraphicsMode(hdc, GM_ADVANCED); SetWorldTransform(hdc, &xform);
HBRUSH hbr = CreateHatchBrush(HS_BDIAGONAL, RGB(255, 0, 0)); SelectObject(hdc, hbr); POINT p[4]={100,0,200,0,200,100,100,100}; Polygon(hdc, p, 4);
I can provide the full test project if requested.
Note: I have tested on both Windows 7 and Windows XP, and they produce exactly the same images, only Wine produces a different image.