diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-04-17 07:17:24 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-04-17 07:21:24 +0300 |
commit | e12c08e8d170b7ca40f204a5b0423c23a9fbc2c1 (patch) | |
tree | 8cf3453d12edb177a218ef8009357518ec6cab6a /source/blender/blenfont/intern/blf_internal_types.h | |
parent | b3dabc200a4b0399ec6b81f2ff2730d07b44fcaa (diff) |
ClangFormat: apply to source, most of intern
Apply clang format as proposed in T53211.
For details on usage and instructions for migrating branches
without conflicts, see:
https://wiki.blender.org/wiki/Tools/ClangFormat
Diffstat (limited to 'source/blender/blenfont/intern/blf_internal_types.h')
-rw-r--r-- | source/blender/blenfont/intern/blf_internal_types.h | 335 |
1 files changed, 167 insertions, 168 deletions
diff --git a/source/blender/blenfont/intern/blf_internal_types.h b/source/blender/blenfont/intern/blf_internal_types.h index 013127b6a47..22950c26b6b 100644 --- a/source/blender/blenfont/intern/blf_internal_types.h +++ b/source/blender/blenfont/intern/blf_internal_types.h @@ -21,7 +21,6 @@ * \ingroup blf */ - #ifndef __BLF_INTERNAL_TYPES_H__ #define __BLF_INTERNAL_TYPES_H__ @@ -31,256 +30,256 @@ #define BLF_BATCH_DRAW_LEN_MAX 2048 /* in glyph */ typedef struct BatchBLF { - struct FontBLF *font; /* can only batch glyph from the same font */ - struct GPUBatch *batch; - struct GPUVertBuf *verts; - struct GPUVertBufRaw pos_step, tex_step, col_step; - unsigned int pos_loc, tex_loc, col_loc; - unsigned int glyph_len; - float ofs[2]; /* copy of font->pos */ - float mat[4][4]; /* previous call modelmatrix. */ - bool enabled, active, simple_shader; - GPUTexture *tex_bind_state; + struct FontBLF *font; /* can only batch glyph from the same font */ + struct GPUBatch *batch; + struct GPUVertBuf *verts; + struct GPUVertBufRaw pos_step, tex_step, col_step; + unsigned int pos_loc, tex_loc, col_loc; + unsigned int glyph_len; + float ofs[2]; /* copy of font->pos */ + float mat[4][4]; /* previous call modelmatrix. */ + bool enabled, active, simple_shader; + GPUTexture *tex_bind_state; } BatchBLF; extern BatchBLF g_batch; typedef struct KerningCacheBLF { - struct KerningCacheBLF *next, *prev; + struct KerningCacheBLF *next, *prev; - /* kerning mode. */ - FT_UInt mode; + /* kerning mode. */ + FT_UInt mode; - /* only cache a ascii glyph pairs. Only store the x - * offset we are interested in, instead of the full FT_Vector. */ - int table[0x80][0x80]; + /* only cache a ascii glyph pairs. Only store the x + * offset we are interested in, instead of the full FT_Vector. */ + int table[0x80][0x80]; } KerningCacheBLF; typedef struct GlyphCacheBLF { - struct GlyphCacheBLF *next; - struct GlyphCacheBLF *prev; + struct GlyphCacheBLF *next; + struct GlyphCacheBLF *prev; - /* font size. */ - unsigned int size; + /* font size. */ + unsigned int size; - /* and dpi. */ - unsigned int dpi; + /* and dpi. */ + unsigned int dpi; - /* and the glyphs. */ - ListBase bucket[257]; + /* and the glyphs. */ + ListBase bucket[257]; - /* fast ascii lookup */ - struct GlyphBLF *glyph_ascii_table[256]; + /* fast ascii lookup */ + struct GlyphBLF *glyph_ascii_table[256]; - /* texture array, to draw the glyphs. */ - GPUTexture **textures; + /* texture array, to draw the glyphs. */ + GPUTexture **textures; - /* size of the array. */ - unsigned int textures_len; + /* size of the array. */ + unsigned int textures_len; - /* and the last texture, aka. the current texture. */ - unsigned int texture_current; + /* and the last texture, aka. the current texture. */ + unsigned int texture_current; - /* like bftgl, we draw every glyph in a big texture, so this is the - * current position inside the texture. - */ - int offset_x; - int offset_y; + /* like bftgl, we draw every glyph in a big texture, so this is the + * current position inside the texture. + */ + int offset_x; + int offset_y; - /* and the space from one to other. */ - int pad; + /* and the space from one to other. */ + int pad; - /* and the bigger glyph in the font. */ - int glyph_width_max; - int glyph_height_max; + /* and the bigger glyph in the font. */ + int glyph_width_max; + int glyph_height_max; - /* next two integer power of two, to build the texture. */ - int p2_width; - int p2_height; + /* next two integer power of two, to build the texture. */ + int p2_width; + int p2_height; - /* number of glyphs in the font. */ - int glyphs_len_max; + /* number of glyphs in the font. */ + int glyphs_len_max; - /* number of glyphs not yet loaded (decreases every glyph loaded). */ - int glyphs_len_free; + /* number of glyphs not yet loaded (decreases every glyph loaded). */ + int glyphs_len_free; - /* ascender and descender value. */ - float ascender; - float descender; + /* ascender and descender value. */ + float ascender; + float descender; } GlyphCacheBLF; typedef struct GlyphBLF { - struct GlyphBLF *next; - struct GlyphBLF *prev; + struct GlyphBLF *next; + struct GlyphBLF *prev; - /* and the character, as UTF8 */ - unsigned int c; + /* and the character, as UTF8 */ + unsigned int c; - /* freetype2 index, to speed-up the search. */ - FT_UInt idx; + /* freetype2 index, to speed-up the search. */ + FT_UInt idx; - /* glyph box. */ - rctf box; + /* glyph box. */ + rctf box; - /* advance size. */ - float advance; - /* avoid conversion to int while drawing */ - int advance_i; + /* advance size. */ + float advance; + /* avoid conversion to int while drawing */ + int advance_i; - /* texture id where this glyph is store. */ - GPUTexture *tex; + /* texture id where this glyph is store. */ + GPUTexture *tex; - /* position inside the texture where this glyph is store. */ - int offset_x; - int offset_y; + /* position inside the texture where this glyph is store. */ + int offset_x; + int offset_y; - /* Bitmap data, from freetype. Take care that this - * can be NULL. - */ - unsigned char *bitmap; + /* Bitmap data, from freetype. Take care that this + * can be NULL. + */ + unsigned char *bitmap; - /* glyph width and height. */ - int width; - int height; - int pitch; + /* glyph width and height. */ + int width; + int height; + int pitch; - /* uv coords. */ - float uv[2][2]; + /* uv coords. */ + float uv[2][2]; - /* X and Y bearing of the glyph. - * The X bearing is from the origin to the glyph left bbox edge. - * The Y bearing is from the baseline to the top of the glyph edge. - */ - float pos_x; - float pos_y; + /* X and Y bearing of the glyph. + * The X bearing is from the origin to the glyph left bbox edge. + * The Y bearing is from the baseline to the top of the glyph edge. + */ + float pos_x; + float pos_y; - /* with value of zero mean that we need build the texture. */ - char build_tex; + /* with value of zero mean that we need build the texture. */ + char build_tex; } GlyphBLF; typedef struct FontBufInfoBLF { - /* for draw to buffer, always set this to NULL after finish! */ - float *fbuf; + /* for draw to buffer, always set this to NULL after finish! */ + float *fbuf; - /* the same but unsigned char */ - unsigned char *cbuf; + /* the same but unsigned char */ + unsigned char *cbuf; - /* buffer size, keep signed so comparisons with negative values work */ - int w; - int h; + /* buffer size, keep signed so comparisons with negative values work */ + int w; + int h; - /* number of channels. */ - int ch; + /* number of channels. */ + int ch; - /* display device used for color management */ - struct ColorManagedDisplay *display; + /* display device used for color management */ + struct ColorManagedDisplay *display; - /* and the color, the alphas is get from the glyph! - * color is srgb space */ - float col_init[4]; - /* cached conversion from 'col_init' */ - unsigned char col_char[4]; - float col_float[4]; + /* and the color, the alphas is get from the glyph! + * color is srgb space */ + float col_init[4]; + /* cached conversion from 'col_init' */ + unsigned char col_char[4]; + float col_float[4]; } FontBufInfoBLF; typedef struct FontBLF { - /* font name. */ - char *name; + /* font name. */ + char *name; - /* # of times this font was loaded */ - unsigned int reference_count; + /* # of times this font was loaded */ + unsigned int reference_count; - /* filename or NULL. */ - char *filename; + /* filename or NULL. */ + char *filename; - /* aspect ratio or scale. */ - float aspect[3]; + /* aspect ratio or scale. */ + float aspect[3]; - /* initial position for draw the text. */ - float pos[3]; + /* initial position for draw the text. */ + float pos[3]; - /* angle in radians. */ - float angle; + /* angle in radians. */ + float angle; #if 0 /* BLF_BLUR_ENABLE */ - /* blur: 3 or 5 large kernel */ - int blur; + /* blur: 3 or 5 large kernel */ + int blur; #endif - /* shadow level. */ - int shadow; + /* shadow level. */ + int shadow; - /* and shadow offset. */ - int shadow_x; - int shadow_y; + /* and shadow offset. */ + int shadow_x; + int shadow_y; - /* shadow color. */ - unsigned char shadow_color[4]; + /* shadow color. */ + unsigned char shadow_color[4]; - /* main text color. */ - unsigned char color[4]; + /* main text color. */ + unsigned char color[4]; - /* Multiplied this matrix with the current one before - * draw the text! see blf_draw__start. - */ - float m[16]; + /* Multiplied this matrix with the current one before + * draw the text! see blf_draw__start. + */ + float m[16]; - /* clipping rectangle. */ - rctf clip_rec; + /* clipping rectangle. */ + rctf clip_rec; - /* the width to wrap the text, see BLF_WORD_WRAP */ - int wrap_width; + /* the width to wrap the text, see BLF_WORD_WRAP */ + int wrap_width; - /* font dpi (default 72). */ - unsigned int dpi; + /* font dpi (default 72). */ + unsigned int dpi; - /* font size. */ - unsigned int size; + /* font size. */ + unsigned int size; - /* max texture size. */ - int tex_size_max; + /* max texture size. */ + int tex_size_max; - /* cache current OpenGL texture to save calls into the API */ - GPUTexture *tex_bind_state; + /* cache current OpenGL texture to save calls into the API */ + GPUTexture *tex_bind_state; - /* font options. */ - int flags; + /* font options. */ + int flags; - /* list of glyph cache for this font. */ - ListBase cache; + /* list of glyph cache for this font. */ + ListBase cache; - /* current glyph cache, size and dpi. */ - GlyphCacheBLF *glyph_cache; + /* current glyph cache, size and dpi. */ + GlyphCacheBLF *glyph_cache; - /* list of kerning cache for this font. */ - ListBase kerning_caches; + /* list of kerning cache for this font. */ + ListBase kerning_caches; - /* current kerning cache for this font and kerning mode. */ - KerningCacheBLF *kerning_cache; + /* current kerning cache for this font and kerning mode. */ + KerningCacheBLF *kerning_cache; - /* freetype2 lib handle. */ - FT_Library ft_lib; + /* freetype2 lib handle. */ + FT_Library ft_lib; - /* Mutex lock for library */ - SpinLock *ft_lib_mutex; + /* Mutex lock for library */ + SpinLock *ft_lib_mutex; - /* freetype2 face. */ - FT_Face face; + /* freetype2 face. */ + FT_Face face; - /* freetype kerning */ - FT_UInt kerning_mode; + /* freetype kerning */ + FT_UInt kerning_mode; - /* data for buffer usage (drawing into a texture buffer) */ - FontBufInfoBLF buf_info; + /* data for buffer usage (drawing into a texture buffer) */ + FontBufInfoBLF buf_info; } FontBLF; typedef struct DirBLF { - struct DirBLF *next; - struct DirBLF *prev; + struct DirBLF *next; + struct DirBLF *prev; - /* full path where search fonts. */ - char *path; + /* full path where search fonts. */ + char *path; } DirBLF; #define BLF_TEXTURE_UNSET ((unsigned int)-1) |