@@ -312,43 +312,39 @@ inline bool point_on_path(
312312
313313struct extent_limits
314314{
315- double x0;
316- double y0;
317- double x1;
318- double y1;
319- double xm;
320- double ym;
321- };
315+ XY start;
316+ XY end;
317+ /* minpos is the minimum positive values in the data; used by log scaling. */
318+ XY minpos;
322319
323- void reset_limits (extent_limits &e)
324- {
325- e.x0 = std::numeric_limits<double >::infinity ();
326- e.y0 = std::numeric_limits<double >::infinity ();
327- e.x1 = -std::numeric_limits<double >::infinity ();
328- e.y1 = -std::numeric_limits<double >::infinity ();
329- /* xm and ym are the minimum positive values in the data, used
330- by log scaling */
331- e.xm = std::numeric_limits<double >::infinity ();
332- e.ym = std::numeric_limits<double >::infinity ();
333- }
320+ extent_limits () : start{0 ,0 }, end{0 ,0 }, minpos{0 ,0 } {
321+ reset ();
322+ }
334323
335- inline void update_limits (double x, double y, extent_limits &e)
336- {
337- if (x < e.x0 )
338- e.x0 = x;
339- if (y < e.y0 )
340- e.y0 = y;
341- if (x > e.x1 )
342- e.x1 = x;
343- if (y > e.y1 )
344- e.y1 = y;
345- /* xm and ym are the minimum positive values in the data, used
346- by log scaling */
347- if (x > 0.0 && x < e.xm )
348- e.xm = x;
349- if (y > 0.0 && y < e.ym )
350- e.ym = y;
351- }
324+ void reset ()
325+ {
326+ start.x = std::numeric_limits<double >::infinity ();
327+ start.y = std::numeric_limits<double >::infinity ();
328+ end.x = -std::numeric_limits<double >::infinity ();
329+ end.y = -std::numeric_limits<double >::infinity ();
330+ minpos.x = std::numeric_limits<double >::infinity ();
331+ minpos.y = std::numeric_limits<double >::infinity ();
332+ }
333+
334+ void update (double x, double y)
335+ {
336+ start.x = std::min (start.x , x);
337+ start.y = std::min (start.y , y);
338+ end.x = std::max (end.x , x);
339+ end.y = std::max (end.y , y);
340+ if (x > 0.0 ) {
341+ minpos.x = std::min (minpos.x , x);
342+ }
343+ if (y > 0.0 ) {
344+ minpos.y = std::min (minpos.y , y);
345+ }
346+ }
347+ };
352348
353349template <class PathIterator >
354350void update_path_extents (PathIterator &path, agg::trans_affine &trans, extent_limits &extents)
@@ -367,7 +363,7 @@ void update_path_extents(PathIterator &path, agg::trans_affine &trans, extent_li
367363 if ((code & agg::path_cmd_end_poly) == agg::path_cmd_end_poly) {
368364 continue ;
369365 }
370- update_limits (x, y, extents );
366+ extents. update (x, y);
371367 }
372368}
373369
@@ -390,7 +386,7 @@ void get_path_collection_extents(agg::trans_affine &master_transform,
390386
391387 agg::trans_affine trans;
392388
393- reset_limits ( extent);
389+ extent. reset ( );
394390
395391 for (auto i = 0 ; i < N; ++i) {
396392 typename PathGenerator::path_iterator path (paths (i % Npaths));
0 commit comments