提交 f8b14bdb 编写于 作者: M Michael Fabian Dirks 提交者: jp9000

libobs: Ensure scene items don't have pre-multiplied alpha

Scene items would incorrectly have pre-multiplied alpha when they were
scaled with different scale filtering, when they were cropped, or when
the item itself was a scene.  This happens because the scene renders the
items to a texture in those cases, and when they are rendered to a
texture the blend function would be the default srcalpha/invsrcalpha
blend function, which would cause alpha to become pre-multiplied in the
texture's result rather than straight alpha.

This changes the behavior to directly copy the color/alpha to the
texture using the one/zero blend function instead, which makes the
resulting texture straight alpha.  (Note that you do not want to turn
off the blend mode for the same result because certain sources can have
custom drawing that may rely on blending being available)

Related Issue: https://obsproject.com/mantis/view.php?id=954

Closes jp9000/obs-studio#966
上级 4fd66d4d
...@@ -486,7 +486,10 @@ static inline void render_item(struct obs_scene_item *item) ...@@ -486,7 +486,10 @@ static inline void render_item(struct obs_scene_item *item)
-(float)item->crop.top, -(float)item->crop.top,
0.0f); 0.0f);
gs_blend_state_push();
gs_blend_function(GS_BLEND_ONE, GS_BLEND_ZERO);
obs_source_video_render(item->source); obs_source_video_render(item->source);
gs_blend_state_pop();
gs_texrender_end(item->item_render); gs_texrender_end(item->item_render);
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册