diff options
| author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> | 2019-01-23 01:58:28 +0000 |
|---|---|---|
| committer | Martin Owens <doctormo@gmail.com> | 2019-03-06 01:26:24 +0000 |
| commit | e71e984af918104579da59e45785fe1651c5e992 (patch) | |
| tree | 9fe91c6e2b1237055e46dc4974c1003c2abc8d61 /src/svg/svg-color.cpp | |
| parent | Revert modal fix to fix #108 (diff) | |
| download | inkscape-e71e984af918104579da59e45785fe1651c5e992.tar.gz inkscape-e71e984af918104579da59e45785fe1651c5e992.zip | |
Avoid the “using std::*;” or “using namespace std;” constructs.
This makes the code a lot less readable and greppable for no reason.
Diffstat (limited to 'src/svg/svg-color.cpp')
| -rw-r--r-- | src/svg/svg-color.cpp | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/src/svg/svg-color.cpp b/src/svg/svg-color.cpp index be919ca54..1a0c3d8b8 100644 --- a/src/svg/svg-color.cpp +++ b/src/svg/svg-color.cpp @@ -35,6 +35,7 @@ #include "color.h" #if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#include <vector> #include "object/color-profile.h" #include "document.h" @@ -44,13 +45,9 @@ #include "cms-system.h" -using std::sprintf; -using std::string; -using Inkscape::CMSSystem; - struct SPSVGColor { unsigned long rgb; - const string name; + const std::string name; }; /* @@ -207,7 +204,7 @@ static SPSVGColor const sp_svg_color_named[] = { { 0x9ACD32, "yellowgreen" } }; -static std::map<string, unsigned long> sp_svg_create_color_hash(); +static std::map<std::string, unsigned long> sp_svg_create_color_hash(); guint32 sp_svg_read_color(gchar const *str, guint32 const dfl) { @@ -216,7 +213,7 @@ guint32 sp_svg_read_color(gchar const *str, guint32 const dfl) static guint32 internal_sp_svg_read_color(gchar const *str, gchar const **end_ptr, guint32 def) { - static std::map<string, unsigned long> colors; + static std::map<std::string, unsigned long> colors; guint32 val = 0; if (str == nullptr) return def; @@ -382,8 +379,8 @@ static guint32 internal_sp_svg_read_color(gchar const *str, gchar const **end_pt } c[31] = '\0'; - if (colors.count(string(c))) { - val = colors[string(c)]; + if (colors.count(std::string(c))) { + val = colors[std::string(c)]; } else { return def; @@ -462,12 +459,12 @@ static void rgb24_to_css(char *const buf, unsigned const rgb24) default: { if ((rgb24 & 0xf0f0f) * 0x11 == rgb24) { /* Can use the shorter three-digit form #rgb instead of #rrggbb. */ - sprintf(buf, "#%x%x%x", + std::sprintf(buf, "#%x%x%x", (rgb24 >> 16) & 0xf, (rgb24 >> 8) & 0xf, rgb24 & 0xf); } else { - sprintf(buf, "#%06x", rgb24); + std::sprintf(buf, "#%06x", rgb24); } break; } @@ -500,10 +497,10 @@ void sp_svg_write_color(gchar *buf, unsigned const buflen, guint32 const rgba32) } } -static std::map<string, unsigned long> +static std::map<std::string, unsigned long> sp_svg_create_color_hash() { - std::map<string, unsigned long> colors; + std::map<std::string, unsigned long> colors; for (const auto & i : sp_svg_color_named) { colors[i.name] = i.rgb; @@ -524,7 +521,7 @@ g_message("profile name: %s", icc->colorProfile.c_str()); if ( trans ) { std::vector<colorspace::Component> comps = colorspace::getColorSpaceInfo( prof ); - size_t count = CMSSystem::getChannelCount( prof ); + size_t count = Inkscape::CMSSystem::getChannelCount( prof ); size_t cap = std::min(count, comps.size()); guchar color_in[4]; for (size_t i = 0; i < cap; i++) { @@ -532,7 +529,7 @@ g_message("profile name: %s", icc->colorProfile.c_str()); g_message("input[%d]: %d", (int)i, (int)color_in[i]); } - CMSSystem::doTransform( trans, color_in, color_out, 1 ); + Inkscape::CMSSystem::doTransform( trans, color_in, color_out, 1 ); g_message("transform to sRGB done"); } *r = color_out[0]; |
