diff options
| author | Joel Klinghed <the_jk@opera.com> | 2020-07-17 11:45:25 +0200 |
|---|---|---|
| committer | Joel Klinghed <the_jk@opera.com> | 2020-07-17 11:45:25 +0200 |
| commit | eb5fd01c5aa7759bc626b9604bc786ea6c492a35 (patch) | |
| tree | 7a4309c02c7f25d86715b19d4153da5eb15aa3b8 /src/cairo.hh | |
| parent | 97d7b6692202c755c8f47f3ae68f2675506c1c25 (diff) | |
Break out MonMon parts that are unrelated to Icecc to a separate class
Diffstat (limited to 'src/cairo.hh')
| -rw-r--r-- | src/cairo.hh | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/src/cairo.hh b/src/cairo.hh new file mode 100644 index 0000000..a53cee9 --- /dev/null +++ b/src/cairo.hh @@ -0,0 +1,50 @@ +#ifndef CAIRO_HH +#define CAIRO_HH + +#include <cairo-xcb.h> +#include <memory> + +namespace cairo { + +namespace priv { + +struct CairoSurfaceDelete { + void operator()(cairo_surface_t* surface) const { + cairo_surface_destroy(surface); + } +}; + +struct CairoDelete { + void operator()(cairo_t* cairo) const { + cairo_destroy(cairo); + } +}; + +struct CairoPatternDelete { + void operator()(cairo_pattern_t* pattern) const { + cairo_pattern_destroy(pattern); + } +}; + +struct CairoPathDelete { + void operator()(cairo_path_t* path) const { + cairo_path_destroy(path); + } +}; + +} // namespace priv + +typedef std::unique_ptr<cairo_surface_t, priv::CairoSurfaceDelete> + unique_surface; + +typedef std::unique_ptr<cairo_path_t, priv::CairoPathDelete> + unique_path; + +typedef std::unique_ptr<cairo_pattern_t, priv::CairoPatternDelete> + unique_pattern; + +typedef std::unique_ptr<cairo_t, priv::CairoDelete> unique; + +} // namespace cairo + +#endif // CAIRO_HH |
