Skip to content
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

Merged
merged 2 commits into from
Dec 21, 2020

Conversation

mulle-nat
Copy link
Contributor

Fixes #600.

Copy link
Owner

@memononen memononen left a 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)
Copy link
Owner

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;
Copy link
Owner

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;
Copy link
Owner

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)
Copy link
Owner

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);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove space after paren

@memononen memononen merged commit e906c5b into memononen:master Dec 21, 2020
@memononen
Copy link
Owner

Thanks for the fix!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Text vanishes when transformation is flipped
3 participants