summaryrefslogtreecommitdiffstats
path: root/libass/ass_render.c
diff options
context:
space:
mode:
Diffstat (limited to 'libass/ass_render.c')
-rw-r--r--libass/ass_render.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/libass/ass_render.c b/libass/ass_render.c
index 4f3f20d..dedd2a7 100644
--- a/libass/ass_render.c
+++ b/libass/ass_render.c
@@ -2598,6 +2598,34 @@ static inline void rectangle_combine(ASS_Rect *rect, const Bitmap *bm, ASS_Vecto
rectangle_update(rect, pos.x, pos.y, pos.x + bm->w, pos.y + bm->h);
}
+/*
+ * To find these values, simulate blur on the border between two
+ * half-planes, one zero-filled (background) and the other filled
+ * with the maximum supported value (foreground). Keep incrementing
+ * the \be argument. The necessary padding is the distance by which
+ * the blurred foreground image extends beyond the original border
+ * and into the background. Initially it increases along with \be,
+ * but very soon it grinds to a halt. At some point, the blurred
+ * image actually reaches a stationary point and stays unchanged
+ * forever after, simply _shifting_ by one pixel for each \be
+ * step--moving in the direction of the non-zero half-plane and
+ * thus decreasing the necessary padding (although the large
+ * padding is still needed for intermediate results). In practice,
+ * images are finite rather than infinite like half-planes, but
+ * this can only decrease the required padding. Half-planes filled
+ * with extreme values are the theoretical limit of the worst case.
+ * Make sure to use the right pixel value range in the simulation!
+ */
+int be_padding(int be)
+{
+ if (be <= 3)
+ return be;
+ if (be <= 7)
+ return 4;
+ return 5;
+}
+
+
size_t ass_composite_construct(void *key, void *value, void *priv)
{
ASS_Renderer *render_priv = priv;