summaryrefslogtreecommitdiffstats
path: root/libs/rs/rsFont.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libs/rs/rsFont.cpp')
-rw-r--r--libs/rs/rsFont.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/libs/rs/rsFont.cpp b/libs/rs/rsFont.cpp
index e09f81c..4f21b3b 100644
--- a/libs/rs/rsFont.cpp
+++ b/libs/rs/rsFont.cpp
@@ -651,14 +651,10 @@ void FontState::appendMeshQuad(float x1, float y1, float z1,
float x4, float y4, float z4,
float u4, float v4) {
const uint32_t vertsPerQuad = 4;
- const uint32_t floatsPerVert = 5;
+ const uint32_t floatsPerVert = 6;
float *currentPos = mTextMeshPtr + mCurrentQuadIndex * vertsPerQuad * floatsPerVert;
- // Cull things that are off the screen
- float width = (float)mRSC->getWidth();
- float height = (float)mRSC->getHeight();
-
- if (x1 > width || y1 < 0.0f || x2 < 0 || y4 > height) {
+ if (x1 > mSurfaceWidth || y1 < 0.0f || x2 < 0 || y4 > mSurfaceHeight) {
return;
}
@@ -670,24 +666,28 @@ void FontState::appendMeshQuad(float x1, float y1, float z1,
(*currentPos++) = x1;
(*currentPos++) = y1;
(*currentPos++) = z1;
+ (*currentPos++) = 0;
(*currentPos++) = u1;
(*currentPos++) = v1;
(*currentPos++) = x2;
(*currentPos++) = y2;
(*currentPos++) = z2;
+ (*currentPos++) = 0;
(*currentPos++) = u2;
(*currentPos++) = v2;
(*currentPos++) = x3;
(*currentPos++) = y3;
(*currentPos++) = z3;
+ (*currentPos++) = 0;
(*currentPos++) = u3;
(*currentPos++) = v3;
(*currentPos++) = x4;
(*currentPos++) = y4;
(*currentPos++) = z4;
+ (*currentPos++) = 0;
(*currentPos++) = u4;
(*currentPos++) = v4;
@@ -746,6 +746,10 @@ void FontState::renderText(const char *text, uint32_t len, int32_t x, int32_t y,
return;
}
+ // Cull things that are off the screen
+ mSurfaceWidth = (float)mRSC->getCurrentSurfaceWidth();
+ mSurfaceHeight = (float)mRSC->getCurrentSurfaceHeight();
+
currentFont->renderUTF(text, len, x, y, startIndex, numGlyphs,
mode, bounds, bitmap, bitmapW, bitmapH);