Imported Upstream version 0.14.2+dfsg1

This commit is contained in:
Sebastian Ramacher 2016-05-24 21:53:01 +02:00
parent fb3990e9e5
commit 41a01dbf05
529 changed files with 25112 additions and 2336 deletions

View file

@ -0,0 +1,14 @@
TextFreetype2="نص (FreeType 2)"
Font="الخط"
Text="النص"
TextFile="ملف نص (UTF-8 أو UTF-16)"
TextFileFilter="ملفات نصية (*.txt);;"
ChatLogMode="وضع سجل المحادثة (آخر 6 سطور)"
Color1="اللون الأول"
Color2="اللون الثاني"
Outline="حدود"
DropShadow="ظل"
ReadFromFile="قراءة من ملف"
CustomWidth="عرض نص مخصص"
WordWrap="التفاف الكلمة"

View file

@ -6,7 +6,7 @@ TextFileFilter="Tekstfiler (*.txt);;"
ChatLogMode="Chat log tilstand (sidste 6 linjer)"
Color1="Farve 1"
Color2="Farve 2"
Outline="Skitse"
Outline="Kontur"
DropShadow="Drop Shadow"
ReadFromFile="Læse fra fil"
CustomWidth="Brugerdefineret tekstbredde"

View file

@ -1,14 +1,14 @@
TextFreetype2="Idazkia (FreeType 2)"
Font="Hizkia"
Text="Idazkia"
TextFile="Idazki Agiria (UTF-8 edo UTF-16)"
TextFileFilter="Idazki Agiriak (*.txt);;"
ChatLogMode="Txat ohar modua (azken 6 lerroak)"
Color1="Margoa 1"
Color2="Margoa 2"
Outline="Ingurua"
DropShadow="Eror Itzala"
ReadFromFile="Irakurri agiritik"
CustomWidth="Norbere idazki zabalera"
WordWrap="Hitz Ingurapena"
TextFreetype2="Testua (FreeType 2)"
Font="Letra-tipoa"
Text="Testua"
TextFile="Testu-fitxategia (UTF-8 edo UTF-16)"
TextFileFilter="Testu-fitxategiak (*.txt);;"
ChatLogMode="Berriketa egunkaria modua (azken 6 lerroak)"
Color1="1. kolorea"
Color2="2. kolorea"
Outline="Eskema"
DropShadow="Egin itzala"
ReadFromFile="Irakurri fitxategitik"
CustomWidth="Testu-zabalera pertsonalizatua"
WordWrap="Hitz ingurapena"

View file

@ -0,0 +1,14 @@
TextFreetype2="טקסט (FreeType 2)"
Font="גופן"
Text="טקסט"
TextFile="קובץ טקסט (UTF-8 או UTF-16)"
TextFileFilter="קבצי טקסט (*.txt);;"
ChatLogMode="מצב יומן צ'אט (6 שורות אחרונות)"
Color1="צבע 1"
Color2="צבע 2"
Outline="קו מתאר"
DropShadow="הטלת צללית"
ReadFromFile="קריאה מקובץ"
CustomWidth="רוחב טקסט מותאם אישית"
WordWrap="הסתת מילים"

View file

@ -7,8 +7,8 @@ ChatLogMode="Beszélgetésnapló mód (utolsó 6 sor)"
Color1="Szín 1"
Color2="Szín 2"
Outline="Körvonal"
DropShadow="Vetett Árnyék"
ReadFromFile="Fájlból olvasni"
DropShadow="Vetett árnyék"
ReadFromFile="Fájlból olvasás"
CustomWidth="Egyedi szövegszélesség"
WordWrap="Sortörés"

View file

@ -1,9 +1,9 @@
TextFreetype2="テキスト(FreeType 2)"
TextFreetype2="テキスト (FreeType 2)"
Font="フォント"
Text="テキスト"
TextFile="テキストファイル (UTF-8 または UTF-16)"
TextFileFilter="テキストファイル (*.txt);;"
ChatLogMode="チャットログモード最新6行"
ChatLogMode="チャットログモード (最新6行)"
Color1="色 1"
Color2="色 2"
Outline="輪郭"

View file

@ -1,14 +1,14 @@
TextFreetype2="Text (FreeType 2)"
Font="Font"
Text="Textul"
TextFile="Fişier text (UTF-8 sau UTF-16)"
Text="Text"
TextFile="Fișier text (UTF-8 sau UTF-16)"
TextFileFilter="Fișiere text (*.txt);;"
ChatLogMode="Modul jurnal chat (ultimele 6 rânduri)"
ChatLogMode="Mod de jurnal al chatului (ultimele 6 rânduri)"
Color1="Culoarea 1"
Color2="Culoarea 2"
Outline="Contur"
DropShadow="Umbră text"
DropShadow="Umbrire"
ReadFromFile="Citește din fișier"
CustomWidth="Lăţime text personalizată"
WordWrap="Word Wrap"
CustomWidth="Lățime de text personalizată"
WordWrap="Încadrare pentru cuvinte"

View file

@ -1,3 +1,4 @@
TextFreetype2="Text (FreeType 2)"
Font="Typsnitt"
Text="Text"
TextFile="Textfil (UTF-8 eller UTF-16)"

View file

@ -6,7 +6,7 @@ TextFileFilter="文本文件(*.txt);;"
ChatLogMode="聊天日志模式 (最后 6 行)"
Color1="颜色 1"
Color2="颜色 2"
Outline="大纲"
Outline="描边"
DropShadow="下拉阴影"
ReadFromFile="从文件读取"
CustomWidth="自定义文本宽度"

View file

@ -1,7 +1,4 @@
uniform float4x4 ViewProj;
uniform float4x4 color_matrix;
uniform float3 color_range_min = {0.0, 0.0, 0.0};
uniform float3 color_range_max = {1.0, 1.0, 1.0};
uniform texture2d image;
sampler_state def_sampler {
@ -27,14 +24,8 @@ VertInOut VSDefault(VertInOut vert_in)
float4 PSDrawBare(VertInOut vert_in) : TARGET
{
return image.Sample(def_sampler, vert_in.uv) * vert_in.col;
}
float4 PSDrawMatrix(VertInOut vert_in) : TARGET
{
float4 yuv = image.Sample(def_sampler, vert_in.uv);
yuv.xyz = clamp(yuv.xyz, color_range_min, color_range_max);
return saturate(mul(float4(yuv.xyz, 1.0), color_matrix));
vert_in.col.a *= image.Sample(def_sampler, vert_in.uv).a;
return vert_in.col;
}
technique Draw
@ -45,12 +36,3 @@ technique Draw
pixel_shader = PSDrawBare(vert_in);
}
}
technique DrawMatrix
{
pass
{
vertex_shader = VSDefault(vert_in);
pixel_shader = PSDrawMatrix(vert_in);
}
}

View file

@ -34,7 +34,8 @@ uint32_t texbuf_w = 2048, texbuf_h = 2048;
static struct obs_source_info freetype2_source_info = {
.id = "text_ft2_source",
.type = OBS_SOURCE_TYPE_INPUT,
.output_flags = OBS_SOURCE_VIDEO,
.output_flags = OBS_SOURCE_VIDEO |
OBS_SOURCE_CUSTOM_DRAW,
.get_name = ft2_source_get_name,
.create = ft2_source_create,
.destroy = ft2_source_destroy,
@ -200,6 +201,7 @@ static void ft2_source_render(void *data, gs_effect_t *effect)
if (srcdata == NULL) return;
if (srcdata->tex == NULL || srcdata->vbuf == NULL) return;
if (srcdata->text == NULL || *srcdata->text == 0) return;
gs_reset_blend_state();
if (srcdata->outline_text) draw_outlines(srcdata);
@ -366,7 +368,7 @@ static void ft2_source_update(void *data, obs_data_t *settings)
bfree(srcdata->texbuf);
srcdata->texbuf = NULL;
}
srcdata->texbuf = bzalloc(texbuf_w * texbuf_h * 4);
srcdata->texbuf = bzalloc(texbuf_w * texbuf_h);
if (srcdata->font_face)
cache_standard_glyphs(srcdata);

View file

@ -53,7 +53,7 @@ struct ft2_source {
FT_Face font_face;
uint32_t *texbuf;
uint8_t *texbuf;
gs_vertbuffer_t *vbuf;
gs_effect_t *draw_effect;

View file

@ -99,6 +99,12 @@ void set_up_vertex_buffer(struct ft2_source *srcdata)
srcdata->vbuf = NULL;
gs_vertexbuffer_destroy(tmpvbuf);
}
if (*srcdata->text == 0) {
obs_leave_graphics();
return;
}
srcdata->vbuf = create_uv_vbuffer((uint32_t)wcslen(srcdata->text) * 6,
true);
@ -241,7 +247,6 @@ void cache_glyphs(struct ft2_source *srcdata, wchar_t *cache_glyphs)
slot = srcdata->font_face->glyph;
uint32_t dx = srcdata->texbuf_x, dy = srcdata->texbuf_y;
uint8_t alpha;
int32_t cached_glyphs = 0;
size_t len = wcslen(cache_glyphs);
@ -266,6 +271,11 @@ void cache_glyphs(struct ft2_source *srcdata, wchar_t *cache_glyphs)
dy += srcdata->max_h + 1;
}
if (dy + g_h >= texbuf_h) {
blog(LOG_WARNING, "Out of space trying to render glyphs");
break;
}
src_glyph = bzalloc(sizeof(struct glyph_info));
src_glyph->u = (float)dx / (float)texbuf_w;
src_glyph->u2 = (float)(dx + g_w) / (float)texbuf_w;
@ -278,11 +288,9 @@ void cache_glyphs(struct ft2_source *srcdata, wchar_t *cache_glyphs)
src_glyph->xadv = slot->advance.x >> 6;
for (uint32_t y = 0; y < g_h; y++) {
for (uint32_t x = 0; x < g_w; x++) {
alpha = slot->bitmap.buffer[glyph_pos];
for (uint32_t x = 0; x < g_w; x++)
srcdata->texbuf[buf_pos] =
0x00FFFFFF ^ ((uint32_t)alpha << 24);
}
slot->bitmap.buffer[glyph_pos];
}
dx += (g_w + 1);
@ -310,7 +318,7 @@ void cache_glyphs(struct ft2_source *srcdata, wchar_t *cache_glyphs)
}
srcdata->tex = gs_texture_create(texbuf_w, texbuf_h,
GS_RGBA, 1, (const uint8_t **)&srcdata->texbuf, 0);
GS_A8, 1, (const uint8_t **)&srcdata->texbuf, 0);
obs_leave_graphics();
}
@ -322,7 +330,8 @@ time_t get_modified_timestamp(char *filename)
// stat is apparently terrifying and horrible, but we only call it once
// every second at most.
stat(filename, &stats);
if (os_stat(filename, &stats) != 0)
return -1;
return stats.st_mtime;
}