Skip to content

Commit 68cefd2

Browse files
Romain GuyAndroid (Google) Code Review
authored andcommitted
Merge "Textured text calls could be invisible Bug #6597730" into jb-dev
2 parents 78a9b67 + 16c8808 commit 68cefd2

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

libs/hwui/FontRenderer.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -598,6 +598,7 @@ void FontRenderer::allocateTextureMemory(CacheTexture* cacheTexture) {
598598
glGenTextures(1, &cacheTexture->mTextureId);
599599
}
600600

601+
Caches::getInstance().activeTexture(0);
601602
glBindTexture(GL_TEXTURE_2D, cacheTexture->mTextureId);
602603
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
603604
// Initialize texture dimensions
@@ -826,6 +827,7 @@ void FontRenderer::checkTextureUpdate() {
826827
}
827828
}
828829

830+
caches.activeTexture(0);
829831
glBindTexture(GL_TEXTURE_2D, mCurrentCacheTexture->mTextureId);
830832
if (mLinearFiltering != mCurrentCacheTexture->mLinearFiltering) {
831833
const GLenum filtering = mLinearFiltering ? GL_LINEAR : GL_NEAREST;

libs/hwui/OpenGLRenderer.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2422,6 +2422,7 @@ status_t OpenGLRenderer::drawText(const char* text, int bytesCount, int count,
24222422
linearFilter = fabs(y - (int) y) > 0.0f || fabs(x - (int) x) > 0.0f;
24232423
}
24242424

2425+
// The font renderer will always use texture unit 0
24252426
mCaches.activeTexture(0);
24262427
setupDraw();
24272428
setupDrawDirtyRegionsDisabled();
@@ -2432,6 +2433,8 @@ status_t OpenGLRenderer::drawText(const char* text, int bytesCount, int count,
24322433
setupDrawBlending(true, mode);
24332434
setupDrawProgram();
24342435
setupDrawModelView(x, y, x, y, pureTranslate, true);
2436+
// See comment above; the font renderer must use texture unit 0
2437+
// assert(mTextureUnit == 0)
24352438
setupDrawTexture(fontRenderer.getTexture(linearFilter));
24362439
setupDrawPureColorUniforms();
24372440
setupDrawColorFilterUniforms();

0 commit comments

Comments
 (0)