@@ -153,8 +153,7 @@ FT2Image::py_write_bitmap(const Py::Tuple & args) {
153153void
154154FT2Image::draw_rect (unsigned long x0, unsigned long y0,
155155 unsigned long x1, unsigned long y1) {
156- if ( x0<0 || y0<0 || x1<0 || y1<0 ||
157- x0>_width || x1>_width ||
156+ if ( x0>_width || x1>_width ||
158157 y0>_height || y1>_height )
159158 throw Py::ValueError (" Rect coords outside image bounds" );
160159
@@ -197,10 +196,10 @@ FT2Image::py_draw_rect(const Py::Tuple & args) {
197196
198197void FT2Image::draw_rect_filled (unsigned long x0, unsigned long y0,
199198 unsigned long x1, unsigned long y1) {
200- x0 = CLAMP (x0, 0 , _width);
201- y0 = CLAMP (y0, 0 , _height);
202- x1 = CLAMP (x1, 0 , _width);
203- y1 = CLAMP (y1, 0 , _height);
199+ x0 = std::min (x0, _width);
200+ y0 = std::min (y0, _height);
201+ x1 = std::min (x1, _width);
202+ y1 = std::min (y1, _height);
204203
205204 for (size_t j=y0; j<y1+1 ; j++) {
206205 for (size_t i=x0; i<x1+1 ; i++) {
@@ -1207,7 +1206,7 @@ char FT2Font::draw_glyph_to_bitmap__doc__[] =
12071206" draw_glyphs_to_bitmap. This function is intended for people who\n "
12081207" want to render individual glyphs at precise locations, eg, a\n "
12091208" a glyph returned by load_char\n " ;
1210- ;
1209+
12111210Py::Object
12121211FT2Font::draw_glyph_to_bitmap (const Py::Tuple & args) {
12131212 _VERBOSE (" FT2Font::draw_glyph_to_bitmap" );
@@ -1768,7 +1767,7 @@ FT2Font::init_type() {
17681767
17691768 behaviors ().supportGetattr ();
17701769 behaviors ().supportSetattr ();
1771- };
1770+ }
17721771
17731772// todo add module docs strings
17741773
0 commit comments