Skip to content
This repository was archived by the owner on Mar 30, 2022. It is now read-only.

Commit 5492370

Browse files
committed
Debug
1 parent 71bf530 commit 5492370

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

cairo_png.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ cairo_status_t cairo_surface_write_to_png_mem(cairo_surface_t *sfc,
3333

3434
png_structp png =
3535
png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
36+
if (png == NULL) {
37+
return CAIRO_STATUS_NO_MEMORY;
38+
}
3639

3740
png_infop info = png_create_info_struct(png);
3841
if (info == NULL) {

main.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,9 @@ static void output_handle_geometry(void *data, struct wl_output *wl_output,
117117

118118
output->geometry.x = x;
119119
output->geometry.y = y;
120+
output->geometry.physical_width = physical_width;
121+
output->geometry.physical_height = physical_height;
122+
printf("debug phys: %dmm x %dmm\n", physical_width, physical_height);
120123
output->transform = transform;
121124
}
122125

@@ -305,6 +308,7 @@ int main(int argc, char *argv[]) {
305308

306309
free(geometry);
307310
geometry = calloc(1, sizeof(struct grim_box));
311+
308312
if (!parse_box(geometry, geometry_str)) {
309313
fprintf(stderr, "invalid geometry\n");
310314
return EXIT_FAILURE;
@@ -478,6 +482,12 @@ int main(int argc, char *argv[]) {
478482
get_output_layout_extents(&state, geometry);
479483
}
480484

485+
printf("debug output_layout_extents: %dpx x %dpx\n", geometry->width, geometry->height);
486+
//TODO
487+
//int px_per_mm_x = geometry->width/(output_layout_extents_physical);
488+
//int px_per_mm_y = geometry->height/(output_layout_extents_physical);
489+
//printf("px/mm values: %d x %d\n", pxmm_x, pxmm_y);
490+
481491
cairo_surface_t *surface = render(&state, geometry, scale);
482492
if (surface == NULL) {
483493
return EXIT_FAILURE;
@@ -519,6 +529,7 @@ int main(int argc, char *argv[]) {
519529
#endif
520530
}
521531
}
532+
printf("Status was: %d, success is %d", status, CAIRO_STATUS_SUCCESS);
522533
if (status != CAIRO_STATUS_SUCCESS) {
523534
fprintf(stderr, "%s\n", cairo_status_to_string(status));
524535
if (status == CAIRO_STATUS_WRITE_ERROR && strlen(output_filepath) > NAME_MAX) {

0 commit comments

Comments
 (0)