diff options
| author | Bryce Harrington <b.harrington@samsung.com> | 2013-12-18 16:33:38 -0800 |
|---|---|---|
| committer | Bryce Harrington <b.harrington@samsung.com> | 2013-12-18 16:33:56 -0800 |
| commit | bbd687b1528051954838bd6f6050b5884d1d3ca5 (patch) | |
| tree | dfe079c1cb7d820fb8eec2688002fdf7cf7597fa /src/caskbench.cpp | |
| parent | b48cbfee8dfb4356ede7bd949f7b00b64c5205f3 (diff) | |
Generalize constructors as well, including skia glx support
Diffstat (limited to 'src/caskbench.cpp')
| -rw-r--r-- | src/caskbench.cpp | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/src/caskbench.cpp b/src/caskbench.cpp index 4e71ae9..15b6a19 100644 --- a/src/caskbench.cpp +++ b/src/caskbench.cpp @@ -55,6 +55,9 @@ cairo_surface_t * create_cairo_surface_glx (int width, int height); void destroy_cairo_glx(); + +SkBaseDevice * +create_skia_device_glx (int width, int height); void destroy_skia_glx(); #endif @@ -258,6 +261,8 @@ main (int argc, char *argv[]) caskbench_context_t context; caskbench_result_t result; SkPaint skia_paint; + cairo_surface_t *(*setup_cairo)(int w, int h); + SkBaseDevice *(*setup_skia)(int w, int h); void (*destroy_cairo)(void); void (*destroy_skia)(void); @@ -268,32 +273,32 @@ main (int argc, char *argv[]) context.skia_paint = &skia_paint; if (opt.surface_type == NULL || !strncmp(opt.surface_type, "image", 5)) { - context.cairo_surface = create_cairo_surface_image ( context.canvas_width, - context.canvas_height); - context.skia_device = create_skia_device_image ( context.canvas_width, - context.canvas_height); + setup_cairo = create_cairo_surface_image; + setup_skia = create_skia_device_image; destroy_cairo = destroy_cairo_image; destroy_skia = destroy_skia_image; #ifdef HAVE_CAIRO_GL_H } else if (!strncmp(opt.surface_type, "glx", 3)) { - context.cairo_surface = create_cairo_surface_glx ( context.canvas_width, - context.canvas_height); + setup_cairo = create_cairo_surface_glx; + setup_skia = create_skia_device_glx; destroy_cairo = destroy_cairo_glx; destroy_skia = destroy_skia_glx; #endif #ifdef HAVE_GLES3_H } else if (!strncmp(opt.surface_type, "egl", 3)) { - context.cairo_surface = create_cairo_surface_egl ( context.canvas_width, - context.canvas_height); - context.skia_device = create_skia_device_egl ( context.canvas_width, - context.canvas_height); + setup_cairo = create_cairo_surface_egl; + setup_skia = create_skia_device_egl; destroy_cairo = destroy_cairo_egl; destroy_skia = destroy_skia_egl; #endif } + context.cairo_surface = setup_cairo(context.canvas_width, + context.canvas_height); + context.skia_device = setup_skia(context.canvas_width, + context.canvas_height); if (!context.cairo_surface) errx(2, "Could not create a cairo surface\n"); if (!context.skia_device) |