@@ -886,7 +886,7 @@ static QPathRef QuartzCreateClipPath(SEXP clipPath, int index,
886886 CGContextBeginPath (ctx );
887887 /* Play the clipPath function to build the clipping path */
888888 R_fcall = PROTECT (lang1 (clipPath ));
889- eval (R_fcall , R_GlobalEnv );
889+ Rf_eval_with_gd (R_fcall , R_GlobalEnv , NULL );
890890 UNPROTECT (1 );
891891 /* Save the clipping path (for reuse) */
892892 quartz_clipPath -> path = CGContextCopyPath (ctx );
@@ -1068,7 +1068,7 @@ static int QuartzCreateMask(SEXP mask,
10681068
10691069 /* Play the mask function to build the mask */
10701070 R_fcall = PROTECT (lang1 (mask ));
1071- eval (R_fcall , R_GlobalEnv );
1071+ Rf_eval_with_gd (R_fcall , R_GlobalEnv , NULL );
10721072 UNPROTECT (1 );
10731073
10741074 /* When working with an alpha mask, convert into a grayscale bitmap */
@@ -1263,7 +1263,7 @@ static SEXP QuartzCreateGroup(SEXP src, int op, SEXP dst,
12631263 if (dst != R_NilValue ) {
12641264 /* Play the destination function to draw the destination */
12651265 R_fcall = PROTECT (lang1 (dst ));
1266- eval (R_fcall , R_GlobalEnv );
1266+ Rf_eval_with_gd (R_fcall , R_GlobalEnv , NULL );
12671267 UNPROTECT (1 );
12681268 }
12691269 /* Set the group operator */
@@ -1276,7 +1276,7 @@ static SEXP QuartzCreateGroup(SEXP src, int op, SEXP dst,
12761276 CGContextSetBlendMode (layerContext , QuartzOperator (op ));
12771277 /* Play the source function to draw the source */
12781278 R_fcall = PROTECT (lang1 (src ));
1279- eval (R_fcall , R_GlobalEnv );
1279+ Rf_eval_with_gd (R_fcall , R_GlobalEnv , NULL );
12801280 UNPROTECT (1 );
12811281 }
12821282
@@ -1662,7 +1662,11 @@ const char *RQuartz_LookUpFontName(int fontface, const char *fontfamily)
16621662 PROTECT (ns = R_FindNamespace (ScalarString (mkChar ("grDevices" ))));
16631663 PROTECT_WITH_INDEX (env = findVar (install (".Quartzenv" ), ns ), & index );
16641664 if (TYPEOF (env ) == PROMSXP )
1665- REPROTECT (env = eval (env ,ns ) ,index );
1665+ if (NoDevices ()) {
1666+ REPROTECT (env = eval (env , ns ), index );
1667+ } else {
1668+ REPROTECT (env = Rf_eval_with_gd (env , ns , NULL ), index );
1669+ }
16661670 PROTECT (db = findVar (install (".Quartz.Fonts" ), env ));
16671671 PROTECT (names = getAttrib (db , R_NamesSymbol ));
16681672 if (* fontfamily ) {
@@ -2685,7 +2689,7 @@ static SEXP RQuartz_setPattern(SEXP pattern, pDevDesc dd) {
26852689
26862690 /* Play the pattern function to draw the pattern on the pattern layer*/
26872691 SEXP R_fcall = PROTECT (lang1 (R_GE_tilingPatternFunction (pattern )));
2688- eval (R_fcall , R_GlobalEnv );
2692+ Rf_eval_with_gd (R_fcall , R_GlobalEnv , desc2GEdesc ( dd ) );
26892693 UNPROTECT (1 );
26902694
26912695 xd -> appendingPattern = savedPattern ;
@@ -2858,7 +2862,7 @@ static void RQuartz_stroke(SEXP path, const pGEcontext gc, pDevDesc dd)
28582862 CGContextBeginPath (ctx );
28592863 /* Play the path function to build the path */
28602864 R_fcall = PROTECT (lang1 (path ));
2861- eval (R_fcall , R_GlobalEnv );
2865+ Rf_eval_with_gd (R_fcall , R_GlobalEnv , desc2GEDesc ( dd ) );
28622866 UNPROTECT (1 );
28632867 /* Decrement the "appending" count */
28642868 xd -> appending -- ;
@@ -2894,7 +2898,7 @@ static void RQuartz_fill(SEXP path, int rule, const pGEcontext gc,
28942898 CGContextBeginPath (ctx );
28952899 /* Play the path function to build the path */
28962900 R_fcall = PROTECT (lang1 (path ));
2897- eval (R_fcall , R_GlobalEnv );
2901+ Rf_eval_with_gd (R_fcall , R_GlobalEnv , desc2GEDesc ( dd ) );
28982902 UNPROTECT (1 );
28992903 /* Decrement the "appending" count */
29002904 xd -> appending -- ;
@@ -2920,7 +2924,7 @@ static void QuartzFillStrokePath(SEXP path, CGContextRef ctx, QuartzDesc *xd)
29202924 CGContextBeginPath (ctx );
29212925 /* Play the path function to build the path */
29222926 R_fcall = PROTECT (lang1 (path ));
2923- eval (R_fcall , R_GlobalEnv );
2927+ Rf_eval_with_gd (R_fcall , R_GlobalEnv , NULL );
29242928 UNPROTECT (1 );
29252929 /* Decrement the "appending" count */
29262930 xd -> appending -- ;
0 commit comments