summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-05-31 23:56:24 +0200
committerwm4 <wm4@nowhere>2014-06-01 23:50:09 +0200
commit4648a02281ff0860cb06e3f56df9095b8a114294 (patch)
tree71181322f82dd608ac08a1964f631bbb3c338e94
parentdc0a14e61a1c454d593db5a91de0819921a2ddc9 (diff)
downloadlibass-4648a02281ff0860cb06e3f56df9095b8a114294.tar.bz2
libass-4648a02281ff0860cb06e3f56df9095b8a114294.tar.xz
Add BorderStyle=4, background color for text
This is somewhat similar to BorderStyle=3, but with a number of differences. Mainly, this new BorderStyle doesn't create overlaps within an event. Closes #105.
-rw-r--r--libass/ass.h2
-rw-r--r--libass/ass_render.c20
2 files changed, 21 insertions, 1 deletions
diff --git a/libass/ass.h b/libass/ass.h
index 17af8cb..b797a97 100644
--- a/libass/ass.h
+++ b/libass/ass.h
@@ -23,7 +23,7 @@
#include <stdarg.h>
#include "ass_types.h"
-#define LIBASS_VERSION 0x01102000
+#define LIBASS_VERSION 0x01102001
/*
* A linked list of images produced by an ass renderer.
diff --git a/libass/ass_render.c b/libass/ass_render.c
index 8e590e8..c64100f 100644
--- a/libass/ass_render.c
+++ b/libass/ass_render.c
@@ -670,6 +670,8 @@ static ASS_Image *render_text(ASS_Renderer *render_priv, int dst_x, int dst_y)
CombinedBitmapInfo *info = &text_info->combined_bitmaps[i];
if (!info->bm_s || (info->shadow_x == 0 && info->shadow_y == 0))
continue;
+ if (render_priv->state.border_style == 4)
+ continue;
pen_x =
dst_x + info->pos.x +
@@ -2541,6 +2543,24 @@ ass_render_event(ASS_Renderer *render_priv, ASS_Event *event,
event_images->event = event;
event_images->imgs = render_text(render_priv, (int) device_x, (int) device_y);
+ if (render_priv->state.border_style == 4) {
+ void *nbuffer = ass_aligned_alloc(1, event_images->width * event_images->height);
+ if (nbuffer) {
+ free_list_add(render_priv, nbuffer);
+ memset(nbuffer, 0xFF, event_images->width * event_images->height);
+ ASS_Image *img = my_draw_bitmap(nbuffer, event_images->width,
+ event_images->height,
+ event_images->width,
+ event_images->left,
+ event_images->top,
+ render_priv->state.c[3]);
+ if (img) {
+ img->next = event_images->imgs;
+ event_images->imgs = img;
+ }
+ }
+ }
+
ass_shaper_cleanup(render_priv->shaper, text_info);
free_render_context(render_priv);