image: remove unneeded area query

This commit is contained in:
Danny Robson 2015-06-09 15:37:35 +10:00
parent da496d8162
commit 9db4dd5b08
3 changed files with 4 additions and 14 deletions

View File

@ -49,7 +49,6 @@ namespace util { namespace image {
buffer<T> downsample (float factor) const;
//---------------------------------------------------------------------
constexpr size_t area (void) const;
constexpr extent2u extent (void) const;
constexpr bool is_packed (void) const;

View File

@ -20,15 +20,6 @@
#define __UTIL_IMAGE_IPP
namespace util { namespace image {
//-------------------------------------------------------------------------
template <typename T>
constexpr size_t
buffer<T>::area (void) const
{
return w * h;
}
//-------------------------------------------------------------------------
template <typename T>
constexpr extent2u

View File

@ -98,7 +98,7 @@ hydraulic_erode (util::image::buffer<float> &height, const unsigned ticks)
}
// evaporate water, deposit sediment
for (size_t i = 0; i < water.area (); ++i) {
for (size_t i = 0; i < water.extent ().area (); ++i) {
water[i] -= EVAPORATION;
height[i] += SOLUBILITY * EVAPORATION;
}
@ -107,8 +107,8 @@ hydraulic_erode (util::image::buffer<float> &height, const unsigned ticks)
}
// forcibly evaporate all remaining water.
CHECK_EQ (water.area (), height.area ());
for (size_t i = 0; i < water.area (); ++i)
CHECK_EQ (water.extent ().area (), height.extent ().area ());
for (size_t i = 0; i < water.extent ().area (); ++i)
height[i] += water[i] * SOLUBILITY;
}
@ -252,7 +252,7 @@ adjust_ocean (util::image::buffer<float> &height,
buckets[size_t (h * 255u)]++;
size_t pivot = 0;
for (size_t accum = 0, target = size_t (percentage * height.area ()); pivot < buckets.size (); ++pivot) {
for (size_t accum = 0, target = size_t (percentage * height.extent ().area ()); pivot < buckets.size (); ++pivot) {
accum += buckets[pivot];
if (accum > target)
break;