summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2013-09-26 23:06:17 +0000
committerJabiertxof <jtx@jtx.marker.es>2013-09-26 23:06:17 +0000
commitdd0b048ba951102b5363bde975f41807cbc6a503 (patch)
treec5e1b3fdaba9bf160b78e30c23d8fc24b401658c /src
parentupdate to trunk (diff)
parentUse Cairo 1.10 blend operators to render feBlend (diff)
downloadinkscape-dd0b048ba951102b5363bde975f41807cbc6a503.tar.gz
inkscape-dd0b048ba951102b5363bde975f41807cbc6a503.zip
update to trunk
(bzr r12588.1.9)
Diffstat (limited to 'src')
-rw-r--r--src/display/drawing-image.cpp121
-rw-r--r--src/display/drawing-image.h3
-rw-r--r--src/display/nr-filter-blend.cpp164
-rw-r--r--src/libnrtype/FontFactory.cpp8
-rw-r--r--src/libnrtype/Layout-TNG-Input.cpp4
-rw-r--r--src/libnrtype/Layout-TNG-Output.cpp14
-rw-r--r--src/libnrtype/font-lister.cpp4
-rw-r--r--src/ui/dialog/template-widget.cpp2
-rw-r--r--src/ui/widget/unit-tracker.cpp2
9 files changed, 51 insertions, 271 deletions
diff --git a/src/display/drawing-image.cpp b/src/display/drawing-image.cpp
index 0b661a450..a9c0499c2 100644
--- a/src/display/drawing-image.cpp
+++ b/src/display/drawing-image.cpp
@@ -23,7 +23,6 @@ DrawingImage::DrawingImage(Drawing &drawing)
: DrawingItem(drawing)
, _pixbuf(NULL)
, _style(NULL)
- , _new_surface(NULL)
{}
DrawingImage::~DrawingImage()
@@ -123,123 +122,11 @@ unsigned DrawingImage::_renderItem(DrawingContext &ct, Geom::IntRect const &/*ar
ct.rectangle(_clipbox);
ct.clip();
- /////////////////////////////////////////////////////////////////////////////
- // BEGIN: Hack to avoid Cairo bug
- // The total transform (which is RIGHT-multiplied with the item points to get display points) equals:
- // scale*translate_origin*_ctm = scale*translate(origin)*expansion*expansionInv*_ctm
- // = scale*expansion*translate(origin*expansion)*expansionInv*_ctm
- // To avoid a Cairo bug, we handle the scale*expansion part ourselves.
- // See https://bugs.launchpad.net/inkscape/+bug/804162
-
- Geom::Scale expansion(_ctm.expansion());
- int orgwidth = _pixbuf->width();
- int orgheight = _pixbuf->height();
-
- if (_scale[Geom::X]*expansion[Geom::X]*orgwidth*255.0<1.0 || _scale[Geom::Y]*expansion[Geom::Y]*orgheight*255.0<1.0) {
- // Resized image too small to actually see anything
- return RENDER_OK;
- }
-
- _pixbuf->ensurePixelFormat(Inkscape::Pixbuf::PF_CAIRO);
-
- // Split scale*expansion in a part that is <= 1.0 and a part that is >= 1.0. We only take care of the part <= 1.0.
- Geom::Scale scaleExpansionSmall(std::min<Geom::Coord>(fabs(_scale[Geom::X]*expansion[Geom::X]),1),std::min<Geom::Coord>(fabs(_scale[Geom::Y]*expansion[Geom::Y]),1));
- Geom::Scale scaleExpansionLarge(_scale[Geom::X]*expansion[Geom::X]/scaleExpansionSmall[Geom::X],_scale[Geom::Y]*expansion[Geom::Y]/scaleExpansionSmall[Geom::Y]);
-
- Geom::Point newSize(Geom::Point(orgwidth,orgheight)*scaleExpansionSmall);
- if ((newSize-Geom::Point(orgwidth,orgheight)).length()<0.1) {
- // Just use _surface directly.
- ct.scale(expansion.inverse()); // This should not include scale (see derivation above)
- ct.translate(_origin*expansion);
- ct.scale(scaleExpansionLarge);
- ct.setSource(_pixbuf->getSurfaceRaw(), 0, 0);
- } else if (!_new_surface || (newSize-_rescaledSize).length()>0.1) {
- // Rescaled image is sufficiently different from cached image to recompute
- if (_new_surface) cairo_surface_destroy(_new_surface);
- _rescaledSize = newSize;
-
- // This essentially considers an image to be composed of rectangular pixels (box kernel) and computes the least-squares approximation of the original.
- // When the scale factor is really large or small this essentially results in using a box filter, while for scale factors approaching 1 it is more like a "tent" kernel.
- // Although the quality of the result is not great, it is typically better than an ordinary box filter, and it is guaranteed to preserve the overall brightness of the image.
- // The best improvement would probably be to do the same kind of thing based on a tent kernel, but that's quite a bit more complicated, and probably not worth the trouble for a hack like this.
- int newwidth = static_cast<int>(floor(orgwidth*scaleExpansionSmall[Geom::X])+1);
- int newheight = static_cast<int>(floor(orgheight*scaleExpansionSmall[Geom::Y])+1);
- std::vector<int> xBegin(newwidth, -1), yBegin(newheight, -1);
- std::vector< std::vector<float> > xCoefs(xBegin.size()), yCoefs(yBegin.size());
- for(int x=0; x<orgwidth; x++) {
- double coordBegin = x*static_cast<double>(scaleExpansionSmall[Geom::X]); // x-coord in target coordinates where the current source pixel begins
- double coordEnd = (x+1)*static_cast<double>(scaleExpansionSmall[Geom::X]); // x-coord in target coordinates where the current source pixel ends
- int begin = static_cast<int>(floor(coordBegin)); // First pixel (x-coord) affected by the current source pixel
- int end = static_cast<int>(ceil(coordEnd)); // First pixel (x-coord) NOT affected by the current source pixel (a zero contribution is counted as not affecting the pixel)
- for(int nx=begin; nx<end; nx++) {
- // Set xBegin if this is the first source pixel contributing to the target pixel.
- if (xBegin[nx]==-1) xBegin[nx] = x;
- // This computes the fraction of the current target pixel (at nx) that is covered by the source pixel (at x).
- xCoefs[nx].push_back(static_cast<float>(std::min<double>(nx+1,coordEnd) - std::max<double>(nx,coordBegin)));
- }
- }
- for(int y=0; y<orgheight; y++) {
- double coordBegin = y*static_cast<double>(scaleExpansionSmall[Geom::Y]); // y-coord in target coordinates where the current source pixel begins
- double coordEnd = (y+1)*static_cast<double>(scaleExpansionSmall[Geom::Y]); // y-coord in target coordinates where the current source pixel ends
- int begin = static_cast<int>(floor(coordBegin)); // First pixel (y-coord) affected by the current source pixel
- int end = static_cast<int>(ceil(coordEnd)); // First pixel (y-coord) NOT affected by the current source pixel (a zero contribution is counted as not affecting the pixel)
- for(int ny=begin; ny<end; ny++) {
- // Set yBegin if this is the first source pixel contributing to the target pixel.
- if (yBegin[ny]==-1) yBegin[ny] = y;
- // This computes the fraction of the current target pixel (at ny) that is covered by the source pixel (at y).
- yCoefs[ny].push_back(static_cast<float>(std::min<double>(ny+1,coordEnd) - std::max<double>(ny,coordBegin)));
- }
- }
-
- cairo_surface_t *surface = _pixbuf->getSurfaceRaw();
- _new_surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, newwidth,newheight);
- unsigned char * orgdata = cairo_image_surface_get_data(surface);
- unsigned char * newdata = cairo_image_surface_get_data(_new_surface);
- int orgstride = cairo_image_surface_get_stride(surface);
- int newstride = cairo_image_surface_get_stride(_new_surface);
-
- cairo_surface_flush(_new_surface);
-
- for(int y=0; y<newheight; y++) {
- for(int x=0; x<newwidth; x++) {
- float tempSum[4] = {0,0,0,0};
- for(int oy=0; oy<static_cast<int>(yCoefs[y].size()); oy++) {
- for(int ox=0; ox<static_cast<int>(xCoefs[x].size()); ox++) {
- for(int c=0; c<4; c++) {
- tempSum[c] += xCoefs[x][ox]*yCoefs[y][oy]*orgdata[c+4*(xBegin[x]+ox)+orgstride*(yBegin[y]+oy)];
- }
- }
- }
- for(int c=0; c<4; c++) {
- newdata[c+4*x+newstride*y] = static_cast<unsigned char>(tempSum[c]);
- }
- }
- }
-
- cairo_surface_mark_dirty(_new_surface);
-
- ct.scale(expansion.inverse()); // This should not include scale (see derivation above)
- ct.translate(_origin*expansion);
- ct.scale(scaleExpansionLarge);
- ct.setSource(_new_surface, 0, 0);
- } else {
- // No need to regenerate, but we do draw from _new_surface.
- ct.scale(expansion.inverse()); // This should not include scale (see derivation above)
- ct.translate(_origin*expansion);
- ct.scale(scaleExpansionLarge);
- ct.setSource(_new_surface, 0, 0);
- }
-
- // END: Hack to avoid Cairo bug
- /////////////////////////////////////////////////////////////////////////////
-
- // TODO: If Cairo's problems are gone, uncomment the following:
- //ct.translate(_origin);
- //ct.scale(_scale);
- //ct.setSource(_pixbuf->getSurfaceRaw(), 0, 0);
+ ct.translate(_origin);
+ ct.scale(_scale);
+ ct.setSource(_pixbuf->getSurfaceRaw(), 0, 0);
- //ct.paint(_opacity);
- ct.paint();
+ ct.paint(_opacity);
} else { // outline; draw a rect instead
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
diff --git a/src/display/drawing-image.h b/src/display/drawing-image.h
index 58e6de72e..cebaafc85 100644
--- a/src/display/drawing-image.h
+++ b/src/display/drawing-image.h
@@ -45,9 +45,6 @@ protected:
Inkscape::Pixbuf *_pixbuf;
SPStyle *_style;
- cairo_surface_t *_new_surface; // Part of hack around Cairo bug
- Geom::Point _rescaledSize; // Part of hack around Cairo bug
-
// TODO: the following three should probably be merged into a new Geom::Viewbox object
Geom::Rect _clipbox; ///< for preserveAspectRatio
Geom::Point _origin;
diff --git a/src/display/nr-filter-blend.cpp b/src/display/nr-filter-blend.cpp
index a08191f67..bff7405b7 100644
--- a/src/display/nr-filter-blend.cpp
+++ b/src/display/nr-filter-blend.cpp
@@ -1,6 +1,6 @@
-/*
+/** @file
* SVG feBlend renderer
- *
+ *//*
* "This filter composites two objects together using commonly used
* imaging software blending modes. It performs a pixel-wise combination
* of two input images."
@@ -9,6 +9,7 @@
* Authors:
* Niko Kiirala <niko@kiirala.com>
* Jasper van de Gronde <th.v.d.gronde@hccnet.nl>
+ * Krzysztof KosiƄski <tweenk.pl@gmail.com>
*
* Copyright (C) 2007-2008 authors
*
@@ -30,20 +31,6 @@
namespace Inkscape {
namespace Filters {
-/*
- * From http://www.w3.org/TR/SVG11/filters.html#feBlend
- *
- * For all feBlend modes, the result opacity is computed as follows:
- * qr = 1 - (1-qa)*(1-qb)
- *
- * For the compositing formulas below, the following definitions apply:
- * cr = Result color (RGB) - premultiplied
- * qa = Opacity value at a given pixel for image A
- * qb = Opacity value at a given pixel for image B
- * ca = Color (RGB) at a given pixel for image A - premultiplied
- * cb = Color (RGB) at a given pixel for image B - premultiplied
- */
-
FilterBlend::FilterBlend()
: _blend_mode(BLEND_NORMAL),
_input2(NR_FILTER_SLOT_NOT_SET)
@@ -56,91 +43,6 @@ FilterPrimitive * FilterBlend::create() {
FilterBlend::~FilterBlend()
{}
-// cr = (1-qa)*cb + (1-qb)*ca + ca*cb
-struct BlendMultiply {
- guint32 operator()(guint32 in1, guint32 in2)
- {
- EXTRACT_ARGB32(in1, aa, ra, ga, ba)
- EXTRACT_ARGB32(in2, ab, rb, gb, bb)
-
- guint32 ao = 255*255 - (255-aa)*(255-ab); ao = (ao + 127) / 255;
- guint32 ro = (255-aa)*rb + (255-ab)*ra + ra*rb; ro = (ro + 127) / 255;
- guint32 go = (255-aa)*gb + (255-ab)*ga + ga*gb; go = (go + 127) / 255;
- guint32 bo = (255-aa)*bb + (255-ab)*ba + ba*bb; bo = (bo + 127) / 255;
-
- ASSEMBLE_ARGB32(pxout, ao, ro, go, bo)
- return pxout;
- }
-};
-
-// cr = cb + ca - ca * cb
-struct BlendScreen {
- guint32 operator()(guint32 in1, guint32 in2)
- {
- EXTRACT_ARGB32(in1, aa, ra, ga, ba)
- EXTRACT_ARGB32(in2, ab, rb, gb, bb)
-
- guint32 ao = 255*255 - (255-aa)*(255-ab); ao = (ao + 127) / 255;
- guint32 ro = 255*(rb + ra) - ra * rb; ro = (ro + 127) / 255;
- guint32 go = 255*(gb + ga) - ga * gb; go = (go + 127) / 255;
- guint32 bo = 255*(bb + ba) - ba * bb; bo = (bo + 127) / 255;
-
- ASSEMBLE_ARGB32(pxout, ao, ro, go, bo)
- return pxout;
- }
-};
-
-// cr = Min ((1 - qa) * cb + ca, (1 - qb) * ca + cb)
-struct BlendDarken {
- guint32 operator()(guint32 in1, guint32 in2)
- {
- EXTRACT_ARGB32(in1, aa, ra, ga, ba)
- EXTRACT_ARGB32(in2, ab, rb, gb, bb)
-
- guint32 ao = 255*255 - (255-aa)*(255-ab); ao = (ao + 127) / 255;
- guint32 ro = std::min((255-aa)*rb + 255*ra, (255-ab)*ra + 255*rb); ro = (ro + 127) / 255;
- guint32 go = std::min((255-aa)*gb + 255*ga, (255-ab)*ga + 255*gb); go = (go + 127) / 255;
- guint32 bo = std::min((255-aa)*bb + 255*ba, (255-ab)*ba + 255*bb); bo = (bo + 127) / 255;
-
- ASSEMBLE_ARGB32(pxout, ao, ro, go, bo)
- return pxout;
- }
-};
-
-// cr = Max ((1 - qa) * cb + ca, (1 - qb) * ca + cb)
-struct BlendLighten {
- guint32 operator()(guint32 in1, guint32 in2)
- {
- EXTRACT_ARGB32(in1, aa, ra, ga, ba)
- EXTRACT_ARGB32(in2, ab, rb, gb, bb)
-
- guint32 ao = 255*255 - (255-aa)*(255-ab); ao = (ao + 127) / 255;
- guint32 ro = std::max((255-aa)*rb + 255*ra, (255-ab)*ra + 255*rb); ro = (ro + 127) / 255;
- guint32 go = std::max((255-aa)*gb + 255*ga, (255-ab)*ga + 255*gb); go = (go + 127) / 255;
- guint32 bo = std::max((255-aa)*bb + 255*ba, (255-ab)*ba + 255*bb); bo = (bo + 127) / 255;
-
- ASSEMBLE_ARGB32(pxout, ao, ro, go, bo)
- return pxout;
- }
-};
-
-/*
-struct BlendAlpha
-static inline void blend_alpha(guint32 in1, guint32 in2, guint32 *out)
-{
- EXTRACT_ARGB32(in1, a1, a2, a3, a4);
- EXTRACT_ARGB32(in2, b1, b2, b3, b4);
-
- guint32 o1 = 255*255 - (255-a1)*(255-b1); o1 = (o1+127) / 255;
- guint32 o2 = 255*255 - (255-a2)*(255-b2); o2 = (o2+127) / 255;
- guint32 o3 = 255*255 - (255-a3)*(255-b3); o3 = (o3+127) / 255;
- guint32 o4 = 255*255 - (255-a4)*(255-b4); o4 = (o4+127) / 255;
-
- ASSEMBLE_ARGB32(pxout, o1, o2, o3, o4);
- *out = pxout;
-}
-*/
-
void FilterBlend::render_cairo(FilterSlot &slot)
{
cairo_surface_t *input1 = slot.getcairo(_input);
@@ -161,41 +63,35 @@ void FilterBlend::render_cairo(FilterSlot &slot)
cairo_surface_t *out = ink_cairo_surface_create_output(input1, input2);
set_cairo_surface_ci( out, ci_fp );
- cairo_content_t ct1 = cairo_surface_get_content(input1);
- cairo_content_t ct2 = cairo_surface_get_content(input2);
- if ((ct1 == CAIRO_CONTENT_ALPHA && ct2 == CAIRO_CONTENT_ALPHA)
- || _blend_mode == BLEND_NORMAL)
- {
- ink_cairo_surface_blit(input2, out);
- cairo_t *out_ct = cairo_create(out);
- cairo_set_source_surface(out_ct, input1, 0, 0);
- cairo_paint(out_ct);
- cairo_destroy(out_ct);
- } else {
- // blend mode != normal and at least 1 surface is not pure alpha
-
- // TODO: convert to Cairo blending operators once we start using the 1.10 series
- switch (_blend_mode) {
- case BLEND_MULTIPLY:
- ink_cairo_surface_blend(input1, input2, out, BlendMultiply());
- break;
- case BLEND_SCREEN:
- ink_cairo_surface_blend(input1, input2, out, BlendScreen());
- break;
- case BLEND_DARKEN:
- ink_cairo_surface_blend(input1, input2, out, BlendDarken());
- break;
- case BLEND_LIGHTEN:
- ink_cairo_surface_blend(input1, input2, out, BlendLighten());
- break;
- case BLEND_NORMAL:
- default:
- // this was handled before
- g_assert_not_reached();
- break;
- }
+ ink_cairo_surface_blit(input2, out);
+ cairo_t *out_ct = cairo_create(out);
+ cairo_set_source_surface(out_ct, input1, 0, 0);
+
+ // All of the blend modes are implemented in Cairo as of 1.10.
+ // For a detailed description, see:
+ // http://cairographics.org/operators/
+ switch (_blend_mode) {
+ case BLEND_MULTIPLY:
+ cairo_set_operator(out_ct, CAIRO_OPERATOR_MULTIPLY);
+ break;
+ case BLEND_SCREEN:
+ cairo_set_operator(out_ct, CAIRO_OPERATOR_SCREEN);
+ break;
+ case BLEND_DARKEN:
+ cairo_set_operator(out_ct, CAIRO_OPERATOR_DARKEN);
+ break;
+ case BLEND_LIGHTEN:
+ cairo_set_operator(out_ct, CAIRO_OPERATOR_LIGHTEN);
+ break;
+ case BLEND_NORMAL:
+ default:
+ cairo_set_operator(out_ct, CAIRO_OPERATOR_OVER);
+ break;
}
+ cairo_paint(out_ct);
+ cairo_destroy(out_ct);
+
slot.set(_output, out);
cairo_surface_destroy(out);
}
diff --git a/src/libnrtype/FontFactory.cpp b/src/libnrtype/FontFactory.cpp
index c91e57065..c896cc470 100644
--- a/src/libnrtype/FontFactory.cpp
+++ b/src/libnrtype/FontFactory.cpp
@@ -348,7 +348,7 @@ font_factory::~font_factory(void)
PangoStringToDescrMap::iterator it = fontInstanceMap.begin();
while (it != fontInstanceMap.end()) {
pango_font_description_free((*it).second);
- it++;
+ ++it;
}
}
@@ -662,7 +662,7 @@ Glib::ustring font_factory::FontSpecificationBestMatch(const Glib::ustring & fon
Glib::ustring bestMatchDescription;
bool setFirstFamilyMatch = false;
- for (it = fontInstanceMap.begin(); it != fontInstanceMap.end(); it++) {
+ for (it = fontInstanceMap.begin(); it != fontInstanceMap.end(); ++it) {
Glib::ustring currentFontSpec = (*it).first;
Glib::ustring currentFamily = GetUIFamilyString((*it).second);
@@ -776,7 +776,7 @@ void font_factory::GetUIFamiliesAndStyles(FamilyToStylesMap *map)
for (std::list<Glib::ustring>::iterator it=styleList.begin();
it != styleList.end();
- it++) {
+ ++it) {
if (*it == styleUIName) {
exists = true;
break;
@@ -809,7 +809,7 @@ void font_factory::GetUIFamiliesAndStyles(FamilyToStylesMap *map)
families = 0;
// Sort the style lists
- for (FamilyToStylesMap::iterator iter = map->begin() ; iter != map->end(); iter++) {
+ for (FamilyToStylesMap::iterator iter = map->begin() ; iter != map->end(); ++iter) {
(*iter).second.sort(StyleNameCompareInternal);
}
}
diff --git a/src/libnrtype/Layout-TNG-Input.cpp b/src/libnrtype/Layout-TNG-Input.cpp
index 10310b4aa..c7b0948e8 100644
--- a/src/libnrtype/Layout-TNG-Input.cpp
+++ b/src/libnrtype/Layout-TNG-Input.cpp
@@ -25,7 +25,7 @@ namespace Text {
void Layout::_clearInputObjects()
{
- for(std::vector<InputStreamItem*>::iterator it = _input_stream.begin() ; it != _input_stream.end() ; it++)
+ for(std::vector<InputStreamItem*>::iterator it = _input_stream.begin() ; it != _input_stream.end() ; ++it)
delete *it;
_input_stream.clear();
_input_wrap_shapes.clear();
@@ -46,7 +46,7 @@ void Layout::appendText(Glib::ustring const &text, SPStyle *style, void *source_
sp_style_ref(style);
new_source->text_length = 0;
- for ( ; text_begin != text_end && text_begin != text.end() ; text_begin++)
+ for ( ; text_begin != text_end && text_begin != text.end() ; ++text_begin)
new_source->text_length++; // save this because calculating the length of a UTF-8 string is expensive
if (optional_attributes) {
diff --git a/src/libnrtype/Layout-TNG-Output.cpp b/src/libnrtype/Layout-TNG-Output.cpp
index 060cecebf..1989c495a 100644
--- a/src/libnrtype/Layout-TNG-Output.cpp
+++ b/src/libnrtype/Layout-TNG-Output.cpp
@@ -85,7 +85,7 @@ void Layout::_clearOutputObjects()
_paragraphs.clear();
_lines.clear();
_chunks.clear();
- for (std::vector<Span>::iterator it_span = _spans.begin() ; it_span != _spans.end() ; it_span++)
+ for (std::vector<Span>::iterator it_span = _spans.begin() ; it_span != _spans.end() ; ++it_span)
if (it_span->font) it_span->font->Unref();
_spans.clear();
_characters.clear();
@@ -330,7 +330,7 @@ std:: cout << "DEBUG Layout::print in while "
// conditions that prevent this character from joining the record
lc_index++;
if(lc_index >= _characters.size()) break; // nothing more to process, so it must be the end of the record
- text_iter++;
+ ++text_iter;
if(doUTN)newtarget=SingleUnicodeToNon(*text_iter); // this should only ever be with a 1:1 glyph:character situation
if(newtarget != oldtarget)break; // change in unicode to nonunicode translation status
// MUST exit on any major span change, but not on some little events, like a font substitution event irrelvant for the file save
@@ -424,7 +424,7 @@ void Layout::showGlyphs(CairoRenderContext *ctx) const
unsigned original_span = _characters[char_index].in_span;
while (char_index && _characters[char_index - 1].in_span == original_span) {
char_index--;
- span_iter++;
+ ++span_iter;
}
// try to output as many characters as possible in one go
@@ -434,7 +434,7 @@ void Layout::showGlyphs(CairoRenderContext *ctx) const
glyphtext.clear();
do {
span_string += *span_iter;
- span_iter++;
+ ++span_iter;
unsigned same_character = _glyphs[glyph_index].in_character;
while (glyph_index < _glyphs.size() && _glyphs[glyph_index].in_character == same_character) {
@@ -550,11 +550,11 @@ Glib::ustring Layout::dumpAsText() const
for(unsigned j = 0; j < _characters.size() ; j++){
if(lastspan != _characters[j].in_span){
lastspan = _characters[j].in_span;
- icc = _spans[lastspan].input_stream_first_character;
+ icc = _spans[lastspan].input_stream_first_character;
}
snprintf(line, sizeof(line), "char %4d: '%c' 0x%4.4x x=%8.4f glyph=%3d span=%3d\n", j, *icc, *icc, _characters[j].x, _characters[j].in_glyph, _characters[j].in_span);
result += line;
- icc++;
+ ++icc;
}
}
if(_glyphs.size()){
@@ -602,7 +602,7 @@ Glib::ustring Layout::dumpAsText() const
snprintf(line, sizeof(line), " %d: control x=%f flags=%03x glyph=%d\n", char_index, _characters[char_index].x, *u.uattr, _characters[char_index].in_glyph);
} else { // some text has empty tspans, iter_char cannot be dereferenced
snprintf(line, sizeof(line), " %d: '%c' 0x%4.4x x=%f flags=%03x glyph=%d\n", char_index, *iter_char, *iter_char, _characters[char_index].x, *u.uattr, _characters[char_index].in_glyph);
- iter_char++;
+ ++iter_char;
}
result += line;
}
diff --git a/src/libnrtype/font-lister.cpp b/src/libnrtype/font-lister.cpp
index 39a04914b..0a83f55e9 100644
--- a/src/libnrtype/font-lister.cpp
+++ b/src/libnrtype/font-lister.cpp
@@ -39,7 +39,7 @@ namespace Inkscape
std::list<Glib::ustring> familyList;
for (FamilyToStylesMap::iterator iter = familyStyleMap.begin();
iter != familyStyleMap.end();
- iter++) {
+ ++iter) {
familyList.push_back((*iter).first);
}
familyList.sort();
@@ -60,7 +60,7 @@ namespace Inkscape
std::list<Glib::ustring> &styleStrings = familyStyleMap[familyName];
for (std::list<Glib::ustring>::iterator it=styleStrings.begin();
it != styleStrings.end();
- it++) {
+ ++it) {
styles = g_list_append(styles, g_strdup((*it).c_str()));
}
diff --git a/src/ui/dialog/template-widget.cpp b/src/ui/dialog/template-widget.cpp
index 7e34e5a58..898903f2b 100644
--- a/src/ui/dialog/template-widget.cpp
+++ b/src/ui/dialog/template-widget.cpp
@@ -120,7 +120,7 @@ void TemplateWidget::_displayTemplateDetails()
if (_current_template.long_description != "")
message += _("Description: ") + _current_template.long_description + "\n\n";
- if (_current_template.keywords.size() > 0){
+ if (~_current_template.keywords.empty()){
message += _("Keywords: ");
for (std::set<Glib::ustring>::iterator it = _current_template.keywords.begin(); it != _current_template.keywords.end(); ++it)
message += *it + " ";
diff --git a/src/ui/widget/unit-tracker.cpp b/src/ui/widget/unit-tracker.cpp
index 5b2dc031b..f9b0c3a44 100644
--- a/src/ui/widget/unit-tracker.cpp
+++ b/src/ui/widget/unit-tracker.cpp
@@ -41,7 +41,7 @@ UnitTracker::UnitTracker(UnitType unit_type) :
UnitTable::UnitMap::iterator m_iter = m.begin();
while(m_iter != m.end()) {
Glib::ustring text = (*m_iter).first;
- m_iter++;
+ ++m_iter;
gtk_list_store_append(_store, &iter);
gtk_list_store_set(_store, &iter, COLUMN_STRING, text.c_str(), -1);
}