Hello community,
here is the log from the commit of package cairomm for openSUSE:Factory checked in at 2017-01-25 23:35:04
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/cairomm (Old)
and /work/SRC/openSUSE:Factory/.cairomm.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "cairomm"
Changes:
--------
--- /work/SRC/openSUSE:Factory/cairomm/cairomm.changes 2016-12-15 10:42:51.286446525 +0100
+++ /work/SRC/openSUSE:Factory/.cairomm.new/cairomm.changes 2017-01-25 23:35:05.424465869 +0100
@@ -1,0 +2,9 @@
+Fri Jan 20 09:11:49 UTC 2017 - zaitor@opensuse.org
+
+- Update to version 1.15.3:
+ + RefPtr: This is now an alias for std::shared_ptr<>. These
+ should be instatiated via Cairo::make_refptr_for_instance(),
+ though that should never be necessary anyway outside of the
+ cairomm implementation itself.
+
+-------------------------------------------------------------------
Old:
----
cairomm-1.15.2.tar.xz
New:
----
cairomm-1.15.3.tar.xz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ cairomm.spec ++++++
--- /var/tmp/diff_new_pack.zvEfWS/_old 2017-01-25 23:35:06.180351974 +0100
+++ /var/tmp/diff_new_pack.zvEfWS/_new 2017-01-25 23:35:06.188350769 +0100
@@ -1,7 +1,7 @@
#
# spec file for package cairomm
#
-# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -17,7 +17,7 @@
Name: cairomm
-Version: 1.15.2
+Version: 1.15.3
Release: 0
Summary: C++ Interface for Cairo
License: LGPL-2.1+
++++++ _service ++++++
--- /var/tmp/diff_new_pack.zvEfWS/_old 2017-01-25 23:35:06.268338716 +0100
+++ /var/tmp/diff_new_pack.zvEfWS/_new 2017-01-25 23:35:06.276337511 +0100
@@ -2,8 +2,8 @@
<service name="tar_scm" mode="disabled">
<param name="url">git://anongit.freedesktop.org/cairomm</param>
<param name="scm">git</param>
- <param name="versionformat">1.15.2</param>
- <param name="revision">refs/tags/v1.15.2</param>
+ <param name="versionformat">1.15.3</param>
+ <param name="revision">refs/tags/v1.15.3</param>
</service>
<service name="recompress" mode="disabled">
<param name="file">*.tar</param>
++++++ cairomm-1.15.2.tar.xz -> cairomm-1.15.3.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cairomm-1.15.2/NEWS new/cairomm-1.15.3/NEWS
--- old/cairomm-1.15.2/NEWS 2016-12-07 11:24:02.000000000 +0100
+++ new/cairomm-1.15.3/NEWS 2016-12-13 17:54:24.000000000 +0100
@@ -1,3 +1,12 @@
+1.15.3 (unstable):
+(Distros should probably not package this yet.)
+
+* RefPtr: This is now an alias for std::shared_ptr<>.
+ These should be instatiated via
+ Cairo::make_refptr_for_instance(), though that should
+ never be necessary anyway outside of the cairomm
+ implementation itself.
+
1.15.2 (unstable):
(Distros should probably not package this yet.)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cairomm-1.15.2/cairomm/context.cc new/cairomm-1.15.3/cairomm/context.cc
--- old/cairomm-1.15.2/cairomm/context.cc 2016-12-07 11:24:02.000000000 +0100
+++ new/cairomm-1.15.3/cairomm/context.cc 2016-12-13 17:54:24.000000000 +0100
@@ -17,9 +17,9 @@
*/
/* M_PI is defined in math.h in the case of Microsoft Visual C++ */
-#if defined(_MSC_VER)
+#if defined(_WIN32)
#define _USE_MATH_DEFINES
-#endif
+#endif
#include
#include
@@ -29,11 +29,6 @@
#include
#include
-/* M_PI is defined in math.h in the case of Microsoft Visual C++ */
-#if defined(_MSC_VER)
-#define _USE_MATH_DEFINES
-#endif
-
/* Solaris et. al. need math.h for M_PI too */
#include <cmath>
@@ -51,7 +46,7 @@
RefPtr<Context> Context::create(const RefPtr<Surface>& target)
{
- return RefPtr<Context>(new Context(target));
+ return make_refptr_for_instance<Context>(new Context(target));
}
Context::Context(cairo_t* cobject, bool has_reference)
@@ -511,7 +506,7 @@
{
auto font = cairo_get_scaled_font(cobj());
check_object_status_and_throw_exception(*this);
- return RefPtr<ScaledFont>(new ScaledFont(font, false /* does not have reference */));
+ return make_refptr_for_instance<ScaledFont>(new ScaledFont(font, false /* does not have reference */));
}
void Context::show_text(const std::string& utf8)
@@ -546,14 +541,14 @@
{
auto cfontface = cairo_get_font_face(cobj());
check_object_status_and_throw_exception(*this);
- return RefPtr<FontFace>(new FontFace(cfontface, false /* does not have reference */));
+ return make_refptr_for_instance<FontFace>(new FontFace(cfontface, false /* does not have reference */));
}
RefPtr<const FontFace> Context::get_font_face() const
{
auto cfontface = cairo_get_font_face(const_cast(cobj()));
check_object_status_and_throw_exception(*this);
- return RefPtr<const FontFace>(new FontFace(cfontface, false /* does not have reference */));
+ return make_refptr_for_instance<const FontFace>(new FontFace(cfontface, false /* does not have reference */));
}
void Context::get_font_extents(FontExtents& extents) const
@@ -610,19 +605,19 @@
switch (pattern_type)
{
case CAIRO_PATTERN_TYPE_SOLID:
- return RefPtr<SolidPattern>(new SolidPattern(pattern, false /* does not have reference */));
+ return make_refptr_for_instance<SolidPattern>(new SolidPattern(pattern, false /* does not have reference */));
break;
case CAIRO_PATTERN_TYPE_SURFACE:
- return RefPtr<SurfacePattern>(new SurfacePattern(pattern, false /* does not have reference */));
+ return make_refptr_for_instance<SurfacePattern>(new SurfacePattern(pattern, false /* does not have reference */));
break;
case CAIRO_PATTERN_TYPE_LINEAR:
- return RefPtr<LinearGradient>(new LinearGradient(pattern, false /* does not have reference */));
+ return make_refptr_for_instance<LinearGradient>(new LinearGradient(pattern, false /* does not have reference */));
break;
case CAIRO_PATTERN_TYPE_RADIAL:
- return RefPtr<RadialGradient>(new RadialGradient(pattern, false /* does not have reference */));
+ return make_refptr_for_instance<RadialGradient>(new RadialGradient(pattern, false /* does not have reference */));
break;
default:
- return RefPtr<Pattern>(new Pattern(pattern, false /* does not have reference */));
+ return make_refptr_for_instance<Pattern>(new Pattern(pattern, false /* does not have reference */));
}
}
@@ -637,7 +632,7 @@
{
auto pattern = cairo_get_source(const_cast(cobj()));
check_object_status_and_throw_exception(*this);
- return RefPtr<const Pattern>::cast_const (get_pattern_wrapper (pattern));
+ return get_pattern_wrapper(pattern);
}
double Context::get_tolerance() const
@@ -735,16 +730,16 @@
switch (surface_type)
{
case CAIRO_SURFACE_TYPE_IMAGE:
- return RefPtr<ImageSurface>(new ImageSurface(surface, false /* does not have reference */));
+ return make_refptr_for_instance<ImageSurface>(new ImageSurface(surface, false /* does not have reference */));
break;
#if CAIRO_HAS_PDF_SURFACE
case CAIRO_SURFACE_TYPE_PDF:
- return RefPtr<PdfSurface>(new PdfSurface(surface, false /* does not have reference */));
+ return make_refptr_for_instance<PdfSurface>(new PdfSurface(surface, false /* does not have reference */));
break;
#endif
#if CAIRO_HAS_PS_SURFACE
case CAIRO_SURFACE_TYPE_PS:
- return RefPtr<PsSurface>(new PsSurface(surface, false /* does not have reference */));
+ return make_refptr_for_instance<PsSurface>(new PsSurface(surface, false /* does not have reference */));
break;
#endif
#if CAIRO_HAS_XLIB_SURFACE
@@ -754,7 +749,7 @@
#endif
#if CAIRO_HAS_GLITZ_SURFACE
case CAIRO_SURFACE_TYPE_GLITZ:
- return RefPtr<GlitzSurface>(new GlitzSurface(surface, false /* does not have reference */));
+ return make_refptr_for_instance<GlitzSurface>(new GlitzSurface(surface, false /* does not have reference */));
break;
#endif
#if CAIRO_HAS_QUARTZ_SURFACE
@@ -764,7 +759,7 @@
#endif
#if CAIRO_HAS_SCRIPT_SURFACE
case CAIRO_SURFACE_TYPE_SCRIPT:
- return RefPtr<ScriptSurface>(new ScriptSurface(surface, false));
+ return make_refptr_for_instance<ScriptSurface>(new ScriptSurface(surface, false));
break;
#endif
#if CAIRO_HAS_WIN32_SURFACE
@@ -774,7 +769,7 @@
#endif
#if CAIRO_HAS_SVG_SURFACE
case CAIRO_SURFACE_TYPE_SVG:
- return RefPtr<SvgSurface>(new SvgSurface(surface, false /* does not have reference */));
+ return make_refptr_for_instance<SvgSurface>(new SvgSurface(surface, false /* does not have reference */));
break;
#endif
// the following surfaces are not directly supported in cairomm yet
@@ -783,7 +778,7 @@
case CAIRO_SURFACE_TYPE_BEOS:
case CAIRO_SURFACE_TYPE_XCB:
default:
- return RefPtr<Surface>(new Surface(surface, false /* does not have reference */));
+ return make_refptr_for_instance<Surface>(new Surface(surface, false /* does not have reference */));
}
}
@@ -798,7 +793,7 @@
{
auto surface = cairo_get_target(const_cast(cobj()));
check_object_status_and_throw_exception(*this);
- return RefPtr<const Surface>::cast_const (get_surface_wrapper (surface));
+ return get_surface_wrapper(surface);
}
Path* Context::copy_path() const
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cairomm-1.15.2/cairomm/context_surface_quartz.cc new/cairomm-1.15.3/cairomm/context_surface_quartz.cc
--- old/cairomm-1.15.2/cairomm/context_surface_quartz.cc 2016-12-07 11:24:02.000000000 +0100
+++ new/cairomm-1.15.3/cairomm/context_surface_quartz.cc 2016-12-13 17:54:24.000000000 +0100
@@ -29,9 +29,9 @@
RefPtr<Surface> wrap_surface_quartz(cairo_surface_t* surface)
{
#if CAIRO_HAS_QUARTZ_SURFACE
- return RefPtr<QuartzSurface>(new QuartzSurface(surface, false /* does not have reference */));
+ return make_refptr_for_instance<QuartzSurface>(new QuartzSurface(surface, false /* does not have reference */));
#else
- return RefPtr<Surface>(new Surface(surface, false /* does not have reference */));
+ return make_refptr_for_instance<Surface>(new Surface(surface, false /* does not have reference */));
#endif
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cairomm-1.15.2/cairomm/context_surface_win32.cc new/cairomm-1.15.3/cairomm/context_surface_win32.cc
--- old/cairomm-1.15.2/cairomm/context_surface_win32.cc 2016-12-07 11:24:02.000000000 +0100
+++ new/cairomm-1.15.3/cairomm/context_surface_win32.cc 2016-12-13 17:54:24.000000000 +0100
@@ -29,9 +29,9 @@
RefPtr<Surface> wrap_surface_win32(cairo_surface_t* surface)
{
#if CAIRO_HAS_WIN32_SURFACE
- return RefPtr<Win32Surface>(new Win32Surface(surface, false /* does not have reference */));
+ return make_refptr_for_instance<Win32Surface>(new Win32Surface(surface, false /* does not have reference */));
#else
- return RefPtr<Surface>(new Surface(surface, false /* does not have reference */));
+ return make_refptr_for_instance<Surface>(new Surface(surface, false /* does not have reference */));
#endif
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cairomm-1.15.2/cairomm/context_surface_xlib.cc new/cairomm-1.15.3/cairomm/context_surface_xlib.cc
--- old/cairomm-1.15.2/cairomm/context_surface_xlib.cc 2016-12-07 11:24:02.000000000 +0100
+++ new/cairomm-1.15.3/cairomm/context_surface_xlib.cc 2016-12-13 17:54:24.000000000 +0100
@@ -29,9 +29,9 @@
RefPtr<Surface> wrap_surface_xlib(cairo_surface_t* surface)
{
#if CAIRO_HAS_XLIB_SURFACE
- return RefPtr<XlibSurface>(new XlibSurface(surface, false /* does not have reference */));
+ return make_refptr_for_instance<XlibSurface>(new XlibSurface(surface, false /* does not have reference */));
#else
- return RefPtr<Surface>(new Surface(surface, false /* does not have reference */));
+ return make_refptr_for_instance<Surface>(new Surface(surface, false /* does not have reference */));
#endif
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cairomm-1.15.2/cairomm/fontface.cc new/cairomm-1.15.3/cairomm/fontface.cc
--- old/cairomm-1.15.2/cairomm/fontface.cc 2016-12-07 11:24:02.000000000 +0100
+++ new/cairomm-1.15.3/cairomm/fontface.cc 2016-12-13 17:54:24.000000000 +0100
@@ -83,7 +83,7 @@
RefPtr<ToyFontFace>
ToyFontFace::create(const std::string& family, FontSlant slant, FontWeight weight)
{
- return RefPtr<ToyFontFace>(new ToyFontFace(family, slant, weight));
+ return make_refptr_for_instance<ToyFontFace>(new ToyFontFace(family, slant, weight));
}
ToyFontFace::ToyFontFace(const std::string& family, FontSlant slant, FontWeight weight) :
@@ -142,8 +142,8 @@
{
try
{
- return instance->init(RefPtr<ScaledFont>(new ScaledFont(scaled_font)),
- RefPtr<Context>(new Context(cr)),
+ return instance->init(make_refptr_for_instance<ScaledFont>(new ScaledFont(scaled_font)),
+ make_refptr_for_instance<Context>(new Context(cr)),
static_cast(*metrics));
}
catch(const std::exception& ex)
@@ -189,7 +189,7 @@
{
try
{
- return instance->unicode_to_glyph(RefPtr<ScaledFont>(new ScaledFont(scaled_font)),
+ return instance->unicode_to_glyph(make_refptr_for_instance<ScaledFont>(new ScaledFont(scaled_font)),
unicode, *glyph);
}
catch(const std::exception& ex)
@@ -242,7 +242,7 @@
auto local_flags = static_cast<TextClusterFlags>(0);
auto status =
- instance->text_to_glyphs(RefPtr<ScaledFont>(new
+ instance->text_to_glyphs(make_refptr_for_instance<ScaledFont>(new
ScaledFont(scaled_font)),
utf8_str, glyph_v, cluster_v, local_flags);
@@ -335,8 +335,8 @@
{
try
{
- return instance->render_glyph(RefPtr<ScaledFont>(new ScaledFont(scaled_font)),
- glyph, RefPtr<Context>(new Context(cr)),
+ return instance->render_glyph(make_refptr_for_instance<ScaledFont>(new ScaledFont(scaled_font)),
+ glyph, make_refptr_for_instance<Context>(new Context(cr)),
static_cast(*metrics));
}
catch(const std::exception& ex)
@@ -380,7 +380,7 @@
RefPtr<FtFontFace>
FtFontFace::create(FT_Face face, int load_flags)
{
- return RefPtr<FtFontFace>(new FtFontFace(face, load_flags));
+ return make_refptr_for_instance<FtFontFace>(new FtFontFace(face, load_flags));
}
FtFontFace::FtFontFace(FT_Face face, int load_flags) :
@@ -394,7 +394,7 @@
RefPtr<FtFontFace>
FtFontFace::create(FcPattern* pattern)
{
- return RefPtr<FtFontFace>(new FtFontFace(pattern));
+ return make_refptr_for_instance<FtFontFace>(new FtFontFace(pattern));
}
FtFontFace::FtFontFace(FcPattern* pattern) :
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cairomm-1.15.2/cairomm/fontface.h new/cairomm-1.15.3/cairomm/fontface.h
--- old/cairomm-1.15.2/cairomm/fontface.h 2016-12-07 11:24:02.000000000 +0100
+++ new/cairomm-1.15.3/cairomm/fontface.h 2016-12-13 17:54:24.000000000 +0100
@@ -164,7 +164,7 @@
*
* public:
* static Cairo::RefPtr<MyUserFont> create() {
- * return Cairo::RefPtr<MyUserFont>(new MyUserFont);
+ * return Cairo::make_refptr_for_instance<MyUserFont>(new MyUserFont);
*
* protected:
* // implement render_glyph() and any other virtual functions you want to override
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cairomm-1.15.2/cairomm/pattern.cc new/cairomm-1.15.3/cairomm/pattern.cc
--- old/cairomm-1.15.2/cairomm/pattern.cc 2016-12-07 11:24:02.000000000 +0100
+++ new/cairomm-1.15.3/cairomm/pattern.cc 2016-12-13 17:54:24.000000000 +0100
@@ -114,14 +114,14 @@
{
auto cobject = cairo_pattern_create_rgb(red, green, blue);
check_status_and_throw_exception(cairo_pattern_status(cobject));
- return RefPtr<SolidPattern>(new SolidPattern(cobject, true /* has reference */));
+ return make_refptr_for_instance<SolidPattern>(new SolidPattern(cobject, true /* has reference */));
}
RefPtr<SolidPattern> SolidPattern::create_rgba(double red, double green, double blue, double alpha)
{
cairo_pattern_t* cobject = cairo_pattern_create_rgba(red, green, blue, alpha);
check_status_and_throw_exception(cairo_pattern_status(cobject));
- return RefPtr<SolidPattern>(new SolidPattern(cobject, true /* has reference */));
+ return make_refptr_for_instance<SolidPattern>(new SolidPattern(cobject, true /* has reference */));
}
@@ -138,7 +138,7 @@
// we can ignore the return value since we know this is a surface pattern
cairo_pattern_get_surface(const_cast(m_cobject), &surface);
check_object_status_and_throw_exception(*this);
- return RefPtr<Surface>(new Surface(surface, false /* does not have reference */));
+ return make_refptr_for_instance<Surface>(new Surface(surface, false /* does not have reference */));
}
RefPtr<const Surface>
@@ -149,7 +149,7 @@
RefPtr<SurfacePattern> SurfacePattern::create(const RefPtr<Surface>& surface)
{
- return RefPtr<SurfacePattern>(new SurfacePattern(surface));
+ return make_refptr_for_instance<SurfacePattern>(new SurfacePattern(surface));
}
SurfacePattern::SurfacePattern(cairo_pattern_t* cobject, bool has_reference)
@@ -242,7 +242,7 @@
RefPtr<LinearGradient> LinearGradient::create(double x0, double y0, double x1, double y1)
{
- return RefPtr<LinearGradient>(new LinearGradient(x0, y0, x1, y1));
+ return make_refptr_for_instance<LinearGradient>(new LinearGradient(x0, y0, x1, y1));
}
LinearGradient::LinearGradient(cairo_pattern_t* cobject, bool has_reference)
@@ -275,7 +275,7 @@
RefPtr<RadialGradient> RadialGradient::create(double cx0, double cy0, double radius0, double cx1, double cy1, double radius1)
{
- return RefPtr<RadialGradient>(new RadialGradient(cx0, cy0, radius0, cx1, cy1, radius1));
+ return make_refptr_for_instance<RadialGradient>(new RadialGradient(cx0, cy0, radius0, cx1, cy1, radius1));
}
RadialGradient::RadialGradient(cairo_pattern_t* cobject, bool has_reference)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cairomm-1.15.2/cairomm/quartz_font.cc new/cairomm-1.15.3/cairomm/quartz_font.cc
--- old/cairomm-1.15.2/cairomm/quartz_font.cc 2016-12-07 11:24:02.000000000 +0100
+++ new/cairomm-1.15.3/cairomm/quartz_font.cc 2016-12-13 17:54:24.000000000 +0100
@@ -32,7 +32,7 @@
RefPtr<QuartzFontFace> QuartzFontFace::create(CGFontRef font)
{
- return RefPtr<QuartzFontFace>(new QuartzFontFace(font));
+ return make_refptr_for_instance<QuartzFontFace>(new QuartzFontFace(font));
}
@@ -45,7 +45,7 @@
RefPtr<QuartzFontFace> QuartzFontFace::create(ATSUFontID font_id)
{
- return RefPtr<QuartzFontFace>(new QuartzFontFace(font_id));
+ return make_refptr_for_instance<QuartzFontFace>(new QuartzFontFace(font_id));
}
#endif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cairomm-1.15.2/cairomm/quartz_surface.cc new/cairomm-1.15.3/cairomm/quartz_surface.cc
--- old/cairomm-1.15.2/cairomm/quartz_surface.cc 2016-12-07 11:24:02.000000000 +0100
+++ new/cairomm-1.15.3/cairomm/quartz_surface.cc 2016-12-13 17:54:24.000000000 +0100
@@ -43,14 +43,14 @@
auto cobject = cairo_quartz_surface_create_for_cg_context(cg_context,
width, height);
check_status_and_throw_exception(cairo_surface_status(cobject));
- return RefPtr<QuartzSurface>(new QuartzSurface(cobject, true /* has reference */));
+ return make_refptr_for_instance<QuartzSurface>(new QuartzSurface(cobject, true /* has reference */));
}
RefPtr<QuartzSurface> QuartzSurface::create(Format format, int width, int height)
{
auto cobject = cairo_quartz_surface_create((cairo_format_t)format, width, height);
check_status_and_throw_exception(cairo_surface_status(cobject));
- return RefPtr<QuartzSurface>(new QuartzSurface(cobject, true /* has reference */));
+ return make_refptr_for_instance<QuartzSurface>(new QuartzSurface(cobject, true /* has reference */));
}
#endif // CAIRO_HAS_QUARTZ_SURFACE
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cairomm-1.15.2/cairomm/refptr.h new/cairomm-1.15.3/cairomm/refptr.h
--- old/cairomm-1.15.2/cairomm/refptr.h 2016-12-07 11:24:02.000000000 +0100
+++ new/cairomm-1.15.3/cairomm/refptr.h 2016-12-13 17:54:24.000000000 +0100
@@ -2,6 +2,8 @@
#ifndef _cairo_REFPTR_H
#define _cairo_REFPTR_H
+#include <memory>
+
/* $Id: refptr.h,v 1.6 2006-09-27 18:38:57 murrayc Exp $ */
/* Copyright 2005 The cairomm Development Team
@@ -27,7 +29,15 @@
namespace Cairo
{
-//TODO: Use std::shared_ptr<> instead when we can break ABI.
+template <class T_CppObject>
+void RefPtrDeleter(T_CppObject* object)
+{
+ if (!object)
+ return;
+
+ object->unreference();
+}
+
/** RefPtr<> is a reference-counting shared smartpointer.
*
* Reference counting means that a shared reference count is incremented each
@@ -41,428 +51,17 @@
* and unreference() cairo objects.
*/
template <class T_CppObject>
-class RefPtr
-{
-public:
- // Let the cast constructors and assignement operators access private data.
- template <typename T_CastFrom>
- friend class RefPtr;
-
- /** Default constructor
- *
- * Afterwards it will be null and use of -> will cause a segmentation fault.
- */
- inline RefPtr() noexcept;
-
- /// Destructor - decrements reference count.
- inline ~RefPtr() noexcept;
-
- /** For use only in the internal implementation of cairomm, gtkmm, etc.
- *
- * This takes ownership of @a pCppObject, so it will be deleted when the
- * last RefPtr is deleted, for instance when it goes out of scope.
- *
- * This assumes that @a pCppObject already has a starting reference for its underlying cairo object,
- * so that destruction of @a @pCppObject will cause a corresponding unreference of its underlying
- * cairo object. For instance, a cairo_*_create() function usually provides a starting reference,
- * but a cairo_*_get_*() function requires the caller to manually reference the returned object.
- * In this case, you should call reference() on @a pCppObject before passing it to this constructor.
- */
- explicit inline RefPtr(T_CppObject* pCppObject) noexcept;
-
- /// For use only in the internal implementation of sharedptr.
- explicit inline RefPtr(T_CppObject* pCppObject, int* refcount) noexcept;
-
- /** Move constructor
- */
- inline RefPtr(RefPtr&& src) noexcept;
-
- /** Move constructor (from different, but castable type).
- */
- template <class T_CastFrom>
- inline RefPtr(RefPtr&& src) noexcept;
-
- /** Copy constructor
- *
- * This increments the shared reference count.
- */
- inline RefPtr(const RefPtr& src) noexcept;
-
- /** Copy constructor (from different, but castable type).
- *
- * Increments the reference count.
- */
- template <class T_CastFrom>
- inline RefPtr(const RefPtr& src) noexcept;
-
- /** Swap the contents of two RefPtr<>.
- * This method swaps the internal pointers to T_CppObject. This can be
- * done safely without involving a reference/unreference cycle and is
- * therefore highly efficient.
- */
- inline void swap(RefPtr& other) noexcept;
-
- /// Copy from another RefPtr:
- inline RefPtr& operator=(const RefPtr& src) noexcept;
-
- /** Copy from different, but castable type).
- *
- * Increments the reference count.
- */
- template <class T_CastFrom>
- inline RefPtr& operator=(const RefPtr& src) noexcept;
-
- /// Move assignment operator:
- inline RefPtr& operator=(RefPtr&& src) noexcept;
-
- /// Move assignment operator (from different, but castable type):
- template <class T_CastFrom>
- inline RefPtr& operator=(RefPtr&& src) noexcept;
-
- /// Tests whether the RefPtr<> point to the same underlying instance.
- inline bool operator==(const RefPtr& src) const noexcept;
-
- /// See operator==().
- inline bool operator!=(const RefPtr& src) const noexcept;
-
- /** Dereferencing.
- *
- * Use the methods of the underlying instance like so:
- * <code>refptr->memberfun()</code>.
- */
- inline T_CppObject* operator->() const noexcept;
-
- /** Test whether the RefPtr<> points to any underlying instance.
- *
- * Mimics usage of ordinary pointers:
- * @code
- * if (ptr)
- * do_something();
- * @endcode
- */
- inline explicit operator bool() const noexcept;
-
- /// Set underlying instance to 0, decrementing reference count of existing instance appropriately.
- inline void clear() noexcept;
-
-
- /** Dynamic cast to derived class.
- *
- * The RefPtr can't be cast with the usual notation so instead you can use
- * @code
- * ptr_derived = RefPtr<Derived>::cast_dynamic(ptr_base);
- * @endcode
- */
- template <class T_CastFrom>
- static inline RefPtr cast_dynamic(const RefPtr& src) noexcept;
-
- /** Static cast to derived class.
- *
- * Like the dynamic cast; the notation is
- * @code
- * ptr_derived = RefPtr<Derived>::cast_static(ptr_base);
- * @endcode
- */
- template <class T_CastFrom>
- static inline RefPtr cast_static(const RefPtr& src) noexcept;
-
- /** Cast to non-const.
- *
- * The RefPtr can't be cast with the usual notation so instead you can use
- * @code
- * ptr_unconst = RefPtr<UnConstType>::cast_const(ptr_const);
- * @endcode
- */
- template <class T_CastFrom>
- static inline RefPtr cast_const(const RefPtr& src) noexcept;
-
-
-#ifndef DOXYGEN_IGNORE_THIS
-
- // Warning: This is for internal use only. Do not manually modify the
- // reference count with this pointer.
- inline int* refcount_() const noexcept { return pCppRefcount_; }
-
-#endif // DOXYGEN_IGNORE_THIS
-
-private:
- void unref() noexcept;
-
- T_CppObject* pCppObject_;
- mutable int* pCppRefcount_;
-};
-
-
-#ifndef DOXYGEN_IGNORE_THIS
-
-// RefPtr<>::operator->() comes first here since it's used by other methods.
-// If it would come after them it wouldn't be inlined.
-
-template <class T_CppObject> inline
-T_CppObject* RefPtr::operator->() const noexcept
-{
- return pCppObject_;
-}
-
-template <class T_CppObject> inline
-RefPtr::RefPtr() noexcept
-:
- pCppObject_(nullptr),
- pCppRefcount_(nullptr)
-{}
-
-template <class T_CppObject> inline
-RefPtr::~RefPtr() noexcept
-{
- unref();
-}
-
-template <class T_CppObject> inline
-void RefPtr::unref() noexcept
-{
- if(pCppRefcount_)
- {
- --(*pCppRefcount_);
-
- if(*pCppRefcount_ == 0)
- {
- if(pCppObject_)
- {
- delete pCppObject_;
- pCppObject_ = nullptr;
- }
-
- delete pCppRefcount_;
- pCppRefcount_ = nullptr;
- }
- }
-}
-
-
-template <class T_CppObject> inline
-RefPtr::RefPtr(T_CppObject* pCppObject) noexcept
-:
- pCppObject_(pCppObject),
- pCppRefcount_(nullptr)
-{
- if(pCppObject)
- {
- pCppRefcount_ = new int;
- *pCppRefcount_ = 1; //This will be decremented in the destructor.
- }
-}
-
-//Used by cast_*() implementations:
-template <class T_CppObject> inline
-RefPtr::RefPtr(T_CppObject* pCppObject, int* refcount) noexcept
-:
- pCppObject_(pCppObject),
- pCppRefcount_(refcount)
-{
- if(pCppObject_ && pCppRefcount_)
- ++(*pCppRefcount_);
-}
-
-template <class T_CppObject> inline
-RefPtr::RefPtr(const RefPtr& src) noexcept
-:
- pCppObject_ (src.pCppObject_),
- pCppRefcount_(src.pCppRefcount_)
-{
- if(pCppObject_ && pCppRefcount_)
- ++(*pCppRefcount_);
-}
-
-template <class T_CppObject> inline
-RefPtr::RefPtr(RefPtr&& src) noexcept
-:
- pCppObject_ (src.pCppObject_),
- pCppRefcount_ (src.pCppRefcount_)
-{
- src.pCppObject_ = nullptr;
- src.pCppRefcount_ = nullptr;
-}
-
-template <class T_CppObject>
- template <class T_CastFrom>
-inline
-RefPtr::RefPtr(RefPtr&& src) noexcept
-:
- pCppObject_ (src.pCppObject_),
- pCppRefcount_ (src.pCppRefcount_)
-{
- src.pCppObject_ = nullptr;
- src.pCppRefcount_ = nullptr;
-}
-
-// The templated ctor allows copy construction from any object that's
-// castable. Thus, it does downcasts:
-// base_ref = derived_ref
-template <class T_CppObject>
- template <class T_CastFrom>
-inline
-RefPtr::RefPtr(const RefPtr& src) noexcept
-:
- // Without the friend delaration,
- // a different RefPtr<> will not allow us access to pCppObject_. We need
- // to add a get_underlying() for this, but that would encourage incorrect
- // use, so we use the less well-known operator->() accessor:
- pCppObject_ (src.operator->()),
- pCppRefcount_(src.refcount_())
-{
- if(pCppObject_ && pCppRefcount_)
- ++(*pCppRefcount_);
-}
-
-template <class T_CppObject> inline
-void RefPtr::swap(RefPtr& other) noexcept
-{
- T_CppObject *const temp = pCppObject_;
- int* temp_count = pCppRefcount_;
-
- pCppObject_ = other.pCppObject_;
- pCppRefcount_ = other.pCppRefcount_;
-
- other.pCppObject_ = temp;
- other.pCppRefcount_ = temp_count;
-}
-
-template <class T_CppObject> inline
-RefPtr& RefPtr::operator=(const RefPtr& src) noexcept
-{
- // In case you haven't seen the swap() technique to implement copy
- // assignment before, here's what it does:
- //
- // 1) Create a temporary RefPtr<> instance via the copy ctor, thereby
- // increasing the reference count of the source object.
- //
- // 2) Swap the internal object pointers of *this and the temporary
- // RefPtr<>. After this step, *this already contains the new pointer,
- // and the old pointer is now managed by temp.
- //
- // 3) The destructor of temp is executed, thereby unreferencing the
- // old object pointer.
- //
- // This technique is described in Herb Sutter's "Exceptional C++", and
- // has a number of advantages over conventional approaches:
- //
- // - Code reuse by calling the copy ctor.
- // - Strong exception safety for free.
- // - Self assignment is handled implicitely.
- // - Simplicity.
- // - It just works and is hard to get wrong; i.e. you can use it without
- // even thinking about it to implement copy assignment whereever the
- // object data is managed indirectly via a pointer, which is very common.
-
- RefPtr temp (src);
- this->swap(temp);
- return *this;
-}
-
-template <class T_CppObject> inline
-RefPtr& RefPtr::operator=(RefPtr&& src) noexcept
-{
- RefPtr temp (std::move(src));
- this->swap(temp);
- src.pCppObject_ = nullptr;
- src.pCppRefcount_ = nullptr;
-
- return *this;
-}
-
-template <class T_CppObject>
- template <class T_CastFrom>
-inline
-RefPtr& RefPtr::operator=(RefPtr&& src) noexcept
-{
- RefPtr temp (std::move(src));
- this->swap(temp);
- src.pCppObject_ = nullptr;
- src.pCppRefcount_ = nullptr;
-
- return *this;
-}
+using RefPtr = std::shared_ptr;
template <class T_CppObject>
- template <class T_CastFrom>
-inline
-RefPtr& RefPtr::operator=(const RefPtr& src) noexcept
-{
- RefPtr temp (src);
- this->swap(temp);
- return *this;
-}
-
-template <class T_CppObject> inline
-bool RefPtr::operator==(const RefPtr& src) const noexcept
+RefPtr
+make_refptr_for_instance(T_CppObject* object)
{
- return (pCppObject_ == src.pCppObject_);
-}
-
-template <class T_CppObject> inline
-bool RefPtr::operator!=(const RefPtr& src) const noexcept
-{
- return (pCppObject_ != src.pCppObject_);
-}
-
-template <class T_CppObject> inline
-RefPtr::operator bool() const noexcept
-{
- return (pCppObject_ != nullptr);
-}
-
-template <class T_CppObject> inline
-void RefPtr::clear() noexcept
-{
- RefPtr temp; // swap with an empty RefPtr<> to clear *this
- this->swap(temp);
-}
-
-template <class T_CppObject>
- template <class T_CastFrom>
-inline
-RefPtr RefPtr::cast_dynamic(const RefPtr& src) noexcept
-{
- T_CppObject *const pCppObject = dynamic_cast(src.operator->());
-
- if(pCppObject) //Check whether dynamic_cast<> succeeded so we don't pass a null object with a used refcount:
- return RefPtr(pCppObject, src.refcount_());
- else
- return RefPtr();
-}
-
-template <class T_CppObject>
- template <class T_CastFrom>
-inline
-RefPtr RefPtr::cast_static(const RefPtr& src) noexcept
-{
- T_CppObject *const pCppObject = static_cast(src.operator->());
-
- return RefPtr(pCppObject, src.refcount_());
-}
-
-template <class T_CppObject>
- template <class T_CastFrom>
-inline
-RefPtr RefPtr::cast_const(const RefPtr& src) noexcept
-{
- T_CppObject *const pCppObject = const_cast(src.operator->());
-
- return RefPtr(pCppObject, src.refcount_());
-}
-
-#endif /* DOXYGEN_IGNORE_THIS */
-
-/** @relates Glib::RefPtr */
-template <class T_CppObject> inline
-void swap(RefPtr& lhs, RefPtr& rhs) noexcept
-{
- lhs.swap(rhs);
+ return RefPtr(object, &RefPtrDeleter);
}
} // namespace Cairo
-
#endif /* _cairo_REFPTR_H */
// vim: ts=2 sw=2 et
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cairomm-1.15.2/cairomm/region.cc new/cairomm-1.15.3/cairomm/region.cc
--- old/cairomm-1.15.2/cairomm/region.cc 2016-12-07 11:24:02.000000000 +0100
+++ new/cairomm-1.15.3/cairomm/region.cc 2016-12-13 17:54:24.000000000 +0100
@@ -68,27 +68,27 @@
RefPtr<Region> Region::create()
{
- return RefPtr<Region>(new Region());
+ return make_refptr_for_instance<Region>(new Region());
}
RefPtr<Region> Region::create(const RectangleInt& rectangle)
{
- return RefPtr<Region>(new Region(rectangle));
+ return make_refptr_for_instance<Region>(new Region(rectangle));
}
RefPtr<Region> Region::create(const std::vector<RectangleInt>& rects)
{
- return RefPtr<Region>(new Region(rects));
+ return make_refptr_for_instance<Region>(new Region(rects));
}
RefPtr<Region> Region::create(const RectangleInt *rects, int count)
{
- return RefPtr<Region>(new Region(rects, count));
+ return make_refptr_for_instance<Region>(new Region(rects, count));
}
RefPtr<Region> Region::copy() const
{
- return RefPtr<Region> (new Region (cairo_region_copy (m_cobject), true));
+ return make_refptr_for_instance<Region>(new Region (cairo_region_copy (m_cobject), true));
}
Region::~Region()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cairomm-1.15.2/cairomm/scaledfont.cc new/cairomm-1.15.3/cairomm/scaledfont.cc
--- old/cairomm-1.15.2/cairomm/scaledfont.cc 2016-12-07 11:24:02.000000000 +0100
+++ new/cairomm-1.15.3/cairomm/scaledfont.cc 2016-12-13 17:54:24.000000000 +0100
@@ -53,7 +53,7 @@
RefPtr<ScaledFont> ScaledFont::create(const RefPtr<FontFace>& font_face, const Matrix& font_matrix,
const Matrix& ctm, const FontOptions& options)
{
- return RefPtr<ScaledFont>(new ScaledFont(font_face, font_matrix, ctm, options));
+ return make_refptr_for_instance<ScaledFont>(new ScaledFont(font_face, font_matrix, ctm, options));
}
void ScaledFont::get_extents(FontExtents& extents) const
@@ -66,7 +66,7 @@
{
auto face = cairo_scaled_font_get_font_face(m_cobject);
check_object_status_and_throw_exception(*this);
- return RefPtr<FontFace>(new FontFace(face, false /* returned face doesn't have a reference */));
+ return make_refptr_for_instance<FontFace>(new FontFace(face, false /* returned face doesn't have a reference */));
}
void ScaledFont::get_font_options(FontOptions& options) const
@@ -148,7 +148,7 @@
const Matrix& font_matrix, const Matrix& ctm,
const FontOptions& options)
{
- return RefPtr<FtScaledFont>(new FtScaledFont(font_face, font_matrix, ctm, options));
+ return make_refptr_for_instance<FtScaledFont>(new FtScaledFont(font_face, font_matrix, ctm, options));
}
FT_Face FtScaledFont::lock_face()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cairomm-1.15.2/cairomm/script.cc new/cairomm-1.15.3/cairomm/script.cc
--- old/cairomm-1.15.2/cairomm/script.cc 2016-12-07 11:24:02.000000000 +0100
+++ new/cairomm-1.15.3/cairomm/script.cc 2016-12-13 17:54:24.000000000 +0100
@@ -58,7 +58,7 @@
{
auto cobject = cairo_script_create(filename.c_str());
check_status_and_throw_exception(cairo_device_status(cobject));
- return RefPtr<Script>(new Script(cobject, true /* has reference */));
+ return make_refptr_for_instance<Script>(new Script(cobject, true /* has reference */));
}
static cairo_user_data_key_t USER_DATA_KEY_DEVICE_WRITE_FUNC = {0};
@@ -95,7 +95,7 @@
slot_copy);
check_status_and_throw_exception(cairo_device_status(cobject));
set_write_slot(cobject, slot_copy);
- return RefPtr<Script>(new Script(cobject, true /* has reference */));
+ return make_refptr_for_instance<Script>(new Script(cobject, true /* has reference */));
}
#endif // CAIRO_HAS_SCRIPT_SURFACE
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cairomm-1.15.2/cairomm/script_surface.cc new/cairomm-1.15.3/cairomm/script_surface.cc
--- old/cairomm-1.15.2/cairomm/script_surface.cc 2016-12-07 11:24:02.000000000 +0100
+++ new/cairomm-1.15.3/cairomm/script_surface.cc 2016-12-13 17:54:24.000000000 +0100
@@ -40,7 +40,7 @@
cairo_script_surface_create(script->cobj(), static_cast(content),
width, height);
check_status_and_throw_exception(cairo_surface_status(cobject));
- return RefPtr<ScriptSurface>(new ScriptSurface(cobject, true /* has reference */));
+ return make_refptr_for_instance<ScriptSurface>(new ScriptSurface(cobject, true /* has reference */));
}
RefPtr<ScriptSurface>
@@ -50,7 +50,7 @@
auto cobject =
cairo_script_surface_create_for_target(script->cobj(), target->cobj());
check_status_and_throw_exception(cairo_surface_status(cobject));
- return RefPtr<ScriptSurface>(new ScriptSurface(cobject, true /* has reference */));
+ return make_refptr_for_instance<ScriptSurface>(new ScriptSurface(cobject, true /* has reference */));
}
#endif // CAIRO_HAS_SCRIPT_SURFACE
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cairomm-1.15.2/cairomm/surface.cc new/cairomm-1.15.3/cairomm/surface.cc
--- old/cairomm-1.15.2/cairomm/surface.cc 2016-12-07 11:24:02.000000000 +0100
+++ new/cairomm-1.15.3/cairomm/surface.cc 2016-12-13 17:54:24.000000000 +0100
@@ -246,11 +246,11 @@
{
#if CAIRO_HAS_SCRIPT_SURFACE
case CAIRO_SURFACE_TYPE_SCRIPT:
- return RefPtr<Script>(new Script(d, true /* has reference */));
+ return make_refptr_for_instance<Script>(new Script(d, true /* has reference */));
break;
#endif
default:
- return RefPtr<Device>(new Device(d, true /* has reference */));
+ return make_refptr_for_instance<Device>(new Device(d, true /* has reference */));
}
}
@@ -268,14 +268,14 @@
{
auto cobject = cairo_surface_create_similar(other->cobj(), (cairo_content_t)content, width, height);
check_status_and_throw_exception(cairo_surface_status(cobject));
- return RefPtr<Surface>(new Surface(cobject, true /* has reference */));
+ return make_refptr_for_instance<Surface>(new Surface(cobject, true /* has reference */));
}
RefPtr<Surface> Surface::create(const RefPtr<Surface>& target, double x, double y, double width, double height)
{
auto cobject = cairo_surface_create_for_rectangle(target->cobj(), x, y, width, height);
check_status_and_throw_exception(cairo_surface_status(cobject));
- return RefPtr<Surface>(new Surface(cobject, true /* has reference */));
+ return make_refptr_for_instance<Surface>(new Surface(cobject, true /* has reference */));
}
@@ -292,14 +292,14 @@
{
auto cobject = cairo_image_surface_create((cairo_format_t)format, width, height);
check_status_and_throw_exception(cairo_surface_status(cobject));
- return RefPtr<ImageSurface>(new ImageSurface(cobject, true /* has reference */));
+ return make_refptr_for_instance<ImageSurface>(new ImageSurface(cobject, true /* has reference */));
}
RefPtr<ImageSurface> ImageSurface::create(unsigned char* data, Format format, int width, int height, int stride)
{
auto cobject = cairo_image_surface_create_for_data(data, (cairo_format_t)format, width, height, stride);
check_status_and_throw_exception(cairo_surface_status(cobject));
- return RefPtr<ImageSurface>(new ImageSurface(cobject, true /* has reference */));
+ return make_refptr_for_instance<ImageSurface>(new ImageSurface(cobject, true /* has reference */));
}
#ifdef CAIRO_HAS_PNG_FUNCTIONS
@@ -308,7 +308,7 @@
{
auto cobject = cairo_image_surface_create_from_png(filename.c_str());
check_status_and_throw_exception(cairo_surface_status(cobject));
- return RefPtr<ImageSurface>(new ImageSurface(cobject, true /* has reference */));
+ return make_refptr_for_instance<ImageSurface>(new ImageSurface(cobject, true /* has reference */));
}
RefPtr<ImageSurface> ImageSurface::create_from_png_stream(const SlotReadFunc& read_func)
@@ -318,7 +318,7 @@
cairo_image_surface_create_from_png_stream(&read_func_wrapper, slot_copy);
check_status_and_throw_exception(cairo_surface_status(cobject));
set_read_slot(cobject, slot_copy);
- return RefPtr<ImageSurface>(new ImageSurface(cobject, true /* has reference */));
+ return make_refptr_for_instance<ImageSurface>(new ImageSurface(cobject, true /* has reference */));
}
#endif // CAIRO_HAS_PNG_FUNCTIONS
@@ -378,14 +378,14 @@
{
auto cobject = cairo_recording_surface_create((cairo_content_t)content, NULL);
check_status_and_throw_exception(cairo_surface_status(cobject));
- return RefPtr<RecordingSurface>(new RecordingSurface(cobject, true /* has reference */));
+ return make_refptr_for_instance<RecordingSurface>(new RecordingSurface(cobject, true /* has reference */));
}
RefPtr<RecordingSurface> RecordingSurface::create(const Rectangle& extents, Content content)
{
auto cobject = cairo_recording_surface_create((cairo_content_t)content, &extents);
check_status_and_throw_exception(cairo_surface_status(cobject));
- return RefPtr<RecordingSurface>(new RecordingSurface(cobject, true /* has reference */));
+ return make_refptr_for_instance<RecordingSurface>(new RecordingSurface(cobject, true /* has reference */));
}
Rectangle RecordingSurface::ink_extents() const
@@ -425,7 +425,7 @@
{
auto cobject = cairo_pdf_surface_create(filename.c_str(), width_in_points, height_in_points);
check_status_and_throw_exception(cairo_surface_status(cobject));
- return RefPtr<PdfSurface>(new PdfSurface(cobject, true /* has reference */));
+ return make_refptr_for_instance<PdfSurface>(new PdfSurface(cobject, true /* has reference */));
}
RefPtr<PdfSurface> PdfSurface::create_for_stream(const SlotWriteFunc& write_func, double
@@ -437,7 +437,7 @@
width_in_points, height_in_points);
check_status_and_throw_exception(cairo_surface_status(cobject));
set_write_slot(cobject, slot_copy);
- return RefPtr<PdfSurface>(new PdfSurface(cobject, true /* has reference */));
+ return make_refptr_for_instance<PdfSurface>(new PdfSurface(cobject, true /* has reference */));
}
void PdfSurface::set_size(double width_in_points, double height_in_points)
@@ -493,7 +493,7 @@
{
auto cobject = cairo_ps_surface_create(filename.c_str(), width_in_points, height_in_points);
check_status_and_throw_exception(cairo_surface_status(cobject));
- return RefPtr<PsSurface>(new PsSurface(cobject, true /* has reference */));
+ return make_refptr_for_instance<PsSurface>(new PsSurface(cobject, true /* has reference */));
}
RefPtr<PsSurface> PsSurface::create_for_stream(const SlotWriteFunc& write_func, double
@@ -505,7 +505,7 @@
width_in_points, height_in_points);
check_status_and_throw_exception(cairo_surface_status(cobject));
set_write_slot(cobject, slot_copy);
- return RefPtr<PsSurface>(new PsSurface(cobject, true /* has reference */));
+ return make_refptr_for_instance<PsSurface>(new PsSurface(cobject, true /* has reference */));
}
void PsSurface::set_size(double width_in_points, double height_in_points)
@@ -594,7 +594,7 @@
{
auto cobject = cairo_svg_surface_create(filename.c_str(), width_in_points, height_in_points);
check_status_and_throw_exception(cairo_surface_status(cobject));
- return RefPtr<SvgSurface>(new SvgSurface(cobject, true /* has reference */));
+ return make_refptr_for_instance<SvgSurface>(new SvgSurface(cobject, true /* has reference */));
}
RefPtr<SvgSurface> SvgSurface::create_for_stream(const SlotWriteFunc& write_func,
@@ -607,7 +607,7 @@
width_in_points, height_in_points);
check_status_and_throw_exception(cairo_surface_status(cobject));
set_write_slot(cobject, slot_copy);
- return RefPtr<SvgSurface>(new SvgSurface(cobject, true /* has reference */));
+ return make_refptr_for_instance<SvgSurface>(new SvgSurface(cobject, true /* has reference */));
}
void SvgSurface::restrict_to_version(SvgVersion version)
@@ -658,7 +658,7 @@
{
auto cobject = cairo_glitz_surface_create(surface);
check_status_and_throw_exception(cairo_surface_status(cobject));
- return RefPtr<GlitzSurface>(new GlitzSurface(cobject, true /* has reference */));
+ return make_refptr_for_instance<GlitzSurface>(new GlitzSurface(cobject, true /* has reference */));
}
#endif // CAIRO_HAS_GLITZ_SURFACE
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cairomm-1.15.2/cairomm/win32_font.cc new/cairomm-1.15.3/cairomm/win32_font.cc
--- old/cairomm-1.15.2/cairomm/win32_font.cc 2016-12-07 11:24:02.000000000 +0100
+++ new/cairomm-1.15.3/cairomm/win32_font.cc 2016-12-13 17:54:24.000000000 +0100
@@ -44,17 +44,17 @@
RefPtr<Win32FontFace> Win32FontFace::create(LOGFONTW* logfont)
{
- return RefPtr<Win32FontFace>(new Win32FontFace(logfont));
+ return make_refptr_for_instance<Win32FontFace>(new Win32FontFace(logfont));
}
RefPtr<Win32FontFace> Win32FontFace::create(HFONT font)
{
- return RefPtr<Win32FontFace>(new Win32FontFace(font));
+ return make_refptr_for_instance<Win32FontFace>(new Win32FontFace(font));
}
RefPtr<Win32FontFace> Win32FontFace::create(LOGFONTW* logfont, HFONT font)
{
- return RefPtr<Win32FontFace>(new Win32FontFace(logfont, font));
+ return make_refptr_for_instance<Win32FontFace>(new Win32FontFace(logfont, font));
}
// ScaledFont
@@ -72,7 +72,7 @@
const Matrix& font_matrix, const Matrix& ctm,
const FontOptions& options)
{
- return RefPtr<Win32ScaledFont>(new Win32ScaledFont(font_face, font_matrix,
+ return make_refptr_for_instance<Win32ScaledFont>(new Win32ScaledFont(font_face, font_matrix,
ctm, options));
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cairomm-1.15.2/cairomm/win32_surface.cc new/cairomm-1.15.3/cairomm/win32_surface.cc
--- old/cairomm-1.15.2/cairomm/win32_surface.cc 2016-12-07 11:24:02.000000000 +0100
+++ new/cairomm-1.15.3/cairomm/win32_surface.cc 2016-12-13 17:54:24.000000000 +0100
@@ -50,7 +50,7 @@
{
auto cobject = cairo_win32_surface_create(hdc);
check_status_and_throw_exception(cairo_surface_status(cobject));
- return RefPtr<Win32Surface>(new Win32Surface(cobject, true /* has reference */));
+ return make_refptr_for_instance<Win32Surface>(new Win32Surface(cobject, true /* has reference */));
}
RefPtr<Win32Surface> Win32Surface::create(Format format, int width, int height)
@@ -62,7 +62,7 @@
{
auto cobject = cairo_win32_surface_create_with_dib((cairo_format_t)format, width, height);
check_status_and_throw_exception(cairo_surface_status(cobject));
- return RefPtr<Win32Surface>(new Win32Surface(cobject, true /* has reference */));
+ return make_refptr_for_instance<Win32Surface>(new Win32Surface(cobject, true /* has reference */));
}
RefPtr<Win32Surface> Win32Surface::create_with_ddb(HDC hdc, Format format, int width, int height)
@@ -70,7 +70,7 @@
auto cobject =
cairo_win32_surface_create_with_ddb(hdc, (cairo_format_t)format, width, height);
check_status_and_throw_exception(cairo_surface_status(cobject));
- return RefPtr<Win32Surface>(new Win32Surface(cobject, true /* has reference */));
+ return make_refptr_for_instance<Win32Surface>(new Win32Surface(cobject, true /* has reference */));
}
Win32PrintingSurface::Win32PrintingSurface(cairo_surface_t* cobject, bool has_reference)
@@ -87,7 +87,7 @@
{
auto cobject = cairo_win32_surface_create(hdc);
check_status_and_throw_exception(cairo_surface_status(cobject));
- return RefPtr<Win32PrintingSurface>(new Win32PrintingSurface(cobject, true /* has reference */));
+ return make_refptr_for_instance<Win32PrintingSurface>(new Win32PrintingSurface(cobject, true /* has reference */));
}
#endif // CAIRO_HAS_WIN32_SURFACE
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cairomm-1.15.2/cairomm/xlib_surface.cc new/cairomm-1.15.3/cairomm/xlib_surface.cc
--- old/cairomm-1.15.2/cairomm/xlib_surface.cc 2016-12-07 11:24:02.000000000 +0100
+++ new/cairomm-1.15.3/cairomm/xlib_surface.cc 2016-12-13 17:54:24.000000000 +0100
@@ -38,14 +38,14 @@
{
auto cobject = cairo_xlib_surface_create(dpy, drawable, visual, width, height);
check_status_and_throw_exception(cairo_surface_status(cobject));
- return RefPtr<XlibSurface>(new XlibSurface(cobject, true /* has reference */));
+ return make_refptr_for_instance<XlibSurface>(new XlibSurface(cobject, true /* has reference */));
}
RefPtr<XlibSurface> XlibSurface::create(Display* dpy, Pixmap bitmap, Screen* screen, int width, int height)
{
auto cobject = cairo_xlib_surface_create_for_bitmap(dpy, bitmap, screen, width, height);
check_status_and_throw_exception(cairo_surface_status(cobject));
- return RefPtr<XlibSurface>(new XlibSurface(cobject, true /* has reference */));
+ return make_refptr_for_instance<XlibSurface>(new XlibSurface(cobject, true /* has reference */));
}
void XlibSurface::set_size(int width, int height)
@@ -144,7 +144,7 @@
screen, format,
width, height);
check_status_and_throw_exception(cairo_surface_status(cobject));
- return RefPtr<XlibSurface>(new XlibSurface(cobject, true /* has reference */));
+ return make_refptr_for_instance<XlibSurface>(new XlibSurface(cobject, true /* has reference */));
}
XRenderPictFormat*
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cairomm-1.15.2/configure.ac new/cairomm-1.15.3/configure.ac
--- old/cairomm-1.15.2/configure.ac 2016-12-07 11:24:02.000000000 +0100
+++ new/cairomm-1.15.3/configure.ac 2016-12-13 17:54:24.000000000 +0100
@@ -15,7 +15,7 @@
## You should have received a copy of the GNU Lesser General Public License
## along with this library. If not, see http://www.gnu.org/licenses/.
-AC_INIT([cairomm], [1.15.2], [https://bugs.freedesktop.org/enter_bug.cgi?product=cairomm],
+AC_INIT([cairomm], [1.15.3], [https://bugs.freedesktop.org/enter_bug.cgi?product=cairomm],
[cairomm], [http://www.cairographics.org/cairomm/])
AC_PREREQ([2.62])
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cairomm-1.15.2/examples/text/user-font.cc new/cairomm-1.15.3/examples/text/user-font.cc
--- old/cairomm-1.15.2/examples/text/user-font.cc 2016-12-07 11:24:02.000000000 +0100
+++ new/cairomm-1.15.3/examples/text/user-font.cc 2016-12-13 17:54:24.000000000 +0100
@@ -36,7 +36,7 @@
// and return it with a RefPtr
static Cairo::RefPtr<BoxFontFace> create()
{
- return Cairo::RefPtr<BoxFontFace>(new BoxFontFace());
+ return Cairo::make_refptr_for_instance<BoxFontFace>(new BoxFontFace());
}
Cairo::ErrorStatus
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cairomm-1.15.2/tests/test-user-font.cc new/cairomm-1.15.3/tests/test-user-font.cc
--- old/cairomm-1.15.2/tests/test-user-font.cc 2016-12-07 11:24:02.000000000 +0100
+++ new/cairomm-1.15.3/tests/test-user-font.cc 2016-12-13 17:54:24.000000000 +0100
@@ -55,7 +55,7 @@
class ImplTextUserFont: public NullRenderUserFont
{
public:
- static RefPtr<ImplTextUserFont> create() { return RefPtr<ImplTextUserFont>(new ImplTextUserFont());};
+ static RefPtr<ImplTextUserFont> create() { return make_refptr_for_insance<ImplTextUserFont>(new ImplTextUserFont());};
ErrorStatus text_to_glyphs(const RefPtr<ScaledFont>& /*scaled_font*/,
const std::string& /*utf8*/,
std::vector<Glyph>& glyphs,
@@ -90,7 +90,7 @@
class ImplUnicodeUserFont: public NullRenderUserFont
{
public:
- static RefPtr<ImplUnicodeUserFont> create() { return RefPtr<ImplUnicodeUserFont>(new ImplUnicodeUserFont());};
+ static RefPtr<ImplUnicodeUserFont> create() { return make_refptr_for_instance<ImplUnicodeUserFont>(new ImplUnicodeUserFont());};
ErrorStatus unicode_to_glyph(const RefPtr<ScaledFont>& /*scaled_font*/,
unsigned long /*unicode*/,
unsigned long& /*glyph*/) override
@@ -117,7 +117,7 @@
class ImplBothUserFont: public NullRenderUserFont
{
public:
- static RefPtr<ImplBothUserFont> create() { return RefPtr<ImplBothUserFont>(new ImplBothUserFont());};
+ static RefPtr<ImplBothUserFont> create() { return make_refptr_for_instance<ImplBothUserFont>(new ImplBothUserFont());};
ErrorStatus unicode_to_glyph(const RefPtr<ScaledFont>& /*scaled_font*/,
unsigned long /*unicode*/,
unsigned long& /*glyph*/) override
@@ -161,7 +161,7 @@
class ImplNeitherUserFont: public NullRenderUserFont
{
public:
- static RefPtr<ImplNeitherUserFont> create() { return RefPtr<ImplNeitherUserFont>(new ImplNeitherUserFont());};
+ static RefPtr<ImplNeitherUserFont> create() { return make_refptr_for_instance<ImplNeitherUserFont>(new ImplNeitherUserFont());};
protected:
ImplNeitherUserFont() : NullRenderUserFont() {}
@@ -182,7 +182,7 @@
class ImplInitUserFont: public NullRenderUserFont
{
public:
- static RefPtr<ImplInitUserFont> create() { return RefPtr<ImplInitUserFont>(new ImplInitUserFont());};
+ static RefPtr<ImplInitUserFont> create() { return make_refptr_for_instance<ImplInitUserFont>(new ImplInitUserFont());};
ErrorStatus init(const RefPtr<ScaledFont>& /*scaled_font*/,
const RefPtr<Context>& /*cr*/,
FontExtents& /*extents*/) override
@@ -207,7 +207,7 @@
class ExceptionUserFont : public UserFontFace
{
public:
- static RefPtr<ExceptionUserFont> create(int flags) { return RefPtr<ExceptionUserFont>(new ExceptionUserFont(flags));};
+ static RefPtr<ExceptionUserFont> create(int flags) { return make_refptr_for_instance<ExceptionUserFont>(new ExceptionUserFont(flags));};
ErrorStatus
render_glyph(const RefPtr<ScaledFont>& /*scaled_font*/,