mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-11-17 06:48:33 +00:00
FS-7500 FS-7513: add and use switch_img_fill
This commit is contained in:
1 parent
c857be4547
commit
9d7eef28e6
3 files changed
+35
-13
No files matched your search
+22
-1
@@ -161,7 +161,7 @@ SWITCH_DECLARE(switch_image_t *) switch_img_copy_rect(switch_image_t *img, int x
|
||||
return new_img;
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(void) switch_image_draw_pixel(switch_image_t *img, int x, int y, switch_yuv_color_t color)
|
||||
SWITCH_DECLARE(void) switch_img_draw_pixel(switch_image_t *img, int x, int y, switch_yuv_color_t color)
|
||||
{
|
||||
if (x < 0 || y < 0 || x >= img->d_w || y >= img->d_h) return;
|
||||
|
||||
@@ -173,6 +173,27 @@ SWITCH_DECLARE(void) switch_image_draw_pixel(switch_image_t *img, int x, int y,
|
||||
}
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(void) switch_img_fill(switch_image_t *img, int x, int y, int w, int h, switch_yuv_color_t color)
|
||||
{
|
||||
int len, i;
|
||||
|
||||
if (x < 0 || y < 0 || x >= img->d_w || y >= img->d_h) return;
|
||||
|
||||
len = MIN(w, img->d_w - x);
|
||||
if (len <= 0) return;
|
||||
|
||||
for (i = y; i < (y + h) && i < img->d_h; i++) {
|
||||
memset(img->planes[SWITCH_PLANE_Y] + img->stride[SWITCH_PLANE_Y] * i + x, color.y, len);
|
||||
}
|
||||
|
||||
len /= 2;
|
||||
|
||||
for (i = y; i < (y + h) && i < img->d_h; i += 2) {
|
||||
memset(img->planes[SWITCH_PLANE_U] + img->stride[SWITCH_PLANE_U] * i / 2 + x / 2, color.u, len);
|
||||
memset(img->planes[SWITCH_PLANE_V] + img->stride[SWITCH_PLANE_V] * i / 2 + x / 2, color.v, len);
|
||||
}
|
||||
}
|
||||
|
||||
static uint8_t scv_art[14][16] = {
|
||||
{0x00, 0x7E, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x7E, 0x00},
|
||||
{0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00},
|
||||
|
||||
Reference in new issue
Block a user