Have Fl_Quartz_Copy_Surface_Driver account for current display scaling factor.

This commit is contained in:
ManoloFLTK
2021-08-05 19:20:53 +02:00
parent e4ce39559a
commit db7bb6cd98
@@ -50,13 +50,14 @@ Fl_Quartz_Copy_Surface_Driver::Fl_Quartz_Copy_Surface_Driver(int w, int h) : Fl_
static CGDataConsumerCallbacks callbacks = { Fl_Quartz_Copy_Surface_Driver::MyPutBytes, NULL }; static CGDataConsumerCallbacks callbacks = { Fl_Quartz_Copy_Surface_Driver::MyPutBytes, NULL };
myconsumer = CGDataConsumerCreate((void*) pdfdata, &callbacks); myconsumer = CGDataConsumerCreate((void*) pdfdata, &callbacks);
} }
CGRect bounds = CGRectMake(0, 0, w, h ); float d = fl_graphics_driver->scale();
CGRect bounds = CGRectMake(0, 0, w * d, h * d);
gc = CGPDFContextCreate(myconsumer, &bounds, NULL); gc = CGPDFContextCreate(myconsumer, &bounds, NULL);
CGDataConsumerRelease(myconsumer); CGDataConsumerRelease(myconsumer);
if (gc) { if (gc) {
CGContextBeginPage(gc, &bounds); CGContextBeginPage(gc, &bounds);
CGContextTranslateCTM(gc, 0.5, h-0.5); CGContextScaleCTM(gc, d, -d);
CGContextScaleCTM(gc, 1.0f, -1.0f); CGContextTranslateCTM(gc, 0.5, -h + 0.5);
CGContextSaveGState(gc); CGContextSaveGState(gc);
} }
} }