diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-02-10 17:14:51 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-02-10 17:14:51 +0400 |
commit | 9a6c5d8b3ef2e2ddd444d79c384bea0eeffca71f (patch) | |
tree | 40f1cdd7932e541e987f1d23001ac5db05ebc6e2 /source/blender/compositor/operations | |
parent | 75cbb07507fa39a1c65296321839cdfd245cc8d6 (diff) |
We've reconsidered previous patch in IRC.
It's more useful to completely ignore alpha for display of straight
colors.
Supporting straight pipeline is possible, but not a topic for bcon4.
Diffstat (limited to 'source/blender/compositor/operations')
5 files changed, 22 insertions, 18 deletions
diff --git a/source/blender/compositor/operations/COM_CompositorOperation.cpp b/source/blender/compositor/operations/COM_CompositorOperation.cpp index 7cb3a614022..43f491ad2d9 100644 --- a/source/blender/compositor/operations/COM_CompositorOperation.cpp +++ b/source/blender/compositor/operations/COM_CompositorOperation.cpp @@ -49,7 +49,7 @@ CompositorOperation::CompositorOperation() : NodeOperation() this->m_alphaInput = NULL; this->m_depthInput = NULL; - this->m_straightAlpha = false; + this->m_ignoreAlpha = false; this->m_sceneName[0] = '\0'; } @@ -140,12 +140,14 @@ void CompositorOperation::executeRegion(rcti *rect, unsigned int tileNumber) for (y = y1; y < y2 && (!breaked); y++) { for (x = x1; x < x2 && (!breaked); x++) { this->m_imageInput->read(color, x, y, COM_PS_NEAREST); - if (this->m_alphaInput != NULL) { - this->m_alphaInput->read(&(color[3]), x, y, COM_PS_NEAREST); + if (this->m_ignoreAlpha) { + color[3] = 1.0f; + } + else { + if (this->m_alphaInput != NULL) { + this->m_alphaInput->read(&(color[3]), x, y, COM_PS_NEAREST); + } } - - if (this->m_straightAlpha) - straight_to_premul_v4(color); copy_v4_v4(buffer + offset4, color); diff --git a/source/blender/compositor/operations/COM_CompositorOperation.h b/source/blender/compositor/operations/COM_CompositorOperation.h index e60862be410..27d29664610 100644 --- a/source/blender/compositor/operations/COM_CompositorOperation.h +++ b/source/blender/compositor/operations/COM_CompositorOperation.h @@ -66,8 +66,8 @@ private: */ SocketReader *m_depthInput; - /* node input has got straight alpha which shall be premultiplied */ - bool m_straightAlpha; + /* Ignore any alpha input */ + bool m_ignoreAlpha; public: CompositorOperation(); @@ -79,6 +79,6 @@ public: void deinitExecution(); const CompositorPriority getRenderPriority() const { return COM_PRIORITY_MEDIUM; } void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]); - void setStraightAlpha(bool value) { this->m_straightAlpha = value; } + void setIgnoreAlpha(bool value) { this->m_ignoreAlpha = value; } }; #endif diff --git a/source/blender/compositor/operations/COM_ViewerBaseOperation.cpp b/source/blender/compositor/operations/COM_ViewerBaseOperation.cpp index 87d7a810d80..072246932db 100644 --- a/source/blender/compositor/operations/COM_ViewerBaseOperation.cpp +++ b/source/blender/compositor/operations/COM_ViewerBaseOperation.cpp @@ -48,7 +48,7 @@ ViewerBaseOperation::ViewerBaseOperation() : NodeOperation() this->m_doDepthBuffer = false; this->m_viewSettings = NULL; this->m_displaySettings = NULL; - this->m_straightAlpha = false; + this->m_ignoreAlpha = false; } void ViewerBaseOperation::initExecution() diff --git a/source/blender/compositor/operations/COM_ViewerBaseOperation.h b/source/blender/compositor/operations/COM_ViewerBaseOperation.h index 1f773c5151a..9f7e80ad6fc 100644 --- a/source/blender/compositor/operations/COM_ViewerBaseOperation.h +++ b/source/blender/compositor/operations/COM_ViewerBaseOperation.h @@ -39,7 +39,7 @@ protected: OrderOfChunks m_chunkOrder; bool m_doDepthBuffer; ImBuf *m_ibuf; - bool m_straightAlpha; + bool m_ignoreAlpha; const ColorManagedViewSettings *m_viewSettings; const ColorManagedDisplaySettings *m_displaySettings; @@ -60,7 +60,7 @@ public: OrderOfChunks getChunkOrder() { return this->m_chunkOrder; } const CompositorPriority getRenderPriority() const; bool isViewerOperation() { return true; } - void setStraightAlpha(bool value) { this->m_straightAlpha = value; } + void setIgnoreAlpha(bool value) { this->m_ignoreAlpha = value; } void setViewSettings(const ColorManagedViewSettings *viewSettings) { this->m_viewSettings = viewSettings; } void setDisplaySettings(const ColorManagedDisplaySettings *displaySettings) { this->m_displaySettings = displaySettings; } diff --git a/source/blender/compositor/operations/COM_ViewerOperation.cpp b/source/blender/compositor/operations/COM_ViewerOperation.cpp index f1ac893bd3f..4d10e49aeeb 100644 --- a/source/blender/compositor/operations/COM_ViewerOperation.cpp +++ b/source/blender/compositor/operations/COM_ViewerOperation.cpp @@ -89,18 +89,20 @@ void ViewerOperation::executeRegion(rcti *rect, unsigned int tileNumber) for (y = y1; y < y2 && (!breaked); y++) { for (x = x1; x < x2; x++) { this->m_imageInput->read(&(buffer[offset4]), x, y, COM_PS_NEAREST); - if (this->m_alphaInput != NULL) { - this->m_alphaInput->read(alpha, x, y, COM_PS_NEAREST); - buffer[offset4 + 3] = alpha[0]; + if (this->m_ignoreAlpha) { + buffer[offset4 + 3] = 1.0f; + } + else { + if (this->m_alphaInput != NULL) { + this->m_alphaInput->read(alpha, x, y, COM_PS_NEAREST); + buffer[offset4 + 3] = alpha[0]; + } } if (m_depthInput) { this->m_depthInput->read(depth, x, y, COM_PS_NEAREST); depthbuffer[offset] = depth[0]; } - if (this->m_straightAlpha) - straight_to_premul_v4(buffer + offset4); - offset ++; offset4 += 4; } |