@@ -613,9 +613,9 @@ void GraphicsContextRenderer::set_clip_path(
613
613
auto const & [path, transform] =
614
614
transformed_path->attr (" get_transformed_path_and_affine" )()
615
615
.cast <std::tuple<py::object, py::object>>();
616
- auto const & matrix =
616
+ auto const & mtx =
617
617
matrix_from_transform (transform, get_additional_state ().height );
618
- load_path_exact (cr_, path, &matrix );
618
+ load_path_exact (cr_, path, &mtx );
619
619
get_additional_state ().clip_path =
620
620
{transformed_path, {cairo_copy_path (cr_), cairo_path_destroy}};
621
621
} else {
@@ -778,8 +778,7 @@ void GraphicsContextRenderer::draw_gouraud_triangles(
778
778
throw std::invalid_argument{" non-matching GraphicsContext" };
779
779
}
780
780
auto const & ac = _additional_context ();
781
- auto matrix =
782
- matrix_from_transform (transform, get_additional_state ().height );
781
+ auto mtx = matrix_from_transform (transform, get_additional_state ().height );
783
782
auto const & tri_raw = triangles.unchecked <3 >();
784
783
auto const & col_raw = colors.unchecked <3 >();
785
784
auto const & n = tri_raw.shape (0 );
@@ -803,8 +802,8 @@ void GraphicsContextRenderer::draw_gouraud_triangles(
803
802
}
804
803
cairo_mesh_pattern_end_patch (pattern);
805
804
}
806
- cairo_matrix_invert (&matrix );
807
- cairo_pattern_set_matrix (pattern, &matrix );
805
+ cairo_matrix_invert (&mtx );
806
+ cairo_pattern_set_matrix (pattern, &mtx );
808
807
cairo_set_source (cr_, pattern);
809
808
cairo_pattern_destroy (pattern);
810
809
cairo_paint (cr_);
@@ -879,9 +878,9 @@ void GraphicsContextRenderer::draw_image(
879
878
}
880
879
auto const & pattern = cairo_pattern_create_for_surface (surface);
881
880
cairo_surface_destroy (surface);
882
- auto const & matrix =
881
+ auto const & mtx =
883
882
cairo_matrix_t {1 , 0 , 0 , -1 , -x, -y + get_additional_state ().height };
884
- cairo_pattern_set_matrix (pattern, &matrix );
883
+ cairo_pattern_set_matrix (pattern, &mtx );
885
884
cairo_set_source (cr_, pattern);
886
885
cairo_pattern_destroy (pattern);
887
886
cairo_paint (cr_);
@@ -909,7 +908,7 @@ void GraphicsContextRenderer::draw_markers(
909
908
auto const & n_vertices = vertices.shape (0 );
910
909
911
910
auto const & marker_matrix = matrix_from_transform (marker_transform);
912
- auto const & matrix =
911
+ auto const & mtx =
913
912
matrix_from_transform (transform, get_additional_state ().height );
914
913
915
914
auto const & fc_raw_opt =
@@ -998,7 +997,7 @@ void GraphicsContextRenderer::draw_markers(
998
997
auto worker = [&](cairo_t * ctx, int start, int stop) {
999
998
for (auto i = start; i < stop; ++i) {
1000
999
auto x = vertices (i, 0 ), y = vertices (i, 1 );
1001
- cairo_matrix_transform_point (&matrix , &x, &y);
1000
+ cairo_matrix_transform_point (&mtx , &x, &y);
1002
1001
auto const & target_x = x + x0,
1003
1002
& target_y = y + y0 ;
1004
1003
if (!(std::isfinite (target_x) && std::isfinite (target_y))) {
@@ -1011,7 +1010,7 @@ void GraphicsContextRenderer::draw_markers(
1011
1010
auto const & idx =
1012
1011
int (n_subpix * f_target_x) * n_subpix + int (n_subpix * f_target_y);
1013
1012
auto const & pattern = patterns[idx];
1014
- // Offsetting by height is already taken care of by matrix .
1013
+ // Offsetting by height is already taken care of by mtx .
1015
1014
auto const & pattern_matrix =
1016
1015
cairo_matrix_t {1 , 0 , 0 , 1 , -i_target_x, -i_target_y};
1017
1016
cairo_pattern_set_matrix (pattern, &pattern_matrix);
@@ -1068,7 +1067,7 @@ void GraphicsContextRenderer::draw_markers(
1068
1067
cairo_surface_flush (surface);
1069
1068
for (auto i = 0 ; i < n_vertices; ++i) {
1070
1069
auto x = vertices (i, 0 ), y = vertices (i, 1 );
1071
- cairo_matrix_transform_point (&matrix , &x, &y);
1070
+ cairo_matrix_transform_point (&mtx , &x, &y);
1072
1071
if (!(std::isfinite (x) && std::isfinite (y))) {
1073
1072
continue ;
1074
1073
}
@@ -1082,7 +1081,7 @@ void GraphicsContextRenderer::draw_markers(
1082
1081
for (auto i = 0 ; i < n_vertices; ++i) {
1083
1082
cairo_save (cr_);
1084
1083
auto x = vertices (i, 0 ), y = vertices (i, 1 );
1085
- cairo_matrix_transform_point (&matrix , &x, &y);
1084
+ cairo_matrix_transform_point (&mtx , &x, &y);
1086
1085
if (!(std::isfinite (x) && std::isfinite (y))) {
1087
1086
cairo_restore (cr_);
1088
1087
continue ;
@@ -1104,19 +1103,18 @@ void GraphicsContextRenderer::draw_path(
1104
1103
}
1105
1104
auto const & ac = _additional_context ();
1106
1105
auto path_loaded = false ;
1107
- auto matrix =
1108
- matrix_from_transform (transform, get_additional_state ().height );
1106
+ auto mtx = matrix_from_transform (transform, get_additional_state ().height );
1109
1107
auto const & load_path = [&] {
1110
1108
if (!path_loaded) {
1111
- load_path_exact (cr_, path, &matrix );
1109
+ load_path_exact (cr_, path, &mtx );
1112
1110
path_loaded = true ;
1113
1111
}
1114
1112
};
1115
1113
if (auto const & sketch = get_additional_state ().sketch ) {
1116
1114
path =
1117
1115
path.attr (" cleaned" )(
1118
1116
" transform" _a=transform, " curves" _a=true , " sketch" _a=sketch);
1119
- matrix = cairo_matrix_t {1 , 0 , 0 , -1 , 0 , get_additional_state ().height };
1117
+ mtx = cairo_matrix_t {1 , 0 , 0 , -1 , 0 , get_additional_state ().height };
1120
1118
}
1121
1119
if (fc) {
1122
1120
load_path ();
@@ -1140,11 +1138,11 @@ void GraphicsContextRenderer::draw_path(
1140
1138
hatch_cr, double (dpi), double (dpi), double (dpi)};
1141
1139
hatch_gcr.get_additional_state ().snap = false ;
1142
1140
hatch_gcr.set_linewidth (get_additional_state ().get_hatch_linewidth ());
1143
- auto const & matrix =
1141
+ auto const & mtx =
1144
1142
cairo_matrix_t {double (dpi), 0 , 0 , -double (dpi), 0 , double (dpi)};
1145
1143
auto const & hatch_color = get_additional_state ().get_hatch_color ();
1146
1144
fill_and_stroke_exact (
1147
- hatch_cr, *hatch_path, &matrix , hatch_color, hatch_color);
1145
+ hatch_cr, *hatch_path, &mtx , hatch_color, hatch_color);
1148
1146
auto const & hatch_pattern =
1149
1147
cairo_pattern_create_for_surface (cairo_get_target (hatch_cr));
1150
1148
cairo_pattern_set_extend (hatch_pattern, CAIRO_EXTEND_REPEAT);
@@ -1163,8 +1161,7 @@ void GraphicsContextRenderer::draw_path(
1163
1161
auto const & vertices = path.attr (" vertices" ).cast <py::array_t <double >>();
1164
1162
auto const & n = vertices.shape (0 );
1165
1163
for (auto i = decltype (n)(0 ); i < n; i += chunksize) {
1166
- load_path_exact (
1167
- cr_, vertices, i, std::min (i + chunksize + 1 , n), &matrix);
1164
+ load_path_exact (cr_, vertices, i, std::min (i + chunksize + 1 , n), &mtx);
1168
1165
cairo_stroke (cr_);
1169
1166
}
1170
1167
}
@@ -1270,7 +1267,7 @@ void GraphicsContextRenderer::draw_path_collection(
1270
1267
// FIXME: Implement parallelization.
1271
1268
for (auto i = 0 ; i < n; ++i) {
1272
1269
auto const & path = paths[i % n_paths];
1273
- auto const & matrix = matrices[i % n_transforms];
1270
+ auto const & mtx = matrices[i % n_transforms];
1274
1271
auto x = offsets_raw (i % n_offsets, 0 ), y = offsets_raw (i % n_offsets, 1 );
1275
1272
cairo_matrix_transform_point (&offset_matrix, &x, &y);
1276
1273
if (!(std::isfinite (x) && std::isfinite (y))) {
@@ -1281,7 +1278,7 @@ void GraphicsContextRenderer::draw_path_collection(
1281
1278
cairo_set_source_rgba (
1282
1279
cr_, fcs_raw (i_mod, 0 ), fcs_raw (i_mod, 1 ),
1283
1280
fcs_raw (i_mod, 2 ), fcs_raw (i_mod, 3 ));
1284
- cache.mask (cr_, path, matrix , draw_func_t ::Fill, 0 , {}, x, y);
1281
+ cache.mask (cr_, path, mtx , draw_func_t ::Fill, 0 , {}, x, y);
1285
1282
}
1286
1283
if (ecs_raw.size ()) {
1287
1284
auto const & i_mod = i % ecs_raw.shape (0 );
@@ -1292,7 +1289,7 @@ void GraphicsContextRenderer::draw_path_collection(
1292
1289
? points_to_pixels (lws_raw[i % lws_raw.size ()])
1293
1290
: cairo_get_line_width (cr_);
1294
1291
auto const & dash = dashes_raw[i % n_dashes];
1295
- cache.mask (cr_, path, matrix , draw_func_t ::Stroke, lw, dash, x, y);
1292
+ cache.mask (cr_, path, mtx , draw_func_t ::Stroke, lw, dash, x, y);
1296
1293
}
1297
1294
// NOTE: We drop antialiaseds because that just seems silly.
1298
1295
// We drop urls as they should be handled in a post-processing step anyways
@@ -1325,7 +1322,7 @@ void GraphicsContextRenderer::draw_quad_mesh(
1325
1322
throw std::invalid_argument{" non-matching GraphicsContext" };
1326
1323
}
1327
1324
auto const & ac = _additional_context ();
1328
- auto const & matrix =
1325
+ auto const & mtx =
1329
1326
matrix_from_transform (master_transform, get_additional_state ().height );
1330
1327
auto const & fcs_raw = fcs.unchecked <2 >(),
1331
1328
& ecs_raw = ecs.unchecked <2 >();
@@ -1353,7 +1350,7 @@ void GraphicsContextRenderer::draw_quad_mesh(
1353
1350
for (auto i = 0 ; i < mesh_height + 1 ; ++i) {
1354
1351
for (auto j = 0 ; j < mesh_width + 1 ; ++j) {
1355
1352
cairo_matrix_transform_point (
1356
- &matrix ,
1353
+ &mtx ,
1357
1354
coords_raw.mutable_data (i, j, 0 ), coords_raw.mutable_data (i, j, 1 ));
1358
1355
}
1359
1356
}
0 commit comments