diff options
| author | Jean-Baptiste Queru <jbq@google.com> | 2012-08-08 13:17:25 -0700 |
|---|---|---|
| committer | android code review <noreply-gerritcodereview@google.com> | 2012-08-08 13:17:26 -0700 |
| commit | 0be33f2d522f76f48062a59ddb520815a0851875 (patch) | |
| tree | b730c4b1946521faf73627204118ec041d40bda8 /libs/hwui/FontRenderer.cpp | |
| parent | 9ab84c203fea0521135e0b0983aa15ce1afdc5ec (diff) | |
| parent | 0412cfcbcdd7224f80a80180a946f0fdd28c3afc (diff) | |
| download | frameworks_base-0be33f2d522f76f48062a59ddb520815a0851875.zip frameworks_base-0be33f2d522f76f48062a59ddb520815a0851875.tar.gz frameworks_base-0be33f2d522f76f48062a59ddb520815a0851875.tar.bz2 | |
Merge "Add shortcut to avoid potential divide by zero in some case"
Diffstat (limited to 'libs/hwui/FontRenderer.cpp')
| -rw-r--r-- | libs/hwui/FontRenderer.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/libs/hwui/FontRenderer.cpp b/libs/hwui/FontRenderer.cpp index 0d6e62a..5fdbc11 100644 --- a/libs/hwui/FontRenderer.cpp +++ b/libs/hwui/FontRenderer.cpp @@ -946,6 +946,11 @@ void FontRenderer::appendRotatedMeshQuad(float x1, float y1, float u1, float v1, uint32_t FontRenderer::getRemainingCacheCapacity() { uint32_t remainingCapacity = 0; float totalPixels = 0; + + //avoid divide by zero if the size is 0 + if (mCacheLines.size() == 0) { + return 0; + } for(uint32_t i = 0; i < mCacheLines.size(); i ++) { remainingCapacity += (mCacheLines[i]->mMaxWidth - mCacheLines[i]->mCurrentCol); totalPixels += mCacheLines[i]->mMaxWidth; |
