MCPcopy Create free account
hub / github.com/davidgiven/fluxengine / bounding_rect_single

Function bounding_rect_single

dep/agg/include/agg_bounding_rect.h:83–127  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

81 //-----------------------------------------------------bounding_rect_single
82 template <class VertexSource, class CoordT>
83 bool bounding_rect_single(VertexSource& vs,
84 unsigned path_id,
85 CoordT* x1,
86 CoordT* y1,
87 CoordT* x2,
88 CoordT* y2)
89 {
90 double x;
91 double y;
92 bool first = true;
93
94 *x1 = CoordT(1);
95 *y1 = CoordT(1);
96 *x2 = CoordT(0);
97 *y2 = CoordT(0);
98
99 vs.rewind(path_id);
100 unsigned cmd;
101 while (!is_stop(cmd = vs.vertex(&x, &y)))
102 {
103 if (is_vertex(cmd))
104 {
105 if (first)
106 {
107 *x1 = CoordT(x);
108 *y1 = CoordT(y);
109 *x2 = CoordT(x);
110 *y2 = CoordT(y);
111 first = false;
112 }
113 else
114 {
115 if (CoordT(x) < *x1)
116 *x1 = CoordT(x);
117 if (CoordT(y) < *y1)
118 *y1 = CoordT(y);
119 if (CoordT(x) > *x2)
120 *x2 = CoordT(x);
121 if (CoordT(y) > *y2)
122 *y2 = CoordT(y);
123 }
124 }
125 }
126 return *x1 <= *x2 && *y1 <= *y2;
127 }
128
129}
130

Callers 2

text_widthMethod · 0.85
contour_createMethod · 0.85

Calls 4

is_stopFunction · 0.85
is_vertexFunction · 0.85
rewindMethod · 0.45
vertexMethod · 0.45

Tested by

no test coverage detected