summaryrefslogtreecommitdiff
path: root/app/bin/cdraw.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2020-05-27 14:58:13 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2020-05-27 14:58:13 +0200
commit265d6934cd70a60228e7a11cfc000aff73dd4701 (patch)
tree610eb753fea70e7f407e751e22697fc8a1ec04bd /app/bin/cdraw.c
parentbd8c21a35fd05fcbdaa95e4c0b7c94c3b97507b6 (diff)
parent359b557176b9bb2ff1aed2082641eed39c358d0d (diff)
Update upstream source from tag 'upstream/5.1.2a'
Update to upstream version '5.1.2a' with Debian dir 4d0d8239e41bb5de5dc968c2a5c6eb9c140bb2f3
Diffstat (limited to 'app/bin/cdraw.c')
-rw-r--r--app/bin/cdraw.c51
1 files changed, 48 insertions, 3 deletions
diff --git a/app/bin/cdraw.c b/app/bin/cdraw.c
index a4a35bd..9bddcaf 100644
--- a/app/bin/cdraw.c
+++ b/app/bin/cdraw.c
@@ -171,8 +171,8 @@ static track_p MakeDrawFromSeg1(
if (xx->segs[0].type == SEG_POLY ||
xx->segs[0].type == SEG_FILPOLY) {
- xx->segs[0].u.p.pts = (coOrd*)MyMalloc( (sp->u.p.cnt) * sizeof *(coOrd*)NULL );
- memcpy(xx->segs[0].u.p.pts, sp->u.p.pts, sp->u.p.cnt * sizeof *(coOrd*)NULL);
+ xx->segs[0].u.p.pts = (coOrd*)MyMalloc( (sp->u.p.cnt) * sizeof (coOrd) );
+ memcpy(xx->segs[0].u.p.pts, sp->u.p.pts, sp->u.p.cnt * sizeof (coOrd) );
}
if (xx->segs[0].type == SEG_TEXT) {
xx->segs[0].u.t.string = MyStrdup(sp->u.t.string);
@@ -589,6 +589,12 @@ static void DrawDraw( track_p t, drawCmd_p d, wDrawColor color )
static void DeleteDraw( track_p t )
{
+ /* Get rid of points if specified */
+ struct extraData * xx = GetTrkExtraData(t);
+ if (xx->segs[0].type == SEG_POLY ||
+ xx->segs[0].type == SEG_FILPOLY) {
+ MyFree(xx->segs[0].u.p.pts);
+ }
}
@@ -753,6 +759,36 @@ static void FlipDraw(
ComputeDrawBoundingBox( trk );
}
+static BOOL_T StoreDraw(
+ track_p trk,
+ void **data,
+ long * len)
+{
+ struct extraData * xx = GetTrkExtraData(trk);
+ if (xx->segs[0].type == SEG_POLY ||
+ xx->segs[0].type == SEG_FILPOLY) {
+ *data = xx->segs[0].u.p.pts;
+ *len = xx->segs[0].u.p.cnt* sizeof (coOrd);
+ return TRUE;
+ }
+ return FALSE;
+}
+
+static BOOL_T ReplayDraw(
+ track_p trk,
+ void * data,
+ long len)
+{
+ struct extraData * xx = GetTrkExtraData(trk);
+ if (xx->segs[0].type == SEG_POLY ||
+ xx->segs[0].type == SEG_FILPOLY) {
+ xx->segs[0].u.p.pts = MyMalloc(len);
+ memcpy(xx->segs[0].u.p.pts,data,len);
+ return TRUE;
+ }
+ return FALSE;
+}
+
static trackCmd_t drawCmds = {
"DRAW",
@@ -779,7 +815,16 @@ static trackCmd_t drawCmds = {
NULL, /* moveEndPt */
NULL, /* query */
UngroupDraw,
- FlipDraw };
+ FlipDraw,
+ NULL,
+ NULL,
+ NULL,
+ NULL, /*Parallel*/
+ NULL,
+ NULL, /*MakeSegs*/
+ ReplayDraw,
+ StoreDraw
+ };
EXPORT BOOL_T OnTableEdgeEndPt( track_p trk, coOrd * pos )
{