changeset 28785:0366ab2c1cb9

Support ScaledBorderAndShadow property.
author greg
date Thu, 05 Mar 2009 20:36:48 +0000
parents 907d3d80b50f
children 9359f0ac6dd6
files libass/ass.c libass/ass_render.c libass/ass_types.h libass/ass_utils.c libass/ass_utils.h
diffstat 5 files changed, 19 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libass/ass.c	Thu Mar 05 20:36:44 2009 +0000
+++ b/libass/ass.c	Thu Mar 05 20:36:48 2009 +0000
@@ -520,6 +520,8 @@
 		track->Timer = atof(str + 6);
 	} else if (!strncmp(str,"WrapStyle:", 10)) {
 		track->WrapStyle = atoi(str + 10);
+	} else if (!strncmp(str, "ScaledBorderAndShadow:", 22)) {
+		track->ScaledBorderAndShadow = parse_bool(str + 22);
 	}
 	return 0;
 }
--- a/libass/ass_render.c	Thu Mar 05 20:36:44 2009 +0000
+++ b/libass/ass_render.c	Thu Mar 05 20:36:48 2009 +0000
@@ -2233,7 +2233,10 @@
 	
 	frame_context.font_scale = global_settings->font_size_coeff *
 	                           frame_context.orig_height / frame_context.track->PlayResY;
-	frame_context.border_scale = ((double)frame_context.orig_height) / frame_context.track->PlayResY;
+	if (frame_context.track->ScaledBorderAndShadow)
+		frame_context.border_scale = ((double)frame_context.orig_height) / frame_context.track->PlayResY;
+	else
+		frame_context.border_scale = 1.;
 
 	frame_context.font_scale_x = 1.;
 
--- a/libass/ass_types.h	Thu Mar 05 20:36:44 2009 +0000
+++ b/libass/ass_types.h	Thu Mar 05 20:36:48 2009 +0000
@@ -105,6 +105,7 @@
 	int PlayResY;
 	double Timer;
 	int WrapStyle;
+	char ScaledBorderAndShadow;
 
 	
 	int default_style; // index of default style
--- a/libass/ass_utils.c	Thu Mar 05 20:36:44 2009 +0000
+++ b/libass/ass_utils.c	Thu Mar 05 20:36:48 2009 +0000
@@ -96,6 +96,17 @@
 	return result;
 }
 
+// Return a boolean value for a string
+char parse_bool(char* str) {
+	while (*str == ' ' || *str == '\t')
+		str++;
+	if (!strncasecmp(str, "yes", 3))
+		return 1;
+	else if (strtol(str, NULL, 10) > 0)
+		return 1;
+	return 0;
+}
+
 #if 0
 static void sprint_tag(uint32_t tag, char* dst)
 {
--- a/libass/ass_utils.h	Thu Mar 05 20:36:44 2009 +0000
+++ b/libass/ass_utils.h	Thu Mar 05 20:36:48 2009 +0000
@@ -30,6 +30,7 @@
 int mystrtou32(char** p, int base, uint32_t* res);
 int mystrtod(char** p, double* res);
 int strtocolor(char** q, uint32_t* res);
+char parse_bool(char* str);
 
 static inline int d6_to_int(int x) {
 	return (x + 32) >> 6;