Skip to content

Commit 6816972

Browse files
author
Romain Guy
committed
Don't use bilinear filtering on unscaled bitmaps
Bug #5198590 Change-Id: I4333d850501ac849eeeeb247e4178dd469b9de3d
1 parent 91bd59d commit 6816972

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

libs/hwui/OpenGLRenderer.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1476,10 +1476,10 @@ void OpenGLRenderer::drawBitmap(SkBitmap* bitmap,
14761476
const float width = texture->width;
14771477
const float height = texture->height;
14781478

1479-
const float u1 = (srcLeft + 0.5f) / width;
1480-
const float v1 = (srcTop + 0.5f) / height;
1481-
const float u2 = (srcRight - 0.5f) / width;
1482-
const float v2 = (srcBottom - 0.5f) / height;
1479+
const float u1 = fmax(0.0f, srcLeft / width);
1480+
const float v1 = fmax(0.0f, srcTop / height);
1481+
const float u2 = fmin(1.0f, srcRight / width);
1482+
const float v2 = fmin(1.0f, srcBottom / height);
14831483

14841484
mCaches.unbindMeshBuffer();
14851485
resetDrawTextureTexCoords(u1, v1, u2, v2);

0 commit comments

Comments
 (0)