Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
obs-studio
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Yunxiang Li
obs-studio
Commits
cabc47c1
Commit
cabc47c1
authored
10 years ago
by
Jim
Browse files
Options
Downloads
Patches
Plain Diff
Add more null pointer checks to text source
parent
8d76f940
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
plugins/text-freetype2/text-functionality.c
+16
-1
16 additions, 1 deletion
plugins/text-freetype2/text-functionality.c
with
16 additions
and
1 deletion
plugins/text-freetype2/text-functionality.c
+
16
−
1
View file @
cabc47c1
...
@@ -34,6 +34,10 @@ void draw_outlines(struct ft2_source *srcdata)
...
@@ -34,6 +34,10 @@ void draw_outlines(struct ft2_source *srcdata)
uint32_t
*
tmp
;
uint32_t
*
tmp
;
struct
gs_vb_data
*
vdata
=
gs_vertexbuffer_get_data
(
srcdata
->
vbuf
);
struct
gs_vb_data
*
vdata
=
gs_vertexbuffer_get_data
(
srcdata
->
vbuf
);
if
(
!
srcdata
->
text
)
return
;
tmp
=
vdata
->
colors
;
tmp
=
vdata
->
colors
;
vdata
->
colors
=
srcdata
->
colorbuf
;
vdata
->
colors
=
srcdata
->
colorbuf
;
...
@@ -57,6 +61,10 @@ void draw_drop_shadow(struct ft2_source *srcdata)
...
@@ -57,6 +61,10 @@ void draw_drop_shadow(struct ft2_source *srcdata)
uint32_t
*
tmp
;
uint32_t
*
tmp
;
struct
gs_vb_data
*
vdata
=
gs_vertexbuffer_get_data
(
srcdata
->
vbuf
);
struct
gs_vb_data
*
vdata
=
gs_vertexbuffer_get_data
(
srcdata
->
vbuf
);
if
(
!
srcdata
->
text
)
return
;
tmp
=
vdata
->
colors
;
tmp
=
vdata
->
colors
;
vdata
->
colors
=
srcdata
->
colorbuf
;
vdata
->
colors
=
srcdata
->
colorbuf
;
...
@@ -75,6 +83,9 @@ void set_up_vertex_buffer(struct ft2_source *srcdata)
...
@@ -75,6 +83,9 @@ void set_up_vertex_buffer(struct ft2_source *srcdata)
FT_UInt
glyph_index
=
0
;
FT_UInt
glyph_index
=
0
;
uint32_t
x
=
0
,
space_pos
=
0
,
word_width
=
0
;
uint32_t
x
=
0
,
space_pos
=
0
,
word_width
=
0
;
if
(
!
srcdata
->
text
)
return
;
if
(
srcdata
->
custom_width
>=
100
)
if
(
srcdata
->
custom_width
>=
100
)
srcdata
->
cx
=
srcdata
->
custom_width
;
srcdata
->
cx
=
srcdata
->
custom_width
;
else
else
...
@@ -128,7 +139,8 @@ skip_word_wrap:;
...
@@ -128,7 +139,8 @@ skip_word_wrap:;
void
fill_vertex_buffer
(
struct
ft2_source
*
srcdata
)
void
fill_vertex_buffer
(
struct
ft2_source
*
srcdata
)
{
{
struct
gs_vb_data
*
vdata
=
gs_vertexbuffer_get_data
(
srcdata
->
vbuf
);
struct
gs_vb_data
*
vdata
=
gs_vertexbuffer_get_data
(
srcdata
->
vbuf
);
if
(
vdata
==
NULL
)
return
;
if
(
vdata
==
NULL
||
!
srcdata
->
text
)
return
;
struct
vec2
*
tvarray
=
(
struct
vec2
*
)
vdata
->
tvarray
[
0
].
array
;
struct
vec2
*
tvarray
=
(
struct
vec2
*
)
vdata
->
tvarray
[
0
].
array
;
uint32_t
*
col
=
(
uint32_t
*
)
vdata
->
colors
;
uint32_t
*
col
=
(
uint32_t
*
)
vdata
->
colors
;
...
@@ -454,6 +466,9 @@ uint32_t get_ft2_text_width(wchar_t *text, struct ft2_source *srcdata)
...
@@ -454,6 +466,9 @@ uint32_t get_ft2_text_width(wchar_t *text, struct ft2_source *srcdata)
FT_UInt
glyph_index
=
0
;
FT_UInt
glyph_index
=
0
;
uint32_t
w
=
0
,
max_w
=
0
;
uint32_t
w
=
0
,
max_w
=
0
;
if
(
!
text
)
return
0
;
for
(
uint32_t
i
=
0
;
i
<
(
uint32_t
)
wcslen
(
text
);
i
++
)
{
for
(
uint32_t
i
=
0
;
i
<
(
uint32_t
)
wcslen
(
text
);
i
++
)
{
glyph_index
=
FT_Get_Char_Index
(
srcdata
->
font_face
,
text
[
i
]);
glyph_index
=
FT_Get_Char_Index
(
srcdata
->
font_face
,
text
[
i
]);
FT_Load_Glyph
(
srcdata
->
font_face
,
glyph_index
,
FT_LOAD_DEFAULT
);
FT_Load_Glyph
(
srcdata
->
font_face
,
glyph_index
,
FT_LOAD_DEFAULT
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment