Commit c3e8af41 authored by Evan Stade's avatar Evan Stade Committed by Alexandre Julliard

gdiplus: Use world transform when drawing points.

parent f30732fd
...@@ -83,9 +83,10 @@ static BYTE convert_path_point_type(BYTE type) ...@@ -83,9 +83,10 @@ static BYTE convert_path_point_type(BYTE type)
* gdi to draw, and these functions would irreparably mess with line widths. * gdi to draw, and these functions would irreparably mess with line widths.
*/ */
static void transform_and_round_points(GpGraphics *graphics, POINT *pti, static void transform_and_round_points(GpGraphics *graphics, POINT *pti,
GDIPCONST GpPointF *ptf, INT count) GpPointF *ptf, INT count)
{ {
REAL unitscale; REAL unitscale;
GpMatrix *matrix;
int i; int i;
switch(graphics->unit) switch(graphics->unit)
...@@ -113,9 +114,13 @@ static void transform_and_round_points(GpGraphics *graphics, POINT *pti, ...@@ -113,9 +114,13 @@ static void transform_and_round_points(GpGraphics *graphics, POINT *pti,
if(graphics->unit != UnitDisplay) if(graphics->unit != UnitDisplay)
unitscale *= graphics->scale; unitscale *= graphics->scale;
GdipCloneMatrix(graphics->worldtrans, &matrix);
GdipScaleMatrix(matrix, unitscale, unitscale, MatrixOrderAppend);
GdipTransformMatrixPoints(matrix, ptf, count);
for(i = 0; i < count; i++){ for(i = 0; i < count; i++){
pti[i].x = roundr(unitscale * ptf[i].X); pti[i].x = roundr(ptf[i].X);
pti[i].y = roundr(unitscale * ptf[i].Y); pti[i].y = roundr(ptf[i].Y);
} }
} }
...@@ -431,9 +436,9 @@ static GpStatus draw_polyline(GpGraphics *graphics, GpPen *pen, ...@@ -431,9 +436,9 @@ static GpStatus draw_polyline(GpGraphics *graphics, GpPen *pen,
goto end; goto end;
} }
if(caps){ memcpy(ptcopy, pt, count * sizeof(GpPointF));
memcpy(ptcopy, pt, count * sizeof(GpPointF));
if(caps){
if(pen->endcap == LineCapArrowAnchor) if(pen->endcap == LineCapArrowAnchor)
shorten_line_amt(ptcopy[count-2].X, ptcopy[count-2].Y, shorten_line_amt(ptcopy[count-2].X, ptcopy[count-2].Y,
&ptcopy[count-1].X, &ptcopy[count-1].Y, pen->width); &ptcopy[count-1].X, &ptcopy[count-1].Y, pen->width);
...@@ -454,11 +459,9 @@ static GpStatus draw_polyline(GpGraphics *graphics, GpPen *pen, ...@@ -454,11 +459,9 @@ static GpStatus draw_polyline(GpGraphics *graphics, GpPen *pen,
pt[count - 2].X, pt[count - 2].Y, pt[count - 1].X, pt[count - 1].Y); pt[count - 2].X, pt[count - 2].Y, pt[count - 1].X, pt[count - 1].Y);
draw_cap(graphics, pen->brush->lb.lbColor, pen->startcap, pen->width, pen->customstart, draw_cap(graphics, pen->brush->lb.lbColor, pen->startcap, pen->width, pen->customstart,
pt[1].X, pt[1].Y, pt[0].X, pt[0].Y);\ pt[1].X, pt[1].Y, pt[0].X, pt[0].Y);\
transform_and_round_points(graphics, pti, ptcopy, count);
} }
else
transform_and_round_points(graphics, pti, pt, count); transform_and_round_points(graphics, pti, ptcopy, count);
Polyline(graphics->hdc, pti, count); Polyline(graphics->hdc, pti, count);
...@@ -533,9 +536,9 @@ static GpStatus draw_polybezier(GpGraphics *graphics, GpPen *pen, ...@@ -533,9 +536,9 @@ static GpStatus draw_polybezier(GpGraphics *graphics, GpPen *pen,
goto end; goto end;
} }
if(caps){ memcpy(ptcopy, pt, count * sizeof(GpPointF));
memcpy(ptcopy, pt, count * sizeof(GpPointF));
if(caps){
if(pen->endcap == LineCapArrowAnchor) if(pen->endcap == LineCapArrowAnchor)
shorten_bezier_amt(&ptcopy[count-4], pen->width, FALSE); shorten_bezier_amt(&ptcopy[count-4], pen->width, FALSE);
/* FIXME The following is seemingly correct only for baseinset < 0 or /* FIXME The following is seemingly correct only for baseinset < 0 or
...@@ -574,11 +577,9 @@ static GpStatus draw_polybezier(GpGraphics *graphics, GpPen *pen, ...@@ -574,11 +577,9 @@ static GpStatus draw_polybezier(GpGraphics *graphics, GpPen *pen,
draw_cap(graphics, pen->brush->lb.lbColor, pen->startcap, pen->width, pen->customstart, draw_cap(graphics, pen->brush->lb.lbColor, pen->startcap, pen->width, pen->customstart,
pt[0].X - (ptcopy[0].X - ptcopy[1].X), pt[0].X - (ptcopy[0].X - ptcopy[1].X),
pt[0].Y - (ptcopy[0].Y - ptcopy[1].Y), pt[0].X, pt[0].Y); pt[0].Y - (ptcopy[0].Y - ptcopy[1].Y), pt[0].X, pt[0].Y);
transform_and_round_points(graphics, pti, ptcopy, count);
} }
else
transform_and_round_points(graphics, pti, pt, count); transform_and_round_points(graphics, pti, ptcopy, count);
PolyBezier(graphics->hdc, pti, count); PolyBezier(graphics->hdc, pti, count);
...@@ -622,11 +623,11 @@ static GpStatus draw_poly(GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF * ...@@ -622,11 +623,11 @@ static GpStatus draw_poly(GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *
} }
} }
memcpy(ptcopy, pt, count * sizeof(GpPointF));
/* If we are drawing caps, go through the points and adjust them accordingly, /* If we are drawing caps, go through the points and adjust them accordingly,
* and draw the caps. */ * and draw the caps. */
if(caps){ if(caps){
memcpy(ptcopy, pt, count * sizeof(GpPointF));
switch(types[count - 1] & PathPointTypePathTypeMask){ switch(types[count - 1] & PathPointTypePathTypeMask){
case PathPointTypeBezier: case PathPointTypeBezier:
if(pen->endcap == LineCapArrowAnchor) if(pen->endcap == LineCapArrowAnchor)
...@@ -711,10 +712,9 @@ static GpStatus draw_poly(GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF * ...@@ -711,10 +712,9 @@ static GpStatus draw_poly(GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *
ERR("Bad path points\n"); ERR("Bad path points\n");
goto end; goto end;
} }
transform_and_round_points(graphics, pti, ptcopy, count);
} }
else
transform_and_round_points(graphics, pti, pt, count); transform_and_round_points(graphics, pti, ptcopy, count);
for(i = 0; i < count; i++){ for(i = 0; i < count; i++){
tp[i] = convert_path_point_type(types[i]); tp[i] = convert_path_point_type(types[i]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment