[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],
.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
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
return dst;
}
-#if CONFIG_RASTERIZER
-
Bitmap *outline_to_bitmap(ASS_Renderer *render_priv,
ASS_Outline *outline, int bord)
{
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
*
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;
const BitmapEngine DECORATE(bitmap_engine) = {
.align_order = ALIGN,
-#if CONFIG_RASTERIZER
#if CONFIG_LARGE_TILES
.tile_order = 5,
.fill_solid = DECORATE(fill_solid_tile32),
.fill_solid = DECORATE(fill_solid_tile16),
.fill_halfplane = DECORATE(fill_halfplane_tile16),
.fill_generic = DECORATE(fill_generic_tile16),
-#endif
#endif
.add_bitmaps = DECORATE(add_bitmaps),
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);
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();
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);
CacheStore cache;
const BitmapEngine *engine;
-#if CONFIG_RASTERIZER
RasterizerData rasterizer;
-#endif
ASS_Style user_override_style;
};