-
Notifications
You must be signed in to change notification settings - Fork 779
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Fixed text vanishing when the transform is vertically flipped #601
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Few fixes, mostly style.
src/nanovg.c
Outdated
@@ -2454,6 +2454,12 @@ static void nvg__renderText(NVGcontext* ctx, NVGvertex* verts, int nverts) | |||
ctx->textTriCount += nverts/3; | |||
} | |||
|
|||
static int nvg__isTransformFlipped( const float *xform) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please copy the formatting from the surrounding code. Function def and return.
src/nanovg.c
Outdated
@@ -2464,6 +2470,8 @@ float nvgText(NVGcontext* ctx, float x, float y, const char* string, const char* | |||
float invscale = 1.0f / scale; | |||
int cverts = 0; | |||
int nverts = 0; | |||
int isFlipped; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
set to nvg__isTransformFlipped( state->xform)
directly here.
@@ -2497,6 +2506,11 @@ float nvgText(NVGcontext* ctx, float x, float y, const char* string, const char* | |||
break; | |||
} | |||
prevIter = iter; | |||
if( isFlipped) | |||
{ | |||
tmp = q.y0; q.y0 = q.y1; q.y1 = tmp; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move tmp definition at the beginning of the block here.
src/nanovg.c
Outdated
@@ -2497,6 +2506,11 @@ float nvgText(NVGcontext* ctx, float x, float y, const char* string, const char* | |||
break; | |||
} | |||
prevIter = iter; | |||
if( isFlipped) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
space after if, not after paren, curly on the same line.
src/nanovg.c
Outdated
@@ -2480,6 +2488,7 @@ float nvgText(NVGcontext* ctx, float x, float y, const char* string, const char* | |||
verts = nvg__allocTempVerts(ctx, cverts); | |||
if (verts == NULL) return x; | |||
|
|||
isFlipped = nvg__isTransformFlipped( state->xform); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove space after paren
Thanks for the fix! |
Fixes #600.