svn merge ^/trunk/blender -r49518:49520

This commit is contained in:
Campbell Barton
2012-08-03 09:53:24 +00:00
2 changed files with 22 additions and 7 deletions

View File

@@ -105,13 +105,24 @@ float MemoryBuffer::getMaximumValue()
return result;
}
float MemoryBuffer::getMaximumValue(rcti* rect)
float MemoryBuffer::getMaximumValue(rcti *rect)
{
MemoryBuffer *temp = new MemoryBuffer(NULL, rect);
temp->copyContentFrom(this);
float result = temp->getMaximumValue();
delete temp;
return result;
rcti rect_clamp;
/* first clamp the rect by the bounds or we get un-initialized values */
BLI_rcti_isect(rect, &this->m_rect, &rect_clamp);
if (!BLI_rcti_is_empty(&rect_clamp)) {
MemoryBuffer *temp = new MemoryBuffer(NULL, &rect_clamp);
temp->copyContentFrom(this);
float result = temp->getMaximumValue();
delete temp;
return result;
}
else {
BLI_assert(0);
return 0.0f;
}
}
MemoryBuffer::~MemoryBuffer()
@@ -125,6 +136,7 @@ MemoryBuffer::~MemoryBuffer()
void MemoryBuffer::copyContentFrom(MemoryBuffer *otherBuffer)
{
if (!otherBuffer) {
BLI_assert(0);
return;
}
unsigned int otherY;

View File

@@ -202,6 +202,9 @@ public:
/**
* @brief add the content from otherBuffer to this MemoryBuffer
* @param otherBuffer source buffer
*
* @note take care when running this on a new buffer since it wont fill in
* uninitialized values in areas where the buffers don't overlap.
*/
void copyContentFrom(MemoryBuffer *otherBuffer);
@@ -229,7 +232,7 @@ public:
float *convertToValueBuffer();
float getMaximumValue();
float getMaximumValue(rcti* rect);
float getMaximumValue(rcti *rect);
private:
unsigned int determineBufferSize();