Anonymous
public c v1 · immutablestatic cairo_surface_t * pdf_document_render_surface (EvDocument *document, EvRenderContext *rc) { PdfDocument *pdf_document; cairo_surface_t *surface; double width_points, height_points; gint width, height; cairo_t *cr; pdf_document = PDF_DOCUMENT (document); set_rc_data (pdf_document, rc); poppler_page_get_size (POPPLER_PAGE (rc->data), &width_points, &height_points); if (rc->rotation == 90 || rc->rotation == 270) { width = (int) ((height_points * rc->scale) + 0.5); height = (int) ((width_points * rc->scale) + 0.5); } else { width = (int) ((width_points * rc->scale) + 0.5); height = (int) ((height_points * rc->scale) + 0.5); } surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, width, height); cr = cairo_create (surface); cairo_scale (cr, rc->scale, rc->scale); cairo_rotate (cr, rc->rotation * M_PI / 180.0); poppler_page_render (POPPLER_PAGE (rc->data), cr); cairo_destroy (cr); return surface; }