stbtt: chardata can be const in GetBakedQuad() and GetPackedQuad()
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Cort · committed by Cort · parent 59a5a15 · Browse files · 1 file·+7 added−6 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
1 file+7 added−6 removed
- other:+7 added−6 removed
Provenance
- Commit
f5519a8- Tree
53f8308- Author
Cort <github@dangerware.org>- Committer
Cort <github@dangerware.org>- Parent
59a5a15
1 file changed+7 added−6 removed
modified:stb_truetype.h+7 added-6 removed
48 unmodified lines49 // Giumo X. Clanjor50 // Higor Euripedes51 // Thomas Fields52 // Derek Vinyard53+// Cort Stratton54 //55 // VERSION HISTORY56 //57 // 1.13 (2017-01-02) support OpenType fonts, certain Apple fonts, num-fonts-in-TTC function436 unmodified lines494 float x0,y0,s0,t0; // top-left495 float x1,y1,s1,t1; // bottom-right496 } stbtt_aligned_quad;497 497-STBTT_DEF void stbtt_GetBakedQuad(stbtt_bakedchar *chardata, int pw, int ph, // same data as above498+STBTT_DEF void stbtt_GetBakedQuad(const stbtt_bakedchar *chardata, int pw, int ph, // same data as above499 int char_index, // character to display500 float *xpos, float *ypos, // pointers to current position in screen pixel space501 stbtt_aligned_quad *q, // output: quad to draw502 int opengl_fillrule); // true if opengl fill rule; false if DX9 or earlier91 unmodified lines594 //595 // To use with PackFontRangesGather etc., you must set it before calls596 // call to PackFontRangesGatherRects.597 597-STBTT_DEF void stbtt_GetPackedQuad(stbtt_packedchar *chardata, int pw, int ph, // same data as above598+STBTT_DEF void stbtt_GetPackedQuad(const stbtt_packedchar *chardata, int pw, int ph, // same data as above599 int char_index, // character to display600 float *xpos, float *ypos, // pointers to current position in screen pixel space601 stbtt_aligned_quad *q, // output: quad to draw602 int align_to_integer);2684 unmodified lines3287 }3288 return bottom_y;3289 }3290 3290-STBTT_DEF void stbtt_GetBakedQuad(stbtt_bakedchar *chardata, int pw, int ph, int char_index, float *xpos, float *ypos, stbtt_aligned_quad *q, int opengl_fillrule)3291+STBTT_DEF void stbtt_GetBakedQuad(const stbtt_bakedchar *chardata, int pw, int ph, int char_index, float *xpos, float *ypos, stbtt_aligned_quad *q, int opengl_fillrule)3292 {3293 float d3d_bias = opengl_fillrule ? 0 : -0.5f;3294 float ipw = 1.0f / pw, iph = 1.0f / ph;3294- stbtt_bakedchar *b = chardata + char_index;3295+ const stbtt_bakedchar *b = chardata + char_index;3296 int round_x = STBTT_ifloor((*xpos + b->xoff) + 0.5f);3297 int round_y = STBTT_ifloor((*ypos + b->yoff) + 0.5f);3298 3299 q->x0 = round_x + d3d_bias;435 unmodified lines3735 range.font_size = font_size;3736 return stbtt_PackFontRanges(spc, fontdata, font_index, &range, 1);3737 }3738 3738-STBTT_DEF void stbtt_GetPackedQuad(stbtt_packedchar *chardata, int pw, int ph, int char_index, float *xpos, float *ypos, stbtt_aligned_quad *q, int align_to_integer)3739+STBTT_DEF void stbtt_GetPackedQuad(const stbtt_packedchar *chardata, int pw, int ph, int char_index, float *xpos, float *ypos, stbtt_aligned_quad *q, int align_to_integer)3740 {3741 float ipw = 1.0f / pw, iph = 1.0f / ph;3741- stbtt_packedchar *b = chardata + char_index;3742+ const stbtt_packedchar *b = chardata + char_index;3743 3744 if (align_to_integer) {3745 float x = (float) STBTT_ifloor((*xpos + b->xoff) + 0.5f);3746 float y = (float) STBTT_ifloor((*ypos + b->yoff) + 0.5f);273 unmodified lines