Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-08-03 13:51:10 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-08-03 13:51:10 +0400
commit52e31a4866ab8db0079c494348dfd642b6694935 (patch)
tree86317367682e705d86d80d3180c590b211dddac1 /source/blender/compositor/intern/COM_MemoryBuffer.cpp
parentdb8c9c24f669d01ba76b9d29d80911d5c96a27a6 (diff)
fix for bokeh blur using uninitialized memory - it would cause some tiles not to be blurred.
was in fact a bug in MemoryBuffer::getMaximumValue
Diffstat (limited to 'source/blender/compositor/intern/COM_MemoryBuffer.cpp')
-rw-r--r--source/blender/compositor/intern/COM_MemoryBuffer.cpp24
1 files changed, 18 insertions, 6 deletions
diff --git a/source/blender/compositor/intern/COM_MemoryBuffer.cpp b/source/blender/compositor/intern/COM_MemoryBuffer.cpp
index f8c842d8e67..eae98a1211f 100644
--- a/source/blender/compositor/intern/COM_MemoryBuffer.cpp
+++ b/source/blender/compositor/intern/COM_MemoryBuffer.cpp
@@ -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;