Vincent Povirk : gdiplus: Clip metafile drawing to destination points.
Alexandre Julliard
julliard at winehq.org
Sun Jul 3 12:18:28 CDT 2016
Module: wine
Branch: master
Commit: 10516308a8d018e6016431d069f38b9ad292afd3
URL: http://source.winehq.org/git/wine.git/?a=commit;h=10516308a8d018e6016431d069f38b9ad292afd3
Author: Vincent Povirk <vincent at codeweavers.com>
Date: Fri Jun 24 12:51:40 2016 -0500
gdiplus: Clip metafile drawing to destination points.
Signed-off-by: Vincent Povirk <vincent at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/gdiplus/gdiplus_private.h | 1 +
dlls/gdiplus/metafile.c | 46 ++++++++++++++++++++++++++++++++++++++++++
2 files changed, 47 insertions(+)
diff --git a/dlls/gdiplus/gdiplus_private.h b/dlls/gdiplus/gdiplus_private.h
index 22478a3..8924ae6 100644
--- a/dlls/gdiplus/gdiplus_private.h
+++ b/dlls/gdiplus/gdiplus_private.h
@@ -358,6 +358,7 @@ struct GpMetafile{
GpMatrix *world_transform;
GpUnit page_unit;
REAL page_scale;
+ GpRegion *base_clip; /* clip region in device space for all metafile output */
};
struct GpBitmap{
diff --git a/dlls/gdiplus/metafile.c b/dlls/gdiplus/metafile.c
index ee16d8e..ca8aac4 100644
--- a/dlls/gdiplus/metafile.c
+++ b/dlls/gdiplus/metafile.c
@@ -591,6 +591,11 @@ static void METAFILE_PlaybackReleaseDC(GpMetafile *metafile)
}
}
+static GpStatus METAFILE_PlaybackUpdateClip(GpMetafile *metafile)
+{
+ return GdipCombineRegionRegion(metafile->playback_graphics->clip, metafile->base_clip, CombineModeReplace);
+}
+
static GpStatus METAFILE_PlaybackUpdateWorldTransform(GpMetafile *metafile)
{
GpMatrix *real_transform;
@@ -822,6 +827,7 @@ GpStatus WINGDIPAPI GdipEnumerateMetafileSrcRectDestPoints(GpGraphics *graphics,
GpStatus stat;
GpMetafile *real_metafile = (GpMetafile*)metafile; /* whoever made this const was joking */
GraphicsContainer state;
+ GpPath *dst_path;
TRACE("(%p,%p,%p,%i,%p,%i,%p,%p,%p)\n", graphics, metafile,
destPoints, count, srcRect, srcUnit, callback, callbackData,
@@ -862,6 +868,38 @@ GpStatus WINGDIPAPI GdipEnumerateMetafileSrcRectDestPoints(GpGraphics *graphics,
stat = GdipSetPageUnit(graphics, UnitPixel);
if (stat == Ok)
+ stat = GdipResetWorldTransform(graphics);
+
+ if (stat == Ok)
+ stat = GdipCreateRegion(&real_metafile->base_clip);
+
+ if (stat == Ok)
+ stat = GdipGetClip(graphics, real_metafile->base_clip);
+
+ if (stat == Ok)
+ stat = GdipCreatePath(FillModeAlternate, &dst_path);
+
+ if (stat == Ok)
+ {
+ GpPointF clip_points[4];
+
+ clip_points[0] = real_metafile->playback_points[0];
+ clip_points[1] = real_metafile->playback_points[1];
+ clip_points[2].X = real_metafile->playback_points[1].X + real_metafile->playback_points[2].X
+ - real_metafile->playback_points[0].X;
+ clip_points[2].Y = real_metafile->playback_points[1].Y + real_metafile->playback_points[2].Y
+ - real_metafile->playback_points[0].Y;
+ clip_points[3] = real_metafile->playback_points[2];
+
+ stat = GdipAddPathPolygon(dst_path, clip_points, 4);
+
+ if (stat == Ok)
+ stat = GdipCombineRegionPath(real_metafile->base_clip, dst_path, CombineModeIntersect);
+
+ GdipDeletePath(dst_path);
+ }
+
+ if (stat == Ok)
stat = GdipCreateMatrix(&real_metafile->world_transform);
if (stat == Ok)
@@ -871,6 +909,11 @@ GpStatus WINGDIPAPI GdipEnumerateMetafileSrcRectDestPoints(GpGraphics *graphics,
stat = METAFILE_PlaybackUpdateWorldTransform(real_metafile);
}
+ if (stat == Ok)
+ {
+ stat = METAFILE_PlaybackUpdateClip(real_metafile);
+ }
+
if (stat == Ok && (metafile->metafile_type == MetafileTypeEmf ||
metafile->metafile_type == MetafileTypeWmfPlaceable ||
metafile->metafile_type == MetafileTypeWmf))
@@ -884,6 +927,9 @@ GpStatus WINGDIPAPI GdipEnumerateMetafileSrcRectDestPoints(GpGraphics *graphics,
GdipDeleteMatrix(real_metafile->world_transform);
real_metafile->world_transform = NULL;
+ GdipDeleteRegion(real_metafile->base_clip);
+ real_metafile->base_clip = NULL;
+
GdipEndContainer(graphics, state);
}
More information about the wine-cvs
mailing list