summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDr.Smile <vabnick@gmail.com>2017-04-13 22:53:40 +0300
committerDr.Smile <vabnick@gmail.com>2017-07-31 05:34:03 +0300
commitef6cc020bc00118a5b142b37fe401327a029a1fc (patch)
treea3396b31bc83792b363cca797e4f8485babe0cb1
parent305463c29a402298911f812b222f54a9f9457920 (diff)
downloadlibass-ef6cc020bc00118a5b142b37fe401327a029a1fc.tar.bz2
libass-ef6cc020bc00118a5b142b37fe401327a029a1fc.tar.xz
renderer: remove legacy FreeType rasterizer
-rw-r--r--configure.ac7
-rw-r--r--libass/Makefile.am29
-rw-r--r--libass/ass_bitmap.c105
-rw-r--r--libass/ass_bitmap.h2
-rw-r--r--libass/ass_func_template.h2
-rw-r--r--libass/ass_outline.h2
-rw-r--r--libass/ass_render.c4
-rw-r--r--libass/ass_render.h2
8 files changed, 10 insertions, 143 deletions
diff --git a/configure.ac b/configure.ac
index c4808de..9345111 100644
--- a/configure.ac
+++ b/configure.ac
@@ -124,13 +124,6 @@ AM_COND_IF([ASM],
[AC_DEFINE(CONFIG_ASM, 0, [ASM enabled])]
)
-AM_CONDITIONAL([RASTERIZER], [test x$enable_rasterizer != xno])
-
-AM_COND_IF([RASTERIZER],
- [AC_DEFINE(CONFIG_RASTERIZER, 1, [rasterizer enabled])],
- [AC_DEFINE(CONFIG_RASTERIZER, 0, [rasterizer enabled])]
- )
-
AM_CONDITIONAL([ENABLE_LARGE_TILES], [test x$enable_large_tiles = xyes])
AM_COND_IF([ENABLE_LARGE_TILES],
diff --git a/libass/Makefile.am b/libass/Makefile.am
index 3579310..e63e216 100644
--- a/libass/Makefile.am
+++ b/libass/Makefile.am
@@ -13,25 +13,23 @@ yasm_verbose_0 = @echo " YASM " $@;
.asm.lo:
$(yasm_verbose)$(LIBTOOL) $(AM_V_lt) --tag=CC --mode=compile $(AS) $(ASFLAGS) -o $@ $< -prefer-non-pic
-SRC_INTEL = x86/blend_bitmaps.asm x86/blur.asm x86/cpuid.asm x86/utils.asm \
+SRC_INTEL = x86/rasterizer.asm x86/blend_bitmaps.asm x86/blur.asm x86/cpuid.asm x86/utils.asm \
x86/cpuid.h
SRC_INTEL64 = x86/be_blur.asm
-SRC_INTEL_RASTERIZER = x86/rasterizer.asm
-
-SRC_RASTERIZER = ass_rasterizer.h ass_rasterizer.c ass_rasterizer_c.c
SRC_DIRECTWRITE = ass_directwrite.c ass_directwrite.h dwrite_c.h
SRC_CORETEXT = ass_coretext.c ass_coretext.h
lib_LTLIBRARIES = libass.la
-libass_la_SOURCES = ass.c ass_cache.c ass_font.c ass_fontselect.c ass_render.c \
- ass_utils.c ass_bitmap.c ass_outline.c ass_blur.c ass_library.c \
- ass_bitmap.h ass_outline.h ass_cache.h ass_fontselect.h ass_font.h ass.h \
- ass_library.h ass_types.h ass_utils.h ass_drawing.c \
- ass_drawing.h ass_cache_template.h ass_render.h \
- ass_parse.c ass_parse.h ass_render_api.c ass_shaper.c \
- ass_shaper.h ass_strtod.c ass_fontconfig.c ass_fontconfig.h \
- ass_string.h ass_string.c ass_compat.h ass_func_template.h
+libass_la_SOURCES = ass.h ass.c ass_types.h ass_utils.h ass_utils.c \
+ ass_compat.h ass_string.h ass_string.c ass_strtod.c \
+ ass_library.h ass_library.c ass_cache.h ass_cache.c ass_cache_template.h \
+ ass_font.h ass_font.c ass_fontselect.h ass_fontselect.c ass_fontconfig.h ass_fontconfig.c \
+ ass_render.h ass_render.c ass_render_api.c \
+ ass_parse.h ass_parse.c ass_shaper.h ass_shaper.c \
+ ass_outline.h ass_outline.c ass_drawing.h ass_drawing.c \
+ ass_rasterizer.h ass_rasterizer.c ass_rasterizer_c.c \
+ ass_bitmap.h ass_bitmap.c ass_blur.c ass_func_template.h
libass_la_LDFLAGS = -no-undefined -version-info $(LIBASS_LT_CURRENT):$(LIBASS_LT_REVISION):$(LIBASS_LT_AGE)
libass_la_LDFLAGS += -export-symbols $(srcdir)/libass.sym
@@ -44,16 +42,9 @@ if CORETEXT
libass_la_SOURCES += $(SRC_CORETEXT)
endif
-if RASTERIZER
-libass_la_SOURCES += $(SRC_RASTERIZER)
-endif
-
if ASM
if INTEL
libass_la_SOURCES += $(SRC_INTEL)
-if RASTERIZER
-libass_la_SOURCES += $(SRC_INTEL_RASTERIZER)
-endif
if X64
libass_la_SOURCES += $(SRC_INTEL64)
endif
diff --git a/libass/ass_bitmap.c b/libass/ass_bitmap.c
index 8e3c3b7..80e041b 100644
--- a/libass/ass_bitmap.c
+++ b/libass/ass_bitmap.c
@@ -186,8 +186,6 @@ Bitmap *copy_bitmap(const BitmapEngine *engine, const Bitmap *src)
return dst;
}
-#if CONFIG_RASTERIZER
-
Bitmap *outline_to_bitmap(ASS_Renderer *render_priv,
ASS_Outline *outline, int bord)
{
@@ -246,109 +244,6 @@ Bitmap *outline_to_bitmap(ASS_Renderer *render_priv,
return bm;
}
-#else
-
-static Bitmap *outline_to_bitmap_ft(ASS_Renderer *render_priv,
- FT_Outline *outline, int bord)
-{
- Bitmap *bm;
- int w, h;
- int error;
- FT_BBox bbox;
- FT_Bitmap bitmap;
-
- FT_Outline_Get_CBox(outline, &bbox);
- if (bbox.xMin >= bbox.xMax || bbox.yMin >= bbox.yMax) {
- bm = alloc_bitmap(render_priv->engine, 2 * bord, 2 * bord, true);
- if (!bm)
- return NULL;
- bm->left = bm->top = -bord;
- return bm;
- }
-
- // move glyph to origin (0, 0)
- bbox.xMin &= ~63;
- bbox.yMin &= ~63;
- FT_Outline_Translate(outline, -bbox.xMin, -bbox.yMin);
- if (bbox.xMax > INT_MAX - 63 || bbox.yMax > INT_MAX - 63)
- return NULL;
- // bitmap size
- bbox.xMax = (bbox.xMax + 63) & ~63;
- bbox.yMax = (bbox.yMax + 63) & ~63;
- w = (bbox.xMax - bbox.xMin) >> 6;
- h = (bbox.yMax - bbox.yMin) >> 6;
- // pen offset
- bbox.xMin >>= 6;
- bbox.yMax >>= 6;
-
- if (w < 0 || h < 0 ||
- w > INT_MAX - 2 * bord || h > INT_MAX - 2 * bord) {
- ass_msg(render_priv->library, MSGL_WARN, "Glyph bounding box too large: %dx%dpx",
- w, h);
- return NULL;
- }
-
- // allocate and set up bitmap
- bm = alloc_bitmap(render_priv->engine, w + 2 * bord, h + 2 * bord, true);
- if (!bm)
- return NULL;
- bm->left = bbox.xMin - bord;
- bm->top = -bbox.yMax - bord;
- bitmap.width = w;
- bitmap.rows = h;
- bitmap.pitch = bm->stride;
- bitmap.buffer = bm->buffer + bord + bm->stride * bord;
- bitmap.num_grays = 256;
- bitmap.pixel_mode = FT_PIXEL_MODE_GRAY;
-
- // render into target bitmap
- if ((error = FT_Outline_Get_Bitmap(render_priv->ftlibrary, outline, &bitmap))) {
- ass_msg(render_priv->library, MSGL_WARN, "Failed to rasterize glyph: %d\n", error);
- ass_free_bitmap(bm);
- return NULL;
- }
-
- return bm;
-}
-
-Bitmap *outline_to_bitmap(ASS_Renderer *render_priv,
- ASS_Outline *outline, int bord)
-{
- size_t n_points = outline->n_points;
- if (n_points > SHRT_MAX) {
- ass_msg(render_priv->library, MSGL_WARN, "Too many outline points: %d",
- outline->n_points);
- n_points = SHRT_MAX;
- }
-
- size_t n_contours = FFMIN(outline->n_contours, SHRT_MAX);
- short contours_small[EFFICIENT_CONTOUR_COUNT];
- short *contours = contours_small;
- short *contours_large = NULL;
- if (n_contours > EFFICIENT_CONTOUR_COUNT) {
- contours_large = malloc(n_contours * sizeof(short));
- if (!contours_large)
- return NULL;
- contours = contours_large;
- }
- for (size_t i = 0; i < n_contours; ++i)
- contours[i] = FFMIN(outline->contours[i], n_points - 1);
-
- FT_Outline ftol;
- ftol.n_points = n_points;
- ftol.n_contours = n_contours;
- ftol.points = outline->points;
- ftol.tags = outline->tags;
- ftol.contours = contours;
- ftol.flags = 0;
-
- Bitmap *bm = outline_to_bitmap_ft(render_priv, &ftol, bord);
- free(contours_large);
- return bm;
-}
-
-#endif
-
/**
* \brief fix outline bitmap
*
diff --git a/libass/ass_bitmap.h b/libass/ass_bitmap.h
index eb58f94..3323cda 100644
--- a/libass/ass_bitmap.h
+++ b/libass/ass_bitmap.h
@@ -62,12 +62,10 @@ typedef struct {
int align_order; // log2(alignment)
// rasterizer functions
-#if CONFIG_RASTERIZER
int tile_order; // log2(tile_size)
FillSolidTileFunc fill_solid;
FillHalfplaneTileFunc fill_halfplane;
FillGenericTileFunc fill_generic;
-#endif
// blend functions
BitmapBlendFunc add_bitmaps, sub_bitmaps;
diff --git a/libass/ass_func_template.h b/libass/ass_func_template.h
index 3fea779..381d3fb 100644
--- a/libass/ass_func_template.h
+++ b/libass/ass_func_template.h
@@ -92,7 +92,6 @@ void DECORATE(blur1246_vert)(int16_t *dst, const int16_t *src,
const BitmapEngine DECORATE(bitmap_engine) = {
.align_order = ALIGN,
-#if CONFIG_RASTERIZER
#if CONFIG_LARGE_TILES
.tile_order = 5,
.fill_solid = DECORATE(fill_solid_tile32),
@@ -104,7 +103,6 @@ const BitmapEngine DECORATE(bitmap_engine) = {
.fill_halfplane = DECORATE(fill_halfplane_tile16),
.fill_generic = DECORATE(fill_generic_tile16),
#endif
-#endif
.add_bitmaps = DECORATE(add_bitmaps),
#ifdef __x86_64__
diff --git a/libass/ass_outline.h b/libass/ass_outline.h
index 86c6b3e..9f38020 100644
--- a/libass/ass_outline.h
+++ b/libass/ass_outline.h
@@ -32,8 +32,6 @@ typedef struct ass_outline {
char *tags;
} ASS_Outline;
-#define EFFICIENT_CONTOUR_COUNT 8
-
bool outline_alloc(ASS_Outline *outline, size_t n_points, size_t n_contours);
ASS_Outline *outline_create(size_t n_points, size_t n_contours);
ASS_Outline *outline_convert(const FT_Outline *source);
diff --git a/libass/ass_render.c b/libass/ass_render.c
index 4379c09..88e1a7d 100644
--- a/libass/ass_render.c
+++ b/libass/ass_render.c
@@ -75,12 +75,10 @@ ASS_Renderer *ass_renderer_init(ASS_Library *library)
priv->engine = &ass_bitmap_engine_c;
#endif
-#if CONFIG_RASTERIZER
if (!rasterizer_init(&priv->rasterizer, priv->engine->tile_order, 16)) {
FT_Done_FreeType(ft);
goto ass_init_exit;
}
-#endif
priv->cache.font_cache = ass_font_cache_create();
priv->cache.bitmap_cache = ass_bitmap_cache_create();
@@ -129,9 +127,7 @@ void ass_renderer_done(ASS_Renderer *render_priv)
ass_shaper_free(render_priv->shaper);
ass_cache_done(render_priv->cache.font_cache);
-#if CONFIG_RASTERIZER
rasterizer_done(&render_priv->rasterizer);
-#endif
if (render_priv->fontselect)
ass_fontselect_free(render_priv->fontselect);
diff --git a/libass/ass_render.h b/libass/ass_render.h
index e8004e9..e858813 100644
--- a/libass/ass_render.h
+++ b/libass/ass_render.h
@@ -324,9 +324,7 @@ struct ass_renderer {
CacheStore cache;
const BitmapEngine *engine;
-#if CONFIG_RASTERIZER
RasterizerData rasterizer;
-#endif
ASS_Style user_override_style;
};