raster_colorizer: avoid color copy by return unsigned from get_color

This commit is contained in:
Dane Springmeyer 2013-09-25 14:58:32 -07:00
parent 7aeff3fb59
commit 8e047aa98e
2 changed files with 5 additions and 5 deletions

View file

@ -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

View file

@ -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<unsigned>(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();
}