summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJon A. Cruz <jon@joncruz.org>2012-02-29 07:45:33 +0000
committerJon A. Cruz <jon@joncruz.org>2012-02-29 07:45:33 +0000
commit195b9e70dd686d20db28c45c0958280e85ecede3 (patch)
tree223aca97567af7e6b8439440705b35f2878505b8 /src
parentHeader tidying, suppress all gdk deprecation errors in gtkmm (diff)
downloadinkscape-195b9e70dd686d20db28c45c0958280e85ecede3.tar.gz
inkscape-195b9e70dd686d20db28c45c0958280e85ecede3.zip
Cleanup of unused variables and warnings.
(bzr r11031)
Diffstat (limited to 'src')
-rw-r--r--src/display/cairo-utils.h32
-rw-r--r--src/display/drawing-item.cpp3
-rw-r--r--src/flood-context.cpp39
3 files changed, 58 insertions, 16 deletions
diff --git a/src/display/cairo-utils.h b/src/display/cairo-utils.h
index dbe874365..e67872891 100644
--- a/src/display/cairo-utils.h
+++ b/src/display/cairo-utils.h
@@ -144,7 +144,37 @@ void feed_pathvector_to_cairo (cairo_t *ct, Geom::PathVector const &pathv);
#define ASSEMBLE_ARGB32(px,a,r,g,b) \
guint32 px = (a << 24) | (r << 16) | (g << 8) | b;
-#endif
+namespace Inkscape {
+
+namespace Display
+{
+
+inline void ExtractARGB32(guint32 px, guint32 &a, guint32 &r, guint32 &g, guint &b)
+{
+ a = ((px) & 0xff000000) >> 24;
+ r = ((px) & 0x00ff0000) >> 16;
+ g = ((px) & 0x0000ff00) >> 8;
+ b = ((px) & 0x000000ff);
+}
+
+inline void ExtractRGB32(guint32 px, guint32 &r, guint32 &g, guint &b)
+{
+ r = ((px) & 0x00ff0000) >> 16;
+ g = ((px) & 0x0000ff00) >> 8;
+ b = ((px) & 0x000000ff);
+}
+
+inline guint AssembleARGB32(guint32 a, guint32 r, guint32 g, guint32 b)
+{
+ return (a << 24) | (r << 16) | (g << 8) | b;
+}
+
+} // namespace Display
+
+} // namespace Inkscape
+
+#endif // SEEN_INKSCAPE_DISPLAY_CAIRO_UTILS_H
+
/*
Local Variables:
mode:c++
diff --git a/src/display/drawing-item.cpp b/src/display/drawing-item.cpp
index df44a3de0..0fb1f0018 100644
--- a/src/display/drawing-item.cpp
+++ b/src/display/drawing-item.cpp
@@ -431,7 +431,8 @@ DrawingItem::update(Geom::IntRect const &area, UpdateContext const &ctx, unsigne
struct MaskLuminanceToAlpha {
guint32 operator()(guint32 in) {
- EXTRACT_ARGB32(in, a, r, g, b)
+ guint r = 0, g = 0, b = 0;
+ Display::ExtractRGB32(in, r, g, b);
// the operation of unpremul -> luminance-to-alpha -> multiply by alpha
// is equivalent to luminance-to-alpha on premultiplied color values
// original computation in double: r*0.2125 + g*0.7154 + b*0.0721
diff --git a/src/flood-context.cpp b/src/flood-context.cpp
index a0f528973..c9f4a0097 100644
--- a/src/flood-context.cpp
+++ b/src/flood-context.cpp
@@ -72,6 +72,10 @@
using Inkscape::DocumentUndo;
+using Inkscape::Display::ExtractARGB32;
+using Inkscape::Display::ExtractRGB32;
+using Inkscape::Display::AssembleARGB32;
+
static void sp_flood_context_class_init(SPFloodContextClass *klass);
static void sp_flood_context_init(SPFloodContext *flood_context);
static void sp_flood_context_dispose(GObject *object);
@@ -202,19 +206,19 @@ static void sp_flood_context_setup(SPEventContext *ec)
}
}
-inline static guint32
-compose_onto (guint32 px, guint32 bg)
+inline static guint32 compose_onto(guint32 px, guint32 bg)
{
- EXTRACT_ARGB32(px, ap,rp,gp,bp)
- EXTRACT_ARGB32(bg, ab,rb,gb,bb)
- guint32 ao,ro,bo,go;
+ guint ap = 0, rp = 0, gp = 0, bp = 0;
+ guint rb = 0, gb = 0, bb = 0;
+ ExtractARGB32(px, ap, rp, gp, bp);
+ ExtractRGB32(bg, rb, gb, bb);
- ao = 255*255 - (255-ap)*(255-bp); ao = (ao + 127) / 255;
- ro = (255-ap)*rb + rp; ro = (ro + 127) / 255;
- go = (255-ap)*gb + gp; go = (go + 127) / 255;
- bo = (255-ap)*bb + bp; bo = (bo + 127) / 255;
+ guint ao = 255*255 - (255-ap)*(255-bp); ao = (ao + 127) / 255;
+ guint ro = (255-ap)*rb + rp; ro = (ro + 127) / 255;
+ guint go = (255-ap)*gb + gp; go = (go + 127) / 255;
+ guint bo = (255-ap)*bb + bp; bo = (bo + 127) / 255;
- ASSEMBLE_ARGB32(pxout, ao,ro,go,bo)
+ guint pxout = AssembleARGB32(ao, ro, go, bo);
return pxout;
}
@@ -279,10 +283,17 @@ static bool compare_pixels(guint32 check, guint32 orig, guint32 merged_orig_pixe
int diff = 0;
float hsl_check[3] = {0,0,0}, hsl_orig[3] = {0,0,0};
- EXTRACT_ARGB32(check, ac,rc,gc,bc)
- EXTRACT_ARGB32(orig, ao,ro,go,bo)
- EXTRACT_ARGB32(dtc, ad,rd,gd,bd)
- EXTRACT_ARGB32(merged_orig_pixel, amop,rmop,gmop,bmop)
+ guint32 ac = 0, rc = 0, gc = 0, bc = 0;
+ ExtractARGB32(check, ac, rc, gc, bc);
+
+ guint32 ao = 0, ro = 0, go = 0, bo = 0;
+ ExtractARGB32(orig, ao, ro, go, bo);
+
+ guint32 ad = 0, rd = 0, gd = 0, bd = 0;
+ ExtractARGB32(dtc, ad, rd, gd, bd);
+
+ guint32 amop = 0, rmop = 0, gmop = 0, bmop = 0;
+ ExtractARGB32(merged_orig_pixel, amop, rmop, gmop, bmop);
if ((method == FLOOD_CHANNELS_H) ||
(method == FLOOD_CHANNELS_S) ||