summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMurray Cumming <murrayc@murrayc.com>2015-07-31 11:54:29 +0200
committerMurray Cumming <murrayc@murrayc.com>2015-07-31 11:56:33 +0200
commit8dfbf6c19e0187e7cc5010e617cf4f4b3e227867 (patch)
treefe45cbd742d9f05826c934c460fbaf288ad48602
parent89e0d60963fffb66cbc7ef34dbfd5fbdf26f81c2 (diff)
C++11: Use auto.
-rw-r--r--cairomm/context.cc48
-rw-r--r--cairomm/device.cc4
-rw-r--r--cairomm/fontface.cc26
-rw-r--r--cairomm/fontface.h2
-rw-r--r--cairomm/fontoptions.cc10
-rw-r--r--cairomm/matrix.cc2
-rw-r--r--cairomm/pattern.cc8
-rw-r--r--cairomm/quartz_surface.cc4
-rw-r--r--cairomm/region.cc18
-rw-r--r--cairomm/scaledfont.cc8
-rw-r--r--cairomm/script.cc12
-rw-r--r--cairomm/script_surface.cc4
-rw-r--r--cairomm/surface.cc78
-rw-r--r--cairomm/win32_font.cc4
-rw-r--r--cairomm/win32_surface.cc8
-rw-r--r--cairomm/xlib_surface.cc26
-rw-r--r--examples/surfaces/image-surface.cc4
-rw-r--r--examples/surfaces/pdf-surface.cc4
-rw-r--r--examples/surfaces/ps-surface.cc4
-rw-r--r--examples/surfaces/svg-surface.cc4
-rw-r--r--examples/text/text-rotate.cc4
-rw-r--r--examples/text/toy-text.cc6
-rw-r--r--examples/text/user-font.cc8
-rw-r--r--tests/test-context.cc40
-rw-r--r--tests/test-font-face.cc12
-rw-r--r--tests/test-font-options.cc8
-rw-r--r--tests/test-matrix.cc10
-rw-r--r--tests/test-scaled-font.cc28
-rw-r--r--tests/test-surface.cc18
-rw-r--r--tests/test-user-font.cc12
30 files changed, 212 insertions, 212 deletions
diff --git a/cairomm/context.cc b/cairomm/context.cc
index bf70ef4..6d586ee 100644
--- a/cairomm/context.cc
+++ b/cairomm/context.cc
@@ -578,7 +578,7 @@ void Context::set_scaled_font(const RefPtr<const ScaledFont>& scaled_font)
RefPtr<ScaledFont> Context::get_scaled_font()
{
- cairo_scaled_font_t* font = cairo_get_scaled_font(cobj());
+ 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 */));
}
@@ -613,14 +613,14 @@ void Context::show_glyphs(const std::vector<Glyph>& glyphs)
RefPtr<FontFace> Context::get_font_face()
{
- cairo_font_face_t* cfontface = cairo_get_font_face(cobj());
+ 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 */));
}
RefPtr<const FontFace> Context::get_font_face() const
{
- cairo_font_face_t* cfontface = cairo_get_font_face(const_cast<cobject*>(cobj()));
+ auto cfontface = cairo_get_font_face(const_cast<cobject*>(cobj()));
check_object_status_and_throw_exception(*this);
return RefPtr<const FontFace>(new FontFace(cfontface, false /* does not have reference */));
}
@@ -667,7 +667,7 @@ void Context::glyph_path(const std::vector<Glyph>& glyphs)
Operator Context::get_operator() const
{
- const Operator result =
+ const auto result =
static_cast<Operator>(cairo_get_operator(const_cast<cobject*>(cobj())));
check_object_status_and_throw_exception(*this);
return result;
@@ -675,7 +675,7 @@ Operator Context::get_operator() const
static RefPtr<Pattern> get_pattern_wrapper (cairo_pattern_t* pattern)
{
- cairo_pattern_type_t pattern_type = cairo_pattern_get_type (pattern);
+ auto pattern_type = cairo_pattern_get_type (pattern);
switch (pattern_type)
{
case CAIRO_PATTERN_TYPE_SOLID:
@@ -697,28 +697,28 @@ static RefPtr<Pattern> get_pattern_wrapper (cairo_pattern_t* pattern)
RefPtr<Pattern> Context::get_source()
{
- cairo_pattern_t* pattern = cairo_get_source(cobj());
+ auto pattern = cairo_get_source(cobj());
check_object_status_and_throw_exception(*this);
return get_pattern_wrapper (pattern);
}
RefPtr<const Pattern> Context::get_source() const
{
- cairo_pattern_t* pattern = cairo_get_source(const_cast<cobject*>(cobj()));
+ auto pattern = cairo_get_source(const_cast<cobject*>(cobj()));
check_object_status_and_throw_exception(*this);
return RefPtr<const Pattern>::cast_const (get_pattern_wrapper (pattern));
}
double Context::get_tolerance() const
{
- const double result = cairo_get_tolerance(const_cast<cobject*>(cobj()));
+ const auto result = cairo_get_tolerance(const_cast<cobject*>(cobj()));
check_object_status_and_throw_exception(*this);
return result;
}
Antialias Context::get_antialias() const
{
- const Antialias result = static_cast<Antialias>(cairo_get_antialias(const_cast<cobject*>(cobj())));
+ const auto result = static_cast<Antialias>(cairo_get_antialias(const_cast<cobject*>(cobj())));
check_object_status_and_throw_exception(*this);
return result;
}
@@ -736,35 +736,35 @@ void Context::get_current_point(double& x, double& y) const
FillRule Context::get_fill_rule() const
{
- const FillRule result = static_cast<FillRule>(cairo_get_fill_rule(const_cast<cobject*>(cobj())));
+ const auto result = static_cast<FillRule>(cairo_get_fill_rule(const_cast<cobject*>(cobj())));
check_object_status_and_throw_exception(*this);
return result;
}
double Context::get_line_width() const
{
- const double result = cairo_get_line_width(const_cast<cobject*>(cobj()));
+ const auto result = cairo_get_line_width(const_cast<cobject*>(cobj()));
check_object_status_and_throw_exception(*this);
return result;
}
LineCap Context::get_line_cap() const
{
- const LineCap result = static_cast<LineCap>(cairo_get_line_cap(const_cast<cobject*>(cobj())));
+ const auto result = static_cast<LineCap>(cairo_get_line_cap(const_cast<cobject*>(cobj())));
check_object_status_and_throw_exception(*this);
return result;
}
LineJoin Context::get_line_join() const
{
- const LineJoin result = static_cast<LineJoin>(cairo_get_line_join(const_cast<cobject*>(cobj())));
+ const auto result = static_cast<LineJoin>(cairo_get_line_join(const_cast<cobject*>(cobj())));
check_object_status_and_throw_exception(*this);
return result;
}
double Context::get_miter_limit() const
{
- const double result = cairo_get_miter_limit(const_cast<cobject*>(cobj()));
+ const auto result = cairo_get_miter_limit(const_cast<cobject*>(cobj()));
check_object_status_and_throw_exception(*this);
return result;
}
@@ -775,8 +775,8 @@ Context::get_dash(std::vector<double>& dashes, double& offset) const
// Allocate this array dynamically because some compilers complain about
// allocating arrays on the stack when the array size isn't a compile-time
// constant...
- const int cnt = cairo_get_dash_count(const_cast<cobject*>(cobj()));
- double* dash_array = new double[cnt];
+ const auto cnt = cairo_get_dash_count(const_cast<cobject*>(cobj()));
+ auto dash_array = new double[cnt];
cairo_get_dash(const_cast<cobject*>(cobj()), dash_array, &offset);
check_object_status_and_throw_exception(*this);
dashes.assign(dash_array, dash_array + cnt);
@@ -806,7 +806,7 @@ Matrix Context::get_matrix() const
static
RefPtr<Surface> get_surface_wrapper (cairo_surface_t* surface)
{
- cairo_surface_type_t surface_type = cairo_surface_get_type (surface);
+ auto surface_type = cairo_surface_get_type (surface);
switch (surface_type)
{
case CAIRO_SURFACE_TYPE_IMAGE:
@@ -864,21 +864,21 @@ RefPtr<Surface> get_surface_wrapper (cairo_surface_t* surface)
RefPtr<Surface> Context::get_target()
{
- cairo_surface_t* surface = cairo_get_target(const_cast<cobject*>(cobj()));
+ auto surface = cairo_get_target(const_cast<cobject*>(cobj()));
check_object_status_and_throw_exception(*this);
return get_surface_wrapper (surface);
}
RefPtr<const Surface> Context::get_target() const
{
- cairo_surface_t* surface = cairo_get_target(const_cast<cobject*>(cobj()));
+ auto surface = cairo_get_target(const_cast<cobject*>(cobj()));
check_object_status_and_throw_exception(*this);
return RefPtr<const Surface>::cast_const (get_surface_wrapper (surface));
}
Path* Context::copy_path() const
{
- cairo_path_t* cresult = cairo_copy_path(const_cast<cobject*>(cobj()));
+ auto cresult = cairo_copy_path(const_cast<cobject*>(cobj()));
check_object_status_and_throw_exception(*this);
return new Path(cresult, true /* take ownership */); //The caller must delete it.
}
@@ -892,7 +892,7 @@ void Context::get_path_extents(double& x1, double& y1, double& x2, double& y2) c
Path* Context::copy_path_flat() const
{
- cairo_path_t* cresult = cairo_copy_path_flat(const_cast<cobject*>(cobj()));
+ auto cresult = cairo_copy_path_flat(const_cast<cobject*>(cobj()));
check_object_status_and_throw_exception(*this);
return new Path(cresult, true /* take ownership */); //The caller must delete it.
}
@@ -917,7 +917,7 @@ void Context::push_group_with_content(Content content)
RefPtr<Pattern> Context::pop_group()
{
- cairo_pattern_t* pattern = cairo_pop_group(cobj());
+ auto pattern = cairo_pop_group(cobj());
check_object_status_and_throw_exception(*this);
return get_pattern_wrapper(pattern);
}
@@ -930,7 +930,7 @@ void Context::pop_group_to_source()
RefPtr<Surface> Context::get_group_target()
{
- cairo_surface_t* surface = cairo_get_group_target(cobj());
+ auto surface = cairo_get_group_target(cobj());
// surface can be NULL if you're not between push/pop group calls
if(!surface)
{
@@ -943,7 +943,7 @@ RefPtr<Surface> Context::get_group_target()
RefPtr<const Surface> Context::get_group_target() const
{
- cairo_surface_t* surface = cairo_get_group_target(const_cast<cobject*>(cobj()));
+ auto surface = cairo_get_group_target(const_cast<cobject*>(cobj()));
// surface can be NULL if you're not between push/pop group calls
if(!surface)
{
diff --git a/cairomm/device.cc b/cairomm/device.cc
index b53f252..9383064 100644
--- a/cairomm/device.cc
+++ b/cairomm/device.cc
@@ -49,7 +49,7 @@ void Device::unreference() const
DeviceType Device::get_type() const
{
- cairo_device_type_t surface_type =
+ auto surface_type =
cairo_device_get_type(const_cast<cobject*>(cobj()));
check_object_status_and_throw_exception(*this);
return static_cast<DeviceType>(surface_type);
@@ -69,7 +69,7 @@ void Device::finish()
void Device::acquire()
{
- ErrorStatus status = cairo_device_acquire(m_cobject);
+ auto status = cairo_device_acquire(m_cobject);
check_status_and_throw_exception(status);
}
diff --git a/cairomm/fontface.cc b/cairomm/fontface.cc
index cb1468f..c44363e 100644
--- a/cairomm/fontface.cc
+++ b/cairomm/fontface.cc
@@ -60,21 +60,21 @@ void FontFace::unreference() const
/*
void* FontFace::get_user_data(const cairo_user_data_key_t *key)
{
- void* result = cairo_font_face_get_user_data(m_cobject, key);
+ auto result = cairo_font_face_get_user_data(m_cobject, key);
check_object_status_and_throw_exception(*this);
return result;
}
void FontFace::set_user_data(const cairo_user_data_key_t* key, void *user_data, cairo_destroy_func_t destroy)
{
- const ErrorStatus status = (ErrorStatus)cairo_font_face_set_user_data(m_cobject, key, user_data, destroy);
+ const auto status = (ErrorStatus)cairo_font_face_set_user_data(m_cobject, key, user_data, destroy);
check_status_and_throw_exception(status);
}
*/
FontType FontFace::get_type() const
{
- cairo_font_type_t font_type = cairo_font_face_get_type(m_cobject);
+ auto font_type = cairo_font_face_get_type(m_cobject);
check_object_status_and_throw_exception(*this);
return static_cast<FontType>(font_type);
}
@@ -132,9 +132,9 @@ UserFontFace::init_cb(cairo_scaled_font_t* scaled_font,
cairo_t *cr,
cairo_font_extents_t* metrics)
{
- cairo_font_face_t* face = cairo_scaled_font_get_font_face(scaled_font);
+ auto face = cairo_scaled_font_get_font_face(scaled_font);
// we've stored a pointer to the wrapper object in the C object's user_data
- UserFontFace* instance =
+ auto instance =
static_cast<UserFontFace*>(cairo_font_face_get_user_data(face,
&user_font_key));
@@ -180,9 +180,9 @@ UserFontFace::unicode_to_glyph_cb(cairo_scaled_font_t *scaled_font,
unsigned long unicode,
unsigned long *glyph)
{
- cairo_font_face_t* face = cairo_scaled_font_get_font_face(scaled_font);
+ auto face = cairo_scaled_font_get_font_face(scaled_font);
// we've stored a pointer to the wrapper object in the C object's user_data
- UserFontFace* instance =
+ auto instance =
static_cast<UserFontFace*>(cairo_font_face_get_user_data(face,
&user_font_key));
if(instance)
@@ -226,9 +226,9 @@ UserFontFace::text_to_glyphs_cb(cairo_scaled_font_t *scaled_font,
int *num_clusters,
cairo_text_cluster_flags_t *cluster_flags)
{
- cairo_font_face_t* face = cairo_scaled_font_get_font_face(scaled_font);
+ auto face = cairo_scaled_font_get_font_face(scaled_font);
// we've stored a pointer to the wrapper object in the C object's user_data
- UserFontFace* instance =
+ auto instance =
static_cast<UserFontFace*>(cairo_font_face_get_user_data(face,
&user_font_key));
@@ -239,9 +239,9 @@ UserFontFace::text_to_glyphs_cb(cairo_scaled_font_t *scaled_font,
std::vector<Glyph> glyph_v;
std::vector<TextCluster> cluster_v;
const std::string utf8_str(utf8, utf8 + utf8_len);
- TextClusterFlags local_flags = static_cast<TextClusterFlags>(0);
+ auto local_flags = static_cast<TextClusterFlags>(0);
- ErrorStatus status =
+ auto status =
instance->text_to_glyphs(RefPtr<ScaledFont>(new
ScaledFont(scaled_font)),
utf8_str, glyph_v, cluster_v, local_flags);
@@ -326,9 +326,9 @@ UserFontFace::render_glyph_cb(cairo_scaled_font_t *scaled_font,
cairo_t *cr,
cairo_text_extents_t *metrics)
{
- cairo_font_face_t* face = cairo_scaled_font_get_font_face(scaled_font);
+ auto face = cairo_scaled_font_get_font_face(scaled_font);
// we've stored a pointer to the wrapper object in the C object's user_data
- UserFontFace* instance =
+ auto instance =
static_cast<UserFontFace*>(cairo_font_face_get_user_data(face,
&user_font_key));
if(instance)
diff --git a/cairomm/fontface.h b/cairomm/fontface.h
index 25268ca..aa0e0cc 100644
--- a/cairomm/fontface.h
+++ b/cairomm/fontface.h
@@ -190,7 +190,7 @@ protected:
*
* @code
* {
- * Cairo::RefPtr<MyUserFont> face = MyUserFont::create();
+ * auto face = MyUserFont::create();
* cr->set_font_face(face);
* } // scope for demonstration purposes
*
diff --git a/cairomm/fontoptions.cc b/cairomm/fontoptions.cc
index 2ba339d..932dfbe 100644
--- a/cairomm/fontoptions.cc
+++ b/cairomm/fontoptions.cc
@@ -96,7 +96,7 @@ void FontOptions::merge(const FontOptions& src)
unsigned long FontOptions::hash() const
{
- const unsigned long result = cairo_font_options_hash(m_cobject);
+ const auto result = cairo_font_options_hash(m_cobject);
check_object_status_and_throw_exception(*this);
return result;
}
@@ -109,7 +109,7 @@ void FontOptions::set_antialias(Antialias antialias)
Antialias FontOptions::get_antialias() const
{
- const Antialias result = static_cast<Antialias>(cairo_font_options_get_antialias(m_cobject));
+ const auto result = static_cast<Antialias>(cairo_font_options_get_antialias(m_cobject));
check_object_status_and_throw_exception(*this);
return result;
}
@@ -122,7 +122,7 @@ void FontOptions::set_subpixel_order(SubpixelOrder subpixel_order)
SubpixelOrder FontOptions::get_subpixel_order() const
{
- const SubpixelOrder result = static_cast<SubpixelOrder>(cairo_font_options_get_subpixel_order(m_cobject));
+ const auto result = static_cast<SubpixelOrder>(cairo_font_options_get_subpixel_order(m_cobject));
check_object_status_and_throw_exception(*this);
return result;
}
@@ -135,7 +135,7 @@ void FontOptions::set_hint_style(HintStyle hint_style)
HintStyle FontOptions::get_hint_style() const
{
- const HintStyle result = static_cast<HintStyle>(cairo_font_options_get_hint_style(m_cobject));
+ const auto result = static_cast<HintStyle>(cairo_font_options_get_hint_style(m_cobject));
check_object_status_and_throw_exception(*this);
return result;
}
@@ -149,7 +149,7 @@ void FontOptions::set_hint_metrics(HintMetrics hint_metrics)
HintMetrics FontOptions::get_hint_metrics() const
{
- const HintMetrics result =
+ const auto result =
static_cast<HintMetrics>(cairo_font_options_get_hint_metrics(m_cobject));
check_object_status_and_throw_exception(*this);
return result;
diff --git a/cairomm/matrix.cc b/cairomm/matrix.cc
index aa74882..4a48f2c 100644
--- a/cairomm/matrix.cc
+++ b/cairomm/matrix.cc
@@ -75,7 +75,7 @@ void Matrix::rotate(double radians)
void Matrix::invert()
{
- cairo_status_t status = cairo_matrix_invert(this);
+ auto status = cairo_matrix_invert(this);
check_status_and_throw_exception(status);
}
diff --git a/cairomm/pattern.cc b/cairomm/pattern.cc
index a57798a..aa2bae1 100644
--- a/cairomm/pattern.cc
+++ b/cairomm/pattern.cc
@@ -87,7 +87,7 @@ Matrix Pattern::get_matrix() const
PatternType Pattern::get_type() const
{
- cairo_pattern_type_t pattern_type = cairo_pattern_get_type(m_cobject);
+ auto pattern_type = cairo_pattern_get_type(m_cobject);
check_object_status_and_throw_exception(*this);
return static_cast<PatternType>(pattern_type);
}
@@ -100,7 +100,7 @@ void Pattern::set_extend(Extend extend)
Extend Pattern::get_extend() const
{
- const Extend result = static_cast<Extend>(cairo_pattern_get_extend(m_cobject));
+ const auto result = static_cast<Extend>(cairo_pattern_get_extend(m_cobject));
check_object_status_and_throw_exception(*this);
return result;
}
@@ -124,7 +124,7 @@ SolidPattern::~SolidPattern()
RefPtr<SolidPattern> SolidPattern::create_rgb(double red, double green, double blue)
{
- cairo_pattern_t* cobject = cairo_pattern_create_rgb(red, green, blue);
+ 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 */));
}
@@ -191,7 +191,7 @@ void SurfacePattern::set_filter(Filter filter)
Filter SurfacePattern::get_filter() const
{
- Filter result = static_cast<Filter>(cairo_pattern_get_filter(m_cobject));
+ auto result = static_cast<Filter>(cairo_pattern_get_filter(m_cobject));
check_object_status_and_throw_exception(*this);
return result;
}
diff --git a/cairomm/quartz_surface.cc b/cairomm/quartz_surface.cc
index b5000c6..006ef9f 100644
--- a/cairomm/quartz_surface.cc
+++ b/cairomm/quartz_surface.cc
@@ -40,7 +40,7 @@ CGContextRef QuartzSurface::get_cg_context() const
RefPtr<QuartzSurface> QuartzSurface::create(CGContextRef cg_context, int width, int height)
{
- cairo_surface_t* cobject = cairo_quartz_surface_create_for_cg_context(cg_context,
+ 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 */));
@@ -48,7 +48,7 @@ RefPtr<QuartzSurface> QuartzSurface::create(CGContextRef cg_context, int width,
RefPtr<QuartzSurface> QuartzSurface::create(Format format, int width, int height)
{
- cairo_surface_t* cobject = cairo_quartz_surface_create((cairo_format_t)format, width, 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 */));
}
diff --git a/cairomm/region.cc b/cairomm/region.cc
index 55b6154..945bf7b 100644
--- a/cairomm/region.cc
+++ b/cairomm/region.cc
@@ -39,7 +39,7 @@ Region::Region(const RectangleInt& rectangle)
Region::Region(const std::vector<RectangleInt>& rects) :
m_cobject(0)
{
- RectangleInt *carray = new RectangleInt[rects.size()];
+ auto *carray = new RectangleInt[rects.size()];
std::copy(rects.begin(), rects.end(), carray);
m_cobject = cairo_region_create_rectangles (carray, rects.size());
@@ -148,49 +148,49 @@ void Region::translate(int dx, int dy)
void Region::subtract(const RefPtr<Region>& other)
{
- ErrorStatus status = cairo_region_subtract(m_cobject, (other ? other->cobj() : 0));
+ auto status = cairo_region_subtract(m_cobject, (other ? other->cobj() : 0));
check_status_and_throw_exception (status);
}
void Region::subtract(const RectangleInt& rectangle)
{
- ErrorStatus status = cairo_region_subtract_rectangle(m_cobject, &rectangle);
+ auto status = cairo_region_subtract_rectangle(m_cobject, &rectangle);
check_status_and_throw_exception (status);
}
void Region::intersect(const RefPtr<Region>& other)
{
- ErrorStatus status = cairo_region_intersect(m_cobject, (other ? other->cobj() : 0));
+ auto status = cairo_region_intersect(m_cobject, (other ? other->cobj() : 0));
check_status_and_throw_exception (status);
}
void Region::intersect(const RectangleInt& rectangle)
{
- ErrorStatus status = cairo_region_intersect_rectangle(m_cobject, &rectangle);
+ auto status = cairo_region_intersect_rectangle(m_cobject, &rectangle);
check_status_and_throw_exception (status);
}
void Region::do_union(const RefPtr<Region>& other)
{
- ErrorStatus status = cairo_region_union(m_cobject, (other ? other->cobj() : 0));
+ auto status = cairo_region_union(m_cobject, (other ? other->cobj() : 0));
check_status_and_throw_exception (status);
}
void Region::do_union(const RectangleInt& rectangle)
{
- ErrorStatus status = cairo_region_union_rectangle(m_cobject, &rectangle);
+ auto status = cairo_region_union_rectangle(m_cobject, &rectangle);
check_status_and_throw_exception (status);
}
void Region::do_xor(const RefPtr<Region>& other)
{
- ErrorStatus status = cairo_region_xor(m_cobject, (other ? other->cobj() : 0));
+ auto status = cairo_region_xor(m_cobject, (other ? other->cobj() : 0));
check_status_and_throw_exception (status);
}
void Region::do_xor(const RectangleInt& rectangle)
{
- ErrorStatus status = cairo_region_xor_rectangle(m_cobject, &rectangle);
+ auto status = cairo_region_xor_rectangle(m_cobject, &rectangle);
check_status_and_throw_exception (status);
}
diff --git a/cairomm/scaledfont.cc b/cairomm/scaledfont.cc
index a562619..fe8cbd5 100644
--- a/cairomm/scaledfont.cc
+++ b/cairomm/scaledfont.cc
@@ -98,7 +98,7 @@ void ScaledFont::glyph_extents(const std::vector<Glyph>& glyphs, TextExtents& ex
RefPtr<FontFace> ScaledFont::get_font_face() const
{
- cairo_font_face_t* face = cairo_scaled_font_get_font_face(m_cobject);
+ 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 */));
}
@@ -137,7 +137,7 @@ void ScaledFont::get_ctm(cairo_matrix_t& ctm) const
FontType ScaledFont::get_type() const
{
- cairo_font_type_t font_type = cairo_scaled_font_get_type(m_cobject);
+ auto font_type = cairo_scaled_font_get_type(m_cobject);
check_object_status_and_throw_exception(*this);
return static_cast<FontType>(font_type);
}
@@ -154,7 +154,7 @@ ScaledFont::text_to_glyphs (double x,
int num_clusters = -1;
cairo_glyph_t* c_glyphs = 0;
cairo_text_cluster_t* c_clusters = 0;
- cairo_status_t status = cairo_scaled_font_text_to_glyphs(cobj(), x, y,
+ auto status = cairo_scaled_font_text_to_glyphs(cobj(), x, y,
utf8.c_str(),
utf8.size(),
&c_glyphs,
@@ -200,7 +200,7 @@ FtScaledFont::create(const RefPtr<FtFontFace>& font_face,
FT_Face FtScaledFont::lock_face()
{
- FT_Face face = cairo_ft_scaled_font_lock_face(cobj());
+ auto face = cairo_ft_scaled_font_lock_face(cobj());
check_object_status_and_throw_exception(*this);
return face;
}
diff --git a/cairomm/script.cc b/cairomm/script.cc
index ac8b22e..c13c595 100644
--- a/cairomm/script.cc
+++ b/cairomm/script.cc
@@ -34,7 +34,7 @@ Script::~Script()
void Script::add_from_recording_surface(const RefPtr<ScriptSurface>& recording_surface)
{
- ErrorStatus status = cairo_script_from_recording_surface(m_cobject,
+ auto status = cairo_script_from_recording_surface(m_cobject,
recording_surface->cobj());
check_status_and_throw_exception(status);
}
@@ -56,7 +56,7 @@ void Script::write_comment(const std::string& comment)
RefPtr<Script> Script::create(const std::string& filename)
{
- cairo_device_t* cobject = cairo_script_create(filename.c_str());
+ 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 */));
}
@@ -66,7 +66,7 @@ static cairo_user_data_key_t USER_DATA_KEY_DEVICE_WRITE_FUNC = {0};
static void device_free_slot(void* data)
{
// FIXME: duplicates free_slot in surface.cc
- Surface::SlotWriteFunc* slot = static_cast<Surface::SlotWriteFunc*>(data);
+ auto slot = static_cast<Surface::SlotWriteFunc*>(data);
delete slot;
}
@@ -76,7 +76,7 @@ cairo_status_t device_write_func_wrapper(void* closure, const unsigned char* dat
// FIXME: duplicates free_slot in surface.cc
if (!closure)
return CAIRO_STATUS_WRITE_ERROR;
- Surface::SlotWriteFunc* write_func = static_cast<Surface::SlotWriteFunc*>(closure);
+ auto write_func = static_cast<Surface::SlotWriteFunc*>(closure);
return static_cast<cairo_status_t>((*write_func)(data, length));
}
@@ -90,8 +90,8 @@ static void set_write_slot(cairo_device_t* surface,
RefPtr<Script> Script::create_for_stream(const Surface::SlotWriteFunc& write_func)
{
- Surface::SlotWriteFunc* slot_copy = new Surface::SlotWriteFunc(write_func);
- cairo_device_t* cobject = cairo_script_create_for_stream(device_write_func_wrapper,
+ auto slot_copy = new Surface::SlotWriteFunc(write_func);
+ auto cobject = cairo_script_create_for_stream(device_write_func_wrapper,
slot_copy);
check_status_and_throw_exception(cairo_device_status(cobject));
set_write_slot(cobject, slot_copy);
diff --git a/cairomm/script_surface.cc b/cairomm/script_surface.cc
index 645bc62..cb3cdc1 100644
--- a/cairomm/script_surface.cc
+++ b/cairomm/script_surface.cc
@@ -36,7 +36,7 @@ RefPtr<ScriptSurface> ScriptSurface::create(const RefPtr<Script>& script,
Content content,
double width, double height)
{
- cairo_surface_t* cobject =
+ auto cobject =
cairo_script_surface_create(script->cobj(), static_cast<cairo_content_t>(content),
width, height);
check_status_and_throw_exception(cairo_surface_status(cobject));
@@ -47,7 +47,7 @@ RefPtr<ScriptSurface>
ScriptSurface::create_for_target(const RefPtr<Script>& script,
const RefPtr<Surface>& target)
{
- cairo_surface_t* cobject =
+ 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 */));
diff --git a/cairomm/surface.cc b/cairomm/surface.cc
index 5697295..137a50b 100644
--- a/cairomm/surface.cc
+++ b/cairomm/surface.cc
@@ -29,7 +29,7 @@ static cairo_user_data_key_t USER_DATA_KEY_READ_FUNC = {0};
static void
free_slot(void* data)
{
- Surface::SlotWriteFunc* slot = static_cast<Surface::SlotWriteFunc*>(data);
+ auto slot = static_cast<Surface::SlotWriteFunc*>(data);
delete slot;
}
@@ -57,7 +57,7 @@ cairo_status_t read_func_wrapper(void* closure, unsigned char* data, unsigned in
{
if (!closure)
return CAIRO_STATUS_READ_ERROR;
- Surface::SlotReadFunc* read_func = static_cast<Surface::SlotReadFunc*>(closure);
+ auto read_func = static_cast<Surface::SlotReadFunc*>(closure);
return static_cast<cairo_status_t>((*read_func)(data, length));
}
@@ -65,7 +65,7 @@ cairo_status_t write_func_wrapper(void* closure, const unsigned char* data, unsi
{
if (!closure)
return CAIRO_STATUS_WRITE_ERROR;
- Surface::SlotWriteFunc* write_func = static_cast<Surface::SlotWriteFunc*>(closure);
+ auto write_func = static_cast<Surface::SlotWriteFunc*>(closure);
return static_cast<cairo_status_t>((*write_func)(data, length));
}
@@ -101,7 +101,7 @@ const unsigned char* Surface::get_mime_data(const std::string& mime_type, unsign
static void on_cairo_destroy(void *data)
{
- Surface::SlotDestroy* slot = static_cast<Surface::SlotDestroy*>(data);
+ auto slot = static_cast<Surface::SlotDestroy*>(data);
if(!slot)
return;
@@ -111,7 +111,7 @@ static void on_cairo_destroy(void *data)
void Surface::set_mime_data(const std::string& mime_type, unsigned char* data, unsigned long length, const SlotDestroy& slot_destroy)
{
- SlotDestroy* copy = new SlotDestroy(slot_destroy); //Deleted when the callback is called once.
+ auto copy = new SlotDestroy(slot_destroy); //Deleted when the callback is called once.
cairo_surface_set_mime_data(const_cast<cobject*>(cobj()), mime_type.c_str(), data, length,
&on_cairo_destroy, copy);
check_object_status_and_throw_exception(*this);
@@ -126,7 +126,7 @@ void Surface::unset_mime_data(const std::string& mime_type)
void Surface::get_font_options(FontOptions& options) const
{
- cairo_font_options_t* cfontoptions = cairo_font_options_create();
+ auto cfontoptions = cairo_font_options_create();
cairo_surface_get_font_options(const_cast<cobject*>(cobj()), cfontoptions);
options = FontOptions(cfontoptions);
cairo_font_options_destroy(cfontoptions);
@@ -179,7 +179,7 @@ void Surface::get_fallback_resolution(double& x_pixels_per_inch,
SurfaceType Surface::get_type() const
{
- cairo_surface_type_t surface_type =
+ auto surface_type =
cairo_surface_get_type(const_cast<cobject*>(cobj()));
check_object_status_and_throw_exception(*this);
return static_cast<SurfaceType>(surface_type);
@@ -187,7 +187,7 @@ SurfaceType Surface::get_type() const
Content Surface::get_content() const
{
- cairo_content_t content = cairo_surface_get_content(const_cast<cairo_surface_t*>(cobj()));
+ auto content = cairo_surface_get_content(const_cast<cairo_surface_t*>(cobj()));
check_object_status_and_throw_exception(*this);
return static_cast<Content>(content);
}
@@ -216,18 +216,18 @@ bool Surface::has_show_text_glyphs() const
#ifdef CAIRO_HAS_PNG_FUNCTIONS
void Surface::write_to_png(const std::string& filename)
{
- ErrorStatus status = cairo_surface_write_to_png(cobj(), filename.c_str());
+ auto status = cairo_surface_write_to_png(cobj(), filename.c_str());
check_status_and_throw_exception(status);
}
void Surface::write_to_png_stream(const SlotWriteFunc& write_func)
{
- SlotWriteFunc* old_slot = get_slot(cobj());
+ auto old_slot = get_slot(cobj());
if (old_slot)
delete old_slot;
- SlotWriteFunc* slot_copy = new SlotWriteFunc(write_func);
+ auto slot_copy = new SlotWriteFunc(write_func);
set_write_slot(cobj(), slot_copy);
- ErrorStatus status = cairo_surface_write_to_png_stream(cobj(),
+ auto status = cairo_surface_write_to_png_stream(cobj(),
&write_func_wrapper,
slot_copy /*closure*/);
check_status_and_throw_exception(status);
@@ -235,19 +235,19 @@ void Surface::write_to_png_stream(const SlotWriteFunc& write_func)
void Surface::write_to_png(cairo_write_func_t write_func, void *closure)
{
- ErrorStatus status = cairo_surface_write_to_png_stream(cobj(), write_func, closure);
+ auto status = cairo_surface_write_to_png_stream(cobj(), write_func, closure);
check_status_and_throw_exception(status);
}
#endif
RefPtr<Device> Surface::get_device()
{
- cairo_device_t *d = cairo_surface_get_device (m_cobject);
+ auto *d = cairo_surface_get_device (m_cobject);
if (!d)
return RefPtr<Device>();
- cairo_surface_type_t surface_type = cairo_surface_get_type(m_cobject);
+ auto surface_type = cairo_surface_get_type(m_cobject);
switch (surface_type)
{
#if CAIRO_HAS_SCRIPT_SURFACE
@@ -272,14 +272,14 @@ void Surface::unreference() const
RefPtr<Surface> Surface::create(const RefPtr<Surface> other, Content content, int width, int height)
{
- cairo_surface_t* cobject = cairo_surface_create_similar(other->cobj(), (cairo_content_t)content, width, height);
+ 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 */));
}
RefPtr<Surface> Surface::create(const RefPtr<Surface>& target, double x, double y, double width, double height)
{
- cairo_surface_t* cobject = cairo_surface_create_for_rectangle(target->cobj(), x, y, width, 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 */));
}
@@ -296,14 +296,14 @@ ImageSurface::~ImageSurface()
RefPtr<ImageSurface> ImageSurface::create(Format format, int width, int height)
{
- cairo_surface_t* cobject = cairo_image_surface_create((cairo_format_t)format, width, height);
+ 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 */));
}
RefPtr<ImageSurface> ImageSurface::create(unsigned char* data, Format format, int width, int height, int stride)
{
- cairo_surface_t* cobject = cairo_image_surface_create_for_data(data, (cairo_format_t)format, width, height, 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 */));
}
@@ -312,15 +312,15 @@ RefPtr<ImageSurface> ImageSurface::create(unsigned char* data, Format format, in
RefPtr<ImageSurface> ImageSurface::create_from_png(std::string filename)
{
- cairo_surface_t* cobject = cairo_image_surface_create_from_png(filename.c_str());
+ 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 */));
}
RefPtr<ImageSurface> ImageSurface::create_from_png_stream(const SlotReadFunc& read_func)
{
- SlotReadFunc* slot_copy = new SlotReadFunc(read_func);
- cairo_surface_t* cobject =
+ auto slot_copy = new SlotReadFunc(read_func);
+ auto cobject =
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);
@@ -329,7 +329,7 @@ RefPtr<ImageSurface> ImageSurface::create_from_png_stream(const SlotReadFunc& re
RefPtr<ImageSurface> ImageSurface::create_from_png(cairo_read_func_t read_func, void *closure)
{
- cairo_surface_t* cobject = cairo_image_surface_create_from_png_stream(read_func, closure);
+ auto cobject = cairo_image_surface_create_from_png_stream(read_func, closure);
check_status_and_throw_exception(cairo_surface_status(cobject));
return RefPtr<ImageSurface>(new ImageSurface(cobject, true /* has reference */));
}
@@ -338,7 +338,7 @@ RefPtr<ImageSurface> ImageSurface::create_from_png(cairo_read_func_t read_func,
int ImageSurface::get_width() const
{
- const int result =
+ const auto result =
cairo_image_surface_get_width(const_cast<cobject*>(cobj()));
check_object_status_and_throw_exception(*this);
return result;
@@ -346,7 +346,7 @@ int ImageSurface::get_width() const
int ImageSurface::get_height() const
{
- const int result =
+ const auto result =
cairo_image_surface_get_height(const_cast<cobject*>(cobj()));
check_object_status_and_throw_exception(*this);
return result;
@@ -395,14 +395,14 @@ PdfSurface::~PdfSurface()
RefPtr<PdfSurface> PdfSurface::create(std::string filename, double width_in_points, double height_in_points)
{
- cairo_surface_t* cobject = cairo_pdf_surface_create(filename.c_str(), width_in_points, height_in_points);
+ 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 */));
}
RefPtr<PdfSurface> PdfSurface::create(cairo_write_func_t write_func, void *closure, double width_in_points, double height_in_points)
{
- cairo_surface_t* cobject = cairo_pdf_surface_create_for_stream(write_func, closure, width_in_points, height_in_points);
+ auto cobject = cairo_pdf_surface_create_for_stream(write_func, closure, width_in_points, height_in_points);
check_status_and_throw_exception(cairo_surface_status(cobject));
return RefPtr<PdfSurface>(new PdfSurface(cobject, true /* has reference */));
}
@@ -410,8 +410,8 @@ RefPtr<PdfSurface> PdfSurface::create(cairo_write_func_t write_func, void *closu
RefPtr<PdfSurface> PdfSurface::create_for_stream(const SlotWriteFunc& write_func, double
width_in_points, double height_in_points)
{
- SlotWriteFunc* slot_copy = new SlotWriteFunc(write_func);
- cairo_surface_t* cobject =
+ auto slot_copy = new SlotWriteFunc(write_func);
+ auto cobject =
cairo_pdf_surface_create_for_stream(write_func_wrapper, slot_copy,
width_in_points, height_in_points);
check_status_and_throw_exception(cairo_surface_status(cobject));
@@ -470,7 +470,7 @@ PsSurface::~PsSurface()
RefPtr<PsSurface> PsSurface::create(std::string filename, double width_in_points, double height_in_points)
{
- cairo_surface_t* cobject = cairo_ps_surface_create(filename.c_str(), width_in_points, height_in_points);
+ 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 */));
}
@@ -478,8 +478,8 @@ RefPtr<PsSurface> PsSurface::create(std::string filename, double width_in_points
RefPtr<PsSurface> PsSurface::create_for_stream(const SlotWriteFunc& write_func, double
width_in_points, double height_in_points)
{
- SlotWriteFunc* slot_copy = new SlotWriteFunc(write_func);
- cairo_surface_t* cobject =
+ auto slot_copy = new SlotWriteFunc(write_func);
+ auto cobject =
cairo_ps_surface_create_for_stream(write_func_wrapper, slot_copy,
width_in_points, height_in_points);
check_status_and_throw_exception(cairo_surface_status(cobject));
@@ -489,7 +489,7 @@ RefPtr<PsSurface> PsSurface::create_for_stream(const SlotWriteFunc& write_func,
RefPtr<PsSurface> PsSurface::create(cairo_write_func_t write_func, void *closure, double width_in_points, double height_in_points)
{
- cairo_surface_t* cobject = cairo_ps_surface_create_for_stream(write_func, closure, width_in_points, height_in_points);
+ auto cobject = cairo_ps_surface_create_for_stream(write_func, closure, width_in_points, height_in_points);
check_status_and_throw_exception(cairo_surface_status(cobject));
return RefPtr<PsSurface>(new PsSurface(cobject, true /* has reference */));
}
@@ -521,7 +521,7 @@ void PsSurface::dsc_begin_page_setup()
bool PsSurface::get_eps() const
{
- bool result = cairo_ps_surface_get_eps(const_cast<cairo_surface_t*>(cobj()));
+ auto result = cairo_ps_surface_get_eps(const_cast<cairo_surface_t*>(cobj()));
check_object_status_and_throw_exception(*this);
return result;
}
@@ -578,7 +578,7 @@ SvgSurface::~SvgSurface()
RefPtr<SvgSurface> SvgSurface::create(std::string filename, double width_in_points, double height_in_points)
{
- cairo_surface_t* cobject = cairo_svg_surface_create(filename.c_str(), width_in_points, height_in_points);
+ 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 */));
}
@@ -587,8 +587,8 @@ RefPtr<SvgSurface> SvgSurface::create_for_stream(const SlotWriteFunc& write_func
double width_in_points,
double height_in_points)
{
- SlotWriteFunc* slot_copy = new SlotWriteFunc(write_func);
- cairo_surface_t* cobject =
+ auto slot_copy = new SlotWriteFunc(write_func);
+ auto cobject =
cairo_svg_surface_create_for_stream(write_func_wrapper, slot_copy,
width_in_points, height_in_points);
check_status_and_throw_exception(cairo_surface_status(cobject));
@@ -598,7 +598,7 @@ RefPtr<SvgSurface> SvgSurface::create_for_stream(const SlotWriteFunc& write_func
RefPtr<SvgSurface> SvgSurface::create(cairo_write_func_t write_func, void *closure, double width_in_points, double height_in_points)
{
- cairo_surface_t* cobject = cairo_svg_surface_create_for_stream(write_func, closure, width_in_points, height_in_points);
+ auto cobject = cairo_svg_surface_create_for_stream(write_func, closure, width_in_points, height_in_points);
check_status_and_throw_exception(cairo_surface_status(cobject));
return RefPtr<SvgSurface>(new SvgSurface(cobject, true /* has reference */));
}
@@ -649,7 +649,7 @@ GlitzSurface::~GlitzSurface()
RefPtr<GlitzSurface> GlitzSurface::create(glitz_surface_t *surface)
{
- cairo_surface_t* cobject = cairo_glitz_surface_create(surface);
+ 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 */));
}
diff --git a/cairomm/win32_font.cc b/cairomm/win32_font.cc
index a28bcdf..201bf3c 100644
--- a/cairomm/win32_font.cc
+++ b/cairomm/win32_font.cc
@@ -78,7 +78,7 @@ Win32ScaledFont::create(const RefPtr<Win32FontFace>& font_face,
void Win32ScaledFont::select_font(HDC hdc)
{
- ErrorStatus status = cairo_win32_scaled_font_select_font(cobj(), hdc);
+ auto status = cairo_win32_scaled_font_select_font(cobj(), hdc);
check_status_and_throw_exception(status);
check_object_status_and_throw_exception(*this);
}
@@ -91,7 +91,7 @@ void Win32ScaledFont::done_font()
double Win32ScaledFont::get_metrics_factor() const
{
- double val = cairo_win32_scaled_font_get_metrics_factor(const_cast<cairo_scaled_font_t*>(cobj()));
+ auto val = cairo_win32_scaled_font_get_metrics_factor(const_cast<cairo_scaled_font_t*>(cobj()));
check_object_status_and_throw_exception(*this);
return val;
}
diff --git a/cairomm/win32_surface.cc b/cairomm/win32_surface.cc
index f93feca..30a6197 100644
--- a/cairomm/win32_surface.cc
+++ b/cairomm/win32_surface.cc
@@ -48,7 +48,7 @@ RefPtr<ImageSurface> Win32Surface::get_image()
RefPtr<Win32Surface> Win32Surface::create(HDC hdc)
{
- cairo_surface_t* cobject = cairo_win32_surface_create(hdc);
+ 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 */));
}
@@ -60,14 +60,14 @@ RefPtr<Win32Surface> Win32Surface::create(Format format, int width, int height)
RefPtr<Win32Surface> Win32Surface::create_with_dib(Format format, int width, int height)
{
- cairo_surface_t* cobject = cairo_win32_surface_create_with_dib((cairo_format_t)format, width, height);
+ 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 */));
}
RefPtr<Win32Surface> Win32Surface::create_with_ddb(HDC hdc, Format format, int width, int height)
{
- cairo_surface_t* cobject =
+ 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 */));
@@ -85,7 +85,7 @@ Win32PrintingSurface::~Win32PrintingSurface()
RefPtr<Win32PrintingSurface> Win32PrintingSurface::create(HDC hdc)
{
- cairo_surface_t* cobject = cairo_win32_surface_create(hdc);
+ 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 */));
}
diff --git a/cairomm/xlib_surface.cc b/cairomm/xlib_surface.cc
index 6d615dd..12c3ae2 100644
--- a/cairomm/xlib_surface.cc
+++ b/cairomm/xlib_surface.cc
@@ -36,14 +36,14 @@ XlibSurface::~XlibSurface()
RefPtr<XlibSurface> XlibSurface::create(Display* dpy, Drawable drawable, Visual* visual, int width, int height)
{
- cairo_surface_t* cobject = cairo_xlib_surface_create(dpy, drawable, visual, width, height);
+ 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 */));
}
RefPtr<XlibSurface> XlibSurface::create(Display* dpy, Pixmap bitmap, Screen* screen, int width, int height)
{
- cairo_surface_t* cobject = cairo_xlib_surface_create_for_bitmap(dpy, bitmap, screen, width, 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 */));
}
@@ -62,70 +62,70 @@ void XlibSurface::set_drawable(Drawable drawable, int width, int height)
Drawable XlibSurface::get_drawable() const
{
- Drawable drawable = cairo_xlib_surface_get_drawable(m_cobject);
+ auto drawable = cairo_xlib_surface_get_drawable(m_cobject);
check_object_status_and_throw_exception(*this);
return drawable;
}
const Display* XlibSurface::get_display() const
{
- const Display* dpy = cairo_xlib_surface_get_display(m_cobject);
+ const auto dpy = cairo_xlib_surface_get_display(m_cobject);
check_object_status_and_throw_exception(*this);
return dpy;
}
Display* XlibSurface::get_display()
{
- Display* dpy = cairo_xlib_surface_get_display(m_cobject);
+ auto dpy = cairo_xlib_surface_get_display(m_cobject);
check_object_status_and_throw_exception(*this);
return dpy;
}
Screen* XlibSurface::get_screen()
{
- Screen* screen = cairo_xlib_surface_get_screen(m_cobject);
+ auto screen = cairo_xlib_surface_get_screen(m_cobject);
check_object_status_and_throw_exception(*this);
return screen;
}
const Screen* XlibSurface::get_screen() const
{
- const Screen* screen = cairo_xlib_surface_get_screen(m_cobject);
+ const auto screen = cairo_xlib_surface_get_screen(m_cobject);
check_object_status_and_throw_exception(*this);
return screen;
}
Visual* XlibSurface::get_visual()
{
- Visual* visual = cairo_xlib_surface_get_visual(m_cobject);
+ auto visual = cairo_xlib_surface_get_visual(m_cobject);
check_object_status_and_throw_exception(*this);
return visual;
}
const Visual* XlibSurface::get_visual() const
{
- const Visual* visual = cairo_xlib_surface_get_visual(m_cobject);
+ const auto visual = cairo_xlib_surface_get_visual(m_cobject);
check_object_status_and_throw_exception(*this);
return visual;
}
int XlibSurface::get_depth() const
{
- int depth = cairo_xlib_surface_get_depth(m_cobject);
+ auto depth = cairo_xlib_surface_get_depth(m_cobject);
check_object_status_and_throw_exception(*this);
return depth;
}
int XlibSurface::get_height() const
{
- int h = cairo_xlib_surface_get_height(m_cobject);
+ auto h = cairo_xlib_surface_get_height(m_cobject);
check_object_status_and_throw_exception(*this);
return h;
}
int XlibSurface::get_width() const
{
- int w = cairo_xlib_surface_get_width(m_cobject);
+ auto w = cairo_xlib_surface_get_width(m_cobject);
check_object_status_and_throw_exception(*this);
return w;
}
@@ -139,7 +139,7 @@ XlibSurface::create_with_xrender_format (Display *dpy,
int width,
int height)
{
- cairo_surface_t* cobject =
+ auto cobject =
cairo_xlib_surface_create_with_xrender_format(dpy, drawable,
screen, format,
width, height);
diff --git a/examples/surfaces/image-surface.cc b/examples/surfaces/image-surface.cc
index d8ea451..9318a1a 100644
--- a/examples/surfaces/image-surface.cc
+++ b/examples/surfaces/image-surface.cc
@@ -15,10 +15,10 @@
int main()
{
- Cairo::RefPtr<Cairo::ImageSurface> surface =
+ auto surface =
Cairo::ImageSurface::create(Cairo::FORMAT_ARGB32, 600, 400);
- Cairo::RefPtr<Cairo::Context> cr = Cairo::Context::create(surface);
+ auto cr = Cairo::Context::create(surface);
cr->save(); // save the state of the context
cr->set_source_rgb(0.86, 0.85, 0.47);
diff --git a/examples/surfaces/pdf-surface.cc b/examples/surfaces/pdf-surface.cc
index 630f196..dd7a36d 100644
--- a/examples/surfaces/pdf-surface.cc
+++ b/examples/surfaces/pdf-surface.cc
@@ -20,10 +20,10 @@ int main()
std::string filename = "image.pdf";
int width = 600;
int height = 400;
- Cairo::RefPtr<Cairo::PdfSurface> surface =
+ auto surface =
Cairo::PdfSurface::create(filename, width, height);
- Cairo::RefPtr<Cairo::Context> cr = Cairo::Context::create(surface);
+ auto cr = Cairo::Context::create(surface);
cr->save(); // save the state of the context
cr->set_source_rgb(0.86, 0.85, 0.47);
diff --git a/examples/surfaces/ps-surface.cc b/examples/surfaces/ps-surface.cc
index 4e5bd2a..3035c22 100644
--- a/examples/surfaces/ps-surface.cc
+++ b/examples/surfaces/ps-surface.cc
@@ -20,10 +20,10 @@ int main()
std::string filename = "image.ps";
double width = 600;
double height = 400;
- Cairo::RefPtr<Cairo::PsSurface> surface =
+ auto surface =
Cairo::PsSurface::create(filename, width, height);
- Cairo::RefPtr<Cairo::Context> cr = Cairo::Context::create(surface);
+ auto cr = Cairo::Context::create(surface);
cr->save(); // save the state of the context
cr->set_source_rgb(0.86, 0.85, 0.47);
diff --git a/examples/surfaces/svg-surface.cc b/examples/surfaces/svg-surface.cc
index 56e101d..cf51d5f 100644
--- a/examples/surfaces/svg-surface.cc
+++ b/examples/surfaces/svg-surface.cc
@@ -20,10 +20,10 @@ int main()
std::string filename = "image.svg";
double width = 600;
double height = 400;
- Cairo::RefPtr<Cairo::SvgSurface> surface =
+ auto surface =
Cairo::SvgSurface::create(filename, width, height);
- Cairo::RefPtr<Cairo::Context> cr = Cairo::Context::create(surface);
+ auto cr = Cairo::Context::create(surface);
cr->save(); // save the state of the context
cr->set_source_rgb(0.86, 0.85, 0.47);
diff --git a/examples/text/text-rotate.cc b/examples/text/text-rotate.cc
index 69e02ff..3a94280 100644
--- a/examples/text/text-rotate.cc
+++ b/examples/text/text-rotate.cc
@@ -90,8 +90,8 @@ void draw(Cairo::RefPtr<Cairo::Context> cr, int width, int height)
int main (void)
{
- Cairo::RefPtr<Cairo::ImageSurface> surface = Cairo::ImageSurface::create(Cairo::FORMAT_ARGB32, WIDTH, HEIGHT);
- Cairo::RefPtr<Cairo::Context> cr = Cairo::Context::create(surface);
+ auto surface = Cairo::ImageSurface::create(Cairo::FORMAT_ARGB32, WIDTH, HEIGHT);
+ auto cr = Cairo::Context::create(surface);
draw(cr, WIDTH, HEIGHT);
#ifdef CAIRO_HAS_PNG_FUNCTIONS
const char* filename = "text-rotate.png";
diff --git a/examples/text/toy-text.cc b/examples/text/toy-text.cc
index 1f22521..87b1cc6 100644
--- a/examples/text/toy-text.cc
+++ b/examples/text/toy-text.cc
@@ -8,9 +8,9 @@ const double TEXT_ORIGIN_X = 50.0; // arbitrary
int main(int, char**)
{
- Cairo::RefPtr<Cairo::ImageSurface> surface =
+ auto surface =
Cairo::ImageSurface::create(Cairo::FORMAT_ARGB32, WIDTH, HEIGHT);
- Cairo::RefPtr<Cairo::Context> cr = Cairo::Context::create(surface);
+ auto cr = Cairo::Context::create(surface);
// fill background in white
cr->set_source_rgb(1.0, 1.0, 1.0);
cr->paint();
@@ -23,7 +23,7 @@ int main(int, char**)
// draw the text
cr->move_to(TEXT_ORIGIN_X, TEXT_ORIGIN_Y);
cr->set_source_rgb(0.8, 0.2, 0.2);
- Cairo::RefPtr<Cairo::ToyFontFace> font =
+ auto font =
Cairo::ToyFontFace::create("Bitstream Charter",
Cairo::FONT_SLANT_ITALIC,
Cairo::FONT_WEIGHT_BOLD);
diff --git a/examples/text/user-font.cc b/examples/text/user-font.cc
index 851887f..afb63cf 100644
--- a/examples/text/user-font.cc
+++ b/examples/text/user-font.cc
@@ -98,9 +98,9 @@ protected:
int main(int, char**)
{
- Cairo::RefPtr<Cairo::ImageSurface> surface =
+ auto surface =
Cairo::ImageSurface::create(Cairo::FORMAT_ARGB32, WIDTH, HEIGHT);
- Cairo::RefPtr<Cairo::Context> cr = Cairo::Context::create(surface);
+ auto cr = Cairo::Context::create(surface);
// fill background in white
cr->set_source_rgb(1.0, 1.0, 1.0);
cr->paint();
@@ -113,7 +113,7 @@ int main(int, char**)
// draw the text
cr->move_to(TEXT_ORIGIN_X, TEXT_ORIGIN_Y);
cr->set_source_rgb(0.8, 0.2, 0.2);
- Cairo::RefPtr<BoxFontFace> font = BoxFontFace::create();
+ auto font = BoxFontFace::create();
cr->set_font_face(font);
cr->set_font_size(FONT_SIZE);
cr->show_text("cairomm!");
@@ -121,7 +121,7 @@ int main(int, char**)
// Now show it with the toy text API to demonstrate how the glyphs match up
cr->move_to(TEXT_ORIGIN_X, TEXT_ORIGIN_Y);
cr->set_source_rgba(0.2, 0.2, 0.2, 0.3);
- Cairo::RefPtr<Cairo::ToyFontFace> toy_font =
+ auto toy_font =
Cairo::ToyFontFace::create("Bitstream Charter",
Cairo::FONT_SLANT_NORMAL,
Cairo::FONT_WEIGHT_BOLD);
diff --git a/tests/test-context.cc b/tests/test-context.cc
index a52bab1..6104640 100644
--- a/tests/test-context.cc
+++ b/tests/test-context.cc
@@ -15,8 +15,8 @@ using namespace boost::unit_test;
#include <cairomm/scaledfont.h>
#define CREATE_CONTEXT(varname) \
- Cairo::RefPtr<Cairo::Surface> surf = Cairo::ImageSurface::create(Cairo::FORMAT_ARGB32, 10, 10); \
- Cairo::RefPtr<Cairo::Context> cr = Cairo::Context::create(surf);
+ auto surf = Cairo::ImageSurface::create(Cairo::FORMAT_ARGB32, 10, 10); \
+ auto cr = Cairo::Context::create(surf);
void
test_dashes ()
@@ -83,14 +83,14 @@ void
test_source ()
{
CREATE_CONTEXT(cr);
- Cairo::RefPtr<Cairo::Pattern> solid_pattern =
+ auto solid_pattern =
Cairo::SolidPattern::create_rgb (1.0, 0.5, 0.25);
- Cairo::RefPtr<Cairo::Pattern> gradient_pattern =
+ auto gradient_pattern =
Cairo::LinearGradient::create (0.0, 0.0, 1.0, 1.0);
cr->set_source (solid_pattern);
{
- Cairo::RefPtr<Cairo::SolidPattern> retrieved_solid =
+ auto retrieved_solid =
Cairo::RefPtr<Cairo::SolidPattern>::cast_dynamic(cr->get_source ());
BOOST_REQUIRE (retrieved_solid);
double r, g, b, a;
@@ -100,15 +100,15 @@ test_source ()
BOOST_CHECK_EQUAL (0.25, b);
// now try for const objects..
- Cairo::RefPtr<const Cairo::Context> cr2 = cr;
- Cairo::RefPtr<const Cairo::SolidPattern> retrieved_solid2 =
+ auto cr2 = cr;
+ auto retrieved_solid2 =
Cairo::RefPtr<const Cairo::SolidPattern>::cast_dynamic(cr2->get_source ());
BOOST_REQUIRE (retrieved_solid2);
}
cr->set_source (gradient_pattern);
{
- Cairo::RefPtr<Cairo::LinearGradient> retrieved_linear =
+ auto retrieved_linear =
Cairo::RefPtr<Cairo::LinearGradient>::cast_dynamic(cr->get_source ());
BOOST_REQUIRE (retrieved_linear);
double x0, x1, y0, y1;
@@ -121,7 +121,7 @@ test_source ()
cr->set_source_rgb (1.0, 0.5, 0.25);
{
- Cairo::RefPtr<Cairo::SolidPattern> solid =
+ auto solid =
Cairo::RefPtr<Cairo::SolidPattern>::cast_dynamic(cr->get_source ());
BOOST_REQUIRE (solid);
double rx, gx, bx, ax;
@@ -132,7 +132,7 @@ test_source ()
}
cr->set_source_rgba (0.1, 0.3, 0.5, 0.7);
{
- Cairo::RefPtr<Cairo::SolidPattern> solid =
+ auto solid =
Cairo::RefPtr<Cairo::SolidPattern>::cast_dynamic(cr->get_source ());
BOOST_REQUIRE (solid);
double rx, gx, bx, ax;
@@ -225,7 +225,7 @@ test_matrix ()
cr->set_matrix(matrix);
cr->set_identity_matrix ();
cr->get_matrix (matrix);
- Cairo::Matrix m2 = cr->get_matrix ();
+ auto m2 = cr->get_matrix ();
}
void
@@ -299,22 +299,22 @@ test_current_point ()
void
test_target ()
{
- Cairo::RefPtr<Cairo::Surface> surf = Cairo::ImageSurface::create(Cairo::FORMAT_ARGB32, 10, 10); \
- Cairo::RefPtr<Cairo::Context> cr = Cairo::Context::create(surf);
+ auto surf = Cairo::ImageSurface::create(Cairo::FORMAT_ARGB32, 10, 10); \
+ auto cr = Cairo::Context::create(surf);
- Cairo::RefPtr<Cairo::ImageSurface> target_surface =
+ auto target_surface =
Cairo::RefPtr<Cairo::ImageSurface>::cast_dynamic(cr->get_target ());
- Cairo::RefPtr<Cairo::PdfSurface> bad_surface =
+ auto bad_surface =
Cairo::RefPtr<Cairo::PdfSurface>::cast_dynamic(cr->get_target ());
BOOST_CHECK (target_surface);
BOOST_CHECK (!bad_surface);
// now check for const objects...
- Cairo::RefPtr<const Cairo::Context> cr2 = Cairo::Context::create(surf);
+ auto cr2 = Cairo::Context::create(surf);
- Cairo::RefPtr<const Cairo::ImageSurface> target_surface2 =
+ auto target_surface2 =
Cairo::RefPtr<const Cairo::ImageSurface>::cast_dynamic(cr2->get_target ());
- Cairo::RefPtr<const Cairo::PdfSurface> bad_surface2 =
+ auto bad_surface2 =
Cairo::RefPtr<const Cairo::PdfSurface>::cast_dynamic(cr2->get_target ());
BOOST_CHECK (target_surface2);
BOOST_CHECK (!bad_surface2);
@@ -323,12 +323,12 @@ test_target ()
void test_scaled_font()
{
CREATE_CONTEXT (cr);
- Cairo::RefPtr<Cairo::ToyFontFace> face = Cairo::ToyFontFace::create("sans",
+ auto face = Cairo::ToyFontFace::create("sans",
Cairo::FONT_SLANT_NORMAL,
Cairo::FONT_WEIGHT_NORMAL);
Cairo::Matrix identity;
cairo_matrix_init_identity(&identity);
- Cairo::RefPtr<Cairo::ScaledFont> font = Cairo::ScaledFont::create(face,
+ auto font = Cairo::ScaledFont::create(face,
identity,
identity,
Cairo::FontOptions());
diff --git a/tests/test-font-face.cc b/tests/test-font-face.cc
index 466f408..280f1a1 100644
--- a/tests/test-font-face.cc
+++ b/tests/test-font-face.cc
@@ -26,7 +26,7 @@ using namespace boost::unit_test;
void
test_create_toy ()
{
- Cairo::RefPtr<Cairo::ToyFontFace> toy =
+ auto toy =
Cairo::ToyFontFace::create("sans",
Cairo::FONT_SLANT_ITALIC,
Cairo::FONT_WEIGHT_NORMAL);
@@ -36,7 +36,7 @@ test_create_toy ()
void test_toy_getters ()
{
- Cairo::RefPtr<Cairo::ToyFontFace> toy =
+ auto toy =
Cairo::ToyFontFace::create("sans",
Cairo::FONT_SLANT_ITALIC,
Cairo::FONT_WEIGHT_NORMAL);
@@ -49,19 +49,19 @@ void test_toy_getters ()
#ifdef CAIRO_HAS_FT_FONT
void test_ft_font_face()
{
- FcPattern* invalid = FcPatternCreate();
+ auto invalid = FcPatternCreate();
Cairo::RefPtr<Cairo::FtFontFace> invalid_face;
BOOST_CHECK_THROW(invalid_face = Cairo::FtFontFace::create(invalid), std::bad_alloc);
// basically taken from the cairo test case -- we don't care what font we're
// using so just create an empty pattern and do the minimal substitution to
// get a valid pattern
- FcPattern* pattern = FcPatternCreate();
+ auto pattern = FcPatternCreate();
FcConfigSubstitute (NULL, pattern, FcMatchPattern);
FcDefaultSubstitute (pattern);
FcResult result;
- FcPattern* resolved = FcFontMatch (NULL, pattern, &result);
- Cairo::RefPtr<Cairo::FtFontFace> face = Cairo::FtFontFace::create(resolved);
+ auto resolved = FcFontMatch (NULL, pattern, &result);
+ auto face = Cairo::FtFontFace::create(resolved);
BOOST_CHECK(face);
// FIXME: test creating from a FT_Face
diff --git a/tests/test-font-options.cc b/tests/test-font-options.cc
index a6690f8..7b42398 100644
--- a/tests/test-font-options.cc
+++ b/tests/test-font-options.cc
@@ -18,19 +18,19 @@ void test_excercise()
options.hash();
options.set_antialias(Cairo::ANTIALIAS_SUBPIXEL);
- Cairo::Antialias antialias = options.get_antialias();
+ auto antialias = options.get_antialias();
BOOST_CHECK_EQUAL(Cairo::ANTIALIAS_SUBPIXEL, antialias);
options.set_subpixel_order(Cairo::SUBPIXEL_ORDER_DEFAULT);
- Cairo::SubpixelOrder order = options.get_subpixel_order();
+ auto order = options.get_subpixel_order();
BOOST_CHECK_EQUAL(Cairo::SUBPIXEL_ORDER_DEFAULT, order);
options.set_hint_style(Cairo::HINT_STYLE_SLIGHT);
- Cairo::HintStyle hint_style = options.get_hint_style();
+ auto hint_style = options.get_hint_style();
BOOST_CHECK_EQUAL(Cairo::HINT_STYLE_SLIGHT, hint_style);
options.set_hint_metrics(Cairo::HINT_METRICS_OFF);
- Cairo::HintMetrics metrics = options.get_hint_metrics();
+ auto metrics = options.get_hint_metrics();
BOOST_CHECK_EQUAL(Cairo::HINT_METRICS_OFF, metrics);
}
diff --git a/tests/test-matrix.cc b/tests/test-matrix.cc
index 02ed4a2..722f8e7 100644
--- a/tests/test-matrix.cc
+++ b/tests/test-matrix.cc
@@ -74,8 +74,8 @@ static void foo(cairo_matrix_t* matrix)
void test_cast()
{
// make sure that we can cast between C++ and C types without ill effect
- Cairo::Matrix matrix = Cairo::identity_matrix();
- cairo_matrix_t casted = (cairo_matrix_t) Cairo::identity_matrix();
+ auto matrix = Cairo::identity_matrix();
+ auto casted = (cairo_matrix_t) Cairo::identity_matrix();
// check that it's equal to the identity matrix
cairo_matrix_t identity;
cairo_matrix_init_identity(&identity);
@@ -99,9 +99,9 @@ void test_cast()
void test_multiply()
{
- Cairo::Matrix A = Cairo::scaling_matrix(2, 4);
- Cairo::Matrix B = Cairo::translation_matrix(5.3, 1.2);
- Cairo::Matrix C = A * B;
+ auto A = Cairo::scaling_matrix(2, 4);
+ auto B = Cairo::translation_matrix(5.3, 1.2);
+ auto C = A * B;
Cairo::Matrix D;
D.multiply(A, B);
BOOST_CHECK_EQUAL(C, D);
diff --git a/tests/test-scaled-font.cc b/tests/test-scaled-font.cc
index e1798b6..8a60725 100644
--- a/tests/test-scaled-font.cc
+++ b/tests/test-scaled-font.cc
@@ -9,10 +9,10 @@ using namespace Cairo;
void test_construction()
{
- RefPtr<ToyFontFace> face = ToyFontFace::create("sans", FONT_SLANT_NORMAL, FONT_WEIGHT_NORMAL);
+ auto face = ToyFontFace::create("sans", FONT_SLANT_NORMAL, FONT_WEIGHT_NORMAL);
Matrix identity;
cairo_matrix_init_identity(&identity);
- RefPtr<ScaledFont> font = ScaledFont::create(face, identity, identity, FontOptions());
+ auto font = ScaledFont::create(face, identity, identity, FontOptions());
BOOST_REQUIRE(font);
// now use the default argument for font_options
@@ -22,10 +22,10 @@ void test_construction()
void test_text_to_glyphs()
{
- RefPtr<ToyFontFace> face = ToyFontFace::create("sans", FONT_SLANT_NORMAL, FONT_WEIGHT_NORMAL);
+ auto face = ToyFontFace::create("sans", FONT_SLANT_NORMAL, FONT_WEIGHT_NORMAL);
Matrix identity;
cairo_matrix_init_identity(&identity);
- RefPtr<ScaledFont> font = ScaledFont::create(face, identity, identity, FontOptions());
+ auto font = ScaledFont::create(face, identity, identity, FontOptions());
BOOST_REQUIRE(font);
std::vector<Glyph> glyphs;
@@ -39,10 +39,10 @@ void test_text_to_glyphs()
void test_scale_matrix()
{
- RefPtr<ToyFontFace> face = ToyFontFace::create("sans", FONT_SLANT_NORMAL, FONT_WEIGHT_NORMAL);
+ auto face = ToyFontFace::create("sans", FONT_SLANT_NORMAL, FONT_WEIGHT_NORMAL);
Matrix m;
cairo_matrix_init_scale(&m, 2.0, 4.0);
- RefPtr<ScaledFont> font = ScaledFont::create(face, m, m, FontOptions());
+ auto font = ScaledFont::create(face, m, m, FontOptions());
BOOST_REQUIRE(font);
Matrix result;
@@ -55,14 +55,14 @@ void test_get_font_face()
// this is to test for a bug where we were accidentally freeing the resulting
// font face from a call to ScaledFont::get_font_face() when we didn't hold a
// reference to it
- RefPtr<ToyFontFace> face = ToyFontFace::create("sans", FONT_SLANT_NORMAL, FONT_WEIGHT_NORMAL);
+ auto face = ToyFontFace::create("sans", FONT_SLANT_NORMAL, FONT_WEIGHT_NORMAL);
Matrix identity;
cairo_matrix_init_identity(&identity);
- RefPtr<ScaledFont> font = ScaledFont::create(face, identity, identity, FontOptions());
+ auto font = ScaledFont::create(face, identity, identity, FontOptions());
BOOST_REQUIRE(font);
const int refcount = cairo_font_face_get_reference_count(face->cobj());
{
- RefPtr<FontFace> got_face = font->get_font_face();
+ auto got_face = font->get_font_face();
} // scope ensure that the font face is destroyed
// after creating and destroying the FontFace in get_font_face, our reference
// count should be the same
@@ -72,25 +72,25 @@ void test_get_font_face()
#ifdef CAIRO_HAS_FT_FONT
void test_ft_scaled_font()
{
- FcPattern* invalid = FcPatternCreate();
+ auto invalid = FcPatternCreate();
Cairo::RefPtr<Cairo::FtFontFace> invalid_face;
BOOST_CHECK_THROW(invalid_face = Cairo::FtFontFace::create(invalid), std::bad_alloc);
// basically taken from the cairo test case -- we don't care what font we're
// using so just create an empty pattern and do the minimal substitution to
// get a valid pattern
- FcPattern* pattern = FcPatternCreate();
+ auto pattern = FcPatternCreate();
FcConfigSubstitute (NULL, pattern, FcMatchPattern);
FcDefaultSubstitute (pattern);
FcResult result;
- FcPattern* resolved = FcFontMatch (NULL, pattern, &result);
- Cairo::RefPtr<Cairo::FtFontFace> face = Cairo::FtFontFace::create(resolved);
+ auto resolved = FcFontMatch (NULL, pattern, &result);
+ auto face = Cairo::FtFontFace::create(resolved);
BOOST_CHECK(face);
cairo_scaled_font_t* c_scaled_font = 0;
int refcount = 0;
{
- Cairo::RefPtr<Cairo::FtScaledFont> scaled_font =
+ auto scaled_font =
FtScaledFont::create(face,
Cairo::identity_matrix(),
Cairo::identity_matrix(),
diff --git a/tests/test-surface.cc b/tests/test-surface.cc
index c1654ca..b0d48b4 100644
--- a/tests/test-surface.cc
+++ b/tests/test-surface.cc
@@ -15,7 +15,7 @@ ErrorStatus test_slot(const unsigned char* /*data*/, unsigned int /*len*/)
void test_write_to_png_stream()
{
- RefPtr<ImageSurface> surface = ImageSurface::create(FORMAT_ARGB32, 1, 1);
+ auto surface = ImageSurface::create(FORMAT_ARGB32, 1, 1);
surface->write_to_png_stream(sigc::ptr_fun(test_slot));
BOOST_CHECK(test_slot_called > 0);
}
@@ -23,7 +23,7 @@ void test_write_to_png_stream()
void test_pdf_constructor_slot()
{
test_slot_called = 0;
- RefPtr<PdfSurface> pdf = PdfSurface::create_for_stream(sigc::ptr_fun(&test_slot), 1, 1);
+ auto pdf = PdfSurface::create_for_stream(sigc::ptr_fun(&test_slot), 1, 1);
pdf->show_page();
pdf->finish();
BOOST_CHECK(test_slot_called > 0);
@@ -32,7 +32,7 @@ void test_pdf_constructor_slot()
void test_ps_constructor_slot()
{
test_slot_called = 0;
- RefPtr<PsSurface> ps = PsSurface::create_for_stream(sigc::ptr_fun(&test_slot), 1, 1);
+ auto ps = PsSurface::create_for_stream(sigc::ptr_fun(&test_slot), 1, 1);
ps->show_page();
ps->finish();
BOOST_CHECK(test_slot_called > 0);
@@ -41,7 +41,7 @@ void test_ps_constructor_slot()
void test_svg_constructor_slot()
{
test_slot_called = 0;
- RefPtr<SvgSurface> svg = SvgSurface::create_for_stream(sigc::ptr_fun(&test_slot), 1, 1);
+ auto svg = SvgSurface::create_for_stream(sigc::ptr_fun(&test_slot), 1, 1);
svg->show_page();
svg->finish();
BOOST_CHECK(test_slot_called > 0);
@@ -84,7 +84,7 @@ void test_create_from_png()
void test_ps_eps()
{
- RefPtr<PsSurface> ps = PsSurface::create("test.ps", 1, 1);
+ auto ps = PsSurface::create("test.ps", 1, 1);
// check the initial value
bool result = ps->get_eps();
// set it to the opposite value
@@ -95,16 +95,16 @@ void test_ps_eps()
void test_content()
{
- RefPtr<ImageSurface> surface = ImageSurface::create(FORMAT_ARGB32, 1, 1);
+ auto surface = ImageSurface::create(FORMAT_ARGB32, 1, 1);
BOOST_CHECK_EQUAL(surface->get_content(), CONTENT_COLOR_ALPHA);
- RefPtr<Surface> similar = Surface::create(surface, CONTENT_ALPHA, 1, 1);
+ auto similar = Surface::create(surface, CONTENT_ALPHA, 1, 1);
BOOST_REQUIRE(similar);
BOOST_CHECK_EQUAL(similar->get_content(), CONTENT_ALPHA);
}
void test_fallback_resolution()
{
- RefPtr<ImageSurface> surface = ImageSurface::create(FORMAT_ARGB32, 1, 1);
+ auto surface = ImageSurface::create(FORMAT_ARGB32, 1, 1);
double x, y;
surface->get_fallback_resolution(x, y);
const double new_x = 94, new_y = 123;
@@ -117,7 +117,7 @@ void test_fallback_resolution()
void test_show_text_glyphs()
{
// image surface doesn't support show_text_glyphs
- Cairo::RefPtr<Cairo::Surface> surf = Cairo::ImageSurface::create(Cairo::FORMAT_ARGB32, 10, 10); \
+ auto surf = Cairo::ImageSurface::create(Cairo::FORMAT_ARGB32, 10, 10); \
BOOST_CHECK(!surf->has_show_text_glyphs());
// but pdf surface should
surf = Cairo::PdfSurface::create("test.pdf", 10.0, 10.0);
diff --git a/tests/test-user-font.cc b/tests/test-user-font.cc
index 656bcfc..b0cd7b4 100644
--- a/tests/test-user-font.cc
+++ b/tests/test-user-font.cc
@@ -77,7 +77,7 @@ protected:
void test_implement_text()
{
TestSetup setup;
- RefPtr<ImplTextUserFont> font = ImplTextUserFont::create();
+ auto font = ImplTextUserFont::create();
setup.cr->set_font_face(font);
setup.cr->show_text("hello");
BOOST_REQUIRE(font->count_text_to_glyphs > 0);
@@ -104,7 +104,7 @@ protected:
void test_implement_unicode()
{
TestSetup setup;
- RefPtr<ImplTextUserFont> font = ImplTextUserFont::create();
+ auto font = ImplTextUserFont::create();
setup.cr->set_font_face(font);
setup.cr->show_text("hello");
BOOST_REQUIRE(font->count_text_to_glyphs > 0);
@@ -146,7 +146,7 @@ protected:
void test_implement_both()
{
TestSetup setup;
- RefPtr<ImplBothUserFont> font = ImplBothUserFont::create();
+ auto font = ImplBothUserFont::create();
setup.cr->set_font_face(font);
setup.cr->show_text("hello");
// text_to_glyphs should take precedence
@@ -170,7 +170,7 @@ protected:
void test_implement_neither()
{
TestSetup setup;
- RefPtr<ImplNeitherUserFont> font = ImplNeitherUserFont::create();
+ auto font = ImplNeitherUserFont::create();
setup.cr->set_font_face(font);
setup.cr->show_text("hello");
BOOST_REQUIRE(font->count_render_glyph > 0);
@@ -197,7 +197,7 @@ protected:
void test_implement_init()
{
TestSetup setup;
- RefPtr<ImplInitUserFont> font = ImplInitUserFont::create();
+ auto font = ImplInitUserFont::create();
setup.cr->set_font_face(font);
setup.cr->show_text("hello");
BOOST_REQUIRE(font->count_init > 0);
@@ -263,7 +263,7 @@ protected:
void test_user_font_exception()
{
- Cairo::RefPtr<ExceptionUserFont> font =
+ auto font =
ExceptionUserFont::create(ExceptionUserFont::FLAG_INIT);
BOOST_CHECK(font);