@@ -69,6 +69,7 @@ class AggDevice {
6969unsigned char * buffer;
7070
7171int pageno;
72+ bool changed;
7273 std::string file;
7374 R_COLOR background;
7475int background_int;
@@ -356,6 +357,7 @@ class AggDevice {
356357if (evenodd) ras.filling_rule (agg::fill_even_odd);
357358
358359if (recording_mask ==NULL && recording_raster ==NULL ) {
360+ changed =true ;
359361 solid_renderer.color (convertColour (fill));
360362if (current_mask ==NULL ) {
361363 render<agg::scanline_p8>(ras, ras_clip, slp, solid_renderer, current_clip !=NULL );
@@ -411,6 +413,7 @@ class AggDevice {
411413 agg::scanline_u8 slu;
412414setStroke (ras, path, lty, lwd, lend, ljoin, lmitre);
413415if (recording_mask ==NULL && recording_raster ==NULL ) {
416+ changed =true ;
414417 solid_renderer.color (convertColour (col));
415418if (current_mask ==NULL ) {
416419 render<agg::scanline_u8>(ras, ras_clip, slu, solid_renderer, current_clip !=NULL );
@@ -537,6 +540,7 @@ void AggDevice<PIXFMT, R_COLOR, BLNDFMT>::newPage(unsigned int bg) {
537540 renderer.clear (background);
538541 }
539542 pageno++;
543+ changed =true ;
540544}
541545template <class PIXFMT ,class R_COLOR ,typename BLNDFMT>
542546void AggDevice<PIXFMT, R_COLOR, BLNDFMT>::close() {
@@ -1044,6 +1048,7 @@ void AggDevice<PIXFMT, R_COLOR, BLNDFMT>::useGroup(SEXP ref, SEXP trans) {
10441048
10451049 agg::scanline_u8 sl;
10461050if (recording_mask ==NULL && recording_raster ==NULL ) {
1051+ changed =true ;
10471052if (current_mask ==NULL ) {
10481053 it->second ->draw (mtx, ras, ras_clip, sl, renderer, clip);
10491054 }else {
@@ -1366,6 +1371,7 @@ void AggDevice<PIXFMT, R_COLOR, BLNDFMT>::drawRaster(unsigned int *raster, int w
13661371
13671372 agg::scanline_u8 slu;
13681373if (recording_mask ==NULL && recording_raster ==NULL ) {
1374+ changed =true ;
13691375if (current_mask ==NULL ) {
13701376 render_raster<pixfmt_r_raster, BLNDFMT>(rbuf, w, h, ras, ras_clip, slu, interpolator, renderer, interpolate, current_clip !=NULL ,false );
13711377 }else {
@@ -1446,6 +1452,7 @@ void AggDevice<PIXFMT, R_COLOR, BLNDFMT>::drawText(double x, double y, const cha
14461452
14471453 agg::scanline_u8 slu;
14481454if (recording_mask ==NULL && recording_raster ==NULL ) {
1455+ changed =true ;
14491456 solid_renderer.color (convertColour (col));
14501457if (current_mask ==NULL ) {
14511458 t_ren.template plot_text <BLNDFMT>(x, y, str, rot, hadj, solid_renderer, renderer, slu, device_id, ras_clip, current_clip !=NULL , recording_path);
@@ -1535,6 +1542,7 @@ void AggDevice<PIXFMT, R_COLOR, BLNDFMT>::drawGlyph(int n, int *glyphs,
15351542
15361543 agg::scanline_u8 slu;
15371544if (recording_mask ==NULL && recording_raster ==NULL ) {
1545+ changed =true ;
15381546 solid_renderer.color (convertColour (colour));
15391547if (current_mask ==NULL ) {
15401548 t_ren.template plot_glyphs <BLNDFMT>(n, glyphs, x, y, rot, solid_renderer, renderer, slu, ras_clip, current_clip !=NULL , recording_path);