[5/14] gdiplus: use world transform
Evan Stade
estade at gmail.com
Tue Jul 24 19:18:50 CDT 2007
Hi,
changelog:
*use world transform when drawing points
*rearrange some things so that transform_and_round_points can
transform the points it's given (const issues)
dlls/gdiplus/graphics.c | 40 ++++++++++++++++++++--------------------
1 files changed, 20 insertions(+), 20 deletions(-)
--
Evan Stade
-------------- next part --------------
diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c
index 9daf092..6f022a1 100644
--- a/dlls/gdiplus/graphics.c
+++ b/dlls/gdiplus/graphics.c
@@ -83,9 +83,10 @@ static BYTE convert_path_point_type(BYTE
* gdi to draw, and these functions would irreparably mess with line widths.
*/
static void transform_and_round_points(GpGraphics *graphics, POINT *pti,
- GDIPCONST GpPointF *ptf, INT count)
+ GpPointF *ptf, INT count)
{
REAL unitscale;
+ GpMatrix *matrix;
int i;
switch(graphics->unit)
@@ -113,9 +114,13 @@ static void transform_and_round_points(G
if(graphics->unit != UnitDisplay)
unitscale *= graphics->scale;
+ GdipCloneMatrix(graphics->worldtrans, &matrix);
+ GdipScaleMatrix(matrix, unitscale, unitscale, MatrixOrderAppend);
+ GdipTransformMatrixPoints(matrix, ptf, count);
+
for(i = 0; i < count; i++){
- pti[i].x = roundr(unitscale * ptf[i].X);
- pti[i].y = roundr(unitscale * ptf[i].Y);
+ pti[i].x = roundr(ptf[i].X);
+ pti[i].y = roundr(ptf[i].Y);
}
}
@@ -431,9 +436,9 @@ static GpStatus draw_polyline(GpGraphics
goto end;
}
- if(caps){
- memcpy(ptcopy, pt, count * sizeof(GpPointF));
+ memcpy(ptcopy, pt, count * sizeof(GpPointF));
+ if(caps){
if(pen->endcap == LineCapArrowAnchor)
shorten_line_amt(ptcopy[count-2].X, ptcopy[count-2].Y,
&ptcopy[count-1].X, &ptcopy[count-1].Y, pen->width);
@@ -454,11 +459,9 @@ static GpStatus draw_polyline(GpGraphics
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,
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);
@@ -533,9 +536,9 @@ static GpStatus draw_polybezier(GpGraphi
goto end;
}
- if(caps){
- memcpy(ptcopy, pt, count * sizeof(GpPointF));
+ memcpy(ptcopy, pt, count * sizeof(GpPointF));
+ if(caps){
if(pen->endcap == LineCapArrowAnchor)
shorten_bezier_amt(&ptcopy[count-4], pen->width, FALSE);
/* FIXME The following is seemingly correct only for baseinset < 0 or
@@ -574,11 +577,9 @@ static GpStatus draw_polybezier(GpGraphi
draw_cap(graphics, pen->brush->lb.lbColor, pen->startcap, pen->width, pen->customstart,
pt[0].X - (ptcopy[0].X - ptcopy[1].X),
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);
@@ -622,11 +623,11 @@ static GpStatus draw_poly(GpGraphics *gr
}
}
+ memcpy(ptcopy, pt, count * sizeof(GpPointF));
+
/* If we are drawing caps, go through the points and adjust them accordingly,
* and draw the caps. */
if(caps){
- memcpy(ptcopy, pt, count * sizeof(GpPointF));
-
switch(types[count - 1] & PathPointTypePathTypeMask){
case PathPointTypeBezier:
if(pen->endcap == LineCapArrowAnchor)
@@ -711,10 +712,9 @@ static GpStatus draw_poly(GpGraphics *gr
ERR("Bad path points\n");
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++){
tp[i] = convert_path_point_type(types[i]);
--
1.4.1
More information about the wine-patches
mailing list