Compositor: Fix image and render layer always extending edges

It was no more possible to translate two images, put one on top of
another in order to do things like mapping VR views.
This commit is contained in:
Sergey Sharybin 2016-04-14 11:20:00 +02:00
parent 8ed746683a
commit 78c3a5d00f
2 changed files with 16 additions and 14 deletions

View File

@ -159,7 +159,11 @@ static void sampleImageAtLocation(ImBuf *ibuf, float x, float y, PixelSampler sa
void ImageOperation::executePixelSampled(float output[4], float x, float y, PixelSampler sampler)
{
if (this->m_imageFloatBuffer == NULL && this->m_imageByteBuffer == NULL) {
int ix = x, iy = y;
if (ix < 0 || iy < 0 || ix >= this->m_buffer->x || iy >= this->m_buffer->y) {
zero_v4(output);
}
else if (this->m_imageFloatBuffer == NULL && this->m_imageByteBuffer == NULL) {
zero_v4(output);
}
else {

View File

@ -77,21 +77,19 @@ void RenderLayersBaseProg::doInterpolation(float output[4], float x, float y, Pi
unsigned int offset;
int width = this->getWidth(), height = this->getHeight();
int ix = x, iy = y;
if (ix < 0 || iy < 0 || ix >= width || iy >= height) {
if (this->m_elementsize == 1)
output[0] = 0.0f;
else if (this->m_elementsize == 3)
zero_v3(output);
else
zero_v4(output);
return;
}
switch (sampler) {
case COM_PS_NEAREST: {
int ix = x;
int iy = y;
if (ix < 0 || iy < 0 || ix >= width || iy >= height) {
if (this->m_elementsize == 1)
output[0] = 0.0f;
else if (this->m_elementsize == 3)
zero_v3(output);
else
zero_v4(output);
break;
}
offset = (iy * width + ix) * this->m_elementsize;
if (this->m_elementsize == 1)