From 8e047aa98ee462793e04fcfd8e14aca1bc754f92 Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Wed, 25 Sep 2013 14:58:32 -0700 Subject: [PATCH] raster_colorizer: avoid color copy by return unsigned from get_color --- include/mapnik/raster_colorizer.hpp | 2 +- src/raster_colorizer.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/mapnik/raster_colorizer.hpp b/include/mapnik/raster_colorizer.hpp index 8a743e2d7..d7dbf65ad 100644 --- a/include/mapnik/raster_colorizer.hpp +++ b/include/mapnik/raster_colorizer.hpp @@ -206,7 +206,7 @@ public: //! //! \param[in] value Input value //! \return color associated with the value - color get_color(float value) const; + unsigned get_color(float value) const; //! \brief Set the epsilon value for exact mode diff --git a/src/raster_colorizer.cpp b/src/raster_colorizer.cpp index dd1dd126a..6bc0c052b 100644 --- a/src/raster_colorizer.cpp +++ b/src/raster_colorizer.cpp @@ -138,7 +138,7 @@ void raster_colorizer::colorize(raster_ptr const& raster, feature_impl const& f) } else { - imageData[i] = get_color(value).rgba(); + imageData[i] = get_color(value); } } } @@ -148,14 +148,14 @@ inline unsigned interpolate(unsigned start, unsigned end, float fraction) return static_cast(fraction * ((float)end - (float)start) + start); } -color raster_colorizer::get_color(float value) const +unsigned raster_colorizer::get_color(float value) const { int stopCount = stops_.size(); //use default color if no stops if(stopCount == 0) { - return default_color_; + return default_color_.rgba(); } //1 - Find the stop that the value is in @@ -278,7 +278,7 @@ color raster_colorizer::get_color(float value) const MAPNIK_LOG_DEBUG(raster_colorizer) << "\toutputColor: " << outputColor.to_string(); */ - return outputColor; + return outputColor.rgba(); }