gvusershape_file_release(us);
}
- return (Image *)(us->data);
+ return reinterpret_cast<Image*>(us->data);
}
static void gdiplus_loadimage_gdiplus(GVJ_t * job, usershape_t *us, boxf b, boolean filled)
{
/* get the image from usershape details, then blit it to the context */
Image *image = gdiplus_loadimage(job, us);
- if (image)
- ((Graphics *)job->context)->DrawImage(image, RectF(b.LL.x, b.LL.y, b.UR.x - b.LL.x, b.UR.y - b.LL.y));
+ if (image) {
+ auto g = reinterpret_cast<Graphics*>(job->context);
+ g->DrawImage(image, RectF(b.LL.x, b.LL.y, b.UR.x - b.LL.x, b.UR.y - b.LL.y));
+ }
}
static gvloadimage_engine_t engine = {
{
/* save the passed-in context in the window field, so we can create a Metafile in the context field later on */
job->window = job->context;
- *((Metafile**)job->window) = NULL;
+ auto m = reinterpret_cast<Metafile**>(job->window);
+ *m = NULL;
job->context = NULL;
}
}
static void gdiplusgen_end_job(GVJ_t *job)
{
- Graphics *context = (Graphics *)job->context;
+ auto context = reinterpret_cast<Graphics*>(job->context);
if (!job->external_context) {
/* flush and delete the graphics */
RectF(0.0f, 0.0f, job->width, job->height),
MetafileFrameUnitPixel,
EmfTypeEmfPlusOnly);
- *((Metafile**)job->window) = metafile;
+ auto m = reinterpret_cast<Metafile**>(job->window);
+ *m = metafile;
job->context = new Graphics(metafile);
}
}
static void gdiplusgen_textspan(GVJ_t *job, pointf p, textspan_t *span)
{
- Graphics* context = (Graphics*)job->context;
+ auto context = reinterpret_cast<Graphics*>(job->context);
/* adjust text position */
switch (span->just) {
Layout* layout;
if (span->free_layout == &gdiplus_free_layout)
- layout = (Layout*)span->layout;
+ layout = reinterpret_cast<Layout*>(span->layout);
else
layout = new Layout(span->font->name, span->font->size, span->str);
static void gdiplusgen_path(GVJ_t *job, const GraphicsPath *path, int filled)
{
- Graphics *context = (Graphics *)job->context;
+ auto context = reinterpret_cast<Graphics *>(job->context);
/* fill the given path with job fill color */
if (filled) {