@@ -350,7 +350,8 @@ RendererAgg::_draw_path(path_t &path, bool has_clippath, const facepair_t &face,
350350 agg::trans_affine hatch_trans;
351351 hatch_trans *= agg::trans_affine_scaling (1.0 , -1.0 );
352352 hatch_trans *= agg::trans_affine_translation (0.0 , 1.0 );
353- hatch_trans *= agg::trans_affine_scaling (hatch_size, hatch_size);
353+ hatch_trans *= agg::trans_affine_scaling (static_cast <double >(hatch_size),
354+ static_cast <double >(hatch_size));
354355 hatch_path_trans_t hatch_path_trans (hatch_path, hatch_trans);
355356 hatch_path_curve_t hatch_path_curve (hatch_path_trans);
356357 hatch_path_stroke_t hatch_path_stroke (hatch_path_curve);
@@ -739,16 +740,19 @@ inline void RendererAgg::draw_text_image(GCAgg &gc, ImageArray &image, int x, in
739740
740741 set_clipbox (gc.cliprect , theRasterizer);
741742
743+ auto image_height = static_cast <double >(image.shape (0 )),
744+ image_width = static_cast <double >(image.shape (1 ));
745+
742746 agg::trans_affine mtx;
743- mtx *= agg::trans_affine_translation (0 , -image. shape ( 0 ) );
747+ mtx *= agg::trans_affine_translation (0 , -image_height );
744748 mtx *= agg::trans_affine_rotation (-angle * (agg::pi / 180.0 ));
745749 mtx *= agg::trans_affine_translation (x, y);
746750
747751 agg::path_storage rect;
748752 rect.move_to (0 , 0 );
749- rect.line_to (image. shape ( 1 ) , 0 );
750- rect.line_to (image. shape ( 1 ), image. shape ( 0 ) );
751- rect.line_to (0 , image. shape ( 0 ) );
753+ rect.line_to (image_width , 0 );
754+ rect.line_to (image_width, image_height );
755+ rect.line_to (0 , image_height );
752756 rect.line_to (0 , 0 );
753757 agg::conv_transform<agg::path_storage> rect2 (rect, mtx);
754758
@@ -842,12 +846,15 @@ inline void RendererAgg::draw_image(GCAgg &gc,
842846 agg::trans_affine mtx;
843847 agg::path_storage rect;
844848
845- mtx *= agg::trans_affine_translation ((int )x, (int )(height - (y + image.shape (0 ))));
849+ auto image_height = static_cast <double >(image.shape (0 )),
850+ image_width = static_cast <double >(image.shape (1 ));
851+
852+ mtx *= agg::trans_affine_translation ((int )x, (int )(height - (y + image_height)));
846853
847854 rect.move_to (0 , 0 );
848- rect.line_to (image. shape ( 1 ) , 0 );
849- rect.line_to (image. shape ( 1 ), image. shape ( 0 ) );
850- rect.line_to (0 , image. shape ( 0 ) );
855+ rect.line_to (image_width , 0 );
856+ rect.line_to (image_width, image_height );
857+ rect.line_to (0 , image_height );
851858 rect.line_to (0 , 0 );
852859
853860 agg::conv_transform<agg::path_storage> rect2 (rect, mtx);
0 commit comments