View Issue Details

IDProjectCategoryView StatusLast Update
0000918MetaPostGeneralpublic2015-10-22 11:04
ReporterGraham Douglas Assigned Toluigi scarso  
PrioritynormalSeveritytweakReproducibilityalways
Status assignedResolutionopen 
PlatformWindows OSWindows 7OS Version64-bit Ultimate
Summary0000918: [MPlib 1.801 and others?] mp_gr_copy_object(MP mp, mp_graphic_object*p) not copying all object properties?
DescriptionWhen using mp_gr_copy_object(MP mp, mp_graphic_object*p) to create a way to cache graphics produced by MPlib I noticed that the "deep copy" process does not appear to copy a number of object properties. mp_gr_copy_object(MP mp, mp_graphic_object*p) is located in psout.w/psout.c.

I made the adjustments noted in "Additional Information" in order to force copying object properties such as the line join, miterlimit, linecap and colour properties into the new object being copied.
Additional InformationApologies I don't use diff so I hope the simple commenting in the code below
(copied from mp_gr_copy_object(MP mp, mp_graphic_object*p)) will be enough to describe the issue and the fix that worked for me.

mp_graphic_object* mp_gr_copy_object(MP mp,mp_graphic_object*p)
{

.....

switch(gr_type(p)){
case mp_fill_code:
tf= (mp_fill_object*)mp_new_graphic_object(mp,mp_fill_code);
gr_pre_script(tf)= mp_xstrdup(mp,gr_pre_script((mp_fill_object*)p));
gr_post_script(tf)= mp_xstrdup(mp,gr_post_script((mp_fill_object*)p));
gr_path_p(tf)= mp_gr_copy_path(mp,gr_path_p((mp_fill_object*)p));
gr_htap_p(tf)= mp_gr_copy_path(mp,gr_htap_p(p));
gr_pen_p(tf)= mp_gr_copy_path(mp,gr_pen_p((mp_fill_object*)p));


//=============================================
//GMD Graham fixes --------------------------------->
tf->ljoin = ((mp_fill_object*)p)->ljoin;
tf->miterlim = ((mp_fill_object*)p)->miterlim;
tf->color_model = ((mp_fill_object*)p)->color_model;
tf->color.a_val = ((mp_fill_object*)p)->color.a_val;
tf->color.b_val = ((mp_fill_object*)p)->color.b_val;
tf->color.c_val = ((mp_fill_object*)p)->color.c_val;
tf->color.d_val = ((mp_fill_object*)p)->color.d_val;
//<-----------------------------------------------------------------
//=============================================


q= (mp_graphic_object*)tf;
break;
case mp_stroked_code:
ts= (mp_stroked_object*)mp_new_graphic_object(mp,mp_stroked_code);
gr_pre_script(ts)= mp_xstrdup(mp,gr_pre_script((mp_stroked_object*)p));
gr_post_script(ts)= mp_xstrdup(mp,gr_post_script((mp_stroked_object*)p));
gr_path_p(ts)= mp_gr_copy_path(mp,gr_path_p((mp_stroked_object*)p));
gr_pen_p(ts)= mp_gr_copy_path(mp,gr_pen_p((mp_stroked_object*)p));
gr_dash_p(ts)= mp_gr_copy_dashes(mp,gr_dash_p(p));

//=============================================
//GMD Graham fixes --------------------------------->
ts->ljoin = ((mp_stroked_object*)p)->ljoin;
ts->color_model = ((mp_stroked_object*)p)->color_model;
ts->miterlim = ((mp_stroked_object*)p)->miterlim;
ts->lcap = ((mp_stroked_object*)p)->lcap;
ts->color_model = ((mp_stroked_object*)p)->color_model;
ts->color.a_val = ((mp_stroked_object*)p)->color.a_val;
ts->color.b_val = ((mp_stroked_object*)p)->color.b_val;
ts->color.c_val = ((mp_stroked_object*)p)->color.c_val;
ts->color.d_val = ((mp_stroked_object*)p)->color.d_val;
//<-----------------------------------------------------------------
//=============================================


q= (mp_graphic_object*)ts;
TagsNo tags attached.

Activities

There are no notes attached to this issue.

Issue History

Date Modified Username Field Change
2014-11-05 00:31 Graham Douglas New Issue
2015-03-21 15:08 Hans Hagen Assigned To => luigi scarso
2015-03-21 15:08 Hans Hagen Status new => assigned
2015-10-22 11:04 Hans Hagen Project luatex => MetaPost
2015-10-22 11:04 Hans Hagen Category mplib bug => General