diff options
author | Přemysl Eric Janouch <p@janouch.name> | 2021-11-12 13:45:22 +0100 |
---|---|---|
committer | Přemysl Eric Janouch <p@janouch.name> | 2024-03-13 15:27:31 +0100 |
commit | 91538aaba53f294b1739e5055266ff17df7b6a54 (patch) | |
tree | 2bb6e6828d78980eda6ff50360769aedcbc605e8 /fiv-io.c | |
parent | c214e668d9029f05b5e2d8b1159bfdb3ac1f1b8b (diff) | |
download | fiv-91538aaba53f294b1739e5055266ff17df7b6a54.tar.gz fiv-91538aaba53f294b1739e5055266ff17df7b6a54.tar.xz fiv-91538aaba53f294b1739e5055266ff17df7b6a54.zip |
Add an experimental OpenGL renderer
Diffstat (limited to 'fiv-io.c')
-rw-r--r-- | fiv-io.c | 18 |
1 files changed, 12 insertions, 6 deletions
@@ -3451,34 +3451,40 @@ fiv_io_orientation_apply(const FivIoImage *image, FivIoOrientation orientation, double *width, double *height) { fiv_io_orientation_dimensions(image, orientation, width, height); + return fiv_io_orientation_matrix(orientation, *width, *height); +} +cairo_matrix_t +fiv_io_orientation_matrix( + FivIoOrientation orientation, double width, double height) +{ cairo_matrix_t matrix = {}; cairo_matrix_init_identity(&matrix); switch (orientation) { case FivIoOrientation90: cairo_matrix_rotate(&matrix, -M_PI_2); - cairo_matrix_translate(&matrix, -*width, 0); + cairo_matrix_translate(&matrix, -width, 0); break; case FivIoOrientation180: cairo_matrix_scale(&matrix, -1, -1); - cairo_matrix_translate(&matrix, -*width, -*height); + cairo_matrix_translate(&matrix, -width, -height); break; case FivIoOrientation270: cairo_matrix_rotate(&matrix, +M_PI_2); - cairo_matrix_translate(&matrix, 0, -*height); + cairo_matrix_translate(&matrix, 0, -height); break; case FivIoOrientationMirror0: cairo_matrix_scale(&matrix, -1, +1); - cairo_matrix_translate(&matrix, -*width, 0); + cairo_matrix_translate(&matrix, -width, 0); break; case FivIoOrientationMirror90: cairo_matrix_rotate(&matrix, +M_PI_2); cairo_matrix_scale(&matrix, -1, +1); - cairo_matrix_translate(&matrix, -*width, -*height); + cairo_matrix_translate(&matrix, -width, -height); break; case FivIoOrientationMirror180: cairo_matrix_scale(&matrix, +1, -1); - cairo_matrix_translate(&matrix, 0, -*height); + cairo_matrix_translate(&matrix, 0, -height); break; case FivIoOrientationMirror270: cairo_matrix_rotate(&matrix, -M_PI_2); |