annotate libass/ass_bitmap.c @ 36417:9e68e53481e4

Display messages that can be confusing only with -v. The VO initialization line will still say which format was chosen, including what kind of hardware acceleration.
author reimar
date Sat, 16 Nov 2013 08:10:04 +0000
parents c3aaaf17c721
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
20008
fa122b7c71c6 Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents: 19966
diff changeset
1 /*
26723
0f892cd714b2 Use standard license header.
diego
parents: 26035
diff changeset
2 * Copyright (C) 2006 Evgeniy Stepanov <eugeni.stepanov@gmail.com>
34295
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
3 * Copyright (C) 2011 Grigori Goronzy <greg@chown.ath.cx>
26723
0f892cd714b2 Use standard license header.
diego
parents: 26035
diff changeset
4 *
26738
588ce97b44f2 Speak of libass instead of MPlayer in the libass license headers.
diego
parents: 26723
diff changeset
5 * This file is part of libass.
26723
0f892cd714b2 Use standard license header.
diego
parents: 26035
diff changeset
6 *
34011
88eebbbbd6a0 Update included libass copy to 0.9.13 release.
reimar
parents: 31875
diff changeset
7 * Permission to use, copy, modify, and distribute this software for any
88eebbbbd6a0 Update included libass copy to 0.9.13 release.
reimar
parents: 31875
diff changeset
8 * purpose with or without fee is hereby granted, provided that the above
88eebbbbd6a0 Update included libass copy to 0.9.13 release.
reimar
parents: 31875
diff changeset
9 * copyright notice and this permission notice appear in all copies.
26723
0f892cd714b2 Use standard license header.
diego
parents: 26035
diff changeset
10 *
34011
88eebbbbd6a0 Update included libass copy to 0.9.13 release.
reimar
parents: 31875
diff changeset
11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
88eebbbbd6a0 Update included libass copy to 0.9.13 release.
reimar
parents: 31875
diff changeset
12 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
88eebbbbd6a0 Update included libass copy to 0.9.13 release.
reimar
parents: 31875
diff changeset
13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
88eebbbbd6a0 Update included libass copy to 0.9.13 release.
reimar
parents: 31875
diff changeset
14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
88eebbbbd6a0 Update included libass copy to 0.9.13 release.
reimar
parents: 31875
diff changeset
15 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
88eebbbbd6a0 Update included libass copy to 0.9.13 release.
reimar
parents: 31875
diff changeset
16 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
88eebbbbd6a0 Update included libass copy to 0.9.13 release.
reimar
parents: 31875
diff changeset
17 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
26723
0f892cd714b2 Use standard license header.
diego
parents: 26035
diff changeset
18 */
20008
fa122b7c71c6 Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents: 19966
diff changeset
19
19846
bcc792bfa431 Store bitmap glyphs in a separate struct, instead of FreeType's internal buffer.
eugeni
parents:
diff changeset
20 #include <stdlib.h>
bcc792bfa431 Store bitmap glyphs in a separate struct, instead of FreeType's internal buffer.
eugeni
parents:
diff changeset
21 #include <string.h>
bcc792bfa431 Store bitmap glyphs in a separate struct, instead of FreeType's internal buffer.
eugeni
parents:
diff changeset
22 #include <math.h>
bcc792bfa431 Store bitmap glyphs in a separate struct, instead of FreeType's internal buffer.
eugeni
parents:
diff changeset
23 #include <assert.h>
bcc792bfa431 Store bitmap glyphs in a separate struct, instead of FreeType's internal buffer.
eugeni
parents:
diff changeset
24 #include <ft2build.h>
bcc792bfa431 Store bitmap glyphs in a separate struct, instead of FreeType's internal buffer.
eugeni
parents:
diff changeset
25 #include FT_GLYPH_H
34295
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
26 #include FT_OUTLINE_H
19846
bcc792bfa431 Store bitmap glyphs in a separate struct, instead of FreeType's internal buffer.
eugeni
parents:
diff changeset
27
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
28 #include "ass_utils.h"
19846
bcc792bfa431 Store bitmap glyphs in a separate struct, instead of FreeType's internal buffer.
eugeni
parents:
diff changeset
29 #include "ass_bitmap.h"
bcc792bfa431 Store bitmap glyphs in a separate struct, instead of FreeType's internal buffer.
eugeni
parents:
diff changeset
30
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
31 struct ass_synth_priv {
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
32 int tmp_w, tmp_h;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
33 unsigned short *tmp;
19848
07be98a5dd5f Add \be (blur edges) support to libass.
eugeni
parents: 19846
diff changeset
34
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
35 int g_r;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
36 int g_w;
19848
07be98a5dd5f Add \be (blur edges) support to libass.
eugeni
parents: 19846
diff changeset
37
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
38 unsigned *g;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
39 unsigned *gt2;
28436
12e936031c36 Allow \be with arguments other than 0 or 1. Implement \blur.
eugeni
parents: 27409
diff changeset
40
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
41 double radius;
19848
07be98a5dd5f Add \be (blur edges) support to libass.
eugeni
parents: 19846
diff changeset
42 };
07be98a5dd5f Add \be (blur edges) support to libass.
eugeni
parents: 19846
diff changeset
43
07be98a5dd5f Add \be (blur edges) support to libass.
eugeni
parents: 19846
diff changeset
44 static const unsigned int maxcolor = 255;
07be98a5dd5f Add \be (blur edges) support to libass.
eugeni
parents: 19846
diff changeset
45 static const unsigned base = 256;
07be98a5dd5f Add \be (blur edges) support to libass.
eugeni
parents: 19846
diff changeset
46
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
47 static int generate_tables(ASS_SynthPriv *priv, double radius)
19848
07be98a5dd5f Add \be (blur edges) support to libass.
eugeni
parents: 19846
diff changeset
48 {
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
49 double A = log(1.0 / base) / (radius * radius * 2);
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
50 int mx, i;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
51 double volume_diff, volume_factor = 0;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
52 unsigned volume;
19848
07be98a5dd5f Add \be (blur edges) support to libass.
eugeni
parents: 19846
diff changeset
53
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
54 if (priv->radius == radius)
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
55 return 0;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
56 else
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
57 priv->radius = radius;
28436
12e936031c36 Allow \be with arguments other than 0 or 1. Implement \blur.
eugeni
parents: 27409
diff changeset
58
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
59 priv->g_r = ceil(radius);
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
60 priv->g_w = 2 * priv->g_r + 1;
19955
2792de2ca069 Cosmetics. Change indentation of block of code to make it consistent with
eugeni
parents: 19941
diff changeset
61
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
62 if (priv->g_r) {
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
63 priv->g = realloc(priv->g, priv->g_w * sizeof(unsigned));
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
64 priv->gt2 = realloc(priv->gt2, 256 * priv->g_w * sizeof(unsigned));
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
65 if (priv->g == NULL || priv->gt2 == NULL) {
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
66 return -1;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
67 }
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
68 }
19848
07be98a5dd5f Add \be (blur edges) support to libass.
eugeni
parents: 19846
diff changeset
69
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
70 if (priv->g_r) {
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
71 // gaussian curve with volume = 256
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
72 for (volume_diff = 10000000; volume_diff > 0.0000001;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
73 volume_diff *= 0.5) {
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
74 volume_factor += volume_diff;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
75 volume = 0;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
76 for (i = 0; i < priv->g_w; ++i) {
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
77 priv->g[i] =
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
78 (unsigned) (exp(A * (i - priv->g_r) * (i - priv->g_r)) *
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
79 volume_factor + .5);
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
80 volume += priv->g[i];
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
81 }
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
82 if (volume > 256)
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
83 volume_factor -= volume_diff;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
84 }
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
85 volume = 0;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
86 for (i = 0; i < priv->g_w; ++i) {
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
87 priv->g[i] =
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
88 (unsigned) (exp(A * (i - priv->g_r) * (i - priv->g_r)) *
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
89 volume_factor + .5);
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
90 volume += priv->g[i];
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
91 }
19955
2792de2ca069 Cosmetics. Change indentation of block of code to make it consistent with
eugeni
parents: 19941
diff changeset
92
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
93 // gauss table:
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
94 for (mx = 0; mx < priv->g_w; mx++) {
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
95 for (i = 0; i < 256; i++) {
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
96 priv->gt2[mx + i * priv->g_w] = i * priv->g[mx];
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
97 }
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
98 }
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
99 }
19955
2792de2ca069 Cosmetics. Change indentation of block of code to make it consistent with
eugeni
parents: 19941
diff changeset
100
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
101 return 0;
19848
07be98a5dd5f Add \be (blur edges) support to libass.
eugeni
parents: 19846
diff changeset
102 }
07be98a5dd5f Add \be (blur edges) support to libass.
eugeni
parents: 19846
diff changeset
103
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
104 static void resize_tmp(ASS_SynthPriv *priv, int w, int h)
19848
07be98a5dd5f Add \be (blur edges) support to libass.
eugeni
parents: 19846
diff changeset
105 {
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
106 if (priv->tmp_w >= w && priv->tmp_h >= h)
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
107 return;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
108 if (priv->tmp_w == 0)
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
109 priv->tmp_w = 64;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
110 if (priv->tmp_h == 0)
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
111 priv->tmp_h = 64;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
112 while (priv->tmp_w < w)
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
113 priv->tmp_w *= 2;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
114 while (priv->tmp_h < h)
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
115 priv->tmp_h *= 2;
31875
ac6e48baa03d Import libass 0.9.11
greg
parents: 31853
diff changeset
116 free(priv->tmp);
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
117 priv->tmp = malloc((priv->tmp_w + 1) * priv->tmp_h * sizeof(short));
19848
07be98a5dd5f Add \be (blur edges) support to libass.
eugeni
parents: 19846
diff changeset
118 }
07be98a5dd5f Add \be (blur edges) support to libass.
eugeni
parents: 19846
diff changeset
119
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
120 ASS_SynthPriv *ass_synth_init(double radius)
19848
07be98a5dd5f Add \be (blur edges) support to libass.
eugeni
parents: 19846
diff changeset
121 {
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
122 ASS_SynthPriv *priv = calloc(1, sizeof(ASS_SynthPriv));
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
123 generate_tables(priv, radius);
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
124 return priv;
19848
07be98a5dd5f Add \be (blur edges) support to libass.
eugeni
parents: 19846
diff changeset
125 }
07be98a5dd5f Add \be (blur edges) support to libass.
eugeni
parents: 19846
diff changeset
126
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
127 void ass_synth_done(ASS_SynthPriv *priv)
19848
07be98a5dd5f Add \be (blur edges) support to libass.
eugeni
parents: 19846
diff changeset
128 {
31875
ac6e48baa03d Import libass 0.9.11
greg
parents: 31853
diff changeset
129 free(priv->tmp);
ac6e48baa03d Import libass 0.9.11
greg
parents: 31853
diff changeset
130 free(priv->g);
ac6e48baa03d Import libass 0.9.11
greg
parents: 31853
diff changeset
131 free(priv->gt2);
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
132 free(priv);
19848
07be98a5dd5f Add \be (blur edges) support to libass.
eugeni
parents: 19846
diff changeset
133 }
07be98a5dd5f Add \be (blur edges) support to libass.
eugeni
parents: 19846
diff changeset
134
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
135 static Bitmap *alloc_bitmap(int w, int h)
19846
bcc792bfa431 Store bitmap glyphs in a separate struct, instead of FreeType's internal buffer.
eugeni
parents:
diff changeset
136 {
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
137 Bitmap *bm;
34295
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
138 unsigned s = w; // XXX: alignment
31853
e64df5862cea Import libass 0.9.10
greg
parents: 30200
diff changeset
139 bm = malloc(sizeof(Bitmap));
34295
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
140 bm->buffer = calloc(s, h);
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
141 bm->w = w;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
142 bm->h = h;
34295
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
143 bm->stride = s;
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
144 bm->left = bm->top = 0;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
145 return bm;
19846
bcc792bfa431 Store bitmap glyphs in a separate struct, instead of FreeType's internal buffer.
eugeni
parents:
diff changeset
146 }
bcc792bfa431 Store bitmap glyphs in a separate struct, instead of FreeType's internal buffer.
eugeni
parents:
diff changeset
147
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
148 void ass_free_bitmap(Bitmap *bm)
19846
bcc792bfa431 Store bitmap glyphs in a separate struct, instead of FreeType's internal buffer.
eugeni
parents:
diff changeset
149 {
31875
ac6e48baa03d Import libass 0.9.11
greg
parents: 31853
diff changeset
150 if (bm)
ac6e48baa03d Import libass 0.9.11
greg
parents: 31853
diff changeset
151 free(bm->buffer);
ac6e48baa03d Import libass 0.9.11
greg
parents: 31853
diff changeset
152 free(bm);
19846
bcc792bfa431 Store bitmap glyphs in a separate struct, instead of FreeType's internal buffer.
eugeni
parents:
diff changeset
153 }
bcc792bfa431 Store bitmap glyphs in a separate struct, instead of FreeType's internal buffer.
eugeni
parents:
diff changeset
154
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
155 static Bitmap *copy_bitmap(const Bitmap *src)
19965
70352570e9ae Shadow support in libass.
eugeni
parents: 19962
diff changeset
156 {
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
157 Bitmap *dst = alloc_bitmap(src->w, src->h);
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
158 dst->left = src->left;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
159 dst->top = src->top;
34295
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
160 memcpy(dst->buffer, src->buffer, src->stride * src->h);
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
161 return dst;
19965
70352570e9ae Shadow support in libass.
eugeni
parents: 19962
diff changeset
162 }
70352570e9ae Shadow support in libass.
eugeni
parents: 19962
diff changeset
163
34295
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
164 Bitmap *outline_to_bitmap(ASS_Library *library, FT_Library ftlib,
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
165 FT_Outline *outline, int bord)
26035
501ea0b13962 Check glyph bounding box before rasterizing and complain if it is too large.
eugeni
parents: 22886
diff changeset
166 {
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
167 Bitmap *bm;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
168 int w, h;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
169 int error;
34295
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
170 FT_BBox bbox;
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
171 FT_Bitmap bitmap;
19846
bcc792bfa431 Store bitmap glyphs in a separate struct, instead of FreeType's internal buffer.
eugeni
parents:
diff changeset
172
34295
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
173 FT_Outline_Get_CBox(outline, &bbox);
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
174 // move glyph to origin (0, 0)
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
175 bbox.xMin &= ~63;
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
176 bbox.yMin &= ~63;
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
177 FT_Outline_Translate(outline, -bbox.xMin, -bbox.yMin);
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
178 // bitmap size
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
179 bbox.xMax = (bbox.xMax + 63) & ~63;
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
180 bbox.yMax = (bbox.yMax + 63) & ~63;
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
181 w = (bbox.xMax - bbox.xMin) >> 6;
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
182 h = (bbox.yMax - bbox.yMin) >> 6;
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
183 // pen offset
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
184 bbox.xMin >>= 6;
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
185 bbox.yMax >>= 6;
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
186
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
187 if (w * h > 8000000) {
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
188 ass_msg(library, MSGL_WARN, "Glyph bounding box too large: %dx%dpx",
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
189 w, h);
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
190 return NULL;
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
191 }
19846
bcc792bfa431 Store bitmap glyphs in a separate struct, instead of FreeType's internal buffer.
eugeni
parents:
diff changeset
192
34295
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
193 // allocate and set up bitmap
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
194 bm = alloc_bitmap(w + 2 * bord, h + 2 * bord);
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
195 bm->left = bbox.xMin - bord;
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
196 bm->top = -bbox.yMax - bord;
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
197 bitmap.width = w;
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
198 bitmap.rows = h;
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
199 bitmap.pitch = bm->stride;
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
200 bitmap.buffer = bm->buffer + bord + bm->stride * bord;
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
201 bitmap.num_grays = 256;
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
202 bitmap.pixel_mode = FT_PIXEL_MODE_GRAY;
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
203
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
204 // render into target bitmap
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
205 if ((error = FT_Outline_Get_Bitmap(ftlib, outline, &bitmap))) {
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
206 ass_msg(library, MSGL_WARN, "Failed to rasterize glyph: %d\n", error);
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
207 ass_free_bitmap(bm);
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
208 return NULL;
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
209 }
19846
bcc792bfa431 Store bitmap glyphs in a separate struct, instead of FreeType's internal buffer.
eugeni
parents:
diff changeset
210
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
211 return bm;
19846
bcc792bfa431 Store bitmap glyphs in a separate struct, instead of FreeType's internal buffer.
eugeni
parents:
diff changeset
212 }
bcc792bfa431 Store bitmap glyphs in a separate struct, instead of FreeType's internal buffer.
eugeni
parents:
diff changeset
213
19966
27187c1ac20b Cosmetics: add some comments.
eugeni
parents: 19965
diff changeset
214 /**
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
215 * \brief fix outline bitmap
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
216 *
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
217 * The glyph bitmap is subtracted from outline bitmap. This way looks much
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
218 * better in some cases.
19966
27187c1ac20b Cosmetics: add some comments.
eugeni
parents: 19965
diff changeset
219 */
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
220 static void fix_outline(Bitmap *bm_g, Bitmap *bm_o)
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
221 {
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
222 int x, y;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
223 const int l = bm_o->left > bm_g->left ? bm_o->left : bm_g->left;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
224 const int t = bm_o->top > bm_g->top ? bm_o->top : bm_g->top;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
225 const int r =
34295
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
226 bm_o->left + bm_o->stride <
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
227 bm_g->left + bm_g->stride ? bm_o->left + bm_o->stride : bm_g->left + bm_g->stride;
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
228 const int b =
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
229 bm_o->top + bm_o->h <
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
230 bm_g->top + bm_g->h ? bm_o->top + bm_o->h : bm_g->top + bm_g->h;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
231
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
232 unsigned char *g =
34295
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
233 bm_g->buffer + (t - bm_g->top) * bm_g->stride + (l - bm_g->left);
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
234 unsigned char *o =
34295
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
235 bm_o->buffer + (t - bm_o->top) * bm_o->stride + (l - bm_o->left);
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
236
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
237 for (y = 0; y < b - t; ++y) {
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
238 for (x = 0; x < r - l; ++x) {
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
239 unsigned char c_g, c_o;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
240 c_g = g[x];
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
241 c_o = o[x];
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
242 o[x] = (c_o > c_g) ? c_o - (c_g / 2) : 0;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
243 }
34295
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
244 g += bm_g->stride;
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
245 o += bm_o->stride;
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
246 }
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
247 }
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
248
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
249 /**
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
250 * \brief Shift a bitmap by the fraction of a pixel in x and y direction
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
251 * expressed in 26.6 fixed point
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
252 */
34295
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
253 static void shift_bitmap(Bitmap *bm, int shift_x, int shift_y)
19856
b4cb97ef9d20 Subtract glyph bitmap from outline bitmap.
eugeni
parents: 19848
diff changeset
254 {
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
255 int x, y, b;
34295
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
256 int w = bm->w;
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
257 int h = bm->h;
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
258 int s = bm->stride;
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
259 unsigned char *buf = bm->buffer;
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
260
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
261 // Shift in x direction
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
262 if (shift_x > 0) {
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
263 for (y = 0; y < h; y++) {
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
264 for (x = w - 1; x > 0; x--) {
34295
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
265 b = (buf[x + y * s - 1] * shift_x) >> 6;
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
266 buf[x + y * s - 1] -= b;
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
267 buf[x + y * s] += b;
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
268 }
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
269 }
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
270 } else if (shift_x < 0) {
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
271 shift_x = -shift_x;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
272 for (y = 0; y < h; y++) {
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
273 for (x = 0; x < w - 1; x++) {
34295
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
274 b = (buf[x + y * s + 1] * shift_x) >> 6;
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
275 buf[x + y * s + 1] -= b;
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
276 buf[x + y * s] += b;
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
277 }
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
278 }
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
279 }
19965
70352570e9ae Shadow support in libass.
eugeni
parents: 19962
diff changeset
280
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
281 // Shift in y direction
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
282 if (shift_y > 0) {
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
283 for (x = 0; x < w; x++) {
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
284 for (y = h - 1; y > 0; y--) {
34295
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
285 b = (buf[x + (y - 1) * s] * shift_y) >> 6;
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
286 buf[x + (y - 1) * s] -= b;
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
287 buf[x + y * s] += b;
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
288 }
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
289 }
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
290 } else if (shift_y < 0) {
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
291 shift_y = -shift_y;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
292 for (x = 0; x < w; x++) {
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
293 for (y = 0; y < h - 1; y++) {
34295
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
294 b = (buf[x + (y + 1) * s] * shift_y) >> 6;
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
295 buf[x + (y + 1) * s] -= b;
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
296 buf[x + y * s] += b;
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
297 }
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
298 }
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
299 }
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
300 }
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
301
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
302 /*
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
303 * Gaussian blur. An fast pure C implementation from MPlayer.
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
304 */
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
305 static void ass_gauss_blur(unsigned char *buffer, unsigned short *tmp2,
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
306 int width, int height, int stride, int *m2,
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
307 int r, int mwidth)
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
308 {
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
309
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
310 int x, y;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
311
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
312 unsigned char *s = buffer;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
313 unsigned short *t = tmp2 + 1;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
314 for (y = 0; y < height; y++) {
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
315 memset(t - 1, 0, (width + 1) * sizeof(short));
19965
70352570e9ae Shadow support in libass.
eugeni
parents: 19962
diff changeset
316
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
317 for (x = 0; x < r; x++) {
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
318 const int src = s[x];
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
319 if (src) {
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
320 register unsigned short *dstp = t + x - r;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
321 int mx;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
322 unsigned *m3 = (unsigned *) (m2 + src * mwidth);
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
323 for (mx = r - x; mx < mwidth; mx++) {
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
324 dstp[mx] += m3[mx];
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
325 }
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
326 }
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
327 }
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
328
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
329 for (; x < width - r; x++) {
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
330 const int src = s[x];
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
331 if (src) {
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
332 register unsigned short *dstp = t + x - r;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
333 int mx;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
334 unsigned *m3 = (unsigned *) (m2 + src * mwidth);
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
335 for (mx = 0; mx < mwidth; mx++) {
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
336 dstp[mx] += m3[mx];
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
337 }
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
338 }
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
339 }
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
340
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
341 for (; x < width; x++) {
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
342 const int src = s[x];
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
343 if (src) {
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
344 register unsigned short *dstp = t + x - r;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
345 int mx;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
346 const int x2 = r + width - x;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
347 unsigned *m3 = (unsigned *) (m2 + src * mwidth);
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
348 for (mx = 0; mx < x2; mx++) {
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
349 dstp[mx] += m3[mx];
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
350 }
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
351 }
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
352 }
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
353
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
354 s += stride;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
355 t += width + 1;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
356 }
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
357
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
358 t = tmp2;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
359 for (x = 0; x < width; x++) {
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
360 for (y = 0; y < r; y++) {
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
361 unsigned short *srcp = t + y * (width + 1) + 1;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
362 int src = *srcp;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
363 if (src) {
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
364 register unsigned short *dstp = srcp - 1 + width + 1;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
365 const int src2 = (src + 128) >> 8;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
366 unsigned *m3 = (unsigned *) (m2 + src2 * mwidth);
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28802
diff changeset
367
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
368 int mx;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
369 *srcp = 128;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
370 for (mx = r - 1; mx < mwidth; mx++) {
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
371 *dstp += m3[mx];
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
372 dstp += width + 1;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
373 }
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
374 }
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
375 }
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
376 for (; y < height - r; y++) {
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
377 unsigned short *srcp = t + y * (width + 1) + 1;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
378 int src = *srcp;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
379 if (src) {
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
380 register unsigned short *dstp = srcp - 1 - r * (width + 1);
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
381 const int src2 = (src + 128) >> 8;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
382 unsigned *m3 = (unsigned *) (m2 + src2 * mwidth);
19965
70352570e9ae Shadow support in libass.
eugeni
parents: 19962
diff changeset
383
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
384 int mx;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
385 *srcp = 128;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
386 for (mx = 0; mx < mwidth; mx++) {
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
387 *dstp += m3[mx];
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
388 dstp += width + 1;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
389 }
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
390 }
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
391 }
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
392 for (; y < height; y++) {
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
393 unsigned short *srcp = t + y * (width + 1) + 1;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
394 int src = *srcp;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
395 if (src) {
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
396 const int y2 = r + height - y;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
397 register unsigned short *dstp = srcp - 1 - r * (width + 1);
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
398 const int src2 = (src + 128) >> 8;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
399 unsigned *m3 = (unsigned *) (m2 + src2 * mwidth);
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
400
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
401 int mx;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
402 *srcp = 128;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
403 for (mx = 0; mx < y2; mx++) {
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
404 *dstp += m3[mx];
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
405 dstp += width + 1;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
406 }
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
407 }
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
408 }
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
409 t++;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
410 }
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
411
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
412 t = tmp2;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
413 s = buffer;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
414 for (y = 0; y < height; y++) {
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
415 for (x = 0; x < width; x++) {
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
416 s[x] = t[x] >> 8;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
417 }
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
418 s += stride;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
419 t += width + 1;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
420 }
19856
b4cb97ef9d20 Subtract glyph bitmap from outline bitmap.
eugeni
parents: 19848
diff changeset
421 }
b4cb97ef9d20 Subtract glyph bitmap from outline bitmap.
eugeni
parents: 19848
diff changeset
422
28799
65b83aee82fb Use blur with kernel [[1,2,1], [2,4,2], [1,2,1]] for \be.
greg
parents: 28781
diff changeset
423 /**
65b83aee82fb Use blur with kernel [[1,2,1], [2,4,2], [1,2,1]] for \be.
greg
parents: 28781
diff changeset
424 * \brief Blur with [[1,2,1]. [2,4,2], [1,2,1]] kernel
65b83aee82fb Use blur with kernel [[1,2,1], [2,4,2], [1,2,1]] for \be.
greg
parents: 28781
diff changeset
425 * This blur is the same as the one employed by vsfilter.
65b83aee82fb Use blur with kernel [[1,2,1], [2,4,2], [1,2,1]] for \be.
greg
parents: 28781
diff changeset
426 */
34295
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
427 static void be_blur(Bitmap *bm)
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
428 {
34295
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
429 int w = bm->w;
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
430 int h = bm->h;
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
431 int s = bm->stride;
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
432 unsigned char *buf = bm->buffer;
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
433 unsigned int x, y;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
434 unsigned int old_sum, new_sum;
28799
65b83aee82fb Use blur with kernel [[1,2,1], [2,4,2], [1,2,1]] for \be.
greg
parents: 28781
diff changeset
435
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
436 for (y = 0; y < h; y++) {
34295
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
437 old_sum = 2 * buf[y * s];
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
438 for (x = 0; x < w - 1; x++) {
34295
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
439 new_sum = buf[y * s + x] + buf[y * s + x + 1];
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
440 buf[y * s + x] = (old_sum + new_sum) >> 2;
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
441 old_sum = new_sum;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
442 }
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
443 }
28799
65b83aee82fb Use blur with kernel [[1,2,1], [2,4,2], [1,2,1]] for \be.
greg
parents: 28781
diff changeset
444
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
445 for (x = 0; x < w; x++) {
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
446 old_sum = 2 * buf[x];
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
447 for (y = 0; y < h - 1; y++) {
34295
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
448 new_sum = buf[y * s + x] + buf[(y + 1) * s + x];
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
449 buf[y * s + x] = (old_sum + new_sum) >> 2;
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
450 old_sum = new_sum;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
451 }
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
452 }
28799
65b83aee82fb Use blur with kernel [[1,2,1], [2,4,2], [1,2,1]] for \be.
greg
parents: 28781
diff changeset
453 }
65b83aee82fb Use blur with kernel [[1,2,1], [2,4,2], [1,2,1]] for \be.
greg
parents: 28781
diff changeset
454
34295
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
455 int outline_to_bitmap3(ASS_Library *library, ASS_SynthPriv *priv_blur,
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
456 FT_Library ftlib, FT_Outline *outline, FT_Outline *border,
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
457 Bitmap **bm_g, Bitmap **bm_o, Bitmap **bm_s,
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
458 int be, double blur_radius, FT_Vector shadow_offset,
36363
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 34295
diff changeset
459 int border_style, int border_visible)
19846
bcc792bfa431 Store bitmap glyphs in a separate struct, instead of FreeType's internal buffer.
eugeni
parents:
diff changeset
460 {
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
461 blur_radius *= 2;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
462 int bbord = be > 0 ? sqrt(2 * be) : 0;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
463 int gbord = blur_radius > 0.0 ? blur_radius + 1 : 0;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
464 int bord = FFMAX(bbord, gbord);
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
465 if (bord == 0 && (shadow_offset.x || shadow_offset.y))
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
466 bord = 1;
19848
07be98a5dd5f Add \be (blur edges) support to libass.
eugeni
parents: 19846
diff changeset
467
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
468 assert(bm_g && bm_o && bm_s);
19965
70352570e9ae Shadow support in libass.
eugeni
parents: 19962
diff changeset
469
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
470 *bm_g = *bm_o = *bm_s = 0;
19846
bcc792bfa431 Store bitmap glyphs in a separate struct, instead of FreeType's internal buffer.
eugeni
parents:
diff changeset
471
34295
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
472 if (outline)
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
473 *bm_g = outline_to_bitmap(library, ftlib, outline, bord);
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
474 if (!*bm_g)
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
475 return 1;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
476
34295
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
477 if (border) {
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
478 *bm_o = outline_to_bitmap(library, ftlib, border, bord);
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
479 if (!*bm_o) {
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
480 return 1;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
481 }
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
482 }
19965
70352570e9ae Shadow support in libass.
eugeni
parents: 19962
diff changeset
483
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
484 // Apply box blur (multiple passes, if requested)
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
485 while (be--) {
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
486 if (*bm_o)
34295
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
487 be_blur(*bm_o);
36363
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 34295
diff changeset
488 if (!*bm_o || border_style == 3)
34295
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
489 be_blur(*bm_g);
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
490 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28802
diff changeset
491
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
492 // Apply gaussian blur
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
493 if (blur_radius > 0.0) {
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
494 if (*bm_o)
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
495 resize_tmp(priv_blur, (*bm_o)->w, (*bm_o)->h);
36363
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 34295
diff changeset
496 if (!*bm_o || border_style == 3)
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
497 resize_tmp(priv_blur, (*bm_g)->w, (*bm_g)->h);
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
498 generate_tables(priv_blur, blur_radius);
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
499 if (*bm_o)
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
500 ass_gauss_blur((*bm_o)->buffer, priv_blur->tmp,
34295
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
501 (*bm_o)->w, (*bm_o)->h, (*bm_o)->stride,
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
502 (int *) priv_blur->gt2, priv_blur->g_r,
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
503 priv_blur->g_w);
36363
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 34295
diff changeset
504 if (!*bm_o || border_style == 3)
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
505 ass_gauss_blur((*bm_g)->buffer, priv_blur->tmp,
34295
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
506 (*bm_g)->w, (*bm_g)->h, (*bm_g)->stride,
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
507 (int *) priv_blur->gt2, priv_blur->g_r,
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
508 priv_blur->g_w);
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
509 }
19856
b4cb97ef9d20 Subtract glyph bitmap from outline bitmap.
eugeni
parents: 19848
diff changeset
510
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
511 // Create shadow and fix outline as needed
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
512 if (*bm_o && border_style != 3) {
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
513 *bm_s = copy_bitmap(*bm_o);
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
514 fix_outline(*bm_g, *bm_o);
36363
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 34295
diff changeset
515 } else if (*bm_o && border_visible) {
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 34295
diff changeset
516 *bm_s = copy_bitmap(*bm_o);
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
517 } else if (*bm_o) {
36363
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 34295
diff changeset
518 *bm_s = *bm_o;
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 34295
diff changeset
519 *bm_o = 0;
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
520 } else
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
521 *bm_s = copy_bitmap(*bm_g);
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
522
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
523 assert(bm_s);
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
524
34295
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
525 shift_bitmap(*bm_s, shadow_offset.x, shadow_offset.y);
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
526
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
527 return 0;
19846
bcc792bfa431 Store bitmap glyphs in a separate struct, instead of FreeType's internal buffer.
eugeni
parents:
diff changeset
528 }