~medibuntu-maintainers/mplayer/medibuntu.precise

« back to all changes in this revision

Viewing changes to libass/ass_drawing.c

  • Committer: Gauvain Pocentek
  • Date: 2012-03-06 11:59:12 UTC
  • mfrom: (66.1.15 precise)
  • Revision ID: gauvain@pocentek.net-20120306115912-h9d6kt9j0l532oo5
* Merge from Ubuntu:
  - put back faac support
  - recommends apport-hooks-medibuntu
  - change Maintainer, Uploaders & Vcs-* fields.
* New upstream snapshot
* upload to unstable
* Build against external libmpeg2
* drop 51_FTBFS_arm.patch again
* no longer build depend on libcdparanoia-dev on the Hurd
* Fix FTBFS on the hurd.
  Thanks to Samuel Thibault <sthibault@debian.org> (Closes: #654974)
* Fix FTBFS on arm
* New upstream snapshot, Closes: #650339, #643621, #481807
* Imported Upstream version 1.0~rc4+svn34492
* Bump standards version
* Bump dependency on libav >= 4:0.8~, Closes: #653887
* Fix build-indep
* Build mplayer-gui again, Closes: #568514
* Drop debian/all-lang-config-mak.sh, no longer needed
* include .dfsg1 in version number
* remove get-orig-source target
* no longer prune compiler flags from the environment
* No longer advertise nor build 3fdx, mga and dxr3 backends,
  Closes: #496106, #442181, #533546
* beautify mplayer version identification string
* Brown paperbag upload.
* Next try to fix build failure on sparce after recent binutils change.
* Brown paperbag upload.
* Really fix build failure on sparc after recent binutils change.
* Properly set Replaces/Conflicts on mplayer2{,-dbg} to avoid
  file overwrite errors.
* Adjust versioning of mplayer listed in the mplayer-dbg's Depends field.
* Fix build failure on sparc after recent binutils change.
* Urgency medium bumped because of RC-level bugfix
  and speeding up x264 transition.
* Update to my @debian.org email.
* Upload to unstable
* Enable joystick support on Linux only, Closes: #638408
* Rebuild fixes toolchain issue on arm, Closes: #637077
* New upstream snapshot
* following the discussion started by Diego Biurrun <diego@biurrun.de>
  in debian-devel, I have prepared a new packaging of 'mplayer'
  (with code that comes from CVS)
* the upstream tar.bz cannot be distributed by Debian, since it contains
   CSS code; so I am repackaging it 
* I have tried my best to address all known issues:
  - the package contains the detailed Copyright made by Diego Biurrun 
  - the package does not contain CSS code, or  AFAIK other code on which 
     there is active patent enforcement
  - there is a script  debian/cvs-changelog.sh  that shows all changes
     done to files included in this source.
    This should comply with GPLv2 sec 2.a  (in spirit if not in letter)
    For this reason, the source code contains CVS directories.
* needs   make (>= 3.80) for 'html-chunked-$(1)' in DOCS/xml/Makefile

* some corrections, as suggested Diego Biurrun
  - binary codecs should go into /usr/lib/codecs (upstream default)
  - better template 'mplayer/install_codecs'
  - an empty 'font=' in mplayer.conf breaks mplayer: postinst corrected
* correction in 'mplayer/cfgnote'
* better mplayer.postinst and mplayer.config

* New upstream release
* better debian/copyright file
* do not ship a skin
* New upstream release
* changed DEB_BUILD_OPTIONS to DEB_BUILD_CONFIGURE ,
  DEB_BUILD_OPTIONS is used as in debian policy
* use gcc-3.4
* changed xlibs-dev to a long list of dependencies, for Debian/etch
* try to adhere to  http://www.mplayerhq.hu/DOCS/tech/binary-packaging.txt
  (see README.Debian for details)
* removed dependency on xlibmesa-dev, disabled opengl
* New upstream release
* Simon McVittie <hacks@pseudorandom.co.uk> wonderful work:
- Work around Debian bug #267442 (glibc's sys/uio.h and gcc's altivec.h have
  conflicting uses for __vector) by re-ordering #includes
- Fix potential symlink attack in ./configure
- Disable support for binary codecs on platforms for which those codecs
  aren't available; also disable the corresponding Debconf note when it's
  inappropriate
- Changed Build-Depends: so it works in pbuilder
- Explicitly build-depend on libjpeg62-dev, libfontconfig1-dev,
  libungif4-dev 
- Tweak debian/rules to avoid certain errors being ignored
- Use --language=all
* provide a target  'debian/rules get-orig-source' 
  that recreates the orig.tar.gz ; then use the above orig.tar.gz
* rewrote some parts of debian/rules
* don't clean and recompile docs if upstream ships them
* mplayer-doc was shipping too much stuff
* translated man pages where not installed properly
* compile with libdv4-dev
* correct README.Debian
* Forgot build-dep on libtheora
* Must not depend on libxvidcore
* New upstream release
* new release.
* rc1 to become 0.90
* new pre-release
* new pre-release
* gtk bug fixed.
* new release.
* version bumped
* 0.60 pre2 release
* 0.60 pre-release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 */
18
18
 
19
19
#include <ft2build.h>
20
 
#include FT_GLYPH_H
21
20
#include FT_OUTLINE_H
22
21
#include FT_BBOX_H
23
22
#include <math.h>
24
23
 
25
24
#include "ass_utils.h"
26
 
#include "ass_font.h"
27
25
#include "ass_drawing.h"
28
26
 
29
27
#define CURVE_ACCURACY 64.0
31
29
#define GLYPH_INITIAL_CONTOURS 5
32
30
 
33
31
/*
34
 
 * \brief Get and prepare a FreeType glyph
35
 
 */
36
 
static void drawing_make_glyph(ASS_Drawing *drawing, void *fontconfig_priv,
37
 
                               ASS_Font *font)
38
 
{
39
 
    FT_OutlineGlyph glyph;
40
 
 
41
 
    // This is hacky...
42
 
    glyph = (FT_OutlineGlyph) ass_font_get_glyph(fontconfig_priv, font,
43
 
                                                 (uint32_t) ' ', 0, 0);
44
 
    if (glyph) {
45
 
        FT_Outline_Done(drawing->ftlibrary, &glyph->outline);
46
 
        FT_Outline_New(drawing->ftlibrary, GLYPH_INITIAL_POINTS,
47
 
                       GLYPH_INITIAL_CONTOURS, &glyph->outline);
48
 
 
49
 
        glyph->outline.n_contours = 0;
50
 
        glyph->outline.n_points = 0;
51
 
        glyph->root.advance.x = glyph->root.advance.y = 0;
52
 
    }
53
 
    drawing->glyph = glyph;
54
 
}
55
 
 
56
 
/*
57
32
 * \brief Add a single point to a contour.
58
33
 */
59
34
static inline void drawing_add_point(ASS_Drawing *drawing,
60
35
                                     FT_Vector *point)
61
36
{
62
 
    FT_Outline *ol = &drawing->glyph->outline;
 
37
    FT_Outline *ol = &drawing->outline;
63
38
 
64
39
    if (ol->n_points >= drawing->max_points) {
65
40
        drawing->max_points *= 2;
75
50
}
76
51
 
77
52
/*
78
 
 * \brief Close a contour and check glyph size overflow.
 
53
 * \brief Close a contour and check outline size overflow.
79
54
 */
80
55
static inline void drawing_close_shape(ASS_Drawing *drawing)
81
56
{
82
 
    FT_Outline *ol = &drawing->glyph->outline;
 
57
    FT_Outline *ol = &drawing->outline;
83
58
 
84
59
    if (ol->n_contours >= drawing->max_contours) {
85
60
        drawing->max_contours *= 2;
107
82
 
108
83
/*
109
84
 * \brief Finish a drawing.  This only sets the horizontal advance according
110
 
 * to the glyph's bbox at the moment.
 
85
 * to the outline's bbox at the moment.
111
86
 */
112
87
static void drawing_finish(ASS_Drawing *drawing, int raw_mode)
113
88
{
114
89
    int i, offset;
115
90
    FT_BBox bbox = drawing->cbox;
116
 
    FT_Outline *ol = &drawing->glyph->outline;
 
91
    FT_Outline *ol = &drawing->outline;
117
92
 
118
93
    // Close the last contour
119
94
    drawing_close_shape(drawing);
120
95
 
121
 
    ass_msg(drawing->library, MSGL_V,
122
 
            "Parsed drawing with %d points and %d contours", ol->n_points,
123
 
            ol->n_contours);
 
96
    if (drawing->library)
 
97
        ass_msg(drawing->library, MSGL_V,
 
98
                "Parsed drawing with %d points and %d contours", ol->n_points,
 
99
                ol->n_contours);
124
100
 
125
101
    if (raw_mode)
126
102
        return;
127
103
 
128
 
    drawing->glyph->root.advance.x = d6_to_d16(bbox.xMax - bbox.xMin);
 
104
    drawing->advance.x = bbox.xMax - bbox.xMin;
129
105
 
130
106
    drawing->desc = double_to_d6(-drawing->pbo * drawing->scale_y);
131
107
    drawing->asc = bbox.yMax - bbox.yMin + drawing->desc;
354
330
/*
355
331
 * \brief Create and initialize a new drawing and return it
356
332
 */
357
 
ASS_Drawing *ass_drawing_new(void *fontconfig_priv, ASS_Font *font,
358
 
                             FT_Library lib)
 
333
ASS_Drawing *ass_drawing_new(ASS_Library *lib, FT_Library ftlib)
359
334
{
360
335
    ASS_Drawing *drawing;
361
336
 
364
339
    drawing->size = DRAWING_INITIAL_SIZE;
365
340
    drawing->cbox.xMin = drawing->cbox.yMin = INT_MAX;
366
341
    drawing->cbox.xMax = drawing->cbox.yMax = INT_MIN;
367
 
    drawing->fontconfig_priv = fontconfig_priv;
368
 
    drawing->font = font;
369
 
    drawing->ftlibrary = lib;
370
 
    drawing->library = font ? font->library : NULL;
371
 
 
 
342
    drawing->ftlibrary = ftlib;
 
343
    drawing->library   = lib;
372
344
    drawing->scale_x = 1.;
373
345
    drawing->scale_y = 1.;
374
346
    drawing->max_contours = GLYPH_INITIAL_CONTOURS;
375
347
    drawing->max_points = GLYPH_INITIAL_POINTS;
376
348
 
 
349
    FT_Outline_New(drawing->ftlibrary, GLYPH_INITIAL_POINTS,
 
350
            GLYPH_INITIAL_CONTOURS, &drawing->outline);
 
351
    drawing->outline.n_contours = 0;
 
352
    drawing->outline.n_points = 0;
 
353
 
377
354
    return drawing;
378
355
}
379
356
 
384
361
{
385
362
    if (drawing) {
386
363
        free(drawing->text);
 
364
        FT_Outline_Done(drawing->ftlibrary, &drawing->outline);
387
365
    }
388
366
    free(drawing);
389
367
}
414
392
/*
415
393
 * \brief Convert token list to outline.  Calls the line and curve evaluators.
416
394
 */
417
 
FT_OutlineGlyph *ass_drawing_parse(ASS_Drawing *drawing, int raw_mode)
 
395
FT_Outline *ass_drawing_parse(ASS_Drawing *drawing, int raw_mode)
418
396
{
419
397
    int started = 0;
420
398
    ASS_DrawingToken *token;
421
399
    FT_Vector pen = {0, 0};
422
400
 
423
 
    if (drawing->font)
424
 
        drawing_make_glyph(drawing, drawing->fontconfig_priv, drawing->font);
425
 
    if (!drawing->glyph)
426
 
        return NULL;
427
 
 
428
401
    drawing->tokens = drawing_tokenize(drawing->text);
429
402
    drawing_prepare(drawing);
430
403
 
484
457
 
485
458
    drawing_finish(drawing, raw_mode);
486
459
    drawing_free_tokens(drawing->tokens);
487
 
    return &drawing->glyph;
 
460
    return &drawing->outline;
488
461
}