FS-10050: [core] chromakey Optimizations broke solid color mode
This commit is contained in:
parent
fbe05e2035
commit
c6ce9da470
|
@ -314,6 +314,8 @@ SWITCH_DECLARE(switch_image_t *) switch_img_copy_rect(switch_image_t *img, uint3
|
|||
*/
|
||||
SWITCH_DECLARE(void) switch_img_fill(switch_image_t *img, int x, int y, int w, int h, switch_rgb_color_t *color);
|
||||
|
||||
SWITCH_DECLARE(void) switch_img_fill_noalpha(switch_image_t *img, int x, int y, int w, int h, switch_rgb_color_t *color);
|
||||
|
||||
/*!\brief Set RGB color with a string
|
||||
*
|
||||
* Color string should be in #RRGGBB format
|
||||
|
|
|
@ -358,7 +358,7 @@ static switch_status_t video_thread_callback(switch_core_session_t *session, swi
|
|||
|
||||
|
||||
} else {
|
||||
switch_img_fill(frame->img, 0, 0, img->d_w, img->d_h, &context->bgcolor);
|
||||
switch_img_fill_noalpha(img, 0, 0, img->d_w, img->d_h, &context->bgcolor);
|
||||
}
|
||||
|
||||
if (context->imgfg) {
|
||||
|
|
|
@ -1362,6 +1362,33 @@ static inline void switch_img_draw_pixel(switch_image_t *img, int x, int y, swit
|
|||
#endif
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(void) switch_img_fill_noalpha(switch_image_t *img, int x, int y, int w, int h, switch_rgb_color_t *color)
|
||||
{
|
||||
#ifdef SWITCH_HAVE_YUV
|
||||
int i;
|
||||
|
||||
if (img->fmt == SWITCH_IMG_FMT_ARGB) {
|
||||
int max_w = img->d_w;
|
||||
int max_h = img->d_h;
|
||||
int j;
|
||||
switch_rgb_color_t *rgb;
|
||||
|
||||
for (i = 0; i < max_h; i++) {
|
||||
for (j = 0; j < max_w; j++) {
|
||||
rgb = (switch_rgb_color_t *)(img->planes[SWITCH_PLANE_PACKED] + i * img->stride[SWITCH_PLANE_PACKED] + j * 4);
|
||||
|
||||
if (rgb->a != 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
*rgb = *color;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(void) switch_img_fill(switch_image_t *img, int x, int y, int w, int h, switch_rgb_color_t *color)
|
||||
{
|
||||
#ifdef SWITCH_HAVE_YUV
|
||||
|
|
Loading…
Reference in New Issue