<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html><head></head><body><div style="font-size: 12pt; font-family: Calibri,sans-serif;"><div>I dunno. We typically define error values for this rather than a bit mask. For float, there is also NaN.</div><div><br></div><div>-- </div><div>Rémi Denis-Courmont</div><div>Sent from my NVIDIA Tegra-powered device</div><br><div id="htc_header">----- Reply message -----<br>De : git@videolan.org (Francois Cartegnie)<br>Pour : <vlc-commits@videolan.org><br>Objet : [vlc-commits] text_style: add style members presence flags<br>Date : jeu., août 13, 2015 16:24</div></div><br><pre style="word-wrap: break-word; white-space: pre-wrap;">vlc | branch: master | Francois Cartegnie <fcvlcdev@free.fr> | Sat Aug 8 22:50:03 2015 +0200| [acd27a20649e71664569c44aad2cbe107cf978a9] | committer: Francois Cartegnie
text_style: add style members presence flags
because you can't tell if members are
have set value or are unset.
> <a href="http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=acd27a20649e71664569c44aad2cbe107cf978a9">http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=acd27a20649e71664569c44aad2cbe107cf978a9</a>
---
include/vlc_text_style.h | 43 +++++++++++++++++++++++++++++++------------
src/misc/text_style.c | 4 +++-
2 files changed, 34 insertions(+), 13 deletions(-)
diff --git a/include/vlc_text_style.h b/include/vlc_text_style.h
index d0be49c..e0d53db 100644
--- a/include/vlc_text_style.h
+++ b/include/vlc_text_style.h
@@ -42,14 +42,17 @@ typedef struct
char * psz_fontname; /**< The name of the font */
char * psz_monofontname; /**< The name of the mono font */
+ uint16_t i_features; /**< Feature flags (means non default) */
+ uint16_t i_style_flags; /**< Formatting style flags */
+
/* Font style */
+ float f_font_relsize; /**< The font size in % */
int i_font_size; /**< The font size in pixels */
int i_font_color; /**< The color of the text 0xRRGGBB
(native endianness) */
uint8_t i_font_alpha; /**< The transparency of the text.
0x00 is fully opaque,
0xFF fully transparent */
- uint16_t i_style_flags; /**< Formatting style flags */
int i_spacing; /**< The spaceing between glyphs in pixels */
/* Outline */
@@ -77,18 +80,34 @@ typedef struct
0xFF fully transparent */
} text_style_t;
+/* Features flags for \ref i_features */
+#define STYLE_NO_DEFAULTS 0x0
+#define STYLE_FULLY_SET 0xFFFF
+#define STYLE_HAS_FONT_COLOR (1 << 0)
+#define STYLE_HAS_FONT_ALPHA (1 << 1)
+#define STYLE_HAS_FLAGS (1 << 2)
+#define STYLE_HAS_OUTLINE_COLOR (1 << 3)
+#define STYLE_HAS_OUTLINE_ALPHA (1 << 4)
+#define STYLE_HAS_SHADOW_COLOR (1 << 5)
+#define STYLE_HAS_SHADOW_ALPHA (1 << 6)
+#define STYLE_HAS_BACKGROUND_COLOR (1 << 7)
+#define STYLE_HAS_BACKGROUND_ALPHA (1 << 8)
+#define STYLE_HAS_K_BACKGROUND_COLOR (1 << 9)
+#define STYLE_HAS_K_BACKGROUND_ALPHA (1 << 10)
+
/* Style flags for \ref text_style_t */
-#define STYLE_BOLD 1
-#define STYLE_ITALIC 2
-#define STYLE_OUTLINE 4
-#define STYLE_SHADOW 8
-#define STYLE_BACKGROUND 16
-#define STYLE_UNDERLINE 32
-#define STYLE_STRIKEOUT 64
-#define STYLE_HALFWIDTH 128
-#define STYLE_MONOSPACED 256
-
-#define STYLE_DEFAULT_FONT_SIZE 22
+#define STYLE_BOLD (1 << 0)
+#define STYLE_ITALIC (1 << 1)
+#define STYLE_OUTLINE (1 << 2)
+#define STYLE_SHADOW (1 << 3)
+#define STYLE_BACKGROUND (1 << 4)
+#define STYLE_UNDERLINE (1 << 5)
+#define STYLE_STRIKEOUT (1 << 6)
+#define STYLE_HALFWIDTH (1 << 7)
+#define STYLE_MONOSPACED (1 << 8)
+
+#define STYLE_DEFAULT_FONT_SIZE 20
+#define STYLE_DEFAULT_REL_FONT_SIZE 5.0
typedef struct text_segment_t text_segment_t;
diff --git a/src/misc/text_style.c b/src/misc/text_style.c
index 82c9640..793c0a9 100644
--- a/src/misc/text_style.c
+++ b/src/misc/text_style.c
@@ -38,10 +38,12 @@ text_style_t *text_style_New( void )
/* initialize to default text style */
p_style->psz_fontname = NULL;
p_style->psz_monofontname = NULL;
+ p_style->i_features = STYLE_FULLY_SET;
+ p_style->i_style_flags = STYLE_OUTLINE;
+ p_style->f_font_relsize = STYLE_DEFAULT_REL_FONT_SIZE;
p_style->i_font_size = STYLE_DEFAULT_FONT_SIZE;
p_style->i_font_color = 0xffffff;
p_style->i_font_alpha = 0xff;
- p_style->i_style_flags = STYLE_OUTLINE;
p_style->i_outline_color = 0x000000;
p_style->i_outline_alpha = 0xff;
p_style->i_shadow_color = 0x000000;
_______________________________________________
vlc-commits mailing list
vlc-commits@videolan.org
<a href="https://mailman.videolan.org/listinfo/vlc-commits">https://mailman.videolan.org/listinfo/vlc-commits</a>
</pre></body></html>