From 195b9e70dd686d20db28c45c0958280e85ecede3 Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Tue, 28 Feb 2012 23:45:33 -0800 Subject: Cleanup of unused variables and warnings. (bzr r11031) --- src/display/cairo-utils.h | 32 +++++++++++++++++++++++++++++++- src/display/drawing-item.cpp | 3 ++- 2 files changed, 33 insertions(+), 2 deletions(-) (limited to 'src/display') 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 -- cgit v1.2.3